summaryrefslogtreecommitdiffstats
path: root/crypto/hmac
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-10-19 16:29:01 +0100
committerMatt Caswell <matt@openssl.org>2016-11-04 12:09:46 +0000
commit708e06c55d9fee5d59e4a4f409d115423ea1fa56 (patch)
treea1ca93b1ec744385a98cbffab617e4d33136958a /crypto/hmac
parent56a26ce3600cc9f96da0e64b345a25276d9abfc0 (diff)
Ensure HMAC_size() handles errors correctly
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/hmac')
-rw-r--r--crypto/hmac/hmac.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/hmac/hmac.c b/crypto/hmac/hmac.c
index 3374105cbb..a2c9dd9845 100644
--- a/crypto/hmac/hmac.c
+++ b/crypto/hmac/hmac.c
@@ -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)