From 8d93f0a96ec007c71f36a838a88dca145a515e00 Mon Sep 17 00:00:00 2001 From: tomoaki Date: Fri, 24 Feb 2017 10:19:32 +0900 Subject: [PATCH] Update for older OpenSSL version. Signed-off-by: tomoaki --- MQTTSNGateway/src/linux/Network.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MQTTSNGateway/src/linux/Network.cpp b/MQTTSNGateway/src/linux/Network.cpp index ba3069c..7c10ffa 100644 --- a/MQTTSNGateway/src/linux/Network.cpp +++ b/MQTTSNGateway/src/linux/Network.cpp @@ -290,7 +290,15 @@ bool Network::connect(const char* host, const char* port, const char* caPath, co { SSL_load_error_strings(); SSL_library_init(); + +#if ( OPENSSL_VERSION_NUMBER >= 0x10100000L ) _ctx = SSL_CTX_new(TLS_client_method()); +#elif ( OPENSSL_VERSION_NUMBER >= 0x10001000L ) + _ctx = SSL_CTX_new(TLSv1_client_method()); +#else + _ctx = SSL_CTX_new(SSLv23_client_method()); +#endif + if (_ctx == 0) { ERR_error_string_n(ERR_get_error(), errmsg, sizeof(errmsg));