Ensure we remove libctx DRBG state before removing the provider store

Otherwise a heap use-after-free can result.

Fixes #15766

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15810)
This commit is contained in:
Matt Caswell 2021-06-17 11:44:10 +01:00
parent 11bac1b4c4
commit 005505fbf8

View File

@ -492,7 +492,7 @@ static void rand_ossl_ctx_free(void *vdgbl)
}
static const OSSL_LIB_CTX_METHOD rand_drbg_ossl_ctx_method = {
OSSL_LIB_CTX_METHOD_DEFAULT_PRIORITY,
OSSL_LIB_CTX_METHOD_PRIORITY_2,
rand_ossl_ctx_new,
rand_ossl_ctx_free,
};