forked from premiere/premiere-libtorrent
making use of openssl API 1.1 compatible
This commit is contained in:
parent
e47f73ee3b
commit
7f3c38025f
2
Jamfile
2
Jamfile
|
@ -68,8 +68,6 @@ rule linking ( properties * )
|
||||||
# system starting with OpenSSL 1.1
|
# system starting with OpenSSL 1.1
|
||||||
result += <library>crypto <library>ssl ;
|
result += <library>crypto <library>ssl ;
|
||||||
}
|
}
|
||||||
# boost.asio use the pre-1.1 OpenSSL API
|
|
||||||
result += <define>OPENSSL_API_COMPAT=0x10000000L ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if <crypto>libcrypto in $(properties)
|
if <crypto>libcrypto in $(properties)
|
||||||
|
|
|
@ -139,6 +139,11 @@ namespace {
|
||||||
#include <openssl/crypto.h>
|
#include <openssl/crypto.h>
|
||||||
#include <openssl/rand.h>
|
#include <openssl/rand.h>
|
||||||
|
|
||||||
|
// 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 {
|
namespace {
|
||||||
|
|
||||||
// openssl requires this to clean up internal
|
// openssl requires this to clean up internal
|
||||||
|
@ -155,6 +160,7 @@ namespace {
|
||||||
#endif
|
#endif
|
||||||
} openssl_global_destructor;
|
} openssl_global_destructor;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // TORRENT_USE_OPENSSL
|
#endif // TORRENT_USE_OPENSSL
|
||||||
|
|
||||||
|
|
|
@ -1536,7 +1536,11 @@ namespace libtorrent {
|
||||||
using boost::asio::ssl::context;
|
using boost::asio::ssl::context;
|
||||||
|
|
||||||
// this is needed for openssl < 1.0 to decrypt keys created by openssl 1.0+
|
// 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();
|
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
|
// create the SSL context for this torrent. We need to
|
||||||
// inject the root certificate, and no other, to
|
// inject the root certificate, and no other, to
|
||||||
|
|
Loading…
Reference in New Issue