From: Matt Caswell Date: Mon, 14 Jun 2021 11:08:38 +0000 (+0100) Subject: Clean up the encoder/decoder/loader stores before providers X-Git-Tag: openssl-3.0.0-beta1~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a5d90ffac78ac17e7a078a501bb33e1080c0935;p=thirdparty%2Fopenssl.git Clean up the encoder/decoder/loader stores before providers We already had the evp method store being cleaned up before the provider store was. This prevents issues where the method clean up functions cause providers to clean up, which then needs access to the provider store. We extend the same thinking to the encoder/decoder/loader stores. Fixes #15727 Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/15741) --- diff --git a/crypto/encode_decode/decoder_meth.c b/crypto/encode_decode/decoder_meth.c index e25efe532be..0ec886bb291 100644 --- a/crypto/encode_decode/decoder_meth.c +++ b/crypto/encode_decode/decoder_meth.c @@ -78,7 +78,8 @@ static void *decoder_store_new(OSSL_LIB_CTX *ctx) static const OSSL_LIB_CTX_METHOD decoder_store_method = { - OSSL_LIB_CTX_METHOD_DEFAULT_PRIORITY, + /* We want decoder_store to be cleaned up before the provider store */ + OSSL_LIB_CTX_METHOD_PRIORITY_2, decoder_store_new, decoder_store_free, }; diff --git a/crypto/encode_decode/encoder_meth.c b/crypto/encode_decode/encoder_meth.c index ac56a296927..9c17b3637ef 100644 --- a/crypto/encode_decode/encoder_meth.c +++ b/crypto/encode_decode/encoder_meth.c @@ -78,7 +78,8 @@ static void *encoder_store_new(OSSL_LIB_CTX *ctx) static const OSSL_LIB_CTX_METHOD encoder_store_method = { - OSSL_LIB_CTX_METHOD_DEFAULT_PRIORITY, + /* We want encoder_store to be cleaned up before the provider store */ + OSSL_LIB_CTX_METHOD_PRIORITY_2, encoder_store_new, encoder_store_free, }; diff --git a/crypto/store/store_meth.c b/crypto/store/store_meth.c index 7b2f537d499..720b70c0e0a 100644 --- a/crypto/store/store_meth.c +++ b/crypto/store/store_meth.c @@ -81,7 +81,8 @@ static void *loader_store_new(OSSL_LIB_CTX *ctx) static const OSSL_LIB_CTX_METHOD loader_store_method = { - OSSL_LIB_CTX_METHOD_DEFAULT_PRIORITY, + /* We want loader_store to be cleaned up before the provider store */ + OSSL_LIB_CTX_METHOD_PRIORITY_2, loader_store_new, loader_store_free, };