summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2021-04-22 09:43:22 +0100
committerMatt Caswell <matt@openssl.org>2021-05-11 14:56:55 +0100
commitd07af736de592602f2831f8559d0302cb116e190 (patch)
tree072afb6b562b793a9455e65078b15c2d25eef20e
parent56784203ec2e4c8d94fccb25b956e21331b800b1 (diff)
Only load the config file into the default libctx if necessary
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)
-rw-r--r--crypto/provider_core.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/provider_core.c b/crypto/provider_core.c
index c419e6f644..3d853eb66b 100644
--- a/crypto/provider_core.c
+++ b/crypto/provider_core.c
@@ -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)