diff options
author | Max Ammann <max@maxammann.org> | 2024-05-07 23:06:39 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2024-05-24 11:57:10 +0200 |
commit | 46f55238d2dc39725873de308e1e727556cb33bd (patch) | |
tree | b17d8c28ff006f2cc7d2ac65afc1c3ed68b97966 /crypto | |
parent | f3b988dc29512d6575ff435e1ff7c1b66d97051e (diff) |
EVP_CIPHER_CTX_get_key_length(): Add null check of ctx->cipher
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22964)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/evp/evp_lib.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c index be95668c7e..e80c2ba681 100644 --- a/crypto/evp/evp_lib.c +++ b/crypto/evp/evp_lib.c @@ -670,6 +670,9 @@ int EVP_CIPHER_get_key_length(const EVP_CIPHER *cipher) int EVP_CIPHER_CTX_get_key_length(const EVP_CIPHER_CTX *ctx) { + if (ctx->cipher == NULL) + return 0; + if (ctx->key_len <= 0 && ctx->cipher->prov != NULL) { int ok; OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END }; |