diff options
author | Pauli <ppzgs1@gmail.com> | 2021-03-19 05:50:28 +0100 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-04-08 00:49:27 +0200 |
commit | 3bbc7b562abf4ca3221d8762fe3f749024936281 (patch) | |
tree | db56fd74f0cc9a4f9fc9b6d372c029bbba6f2f52 /crypto/evp | |
parent | evp: fix coverity 1451510: argument cannot be negative (diff) | |
download | openssl-3bbc7b562abf4ca3221d8762fe3f749024936281.tar.xz openssl-3bbc7b562abf4ca3221d8762fe3f749024936281.zip |
evp: fix coverity 1451509: argument cannot be negative
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14620)
Diffstat (limited to 'crypto/evp')
-rw-r--r-- | crypto/evp/e_rc4_hmac_md5.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/evp/e_rc4_hmac_md5.c b/crypto/evp/e_rc4_hmac_md5.c index 098aa3ee1b..8bc1da6323 100644 --- a/crypto/evp/e_rc4_hmac_md5.c +++ b/crypto/evp/e_rc4_hmac_md5.c @@ -46,8 +46,12 @@ static int rc4_hmac_md5_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *iv, int enc) { EVP_RC4_HMAC_MD5 *key = data(ctx); + const int keylen = EVP_CIPHER_CTX_key_length(ctx); - RC4_set_key(&key->ks, EVP_CIPHER_CTX_key_length(ctx), inkey); + if (keylen <= 0) + return 0; + + RC4_set_key(&key->ks, keylen, inkey); MD5_Init(&key->head); /* handy when benchmarking */ key->tail = key->head; |