From 43646286c0d6c9c50dc356185c89fe9cc56b2fcb Mon Sep 17 00:00:00 2001 From: Hugo Landau Date: Thu, 10 Mar 2022 09:38:09 +0000 Subject: EVP_MD performance fix (refcount cache contention) Partial fix for #17064. Avoid excessive writes to the cache line containing the refcount for an EVP_MD object to avoid extreme cache contention when using a single EVP_MD at high frequency on multiple threads. This changes performance in 3.0 from being double that of 1.1 to only slightly higher than that of 1.1. Reviewed-by: Tim Hudson Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/17857) (cherry picked from commit c0b7dac66edde45b8da80918f5b5b62d1e766a0c) --- include/crypto/evp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/crypto') diff --git a/include/crypto/evp.h b/include/crypto/evp.h index c5d3a930f7..6fb05309dc 100644 --- a/include/crypto/evp.h +++ b/include/crypto/evp.h @@ -900,7 +900,7 @@ int evp_set_default_properties_int(OSSL_LIB_CTX *libctx, const char *propq, int loadconfig, int mirrored); char *evp_get_global_properties_str(OSSL_LIB_CTX *libctx, int loadconfig); -void evp_md_ctx_clear_digest(EVP_MD_CTX *ctx, int force); +void evp_md_ctx_clear_digest(EVP_MD_CTX *ctx, int force, int keep_digest); /* Three possible states: */ # define EVP_PKEY_STATE_UNKNOWN 0 -- cgit v1.2.3