From 7dce37e2ec3d580eccce65c32f8d60dea600a28a Mon Sep 17 00:00:00 2001 From: Pauli Date: Mon, 8 Feb 2021 11:03:01 +1000 Subject: [PATCH] Prov: add an option to force provider fetches to not be cached. If the macro OSSL_FORCE_NO_CACHE_FETCH is defined, no provider will have its fetches cached. Reviewed-by: Shane Lontis Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/14126) --- crypto/provider_core.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/crypto/provider_core.c b/crypto/provider_core.c index 5016d54d55d..627ff384e14 100644 --- a/crypto/provider_core.c +++ b/crypto/provider_core.c @@ -914,8 +914,17 @@ const OSSL_ALGORITHM *ossl_provider_query_operation(const OSSL_PROVIDER *prov, int operation_id, int *no_cache) { - return prov->query_operation == NULL - ? NULL : prov->query_operation(prov->provctx, operation_id, no_cache); + const OSSL_ALGORITHM *res; + + if (prov->query_operation == NULL) + return NULL; + res = prov->query_operation(prov->provctx, operation_id, no_cache); +#if defined(OPENSSL_NO_CACHED_FETCH) + /* Forcing the non-caching of queries */ + if (no_cache != NULL) + *no_cache = 1; +#endif + return res; } int ossl_provider_set_operation_bit(OSSL_PROVIDER *provider, size_t bitnum) -- 2.47.2