summaryrefslogtreecommitdiffstats
path: root/crypto/evp
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2022-02-25 13:37:08 +1100
committerPauli <pauli@openssl.org>2022-03-08 20:33:54 +1100
commit1e2b48103690c3e90569e7546f8d400df483efd3 (patch)
treed16724f7e6401821029739d649783f9fe183a265 /crypto/evp
parent58c8bcbb1d29f107ff7662d7319030541537d070 (diff)
fetch: convert a NULL property query to ""
Previously, a NULL property query was never cached and this lead to a performance degregation. Now, such a query is converted to an empty string and cached. Fixes #17752 Fixes https://github.openssl.org/openssl/openssl/issues/26 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17769) (cherry picked from commit af788ad6c3624ccc4b49778a9ded2487b9dbeedd)
Diffstat (limited to 'crypto/evp')
-rw-r--r--crypto/evp/evp_fetch.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/evp/evp_fetch.c b/crypto/evp/evp_fetch.c
index 80da3fa4bf..ea32cd5dd2 100644
--- a/crypto/evp/evp_fetch.c
+++ b/crypto/evp/evp_fetch.c
@@ -247,6 +247,7 @@ inner_evp_generic_fetch(struct evp_method_data_st *methdata,
{
OSSL_METHOD_STORE *store = get_evp_method_store(methdata->libctx);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(methdata->libctx);
+ const char *const propq = properties != NULL ? properties : "";
uint32_t meth_id = 0;
void *method = NULL;
int unsupported = 0;
@@ -299,8 +300,7 @@ inner_evp_generic_fetch(struct evp_method_data_st *methdata,
unsupported = 1;
if (meth_id == 0
- || !ossl_method_store_cache_get(store, prov, meth_id, properties,
- &method)) {
+ || !ossl_method_store_cache_get(store, prov, meth_id, propq, &method)) {
OSSL_METHOD_CONSTRUCT_METHOD mcm = {
get_tmp_evp_method_store,
get_evp_method_from_store,
@@ -312,7 +312,7 @@ inner_evp_generic_fetch(struct evp_method_data_st *methdata,
methdata->operation_id = operation_id;
methdata->name_id = name_id;
methdata->names = name;
- methdata->propquery = properties;
+ methdata->propquery = propq;
methdata->method_from_algorithm = new_method;
methdata->refcnt_up_method = up_ref_method;
methdata->destruct_method = free_method;
@@ -330,7 +330,7 @@ inner_evp_generic_fetch(struct evp_method_data_st *methdata,
name_id = ossl_namemap_name2num(namemap, name);
meth_id = evp_method_id(name_id, operation_id);
if (name_id != 0)
- ossl_method_store_cache_set(store, prov, meth_id, properties,
+ ossl_method_store_cache_set(store, prov, meth_id, propq,
method, up_ref_method, free_method);
}