From a0deec050931a334d762a1344b3ac18fe1d6b7ae Mon Sep 17 00:00:00 2001 From: "ENT\\stroej1" Date: Thu, 24 Dec 2020 15:26:27 -0600 Subject: [PATCH] Extended test vectors to accomodate addition of nonce to test input array and updated results. Signed-off-by: ENT\stroej1 --- library/ctr_drbg.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/library/ctr_drbg.c b/library/ctr_drbg.c index ce364dfc4..8a5bc49a2 100644 --- a/library/ctr_drbg.c +++ b/library/ctr_drbg.c @@ -684,7 +684,7 @@ exit: #if defined(MBEDTLS_SELF_TEST) -static const unsigned char entropy_source_pr[96] = +static const unsigned char entropy_source_pr[112] = { 0xc1, 0x80, 0x81, 0xa6, 0x5d, 0x44, 0x02, 0x16, 0x19, 0xb3, 0xf1, 0x80, 0xb1, 0xc9, 0x20, 0x02, 0x6a, 0x54, 0x6f, 0x0c, 0x70, 0x81, 0x49, 0x8b, @@ -696,9 +696,11 @@ static const unsigned char entropy_source_pr[96] = 0x37, 0xc9, 0x98, 0x1c, 0x0b, 0xfb, 0x91, 0x31, 0x4d, 0x55, 0xb9, 0xe9, 0x1c, 0x5a, 0x5e, 0xe4, 0x93, 0x92, 0xcf, 0xc5, 0x23, 0x12, 0xd5, 0x56, - 0x2c, 0x4a, 0x6e, 0xff, 0xdc, 0x10, 0xd0, 0x68 }; + 0x2c, 0x4a, 0x6e, 0xff, 0xdc, 0x10, 0xd0, 0x68, + 0x0c, 0xbe, 0x99, 0x82, 0x15, 0x09, 0x97, 0x5d, + 0x82, 0x4f, 0xd8, 0x26, 0xc4, 0x7d, 0x2a, 0xbc }; -static const unsigned char entropy_source_nopr[64] = +static const unsigned char entropy_source_nopr[80] = { 0x5a, 0x19, 0x4d, 0x5e, 0x2b, 0x31, 0x58, 0x14, 0x54, 0xde, 0xf6, 0x75, 0xfb, 0x79, 0x58, 0xfe, 0xc7, 0xdb, 0x87, 0x3e, 0x56, 0x89, 0xfc, 0x9d, @@ -706,7 +708,9 @@ static const unsigned char entropy_source_nopr[64] = 0xf9, 0xe6, 0x5e, 0x04, 0xd8, 0x56, 0xf3, 0xa9, 0xc4, 0x4a, 0x4c, 0xbd, 0xc1, 0xd0, 0x08, 0x46, 0xf5, 0x98, 0x3d, 0x77, 0x1c, 0x1b, 0x13, 0x7e, - 0x4e, 0x0f, 0x9d, 0x8e, 0xf4, 0x09, 0xf9, 0x2e }; + 0x4e, 0x0f, 0x9d, 0x8e, 0xf4, 0x09, 0xf9, 0x2e, + 0xd4, 0xdd, 0x3a, 0xe9, 0x8e, 0x45, 0x65, 0x59, + 0x0e, 0x5b, 0x03, 0xc8, 0x7a, 0x77, 0xce, 0x59 }; static const unsigned char nonce_pers_pr[16] = { 0xd2, 0x54, 0xfc, 0xff, 0x02, 0x1e, 0x69, 0xd2, @@ -718,20 +722,20 @@ static const unsigned char nonce_pers_nopr[16] = #if defined(MBEDTLS_CTR_DRBG_USE_128_BIT_KEY) static const unsigned char result_pr[16] = - { 0x41, 0x23, 0x0c, 0xd8, 0xad, 0x3f, 0x82, 0xfb, - 0x08, 0x2d, 0xe7, 0xbe, 0x6f, 0x84, 0x88, 0x94 }; + { 0x77, 0x84, 0x98, 0x63, 0xad, 0x37, 0xcc, 0xf3, + 0x17, 0x66, 0xb2, 0xa5, 0x06, 0x8c, 0xa9, 0x4f }; static const unsigned char result_nopr[16] = - { 0x6f, 0x91, 0x56, 0xa3, 0xde, 0x0f, 0x7f, 0x01, - 0x96, 0x93, 0xd9, 0x43, 0x5f, 0xc7, 0x56, 0xb6 }; + { 0xd0, 0xf2, 0xc7, 0x7e, 0x12, 0x08, 0xf3, 0xcb, + 0xf1, 0xbc, 0xd9, 0xff, 0x33, 0x6b, 0x7c, 0xa8 }; #else /* MBEDTLS_CTR_DRBG_USE_128_BIT_KEY */ static const unsigned char result_pr[16] = - { 0x4b, 0x78, 0xa5, 0xec, 0x88, 0xc0, 0xfc, 0x0c, - 0x28, 0xfb, 0xe1, 0x7a, 0x6e, 0x5e, 0xeb, 0xf7 }; + { 0xd5, 0x9e, 0xbb, 0xda, 0x5c, 0xb1, 0xd7, 0x60, + 0x15, 0x18, 0x28, 0x82, 0xd9, 0xd5, 0x71, 0x51 }; static const unsigned char result_nopr[16] = - { 0x19, 0x94, 0xfd, 0xe3, 0x11, 0xe8, 0x73, 0x0f, - 0xaa, 0x33, 0xc2, 0x00, 0x19, 0x2c, 0xd9, 0x4d }; + { 0xfd, 0x43, 0xf2, 0xf6, 0x44, 0x6c, 0x62, 0xbf, + 0x9d, 0xd3, 0x6e, 0xfa, 0xdd, 0xc7, 0x2c, 0x02 }; #endif /* MBEDTLS_CTR_DRBG_USE_128_BIT_KEY */ static size_t test_offset;