diff --git a/Jamfile b/Jamfile index e5d48b003..7a3e312a2 100644 --- a/Jamfile +++ b/Jamfile @@ -68,8 +68,6 @@ rule linking ( properties * ) # system starting with OpenSSL 1.1 result += crypto ssl ; } - # boost.asio use the pre-1.1 OpenSSL API - result += OPENSSL_API_COMPAT=0x10000000L ; } if libcrypto in $(properties) diff --git a/src/session_impl.cpp b/src/session_impl.cpp index e17242032..7f76138b0 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -139,6 +139,11 @@ namespace { #include #include +// by openssl changelog at https://www.openssl.org/news/changelog.html +// Changes between 1.0.2h and 1.1.0 [25 Aug 2016] +// - Most global cleanup functions are no longer required because they are handled +// via auto-deinit. Affected function CRYPTO_cleanup_all_ex_data() +#if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < 0x10100000L namespace { // openssl requires this to clean up internal @@ -155,6 +160,7 @@ namespace { #endif } openssl_global_destructor; } +#endif #endif // TORRENT_USE_OPENSSL diff --git a/src/torrent.cpp b/src/torrent.cpp index e5a6bb6bb..c0d250df3 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -1536,7 +1536,11 @@ namespace libtorrent { using boost::asio::ssl::context; // this is needed for openssl < 1.0 to decrypt keys created by openssl 1.0+ +#if !defined(OPENSSL_API_COMPAT) || (OPENSSL_API_COMPAT < 0x10100000L) OpenSSL_add_all_algorithms(); +#else + OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS | OPENSSL_INIT_ADD_ALL_DIGESTS, nullptr); +#endif // create the SSL context for this torrent. We need to // inject the root certificate, and no other, to