Move the caching of cipher constants into evp_cipher_from_dispatch
authorMatt Caswell <matt@openssl.org>
Tue, 22 Dec 2020 11:54:16 +0000 (11:54 +0000)
committerDmitry Belyavskiy <beldmit@gmail.com>
Wed, 23 Dec 2020 20:12:18 +0000 (21:12 +0100)
commitae69da05a7749e21c7526831173405e3570917b2
tree966fb731e2cfe67459801a98842a7d1304d39406
parentfdf05eb7611a1fdb283162228985286a09d07940
Move the caching of cipher constants into evp_cipher_from_dispatch

Previously we cached the cipher constants in EVP_CIPHER_fetch(). However,
this means we do the caching every time we call that function, even if
the core has previusly fetched the cipher and cached it already. This
means we can end up re-caching the constants even though they are already
present. This also means we could be updating these constants from
multiple threads at the same time.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13730)
crypto/err/openssl.txt
crypto/evp/evp_enc.c
crypto/evp/evp_err.c
include/crypto/evperr.h
include/openssl/evperr.h