From 1446211e5e0c621ae8823cfce43626a7c98975f3 Mon Sep 17 00:00:00 2001 From: "ENT\\stroej1" Date: Thu, 24 Dec 2020 12:23:28 -0600 Subject: [PATCH] Update self-test vectors to include nonce and test it as part of reseeding. Signed-off-by: ENT\stroej1 --- library/ctr_drbg.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/library/ctr_drbg.c b/library/ctr_drbg.c index 0a46967f6..ce364dfc4 100644 --- a/library/ctr_drbg.c +++ b/library/ctr_drbg.c @@ -718,20 +718,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] = - { 0x95, 0x3c, 0xa5, 0xbd, 0x44, 0x1, 0x34, 0xb7, - 0x13, 0x58, 0x3e, 0x6a, 0x6c, 0x7e, 0x88, 0x8a }; + { 0x41, 0x23, 0x0c, 0xd8, 0xad, 0x3f, 0x82, 0xfb, + 0x08, 0x2d, 0xe7, 0xbe, 0x6f, 0x84, 0x88, 0x94 }; static const unsigned char result_nopr[16] = - { 0x6c, 0x25, 0x27, 0x95, 0xa3, 0x62, 0xd6, 0xdb, - 0x90, 0xfd, 0x69, 0xb5, 0x42, 0x9, 0x4b, 0x84 }; + { 0x6f, 0x91, 0x56, 0xa3, 0xde, 0x0f, 0x7f, 0x01, + 0x96, 0x93, 0xd9, 0x43, 0x5f, 0xc7, 0x56, 0xb6 }; #else /* MBEDTLS_CTR_DRBG_USE_128_BIT_KEY */ static const unsigned char result_pr[16] = - { 0x34, 0x01, 0x16, 0x56, 0xb4, 0x29, 0x00, 0x8f, - 0x35, 0x63, 0xec, 0xb5, 0xf2, 0x59, 0x07, 0x23 }; + { 0x4b, 0x78, 0xa5, 0xec, 0x88, 0xc0, 0xfc, 0x0c, + 0x28, 0xfb, 0xe1, 0x7a, 0x6e, 0x5e, 0xeb, 0xf7 }; static const unsigned char result_nopr[16] = - { 0xa0, 0x54, 0x30, 0x3d, 0x8a, 0x7e, 0xa9, 0x88, - 0x9d, 0x90, 0x3e, 0x07, 0x7c, 0x6f, 0x21, 0x8f }; + { 0x19, 0x94, 0xfd, 0xe3, 0x11, 0xe8, 0x73, 0x0f, + 0xaa, 0x33, 0xc2, 0x00, 0x19, 0x2c, 0xd9, 0x4d }; #endif /* MBEDTLS_CTR_DRBG_USE_128_BIT_KEY */ static size_t test_offset; @@ -769,7 +769,7 @@ int mbedtls_ctr_drbg_self_test( int verbose ) test_offset = 0; mbedtls_ctr_drbg_set_entropy_len( &ctx, 32 ); - mbedtls_ctr_drbg_set_nonce_len( &ctx, 0 ); + mbedtls_ctr_drbg_set_nonce_len( &ctx, 16 ); CHK( mbedtls_ctr_drbg_seed( &ctx, ctr_drbg_self_test_entropy, (void *) entropy_source_pr, @@ -794,7 +794,7 @@ int mbedtls_ctr_drbg_self_test( int verbose ) test_offset = 0; mbedtls_ctr_drbg_set_entropy_len( &ctx, 32 ); - mbedtls_ctr_drbg_set_nonce_len( &ctx, 0 ); + mbedtls_ctr_drbg_set_nonce_len( &ctx, 16 ); CHK( mbedtls_ctr_drbg_seed( &ctx, ctr_drbg_self_test_entropy, (void *) entropy_source_nopr,