Skip to content

Commit

Permalink
Refs #22024: Fix: Do not register atexit in OPenSSL. Instead, Comply …
Browse files Browse the repository at this point in the history
…with OpenSSL initialization and destruction.

Signed-off-by: Mario Dominguez <[email protected]>
  • Loading branch information
Mario-DL committed Nov 5, 2024
1 parent bc5089c commit f15d463
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/cpp/security/OpenSSLInit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<OpenSSLInit> get_instance()
Expand Down

0 comments on commit f15d463

Please sign in to comment.