#include <openssl/x509.h>
#include <openssl/rc4.h>
#include <openssl/md5.h>
+#include <openssl/configuration.h>
+#include <openssl/provider.h>
#if !defined OPENSSL_NO_RC4 && !defined OPENSSL_NO_MD5 \
|| !defined OPENSSL_NO_DES && !defined OPENSSL_NO_SHA1
}
#endif
+#ifdef OPENSSL_NO_AUTOLOAD_CONFIG
+/*
+ * For configurations where we are not autoloading configuration, we need
+ * to access the legacy provider. The easiest way is to load both the
+ * legacy and default providers directly and unload them on termination.
+ */
+static OSSL_PROVIDER *legacy, *dflt;
+#endif
+
int setup_tests(void)
{
+#ifdef OPENSSL_NO_AUTOLOAD_CONFIG
+ /* Load required providers if not done via configuration */
+ legacy = OSSL_PROVIDER_load(NULL, "legacy");
+ dflt = OSSL_PROVIDER_load(NULL, "default");
+ if (!TEST_ptr(legacy) || !TEST_ptr(dflt)) {
+ cleanup_tests();
+ return -1;
+ }
+#endif
+
#if !defined OPENSSL_NO_RC4 && !defined OPENSSL_NO_MD5
ADD_TEST(test_pkcs5_pbe_rc4_md5);
#endif
return 1;
}
+
+#ifdef OPENSSL_NO_AUTOLOAD_CONFIG
+void cleanup_tests(void)
+{
+ /* Dispose of providers */
+ OSSL_PROVIDER_unload(legacy);
+ OSSL_PROVIDER_unload(dflt);
+ legacy = dflt = NULL;
+}
+#endif