From: Pauli Date: Sun, 26 Apr 2020 23:28:55 +0000 (+1000) Subject: coverity 1462580 Improper use of negative value X-Git-Tag: openssl-3.0.0-alpha2~109 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=206da660a37e84b7266db4e2c4e9485cdafb1366;p=oweals%2Fopenssl.git coverity 1462580 Improper use of negative value Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/11651) --- 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)