diff options
author | Randall S. Becker <randall.becker@nexbridge.ca> | 2024-01-25 22:11:27 +0000 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2024-02-22 10:40:04 +0100 |
commit | 73a68d8adde293ad73cb66444b4b683a5697d686 (patch) | |
tree | 2e32472a9ddbb901f07b2d27828affc358253c41 /crypto | |
parent | 878d31954738369c35cbafbaa65e9201e9fc6d4b (diff) |
Add atexit configuration option to using atexit() in libcrypto at build-time.
This fixes an issue with a mix of atexit() usage in DLL and statically linked
libcrypto that came out in the test suite on NonStop, which has slightly
different DLL unload processing semantics compared to Linux. The change
allows a build configuration to select whether to register OPENSSL_cleanup()
with atexit() or not, so avoid situations where atexit() registration causes
SIGSEGV.
INSTALL.md and CHANGES.md have been modified to include and describe this
option.
Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>
Signed-off-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23642)
(cherry picked from commit 0e1989d4c7435809b60f614c23ba8c9a7c0373e8)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/init.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/crypto/init.c b/crypto/init.c index cacf637c89..994f752b4e 100644 --- a/crypto/init.c +++ b/crypto/init.c @@ -97,17 +97,19 @@ static int win32atexit(void) DEFINE_RUN_ONCE_STATIC(ossl_init_register_atexit) { -#ifdef OPENSSL_INIT_DEBUG +#ifndef OPENSSL_NO_ATEXIT +# ifdef OPENSSL_INIT_DEBUG fprintf(stderr, "OPENSSL_INIT: ossl_init_register_atexit()\n"); -#endif -#ifndef OPENSSL_SYS_UEFI -# if defined(_WIN32) && !defined(__BORLANDC__) +# endif +# ifndef OPENSSL_SYS_UEFI +# if defined(_WIN32) && !defined(__BORLANDC__) /* We use _onexit() in preference because it gets called on DLL unload */ if (_onexit(win32atexit) == NULL) return 0; -# else +# else if (atexit(OPENSSL_cleanup) != 0) return 0; +# endif # endif #endif |