The Great Renaming

A simple execution of tmp/invoke-rename.pl
diff --git a/library/md4.c b/library/md4.c
index 2de259d..75a6719 100644
--- a/library/md4.c
+++ b/library/md4.c
@@ -26,37 +26,37 @@
  *  http://www.ietf.org/rfc/rfc1320.txt
  */
 
-#if !defined(POLARSSL_CONFIG_FILE)
+#if !defined(MBEDTLS_CONFIG_FILE)
 #include "mbedtls/config.h"
 #else
-#include POLARSSL_CONFIG_FILE
+#include MBEDTLS_CONFIG_FILE
 #endif
 
-#if defined(POLARSSL_MD4_C)
+#if defined(MBEDTLS_MD4_C)
 
 #include "mbedtls/md4.h"
 
 #include <string.h>
 
-#if defined(POLARSSL_FS_IO)
+#if defined(MBEDTLS_FS_IO)
 #include <stdio.h>
 #endif
 
-#if defined(POLARSSL_SELF_TEST)
-#if defined(POLARSSL_PLATFORM_C)
+#if defined(MBEDTLS_SELF_TEST)
+#if defined(MBEDTLS_PLATFORM_C)
 #include "mbedtls/platform.h"
 #else
 #include <stdio.h>
-#define polarssl_printf printf
-#endif /* POLARSSL_PLATFORM_C */
-#endif /* POLARSSL_SELF_TEST */
+#define mbedtls_printf printf
+#endif /* MBEDTLS_PLATFORM_C */
+#endif /* MBEDTLS_SELF_TEST */
 
 /* Implementation that should never be optimized out by the compiler */
