summaryrefslogtreecommitdiffstats
path: root/crypto/hmac
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2020-04-27 09:28:55 +1000
committerPauli <paul.dale@oracle.com>2020-04-30 20:21:33 +1000
commit206da660a37e84b7266db4e2c4e9485cdafb1366 (patch)
tree83a3d5ceefa280ad020aeb2689e8e42c1e5abb6a /crypto/hmac
parent209c3d3ef655a807cdb109f3316bb86433ae7f07 (diff)
coverity 1462580 Improper use of negative value
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11651)
Diffstat (limited to 'crypto/hmac')
-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 b49baec4c1..6c1a70e4bd 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)