Files
xmrig/src/base/net/stratum/Tls.h

70 lines
1.8 KiB
C
Raw Normal View History

2018-09-16 03:06:54 +03:00
/* XMRig
2021-08-25 18:45:15 +07:00
* Copyright (c) 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
2018-09-16 03:06:54 +03:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2018-11-06 00:50:28 +07:00
#ifndef XMRIG_CLIENT_TLS_H
#define XMRIG_CLIENT_TLS_H
2018-09-16 03:06:54 +03:00
using BIO = struct bio_st;
using SSL = struct ssl_st;
using SSL_CTX = struct ssl_ctx_st;
using X509 = struct x509_st;
2018-09-16 03:06:54 +03:00
2019-03-15 01:50:35 +07:00
#include "base/net/stratum/Client.h"
#include "base/tools/Object.h"
2018-09-16 03:06:54 +03:00
namespace xmrig {
class Client::Tls
2018-09-16 03:06:54 +03:00
{
public:
XMRIG_DISABLE_COPY_MOVE_DEFAULT(Tls)
2018-09-16 03:06:54 +03:00
Tls(Client *client);
~Tls();
bool handshake();
bool send(const char *data, size_t size);
2018-09-16 08:14:22 +03:00
const char *fingerprint() const;
const char *version() const;
2018-09-16 03:06:54 +03:00
void read(const char *data, size_t size);
private:
bool send();
2018-09-16 08:14:22 +03:00
bool verify(X509 *cert);
bool verifyFingerprint(X509 *cert);
2018-09-16 03:06:54 +03:00
BIO *m_read = nullptr;
BIO *m_write = nullptr;
bool m_ready = false;
char m_fingerprint[32 * 2 + 8]{};
2018-09-16 03:06:54 +03:00
Client *m_client;
SSL *m_ssl = nullptr;
2018-09-16 03:06:54 +03:00
SSL_CTX *m_ctx;
};
} /* namespace xmrig */
2018-11-06 00:50:28 +07:00
#endif /* XMRIG_CLIENT_TLS_H */