Files
macports-ports/security/softhsm/files/0003-mouse07410-OSSLCryptoFactory.patch
Ian Young f63b8bbdb0 softhsm: fix segment violation at application end
Fix a segmentation violation at application termination
through a combination of a couple of commits cherry-picked
from upstream post-2.6.1 and a contribution from mouse07410
directed at the same issue.

Closes: https://trac.macports.org/ticket/64036
2023-07-01 20:24:04 +02:00

22 lines
875 B
Diff

diff --git src/lib/crypto/OSSLCryptoFactory.cpp src/lib/crypto/OSSLCryptoFactory.cpp
index ace4bcb..b5456d4 100644
--- src/lib/crypto/OSSLCryptoFactory.cpp
+++ src/lib/crypto/OSSLCryptoFactory.cpp
@@ -175,6 +175,7 @@ OSSLCryptoFactory::OSSLCryptoFactory()
OPENSSL_INIT_LOAD_CRYPTO_STRINGS |
OPENSSL_INIT_ADD_ALL_CIPHERS |
OPENSSL_INIT_ADD_ALL_DIGESTS |
+ OPENSSL_INIT_NO_ATEXIT |
OPENSSL_INIT_LOAD_CONFIG, NULL);
#endif
@@ -238,7 +239,7 @@ OSSLCryptoFactory::~OSSLCryptoFactory()
// Detect that situation because reinitialisation will fail
// after OPENSSL_cleanup() has run.
(void)ERR_set_mark();
- ossl_shutdown = !OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_RDRAND, NULL);
+ ossl_shutdown = !OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_NO_ATEXIT, NULL);
(void)ERR_pop_to_mark();
#endif
if (!ossl_shutdown)