diff options
author | Matt Caswell <matt@openssl.org> | 2021-06-21 09:23:30 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2021-06-24 14:48:14 +0100 |
commit | 29aff653150c363be2d84f789a10b46d99d5cab9 (patch) | |
tree | c6aba738ee2873756bbb32419173955171e71fce /crypto/provider_conf.c | |
parent | 352d482a2990cc04adff48aeda9c080d4a839f1e (diff) |
Add a new provider to the store only after we activate it
Rather than creating the provider, adding to the store and then activating
it, we do things the other way around, i.e. activate first and then add to
the store. This means that the activation should occur before other threads
are aware of the provider.
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15854)
Diffstat (limited to 'crypto/provider_conf.c')
-rw-r--r-- | crypto/provider_conf.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/provider_conf.c b/crypto/provider_conf.c index d53e1be2dc..8e83264dc6 100644 --- a/crypto/provider_conf.c +++ b/crypto/provider_conf.c @@ -173,6 +173,9 @@ static int provider_conf_load(OSSL_LIB_CTX *libctx, const char *name, if (ok) { if (!ossl_provider_activate(prov, 0, 1)) { ok = 0; + } else if (!ossl_provider_add_to_store(prov)) { + ossl_provider_deactivate(prov); + ok = 0; } else { if (pcgbl->activated_providers == NULL) pcgbl->activated_providers = sk_OSSL_PROVIDER_new_null(); @@ -181,7 +184,7 @@ static int provider_conf_load(OSSL_LIB_CTX *libctx, const char *name, } } - if (!(activate && ok)) + if (!ok) ossl_provider_free(prov); } else { struct provider_info_st entry; |