Don't use the printf format %zd

We target C89 libc, so don't use %zd or %zu. Just use %u, and make
slot numbers `unsigned` for simplicity.
This commit is contained in:
Gilles Peskine 2018-04-26 13:27:43 +02:00
parent 783007375f
commit 5bea9f61b9

View file

@ -933,7 +933,7 @@ static const char *const ssl_async_operation_names[] =
typedef struct typedef struct
{ {
size_t slot; unsigned slot;
ssl_async_operation_type_t operation_type; ssl_async_operation_type_t operation_type;
mbedtls_md_type_t md_alg; mbedtls_md_type_t md_alg;
unsigned char input[SSL_ASYNC_INPUT_MAX_SIZE]; unsigned char input[SSL_ASYNC_INPUT_MAX_SIZE];
@ -950,7 +950,7 @@ static int ssl_async_start( mbedtls_ssl_context *ssl,
{ {
ssl_async_key_context_t *config_data = ssl_async_key_context_t *config_data =
mbedtls_ssl_conf_get_async_config_data( ssl->conf ); mbedtls_ssl_conf_get_async_config_data( ssl->conf );
size_t slot; unsigned slot;
ssl_async_operation_context_t *ctx = NULL; ssl_async_operation_context_t *ctx = NULL;
const char *op_name = ssl_async_operation_names[op_type]; const char *op_name = ssl_async_operation_names[op_type];
@ -971,7 +971,7 @@ static int ssl_async_start( mbedtls_ssl_context *ssl,
op_name ); op_name );
return( MBEDTLS_ERR_SSL_HW_ACCEL_FALLTHROUGH ); return( MBEDTLS_ERR_SSL_HW_ACCEL_FALLTHROUGH );
} }
mbedtls_printf( "Async %s callback: using key slot %zd, delay=%u.\n", mbedtls_printf( "Async %s callback: using key slot %u, delay=%u.\n",
op_name, slot, config_data->slots[slot].delay ); op_name, slot, config_data->slots[slot].delay );
if( config_data->inject_error == SSL_ASYNC_INJECT_ERROR_START ) if( config_data->inject_error == SSL_ASYNC_INJECT_ERROR_START )
@ -1036,7 +1036,7 @@ static int ssl_async_resume( mbedtls_ssl_context *ssl,
if( ctx->remaining_delay > 0 ) if( ctx->remaining_delay > 0 )
{ {
--ctx->remaining_delay; --ctx->remaining_delay;
mbedtls_printf( "Async resume (slot %zd): call %u more times.\n", mbedtls_printf( "Async resume (slot %u): call %u more times.\n",
ctx->slot, ctx->remaining_delay ); ctx->slot, ctx->remaining_delay );
return( MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS ); return( MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS );
} }
@ -1059,7 +1059,7 @@ static int ssl_async_resume( mbedtls_ssl_context *ssl,
config_data->f_rng, config_data->p_rng ); config_data->f_rng, config_data->p_rng );
break; break;
default: default:
mbedtls_printf( "Async resume (slot %zd): unknown operation type %ld. This shouldn't happen.\n", mbedtls_printf( "Async resume (slot %u): unknown operation type %ld. This shouldn't happen.\n",
ctx->slot, (long) ctx->operation_type ); ctx->slot, (long) ctx->operation_type );
return( MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE ); return( MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE );
break; break;
@ -1072,7 +1072,7 @@ static int ssl_async_resume( mbedtls_ssl_context *ssl,
return( MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE ); return( MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE );
} }
mbedtls_printf( "Async resume (slot %zd): %s done, status=%d.\n", mbedtls_printf( "Async resume (slot %u): %s done, status=%d.\n",
ctx->slot, op_name, ret ); ctx->slot, op_name, ret );
mbedtls_free( ctx ); mbedtls_free( ctx );
return( ret ); return( ret );