From 36424806d699233b9a90a3a97fff3011828e2548 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Wed, 10 May 2023 16:27:03 +0100 Subject: Don't take a write lock when freeing an EVP_PKEY When freeing the last reference to an EVP_PKEY there is no point in taking the lock for the key. It is the last reference and is being freed so must only be being used by a single thread. This should not have been the source of any contention so its unclear to what extent this will improve performance. But we should not be locking when we don't need to. Partially fixes #20286 Reviewed-by: Hugo Landau Reviewed-by: Paul Dale Reviewed-by: Richard Levitte Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/20932) --- include/crypto/evp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/crypto/evp.h b/include/crypto/evp.h index 55b44cd835..4f7f0c6eea 100644 --- a/include/crypto/evp.h +++ b/include/crypto/evp.h @@ -785,7 +785,7 @@ void *evp_keymgmt_util_export_to_provider(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt, OP_CACHE_ELEM *evp_keymgmt_util_find_operation_cache(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt, int selection); -int evp_keymgmt_util_clear_operation_cache(EVP_PKEY *pk, int locking); +int evp_keymgmt_util_clear_operation_cache(EVP_PKEY *pk); int evp_keymgmt_util_cache_keydata(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt, void *keydata, int selection); void evp_keymgmt_util_cache_keyinfo(EVP_PKEY *pk); -- cgit v1.2.3