crypto: nhpoly1305 - add a test vector with len % 16 != 0

This is needed to test that the end of the message is zero-padded when
the length is not a multiple of 16 (NH_MESSAGE_UNIT).  It's already
tested indirectly by the 31-byte Adiantum test vector, but it should be
tested directly at the nhpoly1305 level too.

As with the other nhpoly1305 test vectors, this was generated by the
reference Python implementation at https://github.com/google/adiantum
and then automatically formatted for testmgr by a script.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Eric Biggers 2019-02-14 10:27:48 -08:00 committed by Herbert Xu
parent 511306b2d0
commit 367ecc0731
1 changed files with 144 additions and 0 deletions

View File

@ -5924,6 +5924,150 @@ static const struct hash_testvec nhpoly1305_tv_template[] = {
.psize = 16,
.digest = "\x04\xbf\x7f\x6a\xce\x72\xea\x6a"
"\x79\xdb\xb0\xc9\x60\xf6\x12\xcc",
}, {
.key = "\x2e\x77\x1e\x2c\x63\x76\x34\x3f"
"\x71\x08\x4f\x5a\xe3\x3d\x74\x56"
"\xc7\x98\x46\x52\xe5\x8a\xba\x0d"
"\x72\x41\x11\x15\x14\x72\x50\x8a"
"\xd5\xec\x60\x09\xdd\x71\xcc\xb9"
"\x59\x81\x65\x2d\x9e\x50\x18\xf3"
"\x32\xf3\xf1\xe7\x01\x82\x1c\xad"
"\x88\xa0\x21\x0c\x4b\x80\x5e\x62"
"\xfc\x81\xec\x52\xaa\xe4\xa5\x86"
"\xc2\xe6\x03\x11\xdc\x66\x09\x86"
"\x3c\x3b\xf0\x59\x0f\xb3\xf7\x44"
"\x24\xb7\x88\xc5\xfc\xc8\x77\x9f"
"\x8c\x44\xc4\x11\x55\xce\x7a\xa3"
"\xe0\xa2\xb8\xbf\xb5\x3d\x07\x2c"
"\x32\xb6\x6c\xfc\xb4\x42\x95\x95"
"\x98\x32\x81\xc4\xe7\xe2\xd9\x6a"
"\x87\xf4\xf4\x1e\x74\x7c\xb5\xcd"
"\x51\x45\x68\x38\x51\xdb\x30\x74"
"\x11\xe0\xaa\xae\x19\x8f\x15\x55"
"\xdd\x47\x4a\x35\xb9\x0c\xb4\x4e"
"\xa9\xce\x2f\xfa\x8f\xc1\x8a\x5e"
"\x5b\xec\xa5\x81\x3b\xb3\x43\x06"
"\x24\x81\xf4\x24\xe2\x21\xfa\xcb"
"\x49\xa8\xf8\xbd\x31\x4a\x5b\x2d"
"\x64\x0a\x07\xf0\x80\xc9\x0d\x81"
"\x14\x58\x54\x2b\xba\x22\x31\xba"
"\xef\x66\xc9\x49\x69\x69\x83\x0d"
"\xf2\xf9\x80\x9d\x30\x36\xfb\xe3"
"\xc0\x72\x2b\xcc\x5a\x81\x2c\x5d"
"\x3b\x5e\xf8\x2b\xd3\x14\x28\x73"
"\xf9\x1c\x70\xe6\xd8\xbb\xac\x30"
"\xf9\xd9\xa0\xe2\x33\x7c\x33\x34"
"\xa5\x6a\x77\x6d\xd5\xaf\xf4\xf3"
"\xc7\xb3\x0e\x83\x3d\xcb\x01\xcc"
"\x81\xc0\xf9\x4a\xae\x36\x92\xf7"
"\x69\x7b\x65\x01\xc3\xc8\xb8\xae"
"\x16\xd8\x30\xbb\xba\x6d\x78\x6e"
"\x0d\xf0\x7d\x84\xb7\x87\xda\x28"
"\x7a\x18\x10\x0b\x29\xec\x29\xf3"
"\xb0\x7b\xa1\x28\xbf\xbc\x2b\x2c"
"\x92\x2c\x16\xfb\x02\x39\xf9\xa6"
"\xa2\x15\x05\xa6\x72\x10\xbc\x62"
"\x4a\x6e\xb8\xb5\x5d\x59\xae\x3c"
"\x32\xd3\x68\xd7\x8e\x5a\xcd\x1b"
"\xef\xf6\xa7\x5e\x10\x51\x15\x4b"
"\x2c\xe3\xba\x70\x4f\x2c\xa0\x1c"
"\x7b\x97\xd7\xb2\xa5\x05\x17\xcc"
"\xf7\x3a\x29\x6f\xd5\x4b\xb8\x24"
"\xf4\x65\x95\x12\xc0\x86\xd1\x64"
"\x81\xdf\x46\x55\x0d\x22\x06\x77"
"\xd8\xca\x8d\xc8\x87\xc3\xfa\xb9"
"\xe1\x98\x94\xe6\x7b\xed\x65\x66"
"\x0e\xc7\x25\x15\xee\x4a\xe6\x7e"
"\xea\x1b\x58\xee\x96\xa0\x75\x9a"
"\xa3\x00\x9e\x42\xc2\x26\x20\x8c"
"\x3d\x22\x1f\x94\x3e\x74\x43\x72"
"\xe9\x1d\xa6\xa1\x6c\xa7\xb8\x03"
"\xdf\xb9\x7a\xaf\xe9\xe9\x3b\xfe"
"\xdf\x91\xc1\x01\xa8\xba\x5d\x29"
"\xa5\xe0\x98\x9b\x13\xe5\x13\x11"
"\x7c\x04\x3a\xe8\x44\x7e\x78\xfc"
"\xd6\x96\xa8\xbc\x7d\xc1\x89\x3d"
"\x75\x64\xa9\x0e\x86\x33\xfb\x73"
"\xf7\x15\xbc\x2c\x9a\x3f\x29\xce"
"\x1c\x9d\x10\x4e\x85\xe1\x77\x41"
"\x01\xe2\xbc\x88\xec\x81\xef\xc2"
"\x6a\xed\x4f\xf7\xdf\xac\x10\x71"
"\x94\xed\x71\xa4\x01\xd4\xd6\xbe"
"\xfe\x3e\xc3\x92\x6a\xf2\x2b\xb5"
"\xab\x15\x96\xb7\x88\x2c\xc2\xe1"
"\xb0\x04\x22\xe7\x3d\xa9\xc9\x7d"
"\x2c\x7c\x21\xff\x97\x86\x6b\x0c"
"\x2b\x5b\xe0\xb6\x48\x74\x8f\x24"
"\xef\x8e\xdd\x0f\x2a\x5f\xff\x33"
"\xf4\x8e\xc5\xeb\x9c\xd7\x2a\x45"
"\xf3\x50\xf1\xc0\x91\x8f\xc7\xf9"
"\x97\xc1\x3c\x9c\xf4\xed\x8a\x23"
"\x61\x5b\x40\x1a\x09\xee\x23\xa8"
"\x7c\x7a\x96\xe1\x31\x55\x3d\x12"
"\x04\x1f\x21\x78\x72\xf0\x0f\xa5"
"\x80\x58\x7c\x2f\x37\xb5\x67\x24"
"\x2f\xce\xf9\xf6\x86\x9f\xb3\x34"
"\x0c\xfe\x0a\xaf\x27\xe6\x5e\x0a"
"\x21\x44\x68\xe1\x5d\x84\x25\xae"
"\x2c\x5a\x94\x66\x9a\x3f\x0e\x5a"
"\xd0\x60\x2a\xd5\x3a\x4e\x2f\x40"
"\x87\xe9\x27\x3e\xee\x92\xe1\x07"
"\x22\x43\x52\xed\x67\x49\x13\xdd"
"\x68\xd7\x54\xc2\x76\x72\x7e\x75"
"\xaf\x24\x98\x5c\xe8\x22\xaa\x35"
"\x0f\x9a\x1c\x4c\x0b\x43\x68\x99"
"\x45\xdd\xbf\x82\xa5\x6f\x0a\xef"
"\x44\x90\x85\xe7\x57\x23\x22\x41"
"\x2e\xda\x24\x28\x65\x7f\x96\x85"
"\x9f\x4b\x0d\x43\xb9\xa8\xbd\x84"
"\xad\x0b\x09\xcc\x2c\x4a\x0c\xec"
"\x71\x58\xba\xf1\xfc\x49\x4c\xca"
"\x5c\x5d\xb2\x77\x0c\x99\xae\x1c"
"\xce\x70\x05\x5b\x73\x6b\x7c\x28"
"\x3b\xeb\x21\x3f\xa3\x71\xe1\x6a"
"\xf4\x87\xd0\xbf\x73\xaa\x0b\x0b"
"\xed\x70\xb3\xd4\xa3\xca\x76\x3a"
"\xdb\xfa\xd8\x08\x95\xec\xac\x59"
"\xd0\x79\x90\xc2\x33\x7b\xcc\x28"
"\x65\xb6\x5f\x92\xc4\xac\x23\x40"
"\xd1\x20\x44\x1f\xd7\x29\xab\x46"
"\x79\x32\xc6\x8f\x79\xe5\xaa\x2c"
"\xa6\x76\x70\x3a\x9e\x46\x3f\x8c"
"\x1a\x89\x32\x28\x61\x5c\xcf\x93"
"\x1e\xde\x9e\x98\xbe\x06\x30\x23"
"\xc4\x8b\xda\x1c\xd1\x67\x46\x93"
"\x9d\x41\xa2\x8c\x03\x22\xbd\x55"
"\x7e\x91\x51\x13\xdc\xcf\x5c\x1e"
"\xcb\x5d\xfb\x14\x16\x1a\x44\x56"
"\x27\x77\xfd\xed\x7d\xbd\xd1\x49"
"\x7f\x0d\xc3\x59\x48\x6b\x3c\x02"
"\x6b\xb5\xd0\x83\xd5\x81\x29\xe7"
"\xe0\xc9\x36\x23\x8d\x41\x33\x77"
"\xff\x5f\x54\xde\x4d\x3f\xd2\x4e"
"\xb6\x4d\xdd\x85\xf8\x9b\x20\x7d"
"\x39\x27\x68\x63\xd3\x8e\x61\x39"
"\xfa\xe1\xc3\x04\x74\x27\x5a\x34"
"\x7f\xec\x59\x2d\xc5\x6e\x54\x23"
"\xf5\x7b\x4b\xbe\x58\x2b\xf2\x81"
"\x93\x63\xcc\x13\xd9\x90\xbb\x6a"
"\x41\x03\x8d\x95\xeb\xbb\x5d\x06"
"\x38\x4c\x0e\xd6\xa9\x5b\x84\x97"
"\x3e\x64\x72\xe9\x96\x07\x0f\x73"
"\x6e\xc6\x3b\x32\xbe\xac\x13\x14"
"\xd0\x0a\x17\x5f\xb9\x9c\x3e\x34"
"\xd9\xec\xd6\x8f\x89\xbf\x1e\xd3"
"\xda\x80\xb2\x29\xff\x28\x96\xb3"
"\x46\x50\x5b\x15\x80\x97\xee\x1f"
"\x6c\xd8\xe8\xe0\xbd\x09\xe7\x20"
"\x8c\x23\x8e\xd9\xbb\x92\xfa\x82"
"\xaa\x0f\xb5\xf8\x78\x60\x11\xf0",
.ksize = 1088,
.plaintext = "\x0b\xb2\x31\x2d\xad\xfe\xce\xf9"
"\xec\x5d\x3d\x64\x5f\x3f\x75\x43"
"\x05\x5b\x97",
.psize = 19,
.digest = "\x5f\x02\xae\x65\x6c\x13\x21\x67"
"\x77\x9e\xc4\x43\x58\x68\xde\x8f",
}, {
.key = "\x65\x4d\xe3\xf8\xd2\x4c\xac\x28"
"\x68\xf5\xb3\x81\x71\x4b\xa1\xfa"