Use platform layer in programs for consistency.
diff --git a/programs/pkey/key_app_writer.c b/programs/pkey/key_app_writer.c
index 18e6442..6862835 100644
--- a/programs/pkey/key_app_writer.c
+++ b/programs/pkey/key_app_writer.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 <string.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -40,7 +49,7 @@
     ((void) argc);
     ((void) argv);
 
-    printf( "POLARSSL_PK_WRITE_C and/or POLARSSL_FS_IO not defined.\n" );
+    polarssl_printf( "POLARSSL_PK_WRITE_C and/or POLARSSL_FS_IO not defined.\n" );
     return( 0 );
 }
 #else
@@ -201,7 +210,7 @@
     {
     usage:
         ret = 1;
-        printf( USAGE );
+        polarssl_printf( USAGE );
         goto exit;
     }
 
@@ -258,13 +267,13 @@
 
     if( opt.mode == MODE_NONE && opt.output_mode != OUTPUT_MODE_NONE )
     {
-        printf( "\nCannot output a key without reading one.\n");
+        polarssl_printf( "\nCannot output a key without reading one.\n");
         goto exit;
     }
 
     if( opt.mode == MODE_PUBLIC && opt.output_mode == OUTPUT_MODE_PRIVATE )
     {
-        printf( "\nCannot output a private key from a public key.\n");
+        polarssl_printf( "\nCannot output a private key from a public key.\n");
         goto exit;
     }
 
@@ -273,7 +282,7 @@
         /*
          * 1.1. Load the key
          */
-        printf( "\n  . Loading the private key ..." );
+        polarssl_printf( "\n  . Loading the private key ..." );
         fflush( stdout );
 
         ret = pk_parse_keyfile( &key, opt.filename, NULL );
@@ -281,16 +290,16 @@
         if( ret != 0 )
         {
             polarssl_strerror( ret, (char *) buf, sizeof(buf) );
-            printf( " failed\n  !  pk_parse_keyfile returned -0x%04x - %s\n\n", -ret, buf );
+            polarssl_printf( " failed\n  !  pk_parse_keyfile returned -0x%04x - %s\n\n", -ret, buf );
             goto exit;
         }
 
-        printf( " ok\n" );
+        polarssl_printf( " ok\n" );
 
         /*
          * 1.2 Print the key
          */
-        printf( "  . Key information    ...\n" );
+        polarssl_printf( "  . Key information    ...\n" );
 
 #if defined(POLARSSL_RSA_C)
         if( pk_get_type( &key ) == POLARSSL_PK_RSA )
@@ -318,7 +327,7 @@
         }
         else
 #endif
-            printf("key type not supported yet\n");
+            polarssl_printf("key type not supported yet\n");
 
     }
     else if( opt.mode == MODE_PUBLIC )
@@ -326,7 +335,7 @@
         /*
          * 1.1. Load the key
          */
-        printf( "\n  . Loading the public key ..." );
+        polarssl_printf( "\n  . Loading the public key ..." );
         fflush( stdout );
 
         ret = pk_parse_public_keyfile( &key, opt.filename );
@@ -334,16 +343,16 @@
         if( ret != 0 )
         {
             polarssl_strerror( ret, (char *) buf, sizeof(buf) );
-            printf( " failed\n  !  pk_parse_public_key returned -0x%04x - %s\n\n", -ret, buf );
+            polarssl_printf( " failed\n  !  pk_parse_public_key returned -0x%04x - %s\n\n", -ret, buf );
             goto exit;
         }
 
-        printf( " ok\n" );
+        polarssl_printf( " ok\n" );
 
         /*
          * 1.2 Print the key
          */
-        printf( "  . Key information    ...\n" );
+        polarssl_printf( "  . Key information    ...\n" );
 
 #if defined(POLARSSL_RSA_C)
         if( pk_get_type( &key ) == POLARSSL_PK_RSA )
@@ -364,7 +373,7 @@
         }
         else
 #endif
-            printf("key type not supported yet\n");
+            polarssl_printf("key type not supported yet\n");
     }
     else
         goto usage;
@@ -384,16 +393,16 @@
     {
 #ifdef POLARSSL_ERROR_C
         polarssl_strerror( ret, buf, sizeof( buf ) );
-        printf( " - %s\n", buf );
+        polarssl_printf( " - %s\n", buf );
 #else
-        printf("\n");
+        polarssl_printf("\n");
 #endif
     }
 
     pk_free( &key );
 
 #if defined(_WIN32)
-    printf( "  + Press Enter to exit this program.\n" );
+    polarssl_printf( "  + Press Enter to exit this program.\n" );
     fflush( stdout ); getchar();
 #endif