]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Only load the config file into the default libctx if necessary
authorMatt Caswell <matt@openssl.org>
Thu, 22 Apr 2021 08:43:22 +0000 (09:43 +0100)
committerMatt Caswell <matt@openssl.org>
Tue, 11 May 2021 13:56:55 +0000 (14:56 +0100)
There is no need to load providers from the config file into the default
libctx, if the current libctx that we are using isn't the default libctx.
This avoids some deadlock situations.

Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14991)

crypto/provider_core.c

index c419e6f64424da4bc16715d5a4dccf15ce8232e6..3d853eb66b1f079764296a16fd0a6ca1d9e7a6e5 100644 (file)
@@ -233,7 +233,7 @@ OSSL_PROVIDER *ossl_provider_find(OSSL_LIB_CTX *libctx, const char *name,
          * Make sure any providers are loaded from config before we try to find
          * them.
          */
-        if (!noconfig)
+        if (!noconfig && ossl_lib_ctx_is_default(libctx))
             OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL);
 #endif
 
@@ -842,7 +842,8 @@ int ossl_provider_doall_activated(OSSL_LIB_CTX *ctx,
      * Make sure any providers are loaded from config before we try to use
      * them.
      */
-    OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL);
+    if (ossl_lib_ctx_is_default(ctx))
+        OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL);
 #endif
 
     if (store == NULL)