From 749691374ccf87418ca0e6664a9b9c831dcfe108 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Wed, 20 Apr 2022 16:43:13 +0200 Subject: Drop ossl_provider_clear_all_operation_bits() and all uses of it This is a misused function, as it was called during query cache flush, when the provider operation bits were meant to record if methods for a certain operation has already been added to the method store. Fixes #18150 Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/18151) (cherry picked from commit 20b6d85ab2b9cfa4cd29d2422d69c3e3f4db0a41) --- crypto/property/property.c | 3 --- crypto/provider_core.c | 27 --------------------------- 2 files changed, 30 deletions(-) (limited to 'crypto') diff --git a/crypto/property/property.c b/crypto/property/property.c index 509191a893..523d2ba20c 100644 --- a/crypto/property/property.c +++ b/crypto/property/property.c @@ -506,7 +506,6 @@ static void ossl_method_cache_flush(OSSL_METHOD_STORE *store, int nid) ALGORITHM *alg = ossl_method_store_retrieve(store, nid); if (alg != NULL) { - ossl_provider_clear_all_operation_bits(store->ctx); store->nelem -= lh_QUERY_num_items(alg->cache); impl_cache_flush_alg(0, alg, NULL); } @@ -518,7 +517,6 @@ int ossl_method_store_flush_cache(OSSL_METHOD_STORE *store, int all) if (!ossl_property_write_lock(store)) return 0; - ossl_provider_clear_all_operation_bits(store->ctx); ossl_sa_ALGORITHM_doall_arg(store->algs, &impl_cache_flush_alg, arg); store->nelem = 0; ossl_property_unlock(store); @@ -583,7 +581,6 @@ static void ossl_method_cache_flush_some(OSSL_METHOD_STORE *store) state.nelem = 0; if ((state.seed = OPENSSL_rdtsc()) == 0) state.seed = 1; - ossl_provider_clear_all_operation_bits(store->ctx); store->need_flush = 0; ossl_sa_ALGORITHM_doall_arg(store->algs, &impl_cache_flush_one_alg, &state); store->nelem = state.nelem; diff --git a/crypto/provider_core.c b/crypto/provider_core.c index 177358f054..07fe3974ae 100644 --- a/crypto/provider_core.c +++ b/crypto/provider_core.c @@ -1538,33 +1538,6 @@ void ossl_provider_unquery_operation(const OSSL_PROVIDER *prov, prov->unquery_operation(prov->provctx, operation_id, algs); } -int ossl_provider_clear_all_operation_bits(OSSL_LIB_CTX *libctx) -{ - struct provider_store_st *store; - OSSL_PROVIDER *provider; - int i, num, res = 1; - - if ((store = get_provider_store(libctx)) != NULL) { - if (!CRYPTO_THREAD_read_lock(store->lock)) - return 0; - num = sk_OSSL_PROVIDER_num(store->providers); - for (i = 0; i < num; i++) { - provider = sk_OSSL_PROVIDER_value(store->providers, i); - if (!CRYPTO_THREAD_write_lock(provider->opbits_lock)) { - res = 0; - continue; - } - if (provider->operation_bits != NULL) - memset(provider->operation_bits, 0, - provider->operation_bits_sz); - CRYPTO_THREAD_unlock(provider->opbits_lock); - } - CRYPTO_THREAD_unlock(store->lock); - return res; - } - return 0; -} - int ossl_provider_set_operation_bit(OSSL_PROVIDER *provider, size_t bitnum) { size_t byte = bitnum / 8; -- cgit v1.2.3