mirror of
https://github.com/openssl/openssl.git
synced 2024-12-09 05:51:54 +08:00
hmac: fix coverity 1484888 negative integer to size_t conversion
More theoretical than real but easy and cheap to check for. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/15300)
This commit is contained in:
parent
84c5ad23e1
commit
678d0dba6c
@ -221,10 +221,13 @@ unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,
|
||||
unsigned char *md, unsigned int *md_len)
|
||||
{
|
||||
static unsigned char static_md[EVP_MAX_MD_SIZE];
|
||||
int size = EVP_MD_size(evp_md);
|
||||
|
||||
if (size < 0)
|
||||
return NULL;
|
||||
return EVP_Q_mac(NULL, "HMAC", NULL, EVP_MD_name(evp_md), NULL,
|
||||
key, key_len, data, data_len,
|
||||
md == NULL ? static_md : md, EVP_MD_size(evp_md), md_len);
|
||||
md == NULL ? static_md : md, size, md_len);
|
||||
}
|
||||
|
||||
void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags)
|
||||
|
Loading…
Reference in New Issue
Block a user