summaryrefslogtreecommitdiffstats
path: root/crypto/hmac
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2015-02-10 13:15:25 +0000
committerMatt Caswell <matt@openssl.org>2015-03-25 13:01:04 +0000
commit42c9c7103c8e7fd73dafa0500120f8e34fd659c3 (patch)
treeff731eee70f4505a222079b5587d201871c77c68 /crypto/hmac
parent4ebc70cc5148d6ffbf539faca249469778c12f96 (diff)
Fix HMAC to pass invalid key len test
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/hmac')
-rw-r--r--crypto/hmac/hmac.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/hmac/hmac.c b/crypto/hmac/hmac.c
index 6567648acc..2daacf6e70 100644
--- a/crypto/hmac/hmac.c
+++ b/crypto/hmac/hmac.c
@@ -113,7 +113,8 @@ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
&ctx->key_length))
goto err;
} else {
- OPENSSL_assert(len >= 0 && len <= (int)sizeof(ctx->key));
+ if(len < 0 || len > (int)sizeof(ctx->key))
+ return 0;
memcpy(ctx->key, key, len);
ctx->key_length = len;
}