Remove %zu format string from ssl_client2 and ssl_server2

This commit is contained in:
Hanno Becker 2017-06-09 16:13:22 +01:00
parent db108ac944
commit 8651a43e95
2 changed files with 20 additions and 18 deletions

View file

@ -286,6 +286,9 @@ int main( void )
" force_ciphersuite=<name> default: all enabled\n"\ " force_ciphersuite=<name> default: all enabled\n"\
" acceptable ciphersuite names:\n" " acceptable ciphersuite names:\n"
#define ALPN_LIST_SIZE 10
#define CURVE_LIST_SIZE 20
/* /*
* global options * global options
*/ */
@ -440,10 +443,10 @@ int main( int argc, char *argv[] )
size_t psk_len = 0; size_t psk_len = 0;
#endif #endif
#if defined(MBEDTLS_SSL_ALPN) #if defined(MBEDTLS_SSL_ALPN)
const char *alpn_list[10]; const char *alpn_list[ALPN_LIST_SIZE];
#endif #endif
#if defined(MBEDTLS_ECP_C) #if defined(MBEDTLS_ECP_C)
mbedtls_ecp_group_id curve_list[20]; mbedtls_ecp_group_id curve_list[CURVE_LIST_SIZE];
const mbedtls_ecp_curve_info *curve_cur; const mbedtls_ecp_curve_info *curve_cur;
#endif #endif
@ -972,8 +975,7 @@ int main( int argc, char *argv[] )
else if( strcmp( p, "default" ) != 0 ) else if( strcmp( p, "default" ) != 0 )
{ {
/* Leave room for a final NULL in curve list */ /* Leave room for a final NULL in curve list */
while( i < (int) ( sizeof( curve_list ) / sizeof( *curve_list ) ) - 1 while( i < CURVE_LIST_SIZE - 1 && *p != '\0' )
&& *p != '\0' )
{ {
q = p; q = p;
@ -1004,11 +1006,10 @@ int main( int argc, char *argv[] )
mbedtls_printf("Number of curves: %d\n", i ); mbedtls_printf("Number of curves: %d\n", i );
if( i == (int) ( sizeof( curve_list ) / sizeof( *curve_list ) ) - 1 if( i == CURVE_LIST_SIZE - 1 && *p != '\0' )
&& *p != '\0' )
{ {
mbedtls_printf( "curves list too long, maximum %zu", mbedtls_printf( "curves list too long, maximum %d",
(size_t) ( sizeof( curve_list ) / sizeof( *curve_list ) - 1 ) ); CURVE_LIST_SIZE - 1 );
goto exit; goto exit;
} }
@ -1024,7 +1025,7 @@ int main( int argc, char *argv[] )
i = 0; i = 0;
/* Leave room for a final NULL in alpn_list */ /* Leave room for a final NULL in alpn_list */
while( i < (int) sizeof alpn_list - 1 && *p != '\0' ) while( i < ALPN_LIST_SIZE - 1 && *p != '\0' )
{ {
alpn_list[i++] = p; alpn_list[i++] = p;

View file

@ -375,6 +375,9 @@ int main( void )
" acceptable ciphersuite names:\n" " acceptable ciphersuite names:\n"
#define ALPN_LIST_SIZE 10
#define CURVE_LIST_SIZE 20
#define PUT_UINT64_BE(out_be,in_le,i) \ #define PUT_UINT64_BE(out_be,in_le,i) \
{ \ { \
(out_be)[(i) + 0] = (unsigned char)( ( (in_le) >> 56 ) & 0xFF ); \ (out_be)[(i) + 0] = (unsigned char)( ( (in_le) >> 56 ) & 0xFF ); \
@ -886,11 +889,11 @@ int main( int argc, char *argv[] )
sni_entry *sni_info = NULL; sni_entry *sni_info = NULL;
#endif #endif
#if defined(MBEDTLS_ECP_C) #if defined(MBEDTLS_ECP_C)
mbedtls_ecp_group_id curve_list[20]; mbedtls_ecp_group_id curve_list[CURVE_LIST_SIZE];
const mbedtls_ecp_curve_info * curve_cur; const mbedtls_ecp_curve_info * curve_cur;
#endif #endif
#if defined(MBEDTLS_SSL_ALPN) #if defined(MBEDTLS_SSL_ALPN)
const char *alpn_list[10]; const char *alpn_list[ALPN_LIST_SIZE];
#endif #endif
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
unsigned char alloc_buf[100000]; unsigned char alloc_buf[100000];
@ -1453,8 +1456,7 @@ int main( int argc, char *argv[] )
else if( strcmp( p, "default" ) != 0 ) else if( strcmp( p, "default" ) != 0 )
{ {
/* Leave room for a final NULL in curve list */ /* Leave room for a final NULL in curve list */
while( i < (int) ( sizeof( curve_list ) / sizeof( *curve_list ) ) - 1 while( i < CURVE_LIST_SIZE - 1 && *p != '\0' )
&& *p != '\0' )
{ {
q = p; q = p;
@ -1485,11 +1487,10 @@ int main( int argc, char *argv[] )
mbedtls_printf("Number of curves: %d\n", i ); mbedtls_printf("Number of curves: %d\n", i );
if( i == (int) ( sizeof( curve_list ) / sizeof( *curve_list ) ) - 1 if( i == CURVE_LIST_SIZE - 1 && *p != '\0' )
&& *p != '\0' )
{ {
mbedtls_printf( "curves list too long, maximum %zu", mbedtls_printf( "curves list too long, maximum %d",
(size_t) ( sizeof( curve_list ) / sizeof( *curve_list ) - 1 ) ); CURVE_LIST_SIZE - 1 );
goto exit; goto exit;
} }
@ -1505,7 +1506,7 @@ int main( int argc, char *argv[] )
i = 0; i = 0;
/* Leave room for a final NULL in alpn_list */ /* Leave room for a final NULL in alpn_list */
while( i < (int) sizeof alpn_list - 1 && *p != '\0' ) while( i < ALPN_LIST_SIZE - 1 && *p != '\0' )
{ {
alpn_list[i++] = p; alpn_list[i++] = p;