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:58:56 +0000 (12:58 +0000)
Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/hmac/hmactest.c

index f9c84a725ac99a0a61d2a6013e2ee5e3b87f1490..5c8ec4c6152ec1a1d284ddbfff5eed82c39b0700 100644 (file)
@@ -206,6 +206,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++;