diff --git a/Changelog b/Changelog index b06c5a4..8b441a8 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,6 @@ +2019-07-21: +- fixed: compile will work with older versions of SSL. + 2019-05-05: - added SSLSocket support. SSL.Connect (TCP.GetSocket()) it supports as well as non blocking connections with a defined timeout. diff --git a/ssl.cc b/ssl.cc index bb25c04..e6302c6 100644 --- a/ssl.cc +++ b/ssl.cc @@ -53,9 +53,11 @@ int SSLSocket::NewServerCTX() { if (ctx) SSL_CTX_free(ctx); ctx = NULL; - +#ifdef SSLv23_method ctx = SSL_CTX_new(TLS_server_method()); - +#else + ctx = SSL_CTX_new(TLSv1_2_server_method()); +#endif if (SSL_CTX_use_certificate_file(ctx, certfile.c_str(), SSL_FILETYPE_PEM) <= 0 ) { ERR_print_errors_fp(stderr); if (ctx) SSL_CTX_free(ctx); @@ -86,7 +88,11 @@ int SSLSocket::NewServerCTX() { int SSLSocket::NewClientCTX() { if (ctx) SSL_CTX_free(ctx); ctx = NULL; +#ifdef SSLv23_method ctx = SSL_CTX_new(TLS_client_method()); +#else + ctx = SSL_CTX_new(TLSv1_2_client_method()); +#endif return 1; }; diff --git a/test-ssl.cc b/test-ssl.cc index 182614b..20b345e 100644 --- a/test-ssl.cc +++ b/test-ssl.cc @@ -6,7 +6,6 @@ #define DEFAULT_PORT 12345 - void server () { TCP tcpserver; TCP *connection;