Add XOF tests at rate boundary

This commit is contained in:
Frank Denis
2025-11-26 23:03:42 +01:00
parent 6a892675bc
commit 9bd8c45140
4 changed files with 36 additions and 4 deletions
+9 -1
View File
@@ -20,6 +20,7 @@ main(void)
0x78, 0x20, 0x6a, 0x75, 0x6d, 0x70, 0x73, 0x20, 0x6f,
0x76, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c,
0x61, 0x7a, 0x79, 0x20, 0x64, 0x6f, 0x67 };
static const unsigned char msg_rate_block[168] = { 0 };
static const unsigned char out_empty_32[] = { 0x7f, 0x9c, 0x2b, 0xa4, 0xe8, 0x8f, 0x82, 0x7d,
0x61, 0x60, 0x45, 0x50, 0x76, 0x05, 0x85, 0x3e,
@@ -52,11 +53,18 @@ main(void)
0x8f, 0xec, 0x3a, 0x57, 0x1f, 0x09, 0x60, 0x86, 0xa5, 0x23, 0x71, 0x7a
};
static const unsigned char out_rate_block_32[] = { 0x7c, 0x00, 0xff, 0x47, 0x48, 0x87, 0x0c,
0xb2, 0x6d, 0xa4, 0xdc, 0x07, 0x8a, 0xff,
0x74, 0x47, 0x7a, 0xb1, 0x53, 0xfa, 0x11,
0x91, 0xc7, 0xb6, 0x36, 0xfe, 0xa6, 0xc0,
0x1e, 0xcc, 0x1f, 0xab };
testvector vectors[] = { { msg_empty, 0, out_empty_32, 32 },
{ msg_empty, 0, out_empty_64, 64 },
{ msg_abc, 3, out_abc_32, 32 },
{ msg_fox, 43, out_fox_32, 32 },
{ msg_fox, 43, out_fox_64, 64 } };
{ msg_fox, 43, out_fox_64, 64 },
{ msg_rate_block, sizeof msg_rate_block, out_rate_block_32, 32 } };
unsigned char out[256];
crypto_xof_shake128_state state;
+9 -1
View File
@@ -20,6 +20,7 @@ main(void)
0x78, 0x20, 0x6a, 0x75, 0x6d, 0x70, 0x73, 0x20, 0x6f,
0x76, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c,
0x61, 0x7a, 0x79, 0x20, 0x64, 0x6f, 0x67 };
static const unsigned char msg_rate_block[136] = { 0 };
/* SHAKE-256 test vectors */
static const unsigned char out_empty_32[] = { 0x46, 0xb9, 0xdd, 0x2b, 0x0b, 0xa8, 0x8d, 0x13,
@@ -53,11 +54,18 @@ main(void)
0x5b, 0x8e, 0xd5, 0xbd, 0x11, 0x99, 0x8b, 0x40, 0xd5, 0x73, 0x44, 0x42
};
static const unsigned char out_rate_block_32[] = { 0xea, 0x94, 0x7b, 0x83, 0x5f, 0xec, 0x1f,
0x9b, 0x0a, 0x7e, 0xab, 0xba, 0x90, 0x1d,
0xeb, 0x78, 0x81, 0xfd, 0x99, 0x99, 0xa1,
0xcb, 0xd5, 0xcc, 0xbb, 0x5a, 0x9a, 0xfa,
0xb7, 0xf6, 0xfe, 0x70 };
testvector vectors[] = { { msg_empty, 0, out_empty_32, 32 },
{ msg_empty, 0, out_empty_64, 64 },
{ msg_abc, 3, out_abc_32, 32 },
{ msg_fox, 43, out_fox_32, 32 },
{ msg_fox, 43, out_fox_64, 64 } };
{ msg_fox, 43, out_fox_64, 64 },
{ msg_rate_block, sizeof msg_rate_block, out_rate_block_32, 32 } };
unsigned char out[256];
crypto_xof_shake256_state state;
+9 -1
View File
@@ -20,6 +20,7 @@ main(void)
0x78, 0x20, 0x6a, 0x75, 0x6d, 0x70, 0x73, 0x20, 0x6f,
0x76, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c,
0x61, 0x7a, 0x79, 0x20, 0x64, 0x6f, 0x67 };
static const unsigned char msg_rate_block[168] = { 0 };
static const unsigned char out_empty_32[] = { 0x1e, 0x41, 0x5f, 0x1c, 0x59, 0x83, 0xaf, 0xf2,
0x16, 0x92, 0x17, 0x27, 0x7d, 0x17, 0xbb, 0x53,
@@ -52,11 +53,18 @@ main(void)
0x6c, 0x34, 0x12, 0x0f, 0xf2, 0xb2, 0x53, 0xe9, 0xfd, 0x8d, 0x9f, 0xc4
};
static const unsigned char out_rate_block_32[] = { 0xdb, 0xa6, 0xe2, 0x67, 0xbd, 0xd5, 0x67,
0xdb, 0x0a, 0xd2, 0x63, 0x6e, 0x61, 0xf1,
0xae, 0x58, 0x9a, 0x81, 0xc1, 0xa9, 0xc1,
0x1f, 0x7f, 0x76, 0x93, 0x0a, 0x35, 0xea,
0x42, 0x47, 0x56, 0xd0 };
testvector vectors[] = { { msg_empty, 0, out_empty_32, 32 },
{ msg_empty, 0, out_empty_64, 64 },
{ msg_abc, 3, out_abc_32, 32 },
{ msg_fox, 43, out_fox_32, 32 },
{ msg_fox, 43, out_fox_64, 64 } };
{ msg_fox, 43, out_fox_64, 64 },
{ msg_rate_block, sizeof msg_rate_block, out_rate_block_32, 32 } };
unsigned char out[256];
crypto_xof_turboshake128_state state;
+9 -1
View File
@@ -20,6 +20,7 @@ main(void)
0x78, 0x20, 0x6a, 0x75, 0x6d, 0x70, 0x73, 0x20, 0x6f,
0x76, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c,
0x61, 0x7a, 0x79, 0x20, 0x64, 0x6f, 0x67 };
static const unsigned char msg_rate_block[136] = { 0 };
static const unsigned char out_empty_32[] = { 0x36, 0x7a, 0x32, 0x9d, 0xaf, 0xea, 0x87, 0x1c,
0x78, 0x02, 0xec, 0x67, 0xf9, 0x05, 0xae, 0x13,
@@ -52,11 +53,18 @@ main(void)
0xf5, 0x07, 0xc9, 0xb4, 0xf0, 0x41, 0x7e, 0x2b, 0x66, 0x31, 0x60, 0x90
};
static const unsigned char out_rate_block_32[] = { 0x91, 0xef, 0xfd, 0x08, 0xdd, 0x4c, 0xcc,
0xb6, 0x89, 0xc6, 0x26, 0xb4, 0x64, 0x93,
0x67, 0xad, 0x5a, 0x2e, 0xbf, 0xab, 0x61,
0x61, 0x17, 0x69, 0xa3, 0x74, 0x93, 0xfa,
0x70, 0x12, 0x28, 0xea };
testvector vectors[] = { { msg_empty, 0, out_empty_32, 32 },
{ msg_empty, 0, out_empty_64, 64 },
{ msg_abc, 3, out_abc_32, 32 },
{ msg_fox, 43, out_fox_32, 32 },
{ msg_fox, 43, out_fox_64, 64 } };
{ msg_fox, 43, out_fox_64, 64 },
{ msg_rate_block, sizeof msg_rate_block, out_rate_block_32, 32 } };
unsigned char out[256];
crypto_xof_turboshake256_state state;