The Great Renaming

A simple execution of tmp/invoke-rename.pl
diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh
index df5e86c..c7a8399 100755
--- a/tests/scripts/all.sh
+++ b/tests/scripts/all.sh
@@ -107,7 +107,7 @@
 cleanup
 cp "$CONFIG_H" "$CONFIG_BAK"
 scripts/config.pl full
-scripts/config.pl unset POLARSSL_MEMORY_BACKTRACE # too slow for tests
+scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # too slow for tests
 CC=clang cmake -D CMAKE_BUILD_TYPE:String=Check .
 make
 
@@ -133,16 +133,16 @@
 cleanup
 CC=gcc CFLAGS='-Werror -Os' make
 
-# this is meant to cath missing #define polarssl_printf etc
+# this is meant to cath missing #define mbedtls_printf etc
 # disable fsio to catch some more missing #include <stdio.h>
 msg "build: full config except platform/fsio, make, gcc" # ~ 30s
 cleanup
 cp "$CONFIG_H" "$CONFIG_BAK"
 scripts/config.pl full
-scripts/config.pl unset POLARSSL_PLATFORM_C
-scripts/config.pl unset POLARSSL_PLATFORM_MEMORY
-scripts/config.pl unset POLARSSL_MEMORY_BUFFER_ALLOC_C
-scripts/config.pl unset POLARSSL_FS_IO
+scripts/config.pl unset MBEDTLS_PLATFORM_C
+scripts/config.pl unset MBEDTLS_PLATFORM_MEMORY
+scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C
+scripts/config.pl unset MBEDTLS_FS_IO
 CC=gcc CFLAGS='-Werror -O0' make
 
 if uname -a | grep -F x86_64 >/dev/null; then
@@ -156,20 +156,20 @@
 cleanup
 cp "$CONFIG_H" "$CONFIG_BAK"
 scripts/config.pl full
-scripts/config.pl unset POLARSSL_NET_C
-scripts/config.pl unset POLARSSL_TIMING_C
-scripts/config.pl unset POLARSSL_FS_IO
-scripts/config.pl unset POLARSSL_SSL_PROTO_DTLS # timing.c
-scripts/config.pl unset POLARSSL_SSL_DTLS_ANTI_REPLAY
-scripts/config.pl unset POLARSSL_SSL_DTLS_HELLO_VERIFY
-scripts/config.pl unset POLARSSL_SSL_DTLS_BADMAC_LIMIT
-scripts/config.pl unset POLARSSL_SSL_COOKIE_C
+scripts/config.pl unset MBEDTLS_NET_C
+scripts/config.pl unset MBEDTLS_TIMING_C
+scripts/config.pl unset MBEDTLS_FS_IO
+scripts/config.pl unset MBEDTLS_SSL_PROTO_DTLS # timing.c
+scripts/config.pl unset MBEDTLS_SSL_DTLS_ANTI_REPLAY
+scripts/config.pl unset MBEDTLS_SSL_DTLS_HELLO_VERIFY
+scripts/config.pl unset MBEDTLS_SSL_DTLS_BADMAC_LIMIT
+scripts/config.pl unset MBEDTLS_SSL_COOKIE_C
 # following things are not in the default config
-scripts/config.pl unset POLARSSL_HAVEGE_C # depends on timing.c
-scripts/config.pl unset POLARSSL_THREADING_PTHREAD
-scripts/config.pl unset POLARSSL_THREADING_C
-scripts/config.pl unset POLARSSL_MEMORY_BACKTRACE # execinfo.h
-scripts/config.pl unset POLARSSL_MEMORY_BUFFER_ALLOC_C # calls exit
+scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c
+scripts/config.pl unset MBEDTLS_THREADING_PTHREAD
+scripts/config.pl unset MBEDTLS_THREADING_C
+scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h
+scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit
 CC=arm-none-eabi-gcc CFLAGS=-Werror make lib
 fi # arm-gcc
 
@@ -178,22 +178,22 @@
 cleanup
 cp "$CONFIG_H" "$CONFIG_BAK"
 scripts/config.pl full
-scripts/config.pl unset POLARSSL_NET_C
-scripts/config.pl unset POLARSSL_TIMING_C
-scripts/config.pl unset POLARSSL_FS_IO
-scripts/config.pl unset POLARSSL_HAVE_TIME
-scripts/config.pl unset POLARSSL_SSL_PROTO_DTLS # timing.c
-scripts/config.pl unset POLARSSL_SSL_DTLS_ANTI_REPLAY
-scripts/config.pl unset POLARSSL_SSL_DTLS_HELLO_VERIFY
-scripts/config.pl unset POLARSSL_SSL_DTLS_BADMAC_LIMIT
-scripts/config.pl unset POLARSSL_SSL_COOKIE_C
+scripts/config.pl unset MBEDTLS_NET_C
+scripts/config.pl unset MBEDTLS_TIMING_C
+scripts/config.pl unset MBEDTLS_FS_IO
+scripts/config.pl unset MBEDTLS_HAVE_TIME
+scripts/config.pl unset MBEDTLS_SSL_PROTO_DTLS # timing.c
+scripts/config.pl unset MBEDTLS_SSL_DTLS_ANTI_REPLAY
+scripts/config.pl unset MBEDTLS_SSL_DTLS_HELLO_VERIFY
+scripts/config.pl unset MBEDTLS_SSL_DTLS_BADMAC_LIMIT
+scripts/config.pl unset MBEDTLS_SSL_COOKIE_C
 # following things are not in the default config
