summaryrefslogtreecommitdiffstats
path: root/providers
diff options
context:
space:
mode:
authorPeiwei Hu <jlu.hpw@foxmail.com>2022-05-24 22:57:53 +0800
committerTomas Mraz <tomas@openssl.org>2022-05-27 07:58:45 +0200
commitacd6338ff0afa31730a0cff62d993a8ebc63db5c (patch)
tree3e3a9bae859a2359121da6cf75f448d4238c6cdf /providers
parentd3c5aff6cbf1ed6c855fb450b2caefbda8b9ce0f (diff)
Fix the incorrect checks of EVP_CIPHER_CTX_set_key_length
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18397) (cherry picked from commit 8d9fec1781751d2106d899c6076eeb3da6930bfe)
Diffstat (limited to 'providers')
-rw-r--r--providers/implementations/kdfs/krb5kdf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/providers/implementations/kdfs/krb5kdf.c b/providers/implementations/kdfs/krb5kdf.c
index 2c887f0eb9..4000703ca9 100644
--- a/providers/implementations/kdfs/krb5kdf.c
+++ b/providers/implementations/kdfs/krb5kdf.c
@@ -336,8 +336,10 @@ static int cipher_init(EVP_CIPHER_CTX *ctx,
klen = EVP_CIPHER_CTX_get_key_length(ctx);
if (key_len != (size_t)klen) {
ret = EVP_CIPHER_CTX_set_key_length(ctx, key_len);
- if (!ret)
+ if (ret <= 0) {
+ ret = 0;
goto out;
+ }
}
/* we never want padding, either the length requested is a multiple of
* the cipher block size or we are passed a cipher that can cope with