Rename cipher_init_ctx() to cipher_setup()

This commit is contained in:
Manuel Pégourié-Gonnard 2015-05-14 13:51:45 +02:00
parent 51f14be888
commit 3f06d377d6
10 changed files with 14 additions and 14 deletions

View file

@ -320,7 +320,7 @@ void mbedtls_cipher_free( mbedtls_cipher_context_t *ctx );
* MBEDTLS_ERR_CIPHER_ALLOC_FAILED if allocation of the * MBEDTLS_ERR_CIPHER_ALLOC_FAILED if allocation of the
* cipher-specific context failed. * cipher-specific context failed.
*/ */
int mbedtls_cipher_init_ctx( mbedtls_cipher_context_t *ctx, const mbedtls_cipher_info_t *cipher_info ); int mbedtls_cipher_setup( mbedtls_cipher_context_t *ctx, const mbedtls_cipher_info_t *cipher_info );
/** /**
* \brief Returns the block size of the given cipher. * \brief Returns the block size of the given cipher.

View file

@ -1871,7 +1871,7 @@
#define cipher_info_from_values mbedtls_cipher_info_from_values #define cipher_info_from_values mbedtls_cipher_info_from_values
#define cipher_info_t mbedtls_cipher_info_t #define cipher_info_t mbedtls_cipher_info_t
#define cipher_init mbedtls_cipher_init #define cipher_init mbedtls_cipher_init
#define cipher_init_ctx mbedtls_cipher_init_ctx #define cipher_init_ctx mbedtls_cipher_setup
#define cipher_list mbedtls_cipher_list #define cipher_list mbedtls_cipher_list
#define cipher_mode_t mbedtls_cipher_mode_t #define cipher_mode_t mbedtls_cipher_mode_t
#define cipher_padding_t mbedtls_cipher_padding_t #define cipher_padding_t mbedtls_cipher_padding_t

View file

@ -81,7 +81,7 @@ int mbedtls_ccm_setkey( mbedtls_ccm_context *ctx,
if( cipher_info->block_size != 16 ) if( cipher_info->block_size != 16 )
return( MBEDTLS_ERR_CCM_BAD_INPUT ); return( MBEDTLS_ERR_CCM_BAD_INPUT );
if( ( ret = mbedtls_cipher_init_ctx( &ctx->cipher_ctx, cipher_info ) ) != 0 ) if( ( ret = mbedtls_cipher_setup( &ctx->cipher_ctx, cipher_info ) ) != 0 )
return( ret ); return( ret );
if( ( ret = mbedtls_cipher_setkey( &ctx->cipher_ctx, key, keysize, if( ( ret = mbedtls_cipher_setkey( &ctx->cipher_ctx, key, keysize,

View file

@ -139,7 +139,7 @@ void mbedtls_cipher_free( mbedtls_cipher_context_t *ctx )
mbedtls_zeroize( ctx, sizeof(mbedtls_cipher_context_t) ); mbedtls_zeroize( ctx, sizeof(mbedtls_cipher_context_t) );
} }
int mbedtls_cipher_init_ctx( mbedtls_cipher_context_t *ctx, const mbedtls_cipher_info_t *cipher_info ) int mbedtls_cipher_setup( mbedtls_cipher_context_t *ctx, const mbedtls_cipher_info_t *cipher_info )
{ {
if( NULL == cipher_info || NULL == ctx ) if( NULL == cipher_info || NULL == ctx )
return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );

View file

@ -174,7 +174,7 @@ int mbedtls_gcm_setkey( mbedtls_gcm_context *ctx,
if( cipher_info->block_size != 16 ) if( cipher_info->block_size != 16 )
return( MBEDTLS_ERR_GCM_BAD_INPUT ); return( MBEDTLS_ERR_GCM_BAD_INPUT );
if( ( ret = mbedtls_cipher_init_ctx( &ctx->cipher_ctx, cipher_info ) ) != 0 ) if( ( ret = mbedtls_cipher_setup( &ctx->cipher_ctx, cipher_info ) ) != 0 )
return( ret ); return( ret );
if( ( ret = mbedtls_cipher_setkey( &ctx->cipher_ctx, key, keysize, if( ( ret = mbedtls_cipher_setkey( &ctx->cipher_ctx, key, keysize,

View file

@ -195,7 +195,7 @@ int mbedtls_pkcs12_pbe( mbedtls_asn1_buf *pbe_params, int mode,
mbedtls_cipher_init( &cipher_ctx ); mbedtls_cipher_init( &cipher_ctx );
if( ( ret = mbedtls_cipher_init_ctx( &cipher_ctx, cipher_info ) ) != 0 ) if( ( ret = mbedtls_cipher_setup( &cipher_ctx, cipher_info ) ) != 0 )
goto exit; goto exit;
if( ( ret = mbedtls_cipher_setkey( &cipher_ctx, key, 8 * keylen, (mbedtls_operation_t) mode ) ) != 0 ) if( ( ret = mbedtls_cipher_setkey( &cipher_ctx, key, 8 * keylen, (mbedtls_operation_t) mode ) ) != 0 )

View file

@ -198,7 +198,7 @@ int mbedtls_pkcs5_pbes2( const mbedtls_asn1_buf *pbe_params, int mode,
goto exit; goto exit;
} }
if( ( ret = mbedtls_cipher_init_ctx( &cipher_ctx, cipher_info ) ) != 0 ) if( ( ret = mbedtls_cipher_setup( &cipher_ctx, cipher_info ) ) != 0 )
goto exit; goto exit;
if( ( ret = mbedtls_cipher_setkey( &cipher_ctx, key, 8 * keylen, (mbedtls_operation_t) mode ) ) != 0 ) if( ( ret = mbedtls_cipher_setkey( &cipher_ctx, key, 8 * keylen, (mbedtls_operation_t) mode ) ) != 0 )

View file

@ -867,17 +867,17 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl )
} }
#endif /* MBEDTLS_SSL_HW_RECORD_ACCEL */ #endif /* MBEDTLS_SSL_HW_RECORD_ACCEL */
if( ( ret = mbedtls_cipher_init_ctx( &transform->cipher_ctx_enc, if( ( ret = mbedtls_cipher_setup( &transform->cipher_ctx_enc,
cipher_info ) ) != 0 ) cipher_info ) ) != 0 )
{ {
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_cipher_init_ctx", ret ); MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_cipher_setup", ret );
return( ret ); return( ret );
} }
if( ( ret = mbedtls_cipher_init_ctx( &transform->cipher_ctx_dec, if( ( ret = mbedtls_cipher_setup( &transform->cipher_ctx_dec,
cipher_info ) ) != 0 ) cipher_info ) ) != 0 )
{ {
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_cipher_init_ctx", ret ); MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_cipher_setup", ret );
return( ret ); return( ret );
} }

