diff options
author | Matt Caswell <matt@openssl.org> | 2023-05-10 16:27:03 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2023-05-29 16:08:34 +0200 |
commit | 36424806d699233b9a90a3a97fff3011828e2548 (patch) | |
tree | 72ee30300c18d7fddde134a2792acad601c91124 /doc/internal | |
parent | 95a8aa6dc0e283b1560dd3258d2e9115c02659b1 (diff) |
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 <hlandau@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20932)
Diffstat (limited to 'doc/internal')
-rw-r--r-- | doc/internal/man3/evp_keymgmt_util_export_to_provider.pod | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/doc/internal/man3/evp_keymgmt_util_export_to_provider.pod b/doc/internal/man3/evp_keymgmt_util_export_to_provider.pod index 7099e44964..0a32da25a9 100644 --- a/doc/internal/man3/evp_keymgmt_util_export_to_provider.pod +++ b/doc/internal/man3/evp_keymgmt_util_export_to_provider.pod @@ -25,7 +25,7 @@ OP_CACHE_ELEM 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); @@ -52,9 +52,8 @@ I<keymgmt> in I<pk>'s cache of provided keys for operations. It should only be called while holding I<pk>'s lock (read or write). evp_keymgmt_util_clear_operation_cache() can be used to explicitly -clear the cache of operation key references. If I<locking> is set to 1 then -then I<pk>'s lock will be obtained while doing the clear. Otherwise it will be -assumed that the lock has already been obtained or is not required. +clear the cache of operation key references. If required the lock must already +have been obtained. evp_keymgmt_util_cache_keydata() can be used to add a provider key object to a B<PKEY>. |