Clean up the encoder/decoder/loader stores before providers
authorMatt Caswell <matt@openssl.org>
Mon, 14 Jun 2021 11:08:38 +0000 (12:08 +0100)
committerMatt Caswell <matt@openssl.org>
Wed, 16 Jun 2021 10:06:30 +0000 (11:06 +0100)
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 <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15741)

crypto/encode_decode/decoder_meth.c
crypto/encode_decode/encoder_meth.c
crypto/store/store_meth.c

index e25efe532bea2bc5f8de36935d5f6e9f3e1e10d7..0ec886bb291de8ac5cfadbc4e0952c868d969f37 100644 (file)
@@ -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,
 };
index ac56a296927439dd9a0aef7cba1a5d3b3c4a4111..9c17b3637efd82a9ba644481fbbe91c0bfe03ade 100644 (file)
@@ -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,
 };
index 7b2f537d49914fcf1eeafce0701a97059d6c73b8..720b70c0e0ac2d0b63c9e1bdd791132113bf2325 100644 (file)
@@ -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,
 };