diff --git a/tests/suites/test_suite_hmac_drbg.function b/tests/suites/test_suite_hmac_drbg.function index 0882696d0..d9a365d0f 100644 --- a/tests/suites/test_suite_hmac_drbg.function +++ b/tests/suites/test_suite_hmac_drbg.function @@ -153,6 +153,7 @@ void hmac_drbg_no_reseed( int md_alg, char *add1_hex, char *add2_hex, char *output_hex ) { + unsigned char data[1024]; unsigned char entropy[512]; unsigned char custom[512]; unsigned char add1[512]; @@ -174,6 +175,21 @@ void hmac_drbg_no_reseed( int md_alg, p_entropy.p = entropy; TEST_ASSERT( ( md_info = md_info_from_type( md_alg ) ) != NULL ); + + /* Test the simplified buffer-based variant */ + memcpy( data, entropy, p_entropy.len ); + memcpy( data + p_entropy.len, custom, custom_len ); + TEST_ASSERT( hmac_drbg_init_buf( &ctx, md_info, + data, p_entropy.len + custom_len ) == 0 ); + TEST_ASSERT( hmac_drbg_random_with_add( &ctx, my_output, out_len, + add1, add1_len ) == 0 ); + TEST_ASSERT( hmac_drbg_random_with_add( &ctx, my_output, out_len, + add2, add2_len ) == 0 ); + hmac_drbg_free( &ctx ); + + TEST_ASSERT( memcmp( my_output, output, out_len ) == 0 ); + + /* And now the normal entropy-based variant */ TEST_ASSERT( hmac_drbg_init( &ctx, md_info, entropy_func, &p_entropy, custom, custom_len ) == 0 ); TEST_ASSERT( hmac_drbg_random_with_add( &ctx, my_output, out_len, @@ -183,6 +199,7 @@ void hmac_drbg_no_reseed( int md_alg, hmac_drbg_free( &ctx ); TEST_ASSERT( memcmp( my_output, output, out_len ) == 0 ); + } /* END_CASE */