mirror of
https://github.com/cryb-to/cryb-to.git
synced 2024-12-22 04:21:08 +00:00
Replace the FIPS-198 test vectors with those from the NIST CSRC's
algorithm example page.
This commit is contained in:
parent
5bb81214cc
commit
0681394b23
1 changed files with 26 additions and 24 deletions
|
@ -74,7 +74,8 @@ t_hmac_sha1_complete(const void *key, size_t keylen,
|
|||
#endif
|
||||
|
||||
/*
|
||||
* Test vectors from FIPS 198
|
||||
* Test vectors from NIST CSRC
|
||||
* http://csrc.nist.gov/groups/ST/toolkit/examples.html
|
||||
*/
|
||||
static struct t_vector {
|
||||
const char *desc;
|
||||
|
@ -95,7 +96,7 @@ static struct t_vector {
|
|||
},
|
||||
},
|
||||
{
|
||||
"FIPS 198 A.1 (64-byte key)",
|
||||
"NIST CSRC example 1 (64-byte key)",
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||
|
@ -107,30 +108,30 @@ static struct t_vector {
|
|||
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
|
||||
},
|
||||
64,
|
||||
"Sample #1",
|
||||
"Sample message for keylen=blocklen",
|
||||
{
|
||||
0x4f, 0x4c, 0xa3, 0xd5, 0xd6, 0x8b, 0xa7, 0xcc,
|
||||
0x0a, 0x12, 0x08, 0xc9, 0xc6, 0x1e, 0x9c, 0x5d,
|
||||
0xa0, 0x40, 0x3c, 0x0a,
|
||||
0x5f, 0xd5, 0x96, 0xee, 0x78, 0xd5, 0x55, 0x3c,
|
||||
0x8f, 0xf4, 0xe7, 0x2d, 0x26, 0x6d, 0xfd, 0x19,
|
||||
0x23, 0x66, 0xda, 0x29,
|
||||
},
|
||||
},
|
||||
{
|
||||
"FIPS 198 A.2 (20-byte key)",
|
||||
"NIST CSRC example 2 (20-byte key)",
|
||||
{
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
|
||||
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
|
||||
0x40, 0x41, 0x42, 0x43,
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||
0x10, 0x11, 0x12, 0x13,
|
||||
},
|
||||
20,
|
||||
"Sample #2",
|
||||
"Sample message for keylen<blocklen",
|
||||
{
|
||||
0x09, 0x22, 0xd3, 0x40, 0x5f, 0xaa, 0x3d, 0x19,
|
||||
0x4f, 0x82, 0xa4, 0x58, 0x30, 0x73, 0x7d, 0x5c,
|
||||
0xc6, 0xc7, 0x5d, 0x24,
|
||||
0x4c, 0x99, 0xff, 0x0c, 0xb1, 0xb3, 0x1b, 0xd3,
|
||||
0x3f, 0x84, 0x31, 0xdb, 0xaf, 0x4d, 0x17, 0xfc,
|
||||
0xd3, 0x56, 0xa8, 0x07,
|
||||
},
|
||||
},
|
||||
{
|
||||
"FIPS 198 A.3 (100-byte key)",
|
||||
"NIST CSRC example 3 (100-byte key)",
|
||||
{
|
||||
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
|
||||
0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
|
||||
|
@ -147,15 +148,16 @@ static struct t_vector {
|
|||
0xb0, 0xb1, 0xb2, 0xb3,
|
||||
},
|
||||
100,
|
||||
"Sample #3",
|
||||
/* yes, the text should say keylen>blocklen */
|
||||
"Sample message for keylen=blocklen",
|
||||
{
|
||||
0xbc, 0xf4, 0x1e, 0xab, 0x8b, 0xb2, 0xd8, 0x02,
|
||||
0xf3, 0xd0, 0x5c, 0xaf, 0x7c, 0xb0, 0x92, 0xec,
|
||||
0xf8, 0xd1, 0xa3, 0xaa,
|
||||
0x2d, 0x51, 0xb2, 0xf7, 0x75, 0x0e, 0x41, 0x05,
|
||||
0x84, 0x66, 0x2e, 0x38, 0xf1, 0x33, 0x43, 0x5f,
|
||||
0x4c, 0x4f, 0xd4, 0x2a,
|
||||
},
|
||||
},
|
||||
{
|
||||
"FIPS 198 A.4 (49-byte key)",
|
||||
"NIST CSRC example 4 (49-byte key)",
|
||||
{
|
||||
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
|
||||
0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
|
||||
|
@ -166,11 +168,11 @@ static struct t_vector {
|
|||
0xa0,
|
||||
},
|
||||
49,
|
||||
"Sample #4",
|
||||
"Sample message for keylen<blocklen, with truncated tag",
|
||||
{
|
||||
0x9e, 0xa8, 0x86, 0xef, 0xe2, 0x68, 0xdb, 0xec,
|
||||
0xce, 0x42, 0x0c, 0x75, 0x24, 0xdf, 0x32, 0xe0,
|
||||
0x75, 0x1a, 0x2a, 0x26,
|
||||
0xfe, 0x35, 0x29, 0x56, 0x5c, 0xd8, 0xe2, 0x8c,
|
||||
0x5f, 0xa7, 0x9e, 0xac, 0x9d, 0x80, 0x23, 0xb5,
|
||||
0x3b, 0x28, 0x9d, 0x96,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue