diff options
author | Tomas Mraz <tomas@openssl.org> | 2023-12-04 18:01:28 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2023-12-06 13:59:13 +0100 |
commit | 0541fa7802cf0c3a9b28d126066c909736fc5ec8 (patch) | |
tree | bb97eea255fa8b209f0b3b4cf3f326128f8d9a01 /crypto/encode_decode | |
parent | QUIC LCIDM: Minor updates in response to feedback (diff) | |
download | openssl-0541fa7802cf0c3a9b28d126066c909736fc5ec8.tar.xz openssl-0541fa7802cf0c3a9b28d126066c909736fc5ec8.zip |
ossl_decoder_cache_flush(): Do not raise an error if there is no cache
This function can be called during OPENSSL_cleanup() when
the cache was already flushed and deallocated.
Fixes #22939
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22941)
Diffstat (limited to 'crypto/encode_decode')
-rw-r--r-- | crypto/encode_decode/decoder_pkey.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crypto/encode_decode/decoder_pkey.c b/crypto/encode_decode/decoder_pkey.c index 24f61fbf15..eb1be1c980 100644 --- a/crypto/encode_decode/decoder_pkey.c +++ b/crypto/encode_decode/decoder_pkey.c @@ -721,10 +721,9 @@ int ossl_decoder_cache_flush(OSSL_LIB_CTX *libctx) DECODER_CACHE *cache = ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_DECODER_CACHE_INDEX); - if (cache == NULL) { - ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_OSSL_DECODER_LIB); + if (cache == NULL) return 0; - } + if (!CRYPTO_THREAD_write_lock(cache->lock)) { ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_OSSL_DECODER_LIB); |