summaryrefslogtreecommitdiffstats
path: root/crypto/evp/evp_fetch.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2020-07-31 17:29:21 +0100
committerMatt Caswell <matt@openssl.org>2020-08-17 11:27:51 +0100
commite6c54619d151eeec32055bbd713cda11a9182246 (patch)
tree7d1e275da8ee5d4ecbe66ae3c5593573b48dc1f2 /crypto/evp/evp_fetch.c
parentebe3f24b3d53e503bd37a2a08a8b1f896014c30d (diff)
Load the default config file before working with default properties
A config file can change the global default properties. Therefore we must ensure that the config file is loaded before reading or amending them. Fixes #12565 Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/12567)
Diffstat (limited to 'crypto/evp/evp_fetch.c')
-rw-r--r--crypto/evp/evp_fetch.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/crypto/evp/evp_fetch.c b/crypto/evp/evp_fetch.c
index 4c3992ab40..7b0cea7f0b 100644
--- a/crypto/evp/evp_fetch.c
+++ b/crypto/evp/evp_fetch.c
@@ -377,11 +377,12 @@ void evp_method_store_flush(OPENSSL_CTX *libctx)
ossl_method_store_flush_cache(store, 1);
}
-static int evp_set_default_properties(OPENSSL_CTX *libctx,
- OSSL_PROPERTY_LIST *def_prop)
+static int evp_set_parsed_default_properties(OPENSSL_CTX *libctx,
+ OSSL_PROPERTY_LIST *def_prop,
+ int loadconfig)
{
OSSL_METHOD_STORE *store = get_evp_method_store(libctx);
- OSSL_PROPERTY_LIST **plp = ossl_ctx_global_properties(libctx);
+ OSSL_PROPERTY_LIST **plp = ossl_ctx_global_properties(libctx, loadconfig);
if (plp != NULL) {
ossl_property_free(*plp);
@@ -394,7 +395,8 @@ static int evp_set_default_properties(OPENSSL_CTX *libctx,
return 0;
}
-int EVP_set_default_properties(OPENSSL_CTX *libctx, const char *propq)
+int evp_set_default_properties_int(OPENSSL_CTX *libctx, const char *propq,
+ int loadconfig)
{
OSSL_PROPERTY_LIST *pl = NULL;
@@ -402,13 +404,17 @@ int EVP_set_default_properties(OPENSSL_CTX *libctx, const char *propq)
EVPerr(0, EVP_R_DEFAULT_QUERY_PARSE_ERROR);
return 0;
}
- return evp_set_default_properties(libctx, pl);
+ return evp_set_parsed_default_properties(libctx, pl, loadconfig);
}
+int EVP_set_default_properties(OPENSSL_CTX *libctx, const char *propq)
+{
+ return evp_set_default_properties_int(libctx, propq, 1);
+}
static int evp_default_properties_merge(OPENSSL_CTX *libctx, const char *propq)
{
- OSSL_PROPERTY_LIST **plp = ossl_ctx_global_properties(libctx);
+ OSSL_PROPERTY_LIST **plp = ossl_ctx_global_properties(libctx, 1);
OSSL_PROPERTY_LIST *pl1, *pl2;
if (propq == NULL)
@@ -425,13 +431,13 @@ static int evp_default_properties_merge(OPENSSL_CTX *libctx, const char *propq)
EVPerr(0, ERR_R_MALLOC_FAILURE);
return 0;
}
- return evp_set_default_properties(libctx, pl2);
+ return evp_set_parsed_default_properties(libctx, pl2, 0);
}
static int evp_default_property_is_enabled(OPENSSL_CTX *libctx,
const char *prop_name)
{
- OSSL_PROPERTY_LIST **plp = ossl_ctx_global_properties(libctx);
+ OSSL_PROPERTY_LIST **plp = ossl_ctx_global_properties(libctx, 1);
return plp != NULL && ossl_property_is_enabled(libctx, prop_name, *plp);
}