summaryrefslogtreecommitdiffstats
path: root/test/evp_extra_test.c
diff options
context:
space:
mode:
authorNeil Horman <nhorman@openssl.org>2023-11-30 17:20:34 +0100
committerTomas Mraz <tomas@openssl.org>2023-12-06 14:27:05 +0100
commitf529a2eb75374946b60ed686ca6f90fdf244e787 (patch)
treed62e2f7db023cfb7a7bb4a341922a6fe373bdce8 /test/evp_extra_test.c
parentossl_decoder_cache_flush(): Do not raise an error if there is no cache (diff)
downloadopenssl-f529a2eb75374946b60ed686ca6f90fdf244e787.tar.xz
openssl-f529a2eb75374946b60ed686ca6f90fdf244e787.zip
Statically link legacy provider to evp_extra_test
Like in #17345, evp_extra_test links libcrypto statically, but also has a dynamic/shared load via the legacy provider, which leads to ambiguous behavior in evp_extra_test on some platforms, usually a crash (SIGSEGV) on exit via the atexit handlers. Statically link the legacy provider to avoid this. Fixes #22819 Helped-by: Neil Horman <nhorman@openssl.org> Helped-by: Tomas Mraz <tomas@openssl.org> Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22905)
Diffstat (limited to 'test/evp_extra_test.c')
-rw-r--r--test/evp_extra_test.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c
index 4250630327..f3680a0fb4 100644
--- a/test/evp_extra_test.c
+++ b/test/evp_extra_test.c
@@ -38,6 +38,10 @@
#include "crypto/evp.h"
#include "fake_rsaprov.h"
+#ifdef STATIC_LEGACY
+OSSL_provider_init_fn ossl_legacy_provider_init;
+#endif
+
static OSSL_LIB_CTX *testctx = NULL;
static char *testpropq = NULL;
@@ -5437,6 +5441,15 @@ int setup_tests(void)
testctx = OSSL_LIB_CTX_new();
if (!TEST_ptr(testctx))
return 0;
+#ifdef STATIC_LEGACY
+ /*
+ * This test is always statically linked against libcrypto. We must not
+ * attempt to load legacy.so that might be dynamically linked against
+ * libcrypto. Instead we use a built-in version of the legacy provider.
+ */
+ if (!OSSL_PROVIDER_add_builtin(testctx, "legacy", ossl_legacy_provider_init))
+ return 0;
+#endif
/* Swap the libctx to test non-default context only */
nullprov = OSSL_PROVIDER_load(NULL, "null");
deflprov = OSSL_PROVIDER_load(testctx, "default");