Avoid using %zu in selftest functions

This is a C99 feature and unfortunately we can't rely on it yet considering
the set of toolchain (versions) we want to support.
This commit is contained in:
Manuel Pégourié-Gonnard 2018-05-07 10:14:18 +02:00
parent 823b7a0ce7
commit b7e99006f9
3 changed files with 6 additions and 6 deletions

View File

@ -421,7 +421,7 @@ static const unsigned char test_mac[1][16] =
int mbedtls_aead_chacha20_poly1305_self_test( int verbose ) int mbedtls_aead_chacha20_poly1305_self_test( int verbose )
{ {
size_t i; unsigned i;
int result; int result;
unsigned char output[200]; unsigned char output[200];
unsigned char mac[16]; unsigned char mac[16];
@ -430,7 +430,7 @@ int mbedtls_aead_chacha20_poly1305_self_test( int verbose )
{ {
if ( verbose != 0 ) if ( verbose != 0 )
{ {
mbedtls_printf( " ChaCha20-Poly1305 test %zu ", i ); mbedtls_printf( " ChaCha20-Poly1305 test %u ", i );
} }
result = mbedtls_aead_chacha20_poly1305_crypt_and_mac( test_key[i], result = mbedtls_aead_chacha20_poly1305_crypt_and_mac( test_key[i],

View File

@ -554,14 +554,14 @@ static const size_t test_lengths[2] =
int mbedtls_chacha20_self_test( int verbose ) int mbedtls_chacha20_self_test( int verbose )
{ {
unsigned char output[381]; unsigned char output[381];
size_t i; unsigned i;
int result; int result;
for ( i = 0U; i < 2U; i++ ) for ( i = 0U; i < 2U; i++ )
{ {
if ( verbose != 0 ) if ( verbose != 0 )
{ {
mbedtls_printf( " ChaCha20 test %zu ", i ); mbedtls_printf( " ChaCha20 test %u ", i );
} }
result = mbedtls_chacha20_crypt( test_keys[i], result = mbedtls_chacha20_crypt( test_keys[i],

View File

@ -485,14 +485,14 @@ static const unsigned char test_mac[2][16] =
int mbedtls_poly1305_self_test( int verbose ) int mbedtls_poly1305_self_test( int verbose )
{ {
unsigned char mac[16]; unsigned char mac[16];
size_t i; unsigned i;
int result; int result;
for ( i = 0U; i < 2U; i++ ) for ( i = 0U; i < 2U; i++ )
{ {
if ( verbose != 0 ) if ( verbose != 0 )
{ {
mbedtls_printf( " Poly1305 test %zu ", i ); mbedtls_printf( " Poly1305 test %u ", i );
} }
result = mbedtls_poly1305_mac( test_keys[i], result = mbedtls_poly1305_mac( test_keys[i],