From b352160f816585d2be1bcd8862efae647968f406 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Tue, 10 Feb 2015 13:15:05 +0000 Subject: [PATCH] Add HMAC test for invalid key len Reviewed-by: Richard Levitte --- crypto/hmac/hmactest.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crypto/hmac/hmactest.c b/crypto/hmac/hmactest.c index 3db712a776..5e90dba55a 100644 --- a/crypto/hmac/hmactest.c +++ b/crypto/hmac/hmactest.c @@ -199,6 +199,11 @@ test5: err++; goto test6; } + if(HMAC_Init_ex(&ctx, test[4].key, -1, EVP_sha1(), NULL)) { + printf("Should fail to initialise HMAC with invalid key len(test 5)\n"); + err++; + goto test6; + } if(!HMAC_Init_ex(&ctx, test[4].key, test[4].key_len, EVP_sha1(), NULL)) { printf("Failed to initialise HMAC (test 5)\n"); err++; -- 2.34.1