-scripts/config.pl unset POLARSSL_DEPRECATED_WARNING
-scripts/config.pl unset POLARSSL_HAVEGE_C # depends on timing.c
-scripts/config.pl unset POLARSSL_THREADING_PTHREAD
-scripts/config.pl unset POLARSSL_THREADING_C
-scripts/config.pl unset POLARSSL_MEMORY_BACKTRACE # execinfo.h
-scripts/config.pl unset POLARSSL_MEMORY_BUFFER_ALLOC_C # calls exit
+scripts/config.pl unset MBEDTLS_DEPRECATED_WARNING
+scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c
+scripts/config.pl unset MBEDTLS_THREADING_PTHREAD
+scripts/config.pl unset MBEDTLS_THREADING_C
+scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h
+scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit
 CC=armcc WARNING_CFLAGS= make lib 2> armcc.stderr
 if [ -s armcc.stderr ]; then
     cat armcc.stderr
@@ -214,8 +214,8 @@
 msg "build: MSan (clang)" # ~ 1 min 20s
 cleanup
 cp "$CONFIG_H" "$CONFIG_BAK"
-scripts/config.pl unset POLARSSL_AESNI_C # memsan doesn't grok asm
-scripts/config.pl set POLARSSL_NO_PLATFORM_ENTROPY # memsan vs getrandom()
+scripts/config.pl unset MBEDTLS_AESNI_C # memsan doesn't grok asm
+scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY # memsan vs getrandom()
 CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan .
 make
 
diff --git a/tests/scripts/curves.pl b/tests/scripts/curves.pl
index 4e338b5..11b7d46 100755
--- a/tests/scripts/curves.pl
+++ b/tests/scripts/curves.pl
@@ -11,7 +11,7 @@
 
 -d 'library' && -d 'include' && -d 'tests' or die "Must be run from root\n";
 
-my $sed_cmd = 's/^#define \(POLARSSL_ECP_DP.*_ENABLED\)/\1/p';
+my $sed_cmd = 's/^#define \(MBEDTLS_ECP_DP.*_ENABLED\)/\1/p';
 my $config_h = 'include/mbedtls/config.h';
 my @curves = split( /\s+/, `sed -n -e '$sed_cmd' $config_h` );
 
diff --git a/tests/scripts/gen_pkcs1_v21_sign_verify.pl b/tests/scripts/gen_pkcs1_v21_sign_verify.pl
index 0de3b7d..0d7fc7d 100755
--- a/tests/scripts/gen_pkcs1_v21_sign_verify.pl
+++ b/tests/scripts/gen_pkcs1_v21_sign_verify.pl
@@ -54,14 +54,14 @@
         my $val_sig = get_val("Signature", "Sig");
 
         print("RSASSA-PSS Signature Example ${cnt}_${i}\n");
-        print("pkcs1_rsassa_pss_sign:$mod:16:\"$val_p\":16:\"$val_q\":16:\"$val_n\":16:\"$val_e\":SIG_RSA_SHA1:POLARSSL_MD_SHA1");
+        print("pkcs1_rsassa_pss_sign:$mod:16:\"$val_p\":16:\"$val_q\":16:\"$val_n\":16:\"$val_e\":SIG_RSA_SHA1:MBEDTLS_MD_SHA1");
         print(":\"$val_m\"");
         print(":\"$val_salt\"");
         print(":\"$val_sig\":0");
         print("\n\n");
 
         print("RSASSA-PSS Signature Example ${cnt}_${i} (verify)\n");
-        print("pkcs1_rsassa_pss_verify:$mod:16:\"$val_n\":16:\"$val_e\":SIG_RSA_SHA1:POLARSSL_MD_SHA1");
+        print("pkcs1_rsassa_pss_verify:$mod:16:\"$val_n\":16:\"$val_e\":SIG_RSA_SHA1:MBEDTLS_MD_SHA1");
         print(":\"$val_m\"");
         print(":\"$val_salt\"");
         print(":\"$val_sig\":0");
diff --git a/tests/scripts/generate_code.pl b/tests/scripts/generate_code.pl
index 5b7f289..dcc4e11 100755
--- a/tests/scripts/generate_code.pl
+++ b/tests/scripts/generate_code.pl
@@ -60,10 +60,10 @@
 
 open(TEST_FILE, ">$test_file") or die "Opening destination file '$test_file': $!";
 print TEST_FILE << "END";
-#if !defined(POLARSSL_CONFIG_FILE)
+#if !defined(MBEDTLS_CONFIG_FILE)
 #include <mbedtls/config.h>
 #else
-#include POLARSSL_CONFIG_FILE
+#include MBEDTLS_CONFIG_FILE
 #endif
 
 $test_helpers
@@ -173,7 +173,7 @@
 $param_defs
     if( cnt != $param_count )
     {
-        polarssl_fprintf( stderr, "\\nIncorrect argument count (%d != %d)\\n", cnt, $param_count );
+        mbedtls_fprintf( stderr, "\\nIncorrect argument count (%d != %d)\\n", cnt, $param_count );
         return( 2 );
     }