diff --git a/src/cpp/security/OpenSSLInit.hpp b/src/cpp/security/OpenSSLInit.hpp index 0fe47aae62..d204fe132b 100644 --- a/src/cpp/security/OpenSSLInit.hpp +++ b/src/cpp/security/OpenSSLInit.hpp @@ -30,20 +30,13 @@ class OpenSSLInit OpenSSLInit() { -#if OPENSSL_VERSION_NUMBER < 0x10100000L - OpenSSL_add_all_algorithms(); -#endif // if OPENSSL_VERSION_NUMBER < 0x10100000L + uint64_t opts = OPENSSL_INIT_NO_ATEXIT; + OPENSSL_init_crypto(opts, NULL); } ~OpenSSLInit() { -#if OPENSSL_VERSION_NUMBER < 0x10000000L - ERR_remove_state(0); - ENGINE_cleanup(); -#elif OPENSSL_VERSION_NUMBER < 0x10100000L - ERR_remove_thread_state(NULL); - ENGINE_cleanup(); -#endif // if OPENSSL_VERSION_NUMBER < 0x10000000L + OPENSSL_cleanup(); } static std::shared_ptr get_instance() @@ -51,6 +44,7 @@ class OpenSSLInit static auto instance = std::make_shared(); return instance; } + }; } // namespace security