Ensure HMAC_size() handles errors correctly

Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
Matt Caswell 2016-10-19 16:29:01 +01:00
parent 56a26ce360
commit 708e06c55d

View File

@ -118,7 +118,10 @@ int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len)
size_t HMAC_size(const HMAC_CTX *ctx)
{
return EVP_MD_size((ctx)->md);
int size = EVP_MD_size((ctx)->md);
if (size < 0)
return 0;
return size;
}
HMAC_CTX *HMAC_CTX_new(void)