diff options
author | Pauli <pauli@openssl.org> | 2022-02-25 13:37:08 +1100 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2022-03-08 20:33:54 +1100 |
commit | 1e2b48103690c3e90569e7546f8d400df483efd3 (patch) | |
tree | d16724f7e6401821029739d649783f9fe183a265 /crypto/property | |
parent | 58c8bcbb1d29f107ff7662d7319030541537d070 (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/property')
-rw-r--r-- | crypto/property/property.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/crypto/property/property.c b/crypto/property/property.c index c087e741ed..2967b80a09 100644 --- a/crypto/property/property.c +++ b/crypto/property/property.c @@ -596,7 +596,7 @@ int ossl_method_store_cache_get(OSSL_METHOD_STORE *store, OSSL_PROVIDER *prov, QUERY elem, *r; int res = 0; - if (nid <= 0 || store == NULL) + if (nid <= 0 || store == NULL || prop_query == NULL) return 0; if (!ossl_property_read_lock(store)) @@ -605,7 +605,7 @@ int ossl_method_store_cache_get(OSSL_METHOD_STORE *store, OSSL_PROVIDER *prov, if (alg == NULL) goto err; - elem.query = prop_query != NULL ? prop_query : ""; + elem.query = prop_query; elem.provider = prov; r = lh_QUERY_retrieve(alg->cache, &elem); if (r == NULL) @@ -629,10 +629,8 @@ int ossl_method_store_cache_set(OSSL_METHOD_STORE *store, OSSL_PROVIDER *prov, size_t len; int res = 1; - if (nid <= 0 || store == NULL) + if (nid <= 0 || store == NULL || prop_query == NULL) return 0; - if (prop_query == NULL) - return 1; if (!ossl_assert(prov != NULL)) return 0; |