diff options
author | Pauli <pauli@openssl.org> | 2021-06-07 01:26:42 +0200 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-06-08 11:32:17 +0200 |
commit | b0a0ab07b4313cc893b17880b4399bdb804837c5 (patch) | |
tree | eb2f2b2b069da77aa8b59d18ed78e2fe87ede1f8 /engines | |
parent | fix coverity 1485660 improper use of negative value (diff) | |
download | openssl-b0a0ab07b4313cc893b17880b4399bdb804837c5.tar.xz openssl-b0a0ab07b4313cc893b17880b4399bdb804837c5.zip |
afalg: fix coverity 1485661 improper use of negative value
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15635)
Diffstat (limited to 'engines')
-rw-r--r-- | engines/e_afalg.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/engines/e_afalg.c b/engines/e_afalg.c index 93b3b3f02e..f36665acf6 100644 --- a/engines/e_afalg.c +++ b/engines/e_afalg.c @@ -544,7 +544,7 @@ static int afalg_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { int ciphertype; - int ret; + int ret, len; afalg_ctx *actx; const char *ciphername; @@ -588,8 +588,9 @@ static int afalg_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, if (ret < 1) return 0; - - ret = afalg_set_key(actx, key, EVP_CIPHER_CTX_get_key_length(ctx)); + if ((len = EVP_CIPHER_CTX_get_key_length(ctx)) <= 0) + goto err; + ret = afalg_set_key(actx, key, len); if (ret < 1) goto err; |