Skip to content

Commit 15bba85

Browse files
committed
CONF_NO_TLS option
1 parent e4f5318 commit 15bba85

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

cli-miner.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@
3232
#include <stdio.h>
3333
#include <string.h>
3434

35+
#ifndef CONF_NO_TLS
3536
#include <openssl/ssl.h>
3637
#include <openssl/err.h>
38+
#endif
3739

3840
//Do a press any key for the windows folk. *insert any key joke here*
3941
#ifdef _WIN32
@@ -54,12 +56,14 @@ void do_benchmark();
5456

5557
int main(int argc, char *argv[])
5658
{
59+
#ifndef CONF_NO_TLS
5760
SSL_library_init();
5861
SSL_load_error_strings();
5962
ERR_load_BIO_strings();
6063
ERR_load_crypto_strings();
6164
SSL_load_error_strings();
6265
OpenSSL_add_all_digests();
66+
#endif
6367

6468
const char* sFilename = "config.txt";
6569
bool benchmark_mode = false;

jconf.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,15 @@ bool jconf::parse_config(const char* sFilename)
423423
return false;
424424
}
425425

426+
#ifdef CONF_NO_TLS
427+
if(prv->configValues[bTlsMode]->GetBool())
428+
{
429+
printer::inst()->print_msg(L0,
430+
"Invalid config file. TLS enabled while the application has been compiled without TLS support.");
431+
return false;
432+
}
433+
#endif // CONF_NO_TLS
434+
426435
#ifdef _WIN32
427436
if(GetSlowMemSetting() == no_mlck)
428437
{

jpsock.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,14 @@ jpsock::jpsock(size_t id, bool tls) : pool_id(id)
103103

104104
prv = new opaque_private(bJsonCallMem, bJsonRecvMem, bJsonParseMem);
105105

106+
#ifndef CONF_NO_TLS
106107
if(tls)
107108
sck = new tls_socket(this);
108109
else
109110
sck = new plain_socket(this);
111+
#else
112+
sck = new plain_socket(this);
113+
#endif
110114

111115
oRecvThd = nullptr;
112116
bRunning = false;

socket.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@
2727
#include "console.h"
2828
#include "executor.h"
2929

30+
#ifndef CONF_NO_TLS
3031
#include <openssl/ssl.h>
3132
#include <openssl/err.h>
3233
#include <openssl/opensslconf.h>
3334

3435
#ifndef OPENSSL_THREADS
3536
#error OpenSSL was compiled without thread support
3637
#endif
38+
#endif
3739

3840
plain_socket::plain_socket(jpsock* err_callback) : pCallback(err_callback)
3941
{
@@ -166,6 +168,7 @@ void plain_socket::close(bool free)
166168
}
167169
}
168170

171+
#ifndef CONF_NO_TLS
169172
tls_socket::tls_socket(jpsock* err_callback) : pCallback(err_callback)
170173
{
171174
}
@@ -355,4 +358,5 @@ void tls_socket::close(bool free)
355358
bio = nullptr;
356359
}
357360
}
361+
#endif
358362

0 commit comments

Comments
 (0)