Commit 431f786ee6 for openssl.org
commit 431f786ee63818605d7f2fb2f5e1f312081b225d
Author: Neil Horman <nhorman@openssl.org>
Date: Thu Apr 30 10:25:45 2026 -0400
Fix caching of EVP methods when NO_CACHED_FETCH is asserted
noticed during the debugging of this that, even though we may have
no-cached-fetch configured, we still put things in the method store,
which is wrong.
Don't cache things when we say we're not caching things
Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Jun 9 18:17:24 2026
(Merged from https://github.com/openssl/openssl/pull/31018)
diff --git a/crypto/evp/evp_fetch.c b/crypto/evp/evp_fetch.c
index 24eb48103c..a446f976df 100644
--- a/crypto/evp/evp_fetch.c
+++ b/crypto/evp/evp_fetch.c
@@ -355,7 +355,13 @@ inner_evp_generic_fetch(struct evp_method_data_st *methdata,
method = NULL;
} else {
meth_id = evp_method_id(name_id, operation_id);
- if (meth_id != 0)
+ /*
+ * do not insert method to method store cache when provider
+ * did ask for not caching it. methods which are not to be
+ * cached end up in ->tmp_store when provider asks not
+ * to cache the result (see ossl_method_construct_reserve_store())
+ */
+ if (meth_id != 0 && methdata->tmp_store == NULL)
ossl_method_store_cache_set(store, prov, meth_id, propq,
method, up_ref_method, free_method);
}