summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/build.info8
-rw-r--r--test/endecode_test.c14
2 files changed, 22 insertions, 0 deletions
diff --git a/test/build.info b/test/build.info
index ec4bd8d5db..188b850beb 100644
--- a/test/build.info
+++ b/test/build.info
@@ -867,6 +867,14 @@ IF[{- !$disabled{tests} -}]
SOURCE[endecode_test]=endecode_test.c helpers/predefined_dhparams.c
INCLUDE[endecode_test]=.. ../include ../apps/include
DEPEND[endecode_test]=../libcrypto.a libtestutil.a
+ IF[{- !$disabled{module} && !$disabled{legacy} -}]
+ DEFINE[endecode_test]=STATIC_LEGACY
+ SOURCE[endecode_test]=../providers/legacyprov.c
+ INCLUDE[endecode_test]=../providers/common/include \
+ ../providers/implementations/include
+ DEPEND[endecode_test]=../providers/liblegacy.a \
+ ../providers/libcommon.a
+ ENDIF
IF[{- !$disabled{'deprecated-3.0'} -}]
PROGRAMS{noinst}=endecoder_legacy_test
diff --git a/test/endecode_test.c b/test/endecode_test.c
index 1698867b40..0c33dff0ee 100644
--- a/test/endecode_test.c
+++ b/test/endecode_test.c
@@ -26,6 +26,10 @@
#include "helpers/predefined_dhparams.h"
#include "testutil.h"
+#ifdef STATIC_LEGACY
+OSSL_provider_init_fn ossl_legacy_provider_init;
+#endif
+
/* Extended test macros to allow passing file & line number */
#define TEST_FL_ptr(a) test_ptr(file, line, #a, a)
#define TEST_FL_mem_eq(a, m, b, n) test_mem_eq(file, line, #a, #b, a, m, b, n)
@@ -1305,6 +1309,16 @@ int setup_tests(void)
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
+
/* Separate provider/ctx for generating the test data */
if (!TEST_ptr(keyctx = OSSL_LIB_CTX_new()))
return 0;