Unverified Commit 08185596 authored by Dominik Charousset's avatar Dominik Charousset Committed by GitHub

Merge pull request #630

Fix build with OpenSSL <= 1.0.1
parents d6209980 5d995256
...@@ -38,6 +38,10 @@ CAF_POP_WARNINGS ...@@ -38,6 +38,10 @@ CAF_POP_WARNINGS
# define CAF_SSL_HAS_NON_VERSIONED_TLS_FUN # define CAF_SSL_HAS_NON_VERSIONED_TLS_FUN
#endif #endif
#if defined(SSL_CTX_set_ecdh_auto)
# define CAF_SSL_HAS_ECDH_AUTO
#endif
namespace caf { namespace caf {
namespace openssl { namespace openssl {
......
...@@ -244,7 +244,17 @@ SSL_CTX* session::create_ssl_context() { ...@@ -244,7 +244,17 @@ SSL_CTX* session::create_ssl_context() {
} else { } else {
// No authentication. // No authentication.
SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, nullptr); SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, nullptr);
#ifdef CAF_SSL_HAS_ECDH_AUTO
SSL_CTX_set_ecdh_auto(ctx, 1); SSL_CTX_set_ecdh_auto(ctx, 1);
#else
auto ecdh = EC_KEY_new_by_curve_name(NID_secp384r1);
if (!ecdh)
raise_ssl_error("cannot get ECDH curve");
CAF_PUSH_WARNINGS
SSL_CTX_set_tmp_ecdh(ctx, ecdh);
EC_KEY_free(ecdh);
CAF_POP_WARNINGS
#endif
#ifdef CAF_SSL_HAS_SECURITY_LEVEL #ifdef CAF_SSL_HAS_SECURITY_LEVEL
const char* cipher = "AECDH-AES256-SHA@SECLEVEL=0"; const char* cipher = "AECDH-AES256-SHA@SECLEVEL=0";
#else #else
......
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