Skip to content

[9.16] Avoid implicit algorithm fetch for OpenSSL EVP_MD family

Ondřej Surý requested to merge 3795-speed-up-EVP_DigestInit_ex-v9_16 into v9_16

The implicit algorithm fetch causes a lock contention and significant slowdown for small input buffers. For more details, see:

https://github.com/openssl/openssl/issues/19612

Instead of using EVP_DigestInit_ex() initialize empty MD_CTX objects for each algorithm and use EVP_MD_CTX_copy_ex() to initialize MD_CTX from a static copy. Additionally avoid implicit algorithm fetching by using EVP_MD_fetch() for OpenSSL 3.0.

(cherry picked from commit e6bfb8e4)

Closes #3795 (closed)

Backport of MR !7375 (merged)

Edited by Ondřej Surý

Merge request reports