Consistently use (type *) instead of (type*) for pointer conversion

This commit is contained in:
Hanno Becker 2019-05-29 14:41:44 +01:00
parent 2ba9fbdfe9
commit 484caf0abc
6 changed files with 15 additions and 15 deletions

View file

@ -127,7 +127,7 @@ int mbedtls_mpi_grow( mbedtls_mpi *X, size_t nblimbs )
if( X->n < nblimbs ) if( X->n < nblimbs )
{ {
if( ( p = (mbedtls_mpi_uint*)mbedtls_calloc( nblimbs, ciL ) ) == NULL ) if( ( p = (mbedtls_mpi_uint *)mbedtls_calloc( nblimbs, ciL ) ) == NULL )
return( MBEDTLS_ERR_MPI_ALLOC_FAILED ); return( MBEDTLS_ERR_MPI_ALLOC_FAILED );
if( X->p != NULL ) if( X->p != NULL )
@ -169,7 +169,7 @@ int mbedtls_mpi_shrink( mbedtls_mpi *X, size_t nblimbs )
if( i < nblimbs ) if( i < nblimbs )
i = nblimbs; i = nblimbs;
if( ( p = (mbedtls_mpi_uint*)mbedtls_calloc( i, ciL ) ) == NULL ) if( ( p = (mbedtls_mpi_uint *)mbedtls_calloc( i, ciL ) ) == NULL )
return( MBEDTLS_ERR_MPI_ALLOC_FAILED ); return( MBEDTLS_ERR_MPI_ALLOC_FAILED );
if( X->p != NULL ) if( X->p != NULL )

View file

@ -331,13 +331,13 @@ int mbedtls_cipher_update_ad( mbedtls_cipher_context_t *ctx,
? MBEDTLS_CHACHAPOLY_ENCRYPT ? MBEDTLS_CHACHAPOLY_ENCRYPT
: MBEDTLS_CHACHAPOLY_DECRYPT; : MBEDTLS_CHACHAPOLY_DECRYPT;
result = mbedtls_chachapoly_starts( (mbedtls_chachapoly_context*) ctx->cipher_ctx, result = mbedtls_chachapoly_starts( (mbedtls_chachapoly_context *) ctx->cipher_ctx,
ctx->iv, ctx->iv,
mode ); mode );
if ( result != 0 ) if ( result != 0 )
return( result ); return( result );
return( mbedtls_chachapoly_update_aad( (mbedtls_chachapoly_context*) ctx->cipher_ctx, return( mbedtls_chachapoly_update_aad( (mbedtls_chachapoly_context *) ctx->cipher_ctx,
ad, ad_len ) ); ad, ad_len ) );
} }
#endif #endif
@ -391,7 +391,7 @@ int mbedtls_cipher_update( mbedtls_cipher_context_t *ctx, const unsigned char *i
if ( ctx->cipher_info->type == MBEDTLS_CIPHER_CHACHA20_POLY1305 ) if ( ctx->cipher_info->type == MBEDTLS_CIPHER_CHACHA20_POLY1305 )
{ {
*olen = ilen; *olen = ilen;
return( mbedtls_chachapoly_update( (mbedtls_chachapoly_context*) ctx->cipher_ctx, return( mbedtls_chachapoly_update( (mbedtls_chachapoly_context *) ctx->cipher_ctx,
ilen, input, output ) ); ilen, input, output ) );
} }
#endif #endif
@ -924,7 +924,7 @@ int mbedtls_cipher_write_tag( mbedtls_cipher_context_t *ctx,
if ( tag_len != 16U ) if ( tag_len != 16U )
return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
return( mbedtls_chachapoly_finish( (mbedtls_chachapoly_context*) ctx->cipher_ctx, return( mbedtls_chachapoly_finish( (mbedtls_chachapoly_context *) ctx->cipher_ctx,
tag ) ); tag ) );
} }
#endif #endif
@ -975,7 +975,7 @@ int mbedtls_cipher_check_tag( mbedtls_cipher_context_t *ctx,
if ( tag_len != sizeof( check_tag ) ) if ( tag_len != sizeof( check_tag ) )
return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
ret = mbedtls_chachapoly_finish( (mbedtls_chachapoly_context*) ctx->cipher_ctx, ret = mbedtls_chachapoly_finish( (mbedtls_chachapoly_context *) ctx->cipher_ctx,
check_tag ); check_tag );
if ( ret != 0 ) if ( ret != 0 )
{ {

View file

@ -1987,7 +1987,7 @@ static int chachapoly_setkey_wrap( void *ctx,
if( key_bitlen != 256U ) if( key_bitlen != 256U )
return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
if ( 0 != mbedtls_chachapoly_setkey( (mbedtls_chachapoly_context*)ctx, key ) ) if ( 0 != mbedtls_chachapoly_setkey( (mbedtls_chachapoly_context *)ctx, key ) )
return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
return( 0 ); return( 0 );

View file

@ -71,7 +71,7 @@ static inline void debug_send_line( const mbedtls_ssl_context *ssl, int level,
*/ */
#if defined(MBEDTLS_THREADING_C) #if defined(MBEDTLS_THREADING_C)
char idstr[20 + DEBUG_BUF_SIZE]; /* 0x + 16 nibbles + ': ' */ char idstr[20 + DEBUG_BUF_SIZE]; /* 0x + 16 nibbles + ': ' */
mbedtls_snprintf( idstr, sizeof( idstr ), "%p: %s", (void*)ssl, str ); mbedtls_snprintf( idstr, sizeof( idstr ), "%p: %s", (void *)ssl, str );
ssl->conf->f_dbg( ssl->conf->p_dbg, level, file, line, idstr ); ssl->conf->f_dbg( ssl->conf->p_dbg, level, file, line, idstr );
#else #else
ssl->conf->f_dbg( ssl->conf->p_dbg, level, file, line, str ); ssl->conf->f_dbg( ssl->conf->p_dbg, level, file, line, str );

View file

@ -72,8 +72,8 @@
#endif #endif
#endif /* _MSC_VER */ #endif /* _MSC_VER */
#define read(fd,buf,len) recv( fd, (char*)( buf ), (int)( len ), 0 ) #define read(fd,buf,len) recv( fd, (char *)( buf ), (int)( len ), 0 )
#define write(fd,buf,len) send( fd, (char*)( buf ), (int)( len ), 0 ) #define write(fd,buf,len) send( fd, (char *)( buf ), (int)( len ), 0 )
#define close(fd) closesocket(fd) #define close(fd) closesocket(fd)
static int wsa_init_done = 0; static int wsa_init_done = 0;

View file

@ -849,7 +849,7 @@ static int x509_get_ext_key_usage( unsigned char **p,
0xFF, MBEDTLS_ASN1_OID, 0xFF, MBEDTLS_ASN1_OID,
0, 0, 0, 0,
asn1_build_sequence_cb, asn1_build_sequence_cb,
(void*) &ext_key_usage ) ); (void *) &ext_key_usage ) );
} }
/* /*
@ -888,7 +888,7 @@ static int x509_get_subject_alt_name( unsigned char *p,
MBEDTLS_ASN1_TAG_VALUE_MASK, MBEDTLS_ASN1_TAG_VALUE_MASK,
2 /* SubjectAlt DNS */, 2 /* SubjectAlt DNS */,
asn1_build_sequence_cb, asn1_build_sequence_cb,
(void*) &subject_alt_name ) ); (void *) &subject_alt_name ) );
} }
/* /*
@ -3367,13 +3367,13 @@ static int x509_crt_verify_name( const mbedtls_x509_crt *crt,
MBEDTLS_ASN1_TAG_VALUE_MASK, MBEDTLS_ASN1_TAG_VALUE_MASK,
2 /* SubjectAlt DNS */, 2 /* SubjectAlt DNS */,
x509_crt_subject_alt_check_name, x509_crt_subject_alt_check_name,
(void*) cn ); (void *) cn );
} }
else else
{ {
ret = mbedtls_x509_name_cmp_raw( &frame->subject_raw, ret = mbedtls_x509_name_cmp_raw( &frame->subject_raw,
&frame->subject_raw, &frame->subject_raw,
x509_crt_check_name, (void*) cn ); x509_crt_check_name, (void *) cn );
} }
mbedtls_x509_crt_frame_release( crt ); mbedtls_x509_crt_frame_release( crt );