Test multi-block output of the hash-based KDF

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
Manuel Pégourié-Gonnard 2020-06-22 10:18:58 +02:00
parent 2df5857dbe
commit 2df1423eff

View file

@ -3222,33 +3222,35 @@ cleanup:
* https://github.com/patrickfav/singlestep-kdf/wiki/NIST-SP-800-56C-Rev1:-Non-Official-Test-Vectors * https://github.com/patrickfav/singlestep-kdf/wiki/NIST-SP-800-56C-Rev1:-Non-Official-Test-Vectors
* *
* We only use the ones with empty fixedInfo, and for brevity's sake, only * We only use the ones with empty fixedInfo, and for brevity's sake, only
* 32-bytes output (with SHA-256 that's exactly one block, and with SHA-512 * 40-bytes output (with SHA-256 that's more than one block, and with SHA-512
* less than one block). * less than one block).
*/ */
#if defined(MBEDTLS_SHA512_C) #if defined(MBEDTLS_SHA512_C)
static const uint8_t test_kdf_z[16] = { static const uint8_t test_kdf_z[16] = {
0xeb, 0xf3, 0x19, 0x67, 0x1e, 0xac, 0xcc, 0x6f, 0x3b, 0xa9, 0x79, 0xe9, 0xbc, 0x5e, 0x3e, 0xc7,
0xc5, 0xc0, 0x5d, 0x95, 0x8d, 0x17, 0x15, 0x94, 0x61, 0x30, 0x36, 0xb6, 0xf5, 0x1c, 0xd5, 0xaa,
}; };
static const uint8_t test_kdf_out[32] = { static const uint8_t test_kdf_out[40] = {
0xa9, 0x48, 0x85, 0x67, 0x54, 0x7c, 0x2a, 0x8e, 0x3e, 0xf6, 0xda, 0xf9, 0x51, 0x60, 0x70, 0x5f,
0x9e, 0xd1, 0x67, 0x76, 0xe3, 0x1c, 0x03, 0x92, 0xdf, 0x21, 0xcd, 0xab, 0xac, 0x25, 0x7b, 0x05,
0x41, 0x77, 0x2a, 0x9e, 0xc7, 0xcc, 0xd7, 0x1f, 0xfe, 0xc1, 0xab, 0x7c, 0xc9, 0x68, 0x43, 0x25,
0xda, 0x12, 0xe9, 0xba, 0xc9, 0xb2, 0x17, 0x24, 0x8a, 0xfc, 0x40, 0x6e, 0x5b, 0xf7, 0x98, 0x27,
0x10, 0xfa, 0x7b, 0x93, 0x52, 0xd4, 0x16, 0xaa,
}; };
#elif defined(MBEDTLS_SHA256_C) #elif defined(MBEDTLS_SHA256_C)
static const uint8_t test_kdf_z[16] = { static const uint8_t test_kdf_z[16] = {
0x0d, 0x5e, 0xc8, 0x9a, 0x68, 0xb1, 0xa7, 0xa0, 0xc8, 0x3e, 0x35, 0x8e, 0x99, 0xa6, 0x89, 0xc6,
0xdf, 0x95, 0x24, 0x54, 0x3f, 0x4d, 0x70, 0xef, 0x7d, 0xb4, 0xfe, 0x39, 0xcf, 0x8f, 0x26, 0xe1,
}; };
static const uint8_t test_kdf_out[32] = { static const uint8_t test_kdf_out[40] = {
0x77, 0xbc, 0x94, 0x9e, 0xa0, 0xd3, 0xdd, 0x5c, 0x7d, 0xf6, 0x41, 0xf8, 0x3c, 0x47, 0xdc, 0x28,
0x8e, 0xb7, 0xeb, 0x84, 0x05, 0x40, 0x60, 0xfa, 0x5f, 0x7f, 0xaa, 0xde, 0x05, 0x64, 0xd6, 0x25,
0x96, 0x6e, 0x7e, 0xcd, 0x73, 0x9f, 0xa1, 0xe6, 0x00, 0x6a, 0x47, 0xd9, 0x1e, 0xa4, 0xa0, 0x8c,
0x34, 0x3f, 0x6d, 0x82, 0x16, 0x22, 0xb4, 0x45, 0xd7, 0xf7, 0x0c, 0x99, 0xaa, 0xa0, 0x72, 0x66,
0x69, 0x0e, 0x25, 0xaa, 0xa1, 0x63, 0x14, 0x79,
}; };
#endif #endif