modify programs/*.c to use polarssl_snprintf
diff --git a/programs/pkey/pk_sign.c b/programs/pkey/pk_sign.c
index 0d02935..ada29f2 100644
--- a/programs/pkey/pk_sign.c
+++ b/programs/pkey/pk_sign.c
@@ -29,6 +29,7 @@
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
+#define polarssl_snprintf snprintf
#define polarssl_printf printf
#endif
@@ -133,7 +134,7 @@
/*
* Write the signature into <filename>-sig.txt
*/
- snprintf( filename, sizeof(filename), "%s.sig", argv[2] );
+ polarssl_snprintf( filename, sizeof(filename), "%s.sig", argv[2] );
if( ( f = fopen( filename, "wb+" ) ) == NULL )
{
diff --git a/programs/pkey/pk_verify.c b/programs/pkey/pk_verify.c
index 55f977c..88ad575 100644
--- a/programs/pkey/pk_verify.c
+++ b/programs/pkey/pk_verify.c
@@ -29,6 +29,7 @@
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
+#define polarssl_snprintf snprintf
#define polarssl_printf printf
#endif
@@ -94,7 +95,7 @@
* Extract the signature from the text file
*/
ret = 1;
- snprintf( filename, sizeof(filename), "%s.sig", argv[2] );
+ polarssl_snprintf( filename, sizeof(filename), "%s.sig", argv[2] );
if( ( f = fopen( filename, "rb" ) ) == NULL )
{
diff --git a/programs/pkey/rsa_sign_pss.c b/programs/pkey/rsa_sign_pss.c
index de90b7e..45e8482 100644
--- a/programs/pkey/rsa_sign_pss.c
+++ b/programs/pkey/rsa_sign_pss.c
@@ -29,6 +29,7 @@
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
+#define polarssl_snprintf snprintf
#define polarssl_printf printf
#endif
@@ -143,7 +144,7 @@
/*
* Write the signature into <filename>-sig.txt
*/
- snprintf( filename, 512, "%s.sig", argv[2] );
+ polarssl_snprintf( filename, 512, "%s.sig", argv[2] );
if( ( f = fopen( filename, "wb+" ) ) == NULL )
{
diff --git a/programs/pkey/rsa_verify_pss.c b/programs/pkey/rsa_verify_pss.c
index dd625b4..5595be5 100644
--- a/programs/pkey/rsa_verify_pss.c
+++ b/programs/pkey/rsa_verify_pss.c
@@ -29,6 +29,7 @@
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
+#define polarssl_snprintf snprintf
#define polarssl_printf printf
#endif
@@ -105,7 +106,7 @@
* Extract the RSA signature from the text file
*/
ret = 1;
- snprintf( filename, 512, "%s.sig", argv[2] );
+ polarssl_snprintf( filename, 512, "%s.sig", argv[2] );
if( ( f = fopen( filename, "rb" ) ) == NULL )
{
diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c
index 0d4a0f2..9aa98c7 100644
--- a/programs/ssl/ssl_client2.c
+++ b/programs/ssl/ssl_client2.c
@@ -29,6 +29,7 @@
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
+#define polarssl_snprintf snprintf
#define polarssl_printf printf
#define polarssl_fprintf fprintf
#endif
@@ -1197,7 +1198,7 @@
polarssl_printf( " > Write to server:" );
fflush( stdout );
- len = snprintf( (char *) buf, sizeof(buf) - 1, GET_REQUEST,
+ len = polarssl_snprintf( (char *) buf, sizeof(buf) - 1, GET_REQUEST,
opt.request_page );
tail_len = strlen( GET_REQUEST_END );
diff --git a/programs/ssl/ssl_pthread_server.c b/programs/ssl/ssl_pthread_server.c
index 8c67173..b75464b 100644
--- a/programs/ssl/ssl_pthread_server.c
+++ b/programs/ssl/ssl_pthread_server.c
@@ -30,6 +30,7 @@
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
+#define polarssl_snprintf snprintf
#define polarssl_printf printf
#define polarssl_fprintf fprintf
#endif
@@ -137,7 +138,7 @@
memset( &ssl, 0, sizeof( ssl_context ) );
memset( &ctr_drbg, 0, sizeof( ctr_drbg_context ) );
- snprintf( pers, sizeof(pers), "SSL Pthread Thread %d", thread_id );
+ polarssl_snprintf( pers, sizeof(pers), "SSL Pthread Thread %d", thread_id );
polarssl_printf( " [ #%d ] Client FD %d\n", thread_id, client_fd );
polarssl_printf( " [ #%d ] Seeding the random number generator...\n", thread_id );
diff --git a/programs/test/benchmark.c b/programs/test/benchmark.c
index cc83746..3acf78b 100644
--- a/programs/test/benchmark.c
+++ b/programs/test/benchmark.c
@@ -29,6 +29,7 @@
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
+#define polarssl_snprintf snprintf
#define polarssl_printf printf
#endif
@@ -313,7 +314,7 @@
aes_init( &aes );
for( keysize = 128; keysize <= 256; keysize += 64 )
{
- snprintf( title, sizeof( title ), "AES-CBC-%d", keysize );
+ polarssl_snprintf( title, sizeof( title ), "AES-CBC-%d", keysize );
memset( buf, 0, sizeof( buf ) );
memset( tmp, 0, sizeof( tmp ) );
@@ -331,7 +332,7 @@
gcm_context gcm;
for( keysize = 128; keysize <= 256; keysize += 64 )
{
- snprintf( title, sizeof( title ), "AES-GCM-%d", keysize );
+ polarssl_snprintf( title, sizeof( title ), "AES-GCM-%d", keysize );
memset( buf, 0, sizeof( buf ) );
memset( tmp, 0, sizeof( tmp ) );
@@ -351,7 +352,7 @@
ccm_context ccm;
for( keysize = 128; keysize <= 256; keysize += 64 )
{
- snprintf( title, sizeof( title ), "AES-CCM-%d", keysize );
+ polarssl_snprintf( title, sizeof( title ), "AES-CCM-%d", keysize );
memset( buf, 0, sizeof( buf ) );
memset( tmp, 0, sizeof( tmp ) );
@@ -374,7 +375,7 @@
camellia_init( &camellia );
for( keysize = 128; keysize <= 256; keysize += 64 )
{
- snprintf( title, sizeof( title ), "CAMELLIA-CBC-%d", keysize );
+ polarssl_snprintf( title, sizeof( title ), "CAMELLIA-CBC-%d", keysize );
memset( buf, 0, sizeof( buf ) );
memset( tmp, 0, sizeof( tmp ) );
@@ -396,7 +397,7 @@
for( keysize = 128; keysize <= 256; keysize += 64 )
{
- snprintf( title, sizeof( title ), "BLOWFISH-CBC-%d", keysize );
+ polarssl_snprintf( title, sizeof( title ), "BLOWFISH-CBC-%d", keysize );
memset( buf, 0, sizeof( buf ) );
memset( tmp, 0, sizeof( tmp ) );
@@ -498,7 +499,7 @@
rsa_context rsa;
for( keysize = 1024; keysize <= 4096; keysize *= 2 )
{
- snprintf( title, sizeof( title ), "RSA-%d", keysize );
+ polarssl_snprintf( title, sizeof( title ), "RSA-%d", keysize );
rsa_init( &rsa, RSA_PKCS_V15, 0 );
rsa_gen_key( &rsa, myrand, NULL, keysize, 65537 );
@@ -549,14 +550,14 @@
if( mpi_copy( &dhm.GY, &dhm.GX ) != 0 )
exit( 1 );
- snprintf( title, sizeof( title ), "DHE-%d", dhm_sizes[i] );
+ polarssl_snprintf( title, sizeof( title ), "DHE-%d", dhm_sizes[i] );
TIME_PUBLIC( title, "handshake",
olen = sizeof( buf );
ret |= dhm_make_public( &dhm, (int) dhm.len, buf, dhm.len,
myrand, NULL );
ret |= dhm_calc_secret( &dhm, buf, &olen, myrand, NULL ) );
- snprintf( title, sizeof( title ), "DH-%d", dhm_sizes[i] );
+ polarssl_snprintf( title, sizeof( title ), "DH-%d", dhm_sizes[i] );
TIME_PUBLIC( title, "handshake",
olen = sizeof( buf );
ret |= dhm_calc_secret( &dhm, buf, &olen, myrand, NULL ) );
@@ -584,7 +585,7 @@
if( ecdsa_genkey( &ecdsa, curve_info->grp_id, myrand, NULL ) != 0 )
exit( 1 );
- snprintf( title, sizeof( title ), "ECDSA-%s",
+ polarssl_snprintf( title, sizeof( title ), "ECDSA-%s",
curve_info->name );
TIME_PUBLIC( title, "sign",
ret = ecdsa_write_signature( &ecdsa, buf, curve_info->size,
@@ -620,7 +621,7 @@
exit( 1 );
}
- snprintf( title, sizeof( title ), "ECDHE-%s",
+ polarssl_snprintf( title, sizeof( title ), "ECDHE-%s",
curve_info->name );
TIME_PUBLIC( title, "handshake",
ret |= ecdh_make_public( &ecdh, &olen, buf, sizeof( buf),
@@ -628,7 +629,7 @@
ret |= ecdh_calc_secret( &ecdh, &olen, buf, sizeof( buf ),
myrand, NULL ) );
- snprintf( title, sizeof( title ), "ECDH-%s",
+ polarssl_snprintf( title, sizeof( title ), "ECDH-%s",
curve_info->name );
TIME_PUBLIC( title, "handshake",
ret |= ecdh_calc_secret( &ecdh, &olen, buf, sizeof( buf ),
diff --git a/programs/test/ssl_cert_test.c b/programs/test/ssl_cert_test.c
index 037c474..a646c25 100644
--- a/programs/test/ssl_cert_test.c
+++ b/programs/test/ssl_cert_test.c
@@ -29,6 +29,7 @@
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
+#define polarssl_snprintf snprintf
#define polarssl_printf printf
#endif
@@ -149,7 +150,7 @@
x509_crt_init( &clicert );
pk_init( &pk );
- snprintf(name, 512, "ssl/test-ca/%s", client_certificates[i]);
+ polarssl_snprintf(name, 512, "ssl/test-ca/%s", client_certificates[i]);
polarssl_printf( " . Loading the client certificate %s...", name );
fflush( stdout );
@@ -198,7 +199,7 @@
/*
* 1.5. Load own private key
*/
- snprintf(name, 512, "ssl/test-ca/%s", client_private_keys[i]);
+ polarssl_snprintf(name, 512, "ssl/test-ca/%s", client_private_keys[i]);
polarssl_printf( " . Loading the client private key %s...", name );
fflush( stdout );