diff options
author | Richard Levitte <levitte@openssl.org> | 2020-12-16 15:15:06 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-12-17 12:02:08 +0100 |
commit | 390f9bad69ce19f601abf131ceabf90aedc0d3d5 (patch) | |
tree | 33336c07e8a35b8aa45dc7b6d9df6705d6a94643 /crypto/provider.c | |
parent | DECODER: Adjust the library context of keys in our decoders (diff) | |
download | openssl-390f9bad69ce19f601abf131ceabf90aedc0d3d5.tar.xz openssl-390f9bad69ce19f601abf131ceabf90aedc0d3d5.zip |
CORE: Separate OSSL_PROVIDER activation from OSSL_PROVIDER reference
This introduces a separate activation counter, and the function
ossl_provider_deactivate() for provider deactivation.
Something to be noted is that if the reference count goes down to
zero, we don't care if the activation count is non-zero (i.e. someone
forgot to call ossl_provider_deactivate()). Since there are no more
references to the provider, it doesn't matter.
The important thing is that deactivation doesn't remove the provider
as long as there are references to it, for example because there are
live methods associated with that provider, but still makes the
provider unavailable to create new methods from.
Fixes #13503
Fixes #12157
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/13661)
Diffstat (limited to 'crypto/provider.c')
-rw-r--r-- | crypto/provider.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/crypto/provider.c b/crypto/provider.c index 0441fb2f2a..bd8f75a2c1 100644 --- a/crypto/provider.c +++ b/crypto/provider.c @@ -40,6 +40,8 @@ OSSL_PROVIDER *OSSL_PROVIDER_load(OSSL_LIB_CTX *libctx, const char *name) int OSSL_PROVIDER_unload(OSSL_PROVIDER *prov) { + if (!ossl_provider_deactivate(prov)) + return 0; ossl_provider_free(prov); return 1; } |