]> git.ipfire.org Git - thirdparty/openssl.git/blobdiff - crypto/property/property.c
Only call OPENSSL_init_crypto on fetch if using the default libctx
[thirdparty/openssl.git] / crypto / property / property.c
index 6f56d2366bd617d0f234f48b7c8ce05b3c452648..034cde51a8b2b2449fc37177176419ff25808b59 100644 (file)
@@ -502,13 +502,14 @@ int ossl_method_store_fetch(OSSL_METHOD_STORE *store,
     int ret = 0;
     int j, best = -1, score, optional;
 
-#ifndef FIPS_MODULE
-    if (!OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL))
+    if (nid <= 0 || method == NULL || store == NULL)
         return 0;
-#endif
 
-    if (nid <= 0 || method == NULL || store == NULL)
+#ifndef FIPS_MODULE
+    if (ossl_lib_ctx_is_default(store->ctx)
+            && !OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL))
         return 0;
+#endif
 
     /* This only needs to be a read lock, because the query won't create anything */
     if (!ossl_property_read_lock(store))