Split mbedtls_hmac_drbg_init() -> seed{,_buf}()
diff --git a/tests/suites/test_suite_hmac_drbg.function b/tests/suites/test_suite_hmac_drbg.function
index a227ecd..3cc9642 100644
--- a/tests/suites/test_suite_hmac_drbg.function
+++ b/tests/suites/test_suite_hmac_drbg.function
@@ -38,6 +38,7 @@
entropy_ctx entropy;
size_t last_len, i, reps = 10;
+ mbedtls_hmac_drbg_init( &ctx );
memset( buf, 0, sizeof( buf ) );
memset( out, 0, sizeof( out ) );
@@ -49,7 +50,7 @@
/* Init must use entropy */
last_len = entropy.len;
- TEST_ASSERT( mbedtls_hmac_drbg_init( &ctx, md_info, mbedtls_entropy_func, &entropy,
+ TEST_ASSERT( mbedtls_hmac_drbg_seed( &ctx, md_info, mbedtls_entropy_func, &entropy,
NULL, 0 ) == 0 );
TEST_ASSERT( entropy.len < last_len );
@@ -113,10 +114,12 @@
const mbedtls_md_info_t *md_info;
mbedtls_hmac_drbg_context ctx;
+ mbedtls_hmac_drbg_init( &ctx );
+
md_info = mbedtls_md_info_from_type( md_alg );
TEST_ASSERT( md_info != NULL );
- TEST_ASSERT( mbedtls_hmac_drbg_init( &ctx, md_info, rnd_std_rand, NULL,
+ TEST_ASSERT( mbedtls_hmac_drbg_seed( &ctx, md_info, rnd_std_rand, NULL,
NULL, 0 ) == 0 );
TEST_ASSERT( mbedtls_hmac_drbg_write_seed_file( &ctx, path ) == ret );
@@ -136,12 +139,13 @@
mbedtls_hmac_drbg_context ctx;
size_t i;
+ mbedtls_hmac_drbg_init( &ctx );
memset( buf, 0, sizeof( buf ) );
memset( out, 0, sizeof( out ) );
md_info = mbedtls_md_info_from_type( md_alg );
TEST_ASSERT( md_info != NULL );
- TEST_ASSERT( mbedtls_hmac_drbg_init_buf( &ctx, md_info, buf, sizeof( buf ) ) == 0 );
+ TEST_ASSERT( mbedtls_hmac_drbg_seed_buf( &ctx, md_info, buf, sizeof( buf ) ) == 0 );
/* Make sure it never tries to reseed (would segfault otherwise) */
mbedtls_hmac_drbg_set_reseed_interval( &ctx, 3 );
@@ -173,6 +177,7 @@
const mbedtls_md_info_t *md_info;
mbedtls_hmac_drbg_context ctx;
+ mbedtls_hmac_drbg_init( &ctx );
memset( my_output, 0, sizeof my_output );
custom_len = unhexify( custom, custom_hex );
@@ -188,7 +193,7 @@
/* Test the simplified buffer-based variant */
memcpy( data, entropy, p_entropy.len );
memcpy( data + p_entropy.len, custom, custom_len );
- TEST_ASSERT( mbedtls_hmac_drbg_init_buf( &ctx, md_info,
+ TEST_ASSERT( mbedtls_hmac_drbg_seed_buf( &ctx, md_info,
data, p_entropy.len + custom_len ) == 0 );
TEST_ASSERT( mbedtls_hmac_drbg_random_with_add( &ctx, my_output, out_len,
add1, add1_len ) == 0 );
@@ -201,7 +206,7 @@
TEST_ASSERT( memcmp( my_output, output, out_len ) == 0 );
/* And now the normal entropy-based variant */
- TEST_ASSERT( mbedtls_hmac_drbg_init( &ctx, md_info, mbedtls_entropy_func, &p_entropy,
+ TEST_ASSERT( mbedtls_hmac_drbg_seed( &ctx, md_info, mbedtls_entropy_func, &p_entropy,
custom, custom_len ) == 0 );
TEST_ASSERT( mbedtls_hmac_drbg_random_with_add( &ctx, my_output, out_len,
add1, add1_len ) == 0 );
@@ -232,6 +237,7 @@
const mbedtls_md_info_t *md_info;
mbedtls_hmac_drbg_context ctx;
+ mbedtls_hmac_drbg_init( &ctx );
memset( my_output, 0, sizeof my_output );
custom_len = unhexify( custom, custom_hex );
@@ -245,7 +251,7 @@
md_info = mbedtls_md_info_from_type( md_alg );
TEST_ASSERT( md_info != NULL );
- TEST_ASSERT( mbedtls_hmac_drbg_init( &ctx, md_info, mbedtls_entropy_func, &p_entropy,
+ TEST_ASSERT( mbedtls_hmac_drbg_seed( &ctx, md_info, mbedtls_entropy_func, &p_entropy,
custom, custom_len ) == 0 );
TEST_ASSERT( mbedtls_hmac_drbg_reseed( &ctx, add1, add1_len ) == 0 );
TEST_ASSERT( mbedtls_hmac_drbg_random_with_add( &ctx, my_output, out_len,
@@ -277,6 +283,7 @@
const mbedtls_md_info_t *md_info;
mbedtls_hmac_drbg_context ctx;
+ mbedtls_hmac_drbg_init( &ctx );
memset( my_output, 0, sizeof my_output );
custom_len = unhexify( custom, custom_hex );
@@ -289,7 +296,7 @@
md_info = mbedtls_md_info_from_type( md_alg );
TEST_ASSERT( md_info != NULL );
- TEST_ASSERT( mbedtls_hmac_drbg_init( &ctx, md_info, mbedtls_entropy_func, &p_entropy,
+ TEST_ASSERT( mbedtls_hmac_drbg_seed( &ctx, md_info, mbedtls_entropy_func, &p_entropy,
custom, custom_len ) == 0 );
mbedtls_hmac_drbg_set_prediction_resistance( &ctx, MBEDTLS_HMAC_DRBG_PR_ON );
TEST_ASSERT( mbedtls_hmac_drbg_random_with_add( &ctx, my_output, out_len,