|
@@ -348,7 +348,7 @@ static void thread_general_worker(void)
|
|
|
|
|
|
static void thread_multi_simple_fetch(void)
|
|
|
{
|
|
|
- EVP_MD *md = EVP_MD_fetch(NULL, "SHA2-256", NULL);
|
|
|
+ EVP_MD *md = EVP_MD_fetch(multi_libctx, "SHA2-256", NULL);
|
|
|
|
|
|
if (md != NULL)
|
|
|
EVP_MD_free(md);
|
|
@@ -501,6 +501,7 @@ static int test_multi(int idx)
|
|
|
OSSL_LIB_CTX_free(multi_libctx);
|
|
|
EVP_PKEY_free(shared_evp_pkey);
|
|
|
shared_evp_pkey = NULL;
|
|
|
+ multi_libctx = NULL;
|
|
|
return testresult;
|
|
|
}
|
|
|
|
|
@@ -532,6 +533,36 @@ static int test_multi_load(void)
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
+static int test_multi_default(void)
|
|
|
+{
|
|
|
+ thread_t thread1, thread2;
|
|
|
+ int testresult = 0;
|
|
|
+ OSSL_PROVIDER *prov = NULL;
|
|
|
+
|
|
|
+ multi_success = 1;
|
|
|
+ multi_libctx = NULL;
|
|
|
+ prov = OSSL_PROVIDER_load(multi_libctx, "default");
|
|
|
+ if (!TEST_ptr(prov))
|
|
|
+ goto err;
|
|
|
+
|
|
|
+ if (!TEST_true(run_thread(&thread1, thread_multi_simple_fetch))
|
|
|
+ || !TEST_true(run_thread(&thread2, thread_multi_simple_fetch)))
|
|
|
+ goto err;
|
|
|
+
|
|
|
+ thread_multi_simple_fetch();
|
|
|
+
|
|
|
+ if (!TEST_true(wait_for_thread(thread1))
|
|
|
+ || !TEST_true(wait_for_thread(thread2))
|
|
|
+ || !TEST_true(multi_success))
|
|
|
+ goto err;
|
|
|
+
|
|
|
+ testresult = 1;
|
|
|
+
|
|
|
+ err:
|
|
|
+ OSSL_PROVIDER_unload(prov);
|
|
|
+ return testresult;
|
|
|
+}
|
|
|
+
|
|
|
typedef enum OPTION_choice {
|
|
|
OPT_ERR = -1,
|
|
|
OPT_EOF = 0,
|
|
@@ -573,6 +604,9 @@ int setup_tests(void)
|
|
|
if (!TEST_ptr(privkey))
|
|
|
return 0;
|
|
|
|
|
|
+ /* Keep first to validate auto creation of default library context */
|
|
|
+ ADD_TEST(test_multi_default);
|
|
|
+
|
|
|
ADD_TEST(test_lock);
|
|
|
ADD_TEST(test_once);
|
|
|
ADD_TEST(test_thread_local);
|