-static void polarssl_zeroize( void *v, size_t n ) {
+static void mbedtls_zeroize( void *v, size_t n ) {
     volatile unsigned char *p = v; while( n-- ) *p++ = 0;
 }
 
-#if !defined(POLARSSL_MD4_ALT)
+#if !defined(MBEDTLS_MD4_ALT)
 
 /*
  * 32-bit integer manipulation macros (little endian)
@@ -81,23 +81,23 @@
 }
 #endif
 
-void md4_init( md4_context *ctx )
+void mbedtls_md4_init( mbedtls_md4_context *ctx )
 {
-    memset( ctx, 0, sizeof( md4_context ) );
+    memset( ctx, 0, sizeof( mbedtls_md4_context ) );
 }
 
-void md4_free( md4_context *ctx )
+void mbedtls_md4_free( mbedtls_md4_context *ctx )
 {
     if( ctx == NULL )
         return;
 
-    polarssl_zeroize( ctx, sizeof( md4_context ) );
+    mbedtls_zeroize( ctx, sizeof( mbedtls_md4_context ) );
 }
 
 /*
  * MD4 context setup
  */
-void md4_starts( md4_context *ctx )
+void mbedtls_md4_starts( mbedtls_md4_context *ctx )
 {
     ctx->total[0] = 0;
     ctx->total[1] = 0;
@@ -108,8 +108,8 @@
     ctx->state[3] = 0x10325476;
 }
 
-#if !defined(POLARSSL_MD4_PROCESS_ALT)
-void md4_process( md4_context *ctx, const unsigned char data[64] )
+#if !defined(MBEDTLS_MD4_PROCESS_ALT)
+void mbedtls_md4_process( mbedtls_md4_context *ctx, const unsigned char data[64] )
 {
     uint32_t X[16], A, B, C, D;
 
@@ -211,12 +211,12 @@
     ctx->state[2] += C;
     ctx->state[3] += D;
 }
-#endif /* !POLARSSL_MD4_PROCESS_ALT */
+#endif /* !MBEDTLS_MD4_PROCESS_ALT */
 
 /*
  * MD4 process buffer
  */
-void md4_update( md4_context *ctx, const unsigned char *input, size_t ilen )
+void mbedtls_md4_update( mbedtls_md4_context *ctx, const unsigned char *input, size_t ilen )
 {
     size_t fill;
     uint32_t left;
@@ -237,7 +237,7 @@
     {
         memcpy( (void *) (ctx->buffer + left),
                 (void *) input, fill );
-        md4_process( ctx, ctx->buffer );
+        mbedtls_md4_process( ctx, ctx->buffer );
         input += fill;
         ilen  -= fill;
         left = 0;
@@ -245,7 +245,7 @@
 
     while( ilen >= 64 )
     {
-        md4_process( ctx, input );
+        mbedtls_md4_process( ctx, input );
         input += 64;
         ilen  -= 64;
     }
@@ -268,7 +268,7 @@
 /*
  * MD4 final digest
  */
-void md4_finish( md4_context *ctx, unsigned char output[16] )
+void mbedtls_md4_finish( mbedtls_md4_context *ctx, unsigned char output[16] )
 {
     uint32_t last, padn;
     uint32_t high, low;
@@ -284,8 +284,8 @@
     last = ctx->total[0] & 0x3F;
     padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
 
-    md4_update( ctx, (unsigned char *) md4_padding, padn );
-    md4_update( ctx, msglen, 8 );
+    mbedtls_md4_update( ctx, (unsigned char *) md4_padding, padn );
+    mbedtls_md4_update( ctx, msglen, 8 );
 
     PUT_UINT32_LE( ctx->state[0], output,  0 );
     PUT_UINT32_LE( ctx->state[1], output,  4 );
@@ -293,57 +293,57 @@
     PUT_UINT32_LE( ctx->state[3], output, 12 );
 }
 
-#endif /* !POLARSSL_MD4_ALT */
+#endif /* !MBEDTLS_MD4_ALT */
 
 /*
  * output = MD4( input buffer )
  */
-void md4( const unsigned char *input, size_t ilen, unsigned char output[16] )
+void mbedtls_md4( const unsigned char *input, size_t ilen, unsigned char output[16] )
 {
-    md4_context ctx;
+    mbedtls_md4_context ctx;
 
-    md4_init( &ctx );
-    md4_starts( &ctx );
-    md4_update( &ctx, input, ilen );
-    md4_finish( &ctx, output );
-    md4_free( &ctx );
+    mbedtls_md4_init( &ctx );
+    mbedtls_md4_starts( &ctx );
+    mbedtls_md4_update( &ctx, input, ilen );
+    mbedtls_md4_finish( &ctx, output );
+    mbedtls_md4_free( &ctx );
 }
 
-#if defined(POLARSSL_FS_IO)
+#if defined(MBEDTLS_FS_IO)
 /*
  * output = MD4( file contents )
  */
-int md4_file( const char *path, unsigned char output[16] )
+int mbedtls_md4_file( const char *path, unsigned char output[16] )
 {
     FILE *f;
     size_t n;
-    md4_context ctx;
+    mbedtls_md4_context ctx;
     unsigned char buf[1024];
 
     if( ( f = fopen( path, "rb" ) ) == NULL )
-        return( POLARSSL_ERR_MD4_FILE_IO_ERROR );
+        return( MBEDTLS_ERR_MD4_FILE_IO_ERROR );
 
-    md4_init( &ctx );
-    md4_starts( &ctx );
+    mbedtls_md4_init( &ctx );
+    mbedtls_md4_starts( &ctx );
 
     while( ( n = fread( buf, 1, sizeof( buf ), f ) ) > 0 )
-        md4_update( &ctx, buf, n );
+        mbedtls_md4_update( &ctx, buf, n );
 
-    md4_finish( &ctx, output );
-    md4_free( &ctx );
+    mbedtls_md4_finish( &ctx, output );
+    mbedtls_md4_free( &ctx );
 
     if( ferror( f ) != 0 )
     {
         fclose( f );
-        return( POLARSSL_ERR_MD4_FILE_IO_ERROR );
+        return( MBEDTLS_ERR_MD4_FILE_IO_ERROR );
     }
 
     fclose( f );
     return( 0 );
 }
-#endif /* POLARSSL_FS_IO */
+#endif /* MBEDTLS_FS_IO */
 
-#if defined(POLARSSL_SELF_TEST)
+#if defined(MBEDTLS_SELF_TEST)
 
 /*
  * RFC 1320 test vectors
@@ -381,7 +381,7 @@
 /*
  * Checkup routine
  */
-int md4_self_test( int verbose )
+int mbedtls_md4_self_test( int verbose )
 {
     int i;
     unsigned char md4sum[16];
@@ -389,29 +389,29 @@
     for( i = 0; i < 7; i++ )
     {
         if( verbose != 0 )
-            polarssl_printf( "  MD4 test #%d: ", i + 1 );
+            mbedtls_printf( "  MD4 test #%d: ", i + 1 );
 
-        md4( (unsigned char *) md4_test_str[i],
+        mbedtls_md4( (unsigned char *) md4_test_str[i],
              strlen( md4_test_str[i] ), md4sum );
 
         if( memcmp( md4sum, md4_test_sum[i], 16 ) != 0 )
         {
             if( verbose != 0 )
-                polarssl_printf( "failed\n" );
+                mbedtls_printf( "failed\n" );
 
             return( 1 );
         }
 
         if( verbose != 0 )
-            polarssl_printf( "passed\n" );
+            mbedtls_printf( "passed\n" );
     }
 
     if( verbose != 0 )
-        polarssl_printf( "\n" );
+        mbedtls_printf( "\n" );
 
     return( 0 );
 }
 
-#endif /* POLARSSL_SELF_TEST */
+#endif /* MBEDTLS_SELF_TEST */
 
-#endif /* POLARSSL_MD4_C */
+#endif /* MBEDTLS_MD4_C */