CORE: make sure activated fallback providers stay activated
authorRichard Levitte <levitte@openssl.org>
Sat, 23 May 2020 14:39:18 +0000 (16:39 +0200)
committerRichard Levitte <levitte@openssl.org>
Thu, 4 Jun 2020 14:42:45 +0000 (16:42 +0200)
commitc8567c392c1dc3dd15651c0d2746a5b87b5a88dd
treebfa4ffe0f951b72a7e1eda188d921e44c35cae3f
parentf995e5bdcd5d4c2143323ff78e4dcc0b95c5e024
CORE: make sure activated fallback providers stay activated

Calling 'OSSL_PROVIDER_available(NULL, "default")' would search for
the "default" provider, and in doing so, activate it if necessary,
thereby detecting that it's available...  and then immediately free
it, which could deactivate that provider, even though it should stay
available.

We solve this by incrementing the refcount for activated fallbacks one
extra time, thereby simulating an explicit OSSL_PROVIDER_load(), and
compensate for it with an extra ossl_provider_free() when emptying the
provider store.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11926)
crypto/provider_core.c