aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauli <[email protected]>2020-04-27 01:28:55 +0200
committerPauli <[email protected]>2020-04-30 12:21:33 +0200
commit206da660a37e84b7266db4e2c4e9485cdafb1366 (patch)
tree83a3d5ceefa280ad020aeb2689e8e42c1e5abb6a
parentcoverity 1462578 Resource leak (diff)
downloadopenssl-206da660a37e84b7266db4e2c4e9485cdafb1366.tar.gz
openssl-206da660a37e84b7266db4e2c4e9485cdafb1366.zip
coverity 1462580 Improper use of negative value
Reviewed-by: Tomas Mraz <[email protected]> (Merged from https://github.com/openssl/openssl/pull/11651)
-rw-r--r--crypto/hmac/hmac.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/crypto/hmac/hmac.c b/crypto/hmac/hmac.c
index b49baec4c1e..6c1a70e4bda 100644
--- a/crypto/hmac/hmac.c
+++ b/crypto/hmac/hmac.c
@@ -55,6 +55,8 @@ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
j = EVP_MD_block_size(md);
if (!ossl_assert(j <= (int)sizeof(keytmp)))
return 0;
+ if (j < 0)
+ return 0;
if (j < len) {
if (!EVP_DigestInit_ex(ctx->md_ctx, md, impl)
|| !EVP_DigestUpdate(ctx->md_ctx, key, len)