From: Pauli Date: Mon, 8 Feb 2021 01:03:01 +0000 (+1000) Subject: Prov: add an option to force provider fetches to not be cached. X-Git-Tag: openssl-3.0.0-alpha12~68 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7dce37e2ec3d580eccce65c32f8d60dea600a28a;p=thirdparty%2Fopenssl.git 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) --- 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)