View file

@ -173,9 +173,9 @@ int main( int argc, char *argv[] )
mbedtls_fprintf( stderr, "Cipher '%s' not found\n", argv[4] ); mbedtls_fprintf( stderr, "Cipher '%s' not found\n", argv[4] );
goto exit; goto exit;
} }
if( ( ret = mbedtls_cipher_init_ctx( &cipher_ctx, cipher_info) ) != 0 ) if( ( ret = mbedtls_cipher_setup( &cipher_ctx, cipher_info) ) != 0 )
{ {
mbedtls_fprintf( stderr, "mbedtls_cipher_init_ctx failed\n" ); mbedtls_fprintf( stderr, "mbedtls_cipher_setup failed\n" );
goto exit; goto exit;
} }

View file

@ -1400,7 +1400,7 @@ cipher_info_from_type mbedtls_cipher_info_from_type
cipher_info_from_values mbedtls_cipher_info_from_values cipher_info_from_values mbedtls_cipher_info_from_values
cipher_info_t mbedtls_cipher_info_t cipher_info_t mbedtls_cipher_info_t
cipher_init mbedtls_cipher_init cipher_init mbedtls_cipher_init
cipher_init_ctx mbedtls_cipher_init_ctx cipher_init_ctx mbedtls_cipher_setup
cipher_list mbedtls_cipher_list cipher_list mbedtls_cipher_list
cipher_mode_t mbedtls_cipher_mode_t cipher_mode_t mbedtls_cipher_mode_t
cipher_padding_t mbedtls_cipher_padding_t cipher_padding_t mbedtls_cipher_padding_t