Unverified Commit 4182bc5a authored by Dominik Charousset's avatar Dominik Charousset Committed by GitHub

Merge pull request #717

Fix "unused" warnings when using OpenSSL 1.1
parents 3707ba7d fef0a5f7
......@@ -45,6 +45,7 @@ struct CRYPTO_dynlock_value {
namespace caf {
namespace openssl {
#if OPENSSL_VERSION_NUMBER < 0x10100000L
static int init_count = 0;
static std::mutex init_mutex;
static std::vector<std::mutex> mutexes;
......@@ -74,8 +75,10 @@ static void dynlock_destroy(CRYPTO_dynlock_value* dynlock,
const char* /* file */, int /* line */) {
delete dynlock;
}
#endif
manager::~manager() {
#if OPENSSL_VERSION_NUMBER < 0x10100000L
std::lock_guard<std::mutex> lock{init_mutex};
--init_count;
if (init_count == 0) {
......@@ -85,6 +88,7 @@ manager::~manager() {
CRYPTO_set_dynlock_destroy_callback(nullptr);
mutexes = std::vector<std::mutex>(0);
}
#endif
}
void manager::start() {
......@@ -115,6 +119,7 @@ void manager::init(actor_system_config&) {
CAF_RAISE_ERROR("No private key configured for SSL endpoint");
}
#if OPENSSL_VERSION_NUMBER < 0x10100000L
std::lock_guard<std::mutex> lock{init_mutex};
++init_count;
if (init_count == 1) {
......@@ -125,6 +130,7 @@ void manager::init(actor_system_config&) {
CRYPTO_set_dynlock_destroy_callback(dynlock_destroy);
// OpenSSL's default thread ID callback should work, so don't set our own.
}
#endif
}
actor_system::module::id_t manager::id() const {
......
......@@ -243,7 +243,7 @@ SSL_CTX* session::create_ssl_context() {
} else {
// No authentication.
SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, nullptr);
#ifdef CAF_SSL_HAS_ECDH_AUTO
#if defined(CAF_SSL_HAS_ECDH_AUTO) && (OPENSSL_VERSION_NUMBER < 0x10100000L)
SSL_CTX_set_ecdh_auto(ctx, 1);
#else
auto ecdh = EC_KEY_new_by_curve_name(NID_secp384r1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment