Skip to content

Avoid implicit algorithm fetch for OpenSSL EVP_MD family

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

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.

This helps only partially, so we are not closing the issue yet.

See #3795 (closed)

Edited by Michał Kępień

Merge request reports