mirror of
https://github.com/jwinterm/xmr-stak.git
synced 2026-10-17 05:41:41 +02:00
CONF_NO_TLS option
This commit is contained in:
@@ -32,8 +32,10 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef CONF_NO_TLS
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/err.h>
|
||||
#endif
|
||||
|
||||
//Do a press any key for the windows folk. *insert any key joke here*
|
||||
#ifdef _WIN32
|
||||
@@ -54,12 +56,14 @@ void do_benchmark();
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifndef CONF_NO_TLS
|
||||
SSL_library_init();
|
||||
SSL_load_error_strings();
|
||||
ERR_load_BIO_strings();
|
||||
ERR_load_crypto_strings();
|
||||
SSL_load_error_strings();
|
||||
OpenSSL_add_all_digests();
|
||||
#endif
|
||||
|
||||
const char* sFilename = "config.txt";
|
||||
bool benchmark_mode = false;
|
||||
|
||||
@@ -423,6 +423,15 @@ bool jconf::parse_config(const char* sFilename)
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef CONF_NO_TLS
|
||||
if(prv->configValues[bTlsMode]->GetBool())
|
||||
{
|
||||
printer::inst()->print_msg(L0,
|
||||
"Invalid config file. TLS enabled while the application has been compiled without TLS support.");
|
||||
return false;
|
||||
}
|
||||
#endif // CONF_NO_TLS
|
||||
|
||||
#ifdef _WIN32
|
||||
if(GetSlowMemSetting() == no_mlck)
|
||||
{
|
||||
|
||||
@@ -103,10 +103,14 @@ jpsock::jpsock(size_t id, bool tls) : pool_id(id)
|
||||
|
||||
prv = new opaque_private(bJsonCallMem, bJsonRecvMem, bJsonParseMem);
|
||||
|
||||
#ifndef CONF_NO_TLS
|
||||
if(tls)
|
||||
sck = new tls_socket(this);
|
||||
else
|
||||
sck = new plain_socket(this);
|
||||
#else
|
||||
sck = new plain_socket(this);
|
||||
#endif
|
||||
|
||||
oRecvThd = nullptr;
|
||||
bRunning = false;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "console.h"
|
||||
#include "executor.h"
|
||||
|
||||
#ifndef CONF_NO_TLS
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/opensslconf.h>
|
||||
@@ -34,6 +35,7 @@
|
||||
#ifndef OPENSSL_THREADS
|
||||
#error OpenSSL was compiled without thread support
|
||||
#endif
|
||||
#endif
|
||||
|
||||
plain_socket::plain_socket(jpsock* err_callback) : pCallback(err_callback)
|
||||
{
|
||||
@@ -166,6 +168,7 @@ void plain_socket::close(bool free)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef CONF_NO_TLS
|
||||
tls_socket::tls_socket(jpsock* err_callback) : pCallback(err_callback)
|
||||
{
|
||||
}
|
||||
@@ -355,4 +358,5 @@ void tls_socket::close(bool free)
|
||||
bio = nullptr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user