]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.boringcrypto] crypto/hmac: test empty key
authorRuss Cox <rsc@golang.org>
Mon, 28 Aug 2017 18:27:03 +0000 (14:27 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 30 Aug 2017 19:23:48 +0000 (19:23 +0000)
This happens in the scrypt and pbkdf unit tests.

Change-Id: I1eda944d7c01d28c7a6dd9f428f5fdd1cbd58939
Reviewed-on: https://go-review.googlesource.com/59771
Reviewed-by: Adam Langley <agl@golang.org>
src/crypto/hmac/hmac_test.go

index aac9aa96a8ece496e4af4120ea556b51dbfdac34..444978001ca3dc6c94976b1b0b20a130aba9f89e 100644 (file)
@@ -518,6 +518,31 @@ var hmacTests = []hmacTest{
                sha512.Size,
                sha512.BlockSize,
        },
+       // HMAC without key is dumb but should probably not fail.
+       {
+               sha1.New,
+               []byte{},
+               []byte("message"),
+               "d5d1ed05121417247616cfc8378f360a39da7cfa",
+               sha1.Size,
+               sha1.BlockSize,
+       },
+       {
+               sha256.New,
+               []byte{},
+               []byte("message"),
+               "eb08c1f56d5ddee07f7bdf80468083da06b64cf4fac64fe3a90883df5feacae4",
+               sha256.Size,
+               sha256.BlockSize,
+       },
+       {
+               sha512.New,
+               []byte{},
+               []byte("message"),
+               "08fce52f6395d59c2a3fb8abb281d74ad6f112b9a9c787bcea290d94dadbc82b2ca3e5e12bf2277c7fedbb0154d5493e41bb7459f63c8e39554ea3651b812492",
+               sha512.Size,
+               sha512.BlockSize,
+       },
 }
 
 func TestHMAC(t *testing.T) {