blob: 8a8b21ce7e9ca47b15f501fe741e0a1a44d9f66f [file] [edit]
From 073a1b779826d1e1bbf473ba45db3ac1e273efce Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Tue, 27 Nov 2018 10:18:37 -0800
Subject: [PATCH] ssl: Fix compilation without deprecated OpenSSL 1.1 APIs
Upstream: https://github.com/morgenroth/ibrdtn/commit/073a1b779826d1e1bbf473ba45db3ac1e273efce
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
ibrcommon/ssl/TLSStream.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/ibrcommon/ssl/TLSStream.cpp b/ibrcommon/ssl/TLSStream.cpp
index b18b43c3..e336db55 100644
--- a/ibrcommon/ssl/TLSStream.cpp
+++ b/ibrcommon/ssl/TLSStream.cpp
@@ -259,16 +259,22 @@ namespace ibrcommon
/* openssl initialization */
/* the if block is needed because SSL_library_init() is not reentrant */
if(!_SSL_initialized){
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
SSL_load_error_strings();
SSL_library_init();
ERR_load_BIO_strings();
ERR_load_SSL_strings();
+#endif
_SSL_initialized = true;
}
/* create ssl context and throw exception if it fails */
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
_ssl_ctx = SSL_CTX_new(TLSv1_method());
+#else
+ _ssl_ctx = SSL_CTX_new(TLS_method());
+#endif
if(!_ssl_ctx){
char err_buf[ERR_BUF_SIZE];
ERR_error_string_n(ERR_get_error(), err_buf, ERR_BUF_SIZE);
--
2.47.3