Add HMAC test for invalid key len
authorMatt Caswell <matt@openssl.org>
Tue, 10 Feb 2015 13:15:05 +0000 (13:15 +0000)
committerMatt Caswell <matt@openssl.org>
Wed, 25 Mar 2015 12:54:18 +0000 (12:54 +0000)
Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/hmac/hmactest.c

index 3db712a776c6145b2bf031ba45671df93be75db5..5e90dba55af9b1ef90a4a4acc3219a8c8016db20 100644 (file)
@@ -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++;