Use platform layer in programs for consistency.
diff --git a/programs/random/gen_entropy.c b/programs/random/gen_entropy.c
index 38bd423..5234f01 100644
--- a/programs/random/gen_entropy.c
+++ b/programs/random/gen_entropy.c
@@ -26,6 +26,15 @@
#include POLARSSL_CONFIG_FILE
#endif
+#if defined(POLARSSL_PLATFORM_C)
+#include "polarssl/platform.h"
+#else
+#define polarssl_printf printf
+#define polarssl_fprintf fprintf
+#define polarssl_malloc malloc
+#define polarssl_free free
+#endif
+
#include "polarssl/entropy.h"
#include <stdio.h>
@@ -36,7 +45,7 @@
((void) argc);
((void) argv);
- printf("POLARSSL_ENTROPY_C not defined.\n");
+ polarssl_printf("POLARSSL_ENTROPY_C not defined.\n");
return( 0 );
}
#else
@@ -49,13 +58,13 @@
if( argc < 2 )
{
- fprintf( stderr, "usage: %s <output filename>\n", argv[0] );
+ polarssl_fprintf( stderr, "usage: %s <output filename>\n", argv[0] );
return( 1 );
}
if( ( f = fopen( argv[1], "wb+" ) ) == NULL )
{
- printf( "failed to open '%s' for writing.\n", argv[0] );
+ polarssl_printf( "failed to open '%s' for writing.\n", argv[0] );
return( 1 );
}
@@ -66,13 +75,13 @@
ret = entropy_func( &entropy, buf, sizeof( buf ) );
if( ret != 0 )
{
- printf("failed!\n");
+ polarssl_printf("failed!\n");
goto cleanup;
}
fwrite( buf, 1, sizeof( buf ), f );
- printf( "Generating 32Mb of data in file '%s'... %04.1f" \
+ polarssl_printf( "Generating 32Mb of data in file '%s'... %04.1f" \
"%% done\r", argv[1], (100 * (float) (i + 1)) / k );
fflush( stdout );
}