The Great Renaming

A simple execution of tmp/invoke-rename.pl
diff --git a/tests/suites/test_suite_hmac_drbg.function b/tests/suites/test_suite_hmac_drbg.function
index 2e4e83c..a227ecd 100644
--- a/tests/suites/test_suite_hmac_drbg.function
+++ b/tests/suites/test_suite_hmac_drbg.function
@@ -7,7 +7,7 @@
     size_t len;
 } entropy_ctx;
 
-int entropy_func( void *data, unsigned char *buf, size_t len )
+int mbedtls_entropy_func( void *data, unsigned char *buf, size_t len )
 {
     entropy_ctx *ctx = (entropy_ctx *) data;
 
@@ -24,7 +24,7 @@
 /* END_HEADER */
 
 /* BEGIN_DEPENDENCIES
- * depends_on:POLARSSL_HMAC_DRBG_C
+ * depends_on:MBEDTLS_HMAC_DRBG_C
  * END_DEPENDENCIES
  */
 
@@ -33,8 +33,8 @@
 {
     unsigned char out[16];
     unsigned char buf[1024];
-    const md_info_t *md_info;
-    hmac_drbg_context ctx;
+    const mbedtls_md_info_t *md_info;
+    mbedtls_hmac_drbg_context ctx;
     entropy_ctx entropy;
     size_t last_len, i, reps = 10;
 
@@ -44,12 +44,12 @@
     entropy.len = sizeof( buf );
     entropy.p = buf;
 
-    md_info = md_info_from_type( md_alg );
+    md_info = mbedtls_md_info_from_type( md_alg );
     TEST_ASSERT( md_info != NULL );
 
     /* Init must use entropy */
     last_len = entropy.len;
-    TEST_ASSERT( hmac_drbg_init( &ctx, md_info, entropy_func, &entropy,
+    TEST_ASSERT( mbedtls_hmac_drbg_init( &ctx, md_info, mbedtls_entropy_func, &entropy,
                                  NULL, 0 ) == 0 );
     TEST_ASSERT( entropy.len < last_len );
 
@@ -58,8 +58,8 @@
     last_len = entropy.len;
     for( i = 0; i < reps; i++ )
     {
-        TEST_ASSERT( hmac_drbg_random( &ctx, out, sizeof( out ) - 4 ) == 0 );
-        TEST_ASSERT( hmac_drbg_random_with_add( &ctx, out, sizeof( out ) - 4,
+        TEST_ASSERT( mbedtls_hmac_drbg_random( &ctx, out, sizeof( out ) - 4 ) == 0 );
+        TEST_ASSERT( mbedtls_hmac_drbg_random_with_add( &ctx, out, sizeof( out ) - 4,
                                                 buf, 16 ) == 0 );
     }
     TEST_ASSERT( entropy.len == last_len );
@@ -72,58 +72,58 @@
 
     /* Set reseed_interval to the number of calls done,
      * so the next call should reseed */
-    hmac_drbg_set_reseed_interval( &ctx, 2 * reps );
-    TEST_ASSERT( hmac_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
+    mbedtls_hmac_drbg_set_reseed_interval( &ctx, 2 * reps );
+    TEST_ASSERT( mbedtls_hmac_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
     TEST_ASSERT( entropy.len < last_len );
 
     /* The new few calls should not reseed */
     last_len = entropy.len;
     for( i = 0; i < reps / 2; i++ )
     {
-        TEST_ASSERT( hmac_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
-        TEST_ASSERT( hmac_drbg_random_with_add( &ctx, out, sizeof( out ) ,
+        TEST_ASSERT( mbedtls_hmac_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
+        TEST_ASSERT( mbedtls_hmac_drbg_random_with_add( &ctx, out, sizeof( out ) ,
                                                 buf, 16 ) == 0 );
     }
     TEST_ASSERT( entropy.len == last_len );
 
     /* Now enable PR, so the next few calls should all reseed */
-    hmac_drbg_set_prediction_resistance( &ctx, POLARSSL_HMAC_DRBG_PR_ON );
-    TEST_ASSERT( hmac_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
+    mbedtls_hmac_drbg_set_prediction_resistance( &ctx, MBEDTLS_HMAC_DRBG_PR_ON );
+    TEST_ASSERT( mbedtls_hmac_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
     TEST_ASSERT( entropy.len < last_len );
 
     /* Finally, check setting entropy_len */
-    hmac_drbg_set_entropy_len( &ctx, 42 );
+    mbedtls_hmac_drbg_set_entropy_len( &ctx, 42 );
     last_len = entropy.len;
-    TEST_ASSERT( hmac_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
+    TEST_ASSERT( mbedtls_hmac_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
     TEST_ASSERT( (int) last_len - entropy.len == 42 );
 
-    hmac_drbg_set_entropy_len( &ctx, 13 );
+    mbedtls_hmac_drbg_set_entropy_len( &ctx, 13 );
     last_len = entropy.len;
-    TEST_ASSERT( hmac_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
+    TEST_ASSERT( mbedtls_hmac_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
     TEST_ASSERT( (int) last_len - entropy.len == 13 );
 
 exit:
-    hmac_drbg_free( &ctx );
+    mbedtls_hmac_drbg_free( &ctx );
 }
 /* END_CASE */
 
-/* BEGIN_CASE depends_on:POLARSSL_FS_IO */
+/* BEGIN_CASE depends_on:MBEDTLS_FS_IO */
 void hmac_drbg_seed_file( int md_alg, char *path, int ret )
 {
-    const md_info_t *md_info;
-    hmac_drbg_context ctx;
+    const mbedtls_md_info_t *md_info;
+    mbedtls_hmac_drbg_context ctx;
 
-    md_info = md_info_from_type( md_alg );
+    md_info = mbedtls_md_info_from_type( md_alg );
     TEST_ASSERT( md_info != NULL );
 
-    TEST_ASSERT( hmac_drbg_init( &ctx, md_info, rnd_std_rand, NULL,
+    TEST_ASSERT( mbedtls_hmac_drbg_init( &ctx, md_info, rnd_std_rand, NULL,
                                  NULL, 0 ) == 0 );
 
-    TEST_ASSERT( hmac_drbg_write_seed_file( &ctx, path ) == ret );
-    TEST_ASSERT( hmac_drbg_update_seed_file( &ctx, path ) == ret );
+    TEST_ASSERT( mbedtls_hmac_drbg_write_seed_file( &ctx, path ) == ret );
+    TEST_ASSERT( mbedtls_hmac_drbg_update_seed_file( &ctx, path ) == ret );
 
 exit:
-    hmac_drbg_free( &ctx );
+    mbedtls_hmac_drbg_free( &ctx );
 }
 /* END_CASE */
 
@@ -132,26 +132,26 @@
 {
     unsigned char out[16];
     unsigned char buf[100];
-    const md_info_t *md_info;
-    hmac_drbg_context ctx;
+    const mbedtls_md_info_t *md_info;
+    mbedtls_hmac_drbg_context ctx;
     size_t i;
 
     memset( buf, 0, sizeof( buf ) );
     memset( out, 0, sizeof( out ) );
 
-    md_info = md_info_from_type( md_alg );
+    md_info = mbedtls_md_info_from_type( md_alg );
     TEST_ASSERT( md_info != NULL );
-    TEST_ASSERT( hmac_drbg_init_buf( &ctx, md_info, buf, sizeof( buf ) ) == 0 );
+    TEST_ASSERT( mbedtls_hmac_drbg_init_buf( &ctx, md_info, buf, sizeof( buf ) ) == 0 );
 
     /* Make sure it never tries to reseed (would segfault otherwise) */
-    hmac_drbg_set_reseed_interval( &ctx, 3 );
-    hmac_drbg_set_prediction_resistance( &ctx, POLARSSL_HMAC_DRBG_PR_ON );
+    mbedtls_hmac_drbg_set_reseed_interval( &ctx, 3 );
+    mbedtls_hmac_drbg_set_prediction_resistance( &ctx, MBEDTLS_HMAC_DRBG_PR_ON );
 
     for( i = 0; i < 30; i++ )
-        TEST_ASSERT( hmac_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
+        TEST_ASSERT( mbedtls_hmac_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
 
 exit:
-    hmac_drbg_free( &ctx );
+    mbedtls_hmac_drbg_free( &ctx );
 }
 /* END_CASE */
 
@@ -170,8 +170,8 @@
     unsigned char my_output[512];
     size_t custom_len, add1_len, add2_len, out_len;
     entropy_ctx p_entropy;
-    const md_info_t *md_info;
-    hmac_drbg_context ctx;
+    const mbedtls_md_info_t *md_info;
+    mbedtls_hmac_drbg_context ctx;
 
     memset( my_output, 0, sizeof my_output );
 
@@ -182,35 +182,35 @@
     p_entropy.len = unhexify( entropy, entropy_hex );
     p_entropy.p = entropy;
 
-    md_info = md_info_from_type( md_alg );
+    md_info = mbedtls_md_info_from_type( md_alg );
     TEST_ASSERT( md_info != 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,
+    TEST_ASSERT( mbedtls_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,
+    TEST_ASSERT( mbedtls_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,
+    TEST_ASSERT( mbedtls_hmac_drbg_random_with_add( &ctx, my_output, out_len,
                                             add2, add2_len ) == 0 );
 
     /* clear for second run */
-    hmac_drbg_free( &ctx );
+    mbedtls_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,
+    TEST_ASSERT( mbedtls_hmac_drbg_init( &ctx, md_info, mbedtls_entropy_func, &p_entropy,
                                  custom, custom_len ) == 0 );
-    TEST_ASSERT( hmac_drbg_random_with_add( &ctx, my_output, out_len,
+    TEST_ASSERT( mbedtls_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,
+    TEST_ASSERT( mbedtls_hmac_drbg_random_with_add( &ctx, my_output, out_len,
                                             add2, add2_len ) == 0 );
     TEST_ASSERT( memcmp( my_output, output, out_len ) == 0 );
 
 exit:
-    hmac_drbg_free( &ctx );
+    mbedtls_hmac_drbg_free( &ctx );
 }
 /* END_CASE */
 
@@ -229,8 +229,8 @@
     unsigned char my_output[512];
     size_t custom_len, add1_len, add2_len, add3_len, out_len;
     entropy_ctx p_entropy;
-    const md_info_t *md_info;
-    hmac_drbg_context ctx;
+    const mbedtls_md_info_t *md_info;
+    mbedtls_hmac_drbg_context ctx;
 
     memset( my_output, 0, sizeof my_output );
 
@@ -242,21 +242,21 @@
     p_entropy.len = unhexify( entropy, entropy_hex );
     p_entropy.p = entropy;
 
-    md_info = md_info_from_type( md_alg );
+    md_info = mbedtls_md_info_from_type( md_alg );
     TEST_ASSERT( md_info != NULL );
 
-    TEST_ASSERT( hmac_drbg_init( &ctx, md_info, entropy_func, &p_entropy,
+    TEST_ASSERT( mbedtls_hmac_drbg_init( &ctx, md_info, mbedtls_entropy_func, &p_entropy,
                                  custom, custom_len ) == 0 );
-    TEST_ASSERT( hmac_drbg_reseed( &ctx, add1, add1_len ) == 0 );
-    TEST_ASSERT( hmac_drbg_random_with_add( &ctx, my_output, out_len,
+    TEST_ASSERT( mbedtls_hmac_drbg_reseed( &ctx, add1, add1_len ) == 0 );
+    TEST_ASSERT( mbedtls_hmac_drbg_random_with_add( &ctx, my_output, out_len,
                                             add2, add2_len ) == 0 );
-    TEST_ASSERT( hmac_drbg_random_with_add( &ctx, my_output, out_len,
+    TEST_ASSERT( mbedtls_hmac_drbg_random_with_add( &ctx, my_output, out_len,
                                             add3, add3_len ) == 0 );
 
     TEST_ASSERT( memcmp( my_output, output, out_len ) == 0 );
 
 exit:
-    hmac_drbg_free( &ctx );
+    mbedtls_hmac_drbg_free( &ctx );
 }
 /* END_CASE */
 
@@ -274,8 +274,8 @@
     unsigned char my_output[512];
     size_t custom_len, add1_len, add2_len, out_len;
     entropy_ctx p_entropy;
-    const md_info_t *md_info;
-    hmac_drbg_context ctx;
+    const mbedtls_md_info_t *md_info;
+    mbedtls_hmac_drbg_context ctx;
 
     memset( my_output, 0, sizeof my_output );
 
@@ -286,27 +286,27 @@
     p_entropy.len = unhexify( entropy, entropy_hex );
     p_entropy.p = entropy;
 
-    md_info = md_info_from_type( md_alg );
+    md_info = mbedtls_md_info_from_type( md_alg );
     TEST_ASSERT( md_info != NULL );
 
-    TEST_ASSERT( hmac_drbg_init( &ctx, md_info, entropy_func, &p_entropy,
+    TEST_ASSERT( mbedtls_hmac_drbg_init( &ctx, md_info, mbedtls_entropy_func, &p_entropy,
                                  custom, custom_len ) == 0 );
-    hmac_drbg_set_prediction_resistance( &ctx, POLARSSL_HMAC_DRBG_PR_ON );
-    TEST_ASSERT( hmac_drbg_random_with_add( &ctx, my_output, out_len,
+    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,
                                             add1, add1_len ) == 0 );
-    TEST_ASSERT( hmac_drbg_random_with_add( &ctx, my_output, out_len,
+    TEST_ASSERT( mbedtls_hmac_drbg_random_with_add( &ctx, my_output, out_len,
                                             add2, add2_len ) == 0 );
 
     TEST_ASSERT( memcmp( my_output, output, out_len ) == 0 );
 
 exit:
-    hmac_drbg_free( &ctx );
+    mbedtls_hmac_drbg_free( &ctx );
 }
 /* END_CASE */
 
-/* BEGIN_CASE depends_on:POLARSSL_SELF_TEST */
+/* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
 void hmac_drbg_selftest( )
 {
-    TEST_ASSERT( hmac_drbg_self_test( 0 ) == 0 );
+    TEST_ASSERT( mbedtls_hmac_drbg_self_test( 0 ) == 0 );
 }
 /* END_CASE */