From b7e99006f9c85df28a9f15464e1fd5ed28559028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Mon, 7 May 2018 10:14:18 +0200 Subject: [PATCH] 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. --- library/aead_chacha20_poly1305.c | 4 ++-- library/chacha20.c | 4 ++-- library/poly1305.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/library/aead_chacha20_poly1305.c b/library/aead_chacha20_poly1305.c index 2e07f1ed46..f00380c0be 100644 --- a/library/aead_chacha20_poly1305.c +++ b/library/aead_chacha20_poly1305.c @@ -421,7 +421,7 @@ static const unsigned char test_mac[1][16] = int mbedtls_aead_chacha20_poly1305_self_test( int verbose ) { - size_t i; + unsigned i; int result; unsigned char output[200]; unsigned char mac[16]; @@ -430,7 +430,7 @@ int mbedtls_aead_chacha20_poly1305_self_test( int verbose ) { 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], diff --git a/library/chacha20.c b/library/chacha20.c index 5d2c3e5bf7..28133a675e 100644 --- a/library/chacha20.c +++ b/library/chacha20.c @@ -554,14 +554,14 @@ static const size_t test_lengths[2] = int mbedtls_chacha20_self_test( int verbose ) { unsigned char output[381]; - size_t i; + unsigned i; int result; for ( i = 0U; i < 2U; i++ ) { if ( verbose != 0 ) { - mbedtls_printf( " ChaCha20 test %zu ", i ); + mbedtls_printf( " ChaCha20 test %u ", i ); } result = mbedtls_chacha20_crypt( test_keys[i], diff --git a/library/poly1305.c b/library/poly1305.c index 6acbc7fa57..5a096586d1 100644 --- a/library/poly1305.c +++ b/library/poly1305.c @@ -485,14 +485,14 @@ static const unsigned char test_mac[2][16] = int mbedtls_poly1305_self_test( int verbose ) { unsigned char mac[16]; - size_t i; + unsigned i; int result; for ( i = 0U; i < 2U; i++ ) { if ( verbose != 0 ) { - mbedtls_printf( " Poly1305 test %zu ", i ); + mbedtls_printf( " Poly1305 test %u ", i ); } result = mbedtls_poly1305_mac( test_keys[i],