diff --git a/include/mbedtls/cipher.h b/include/mbedtls/cipher.h index 084175d0f..58c974bd3 100644 --- a/include/mbedtls/cipher.h +++ b/include/mbedtls/cipher.h @@ -320,7 +320,7 @@ void mbedtls_cipher_free( mbedtls_cipher_context_t *ctx ); * MBEDTLS_ERR_CIPHER_ALLOC_FAILED if allocation of the * 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. diff --git a/include/mbedtls/compat-1.3.h b/include/mbedtls/compat-1.3.h index ae3e14e2b..9276eaee4 100644 --- a/include/mbedtls/compat-1.3.h +++ b/include/mbedtls/compat-1.3.h @@ -1871,7 +1871,7 @@ #define cipher_info_from_values mbedtls_cipher_info_from_values #define cipher_info_t mbedtls_cipher_info_t #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_mode_t mbedtls_cipher_mode_t #define cipher_padding_t mbedtls_cipher_padding_t diff --git a/library/ccm.c b/library/ccm.c index 109927e4c..75de8cb5b 100644 --- a/library/ccm.c +++ b/library/ccm.c @@ -81,7 +81,7 @@ int mbedtls_ccm_setkey( mbedtls_ccm_context *ctx, if( cipher_info->block_size != 16 ) 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 ); if( ( ret = mbedtls_cipher_setkey( &ctx->cipher_ctx, key, keysize, diff --git a/library/cipher.c b/library/cipher.c index d16893b8d..a55857537 100644 --- a/library/cipher.c +++ b/library/cipher.c @@ -139,7 +139,7 @@ void mbedtls_cipher_free( mbedtls_cipher_context_t *ctx ) 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 ) return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); diff --git a/library/gcm.c b/library/gcm.c index 39648b4c6..79d433a17 100644 --- a/library/gcm.c +++ b/library/gcm.c @@ -174,7 +174,7 @@ int mbedtls_gcm_setkey( mbedtls_gcm_context *ctx, if( cipher_info->block_size != 16 ) 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 ); if( ( ret = mbedtls_cipher_setkey( &ctx->cipher_ctx, key, keysize, diff --git a/library/pkcs12.c b/library/pkcs12.c index e3ca99506..1baa95c2b 100644 --- a/library/pkcs12.c +++ b/library/pkcs12.c @@ -195,7 +195,7 @@ int mbedtls_pkcs12_pbe( mbedtls_asn1_buf *pbe_params, int mode, 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; if( ( ret = mbedtls_cipher_setkey( &cipher_ctx, key, 8 * keylen, (mbedtls_operation_t) mode ) ) != 0 ) diff --git a/library/pkcs5.c b/library/pkcs5.c index 6163e9aa0..756473348 100644 --- a/library/pkcs5.c +++ b/library/pkcs5.c @@ -198,7 +198,7 @@ int mbedtls_pkcs5_pbes2( const mbedtls_asn1_buf *pbe_params, int mode, 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; if( ( ret = mbedtls_cipher_setkey( &cipher_ctx, key, 8 * keylen, (mbedtls_operation_t) mode ) ) != 0 ) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 19d359ad1..6cf9b7471 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -867,17 +867,17 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl ) } #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 ) { - MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_cipher_init_ctx", ret ); + MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_cipher_setup", 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 ) { - MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_cipher_init_ctx", ret ); + MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_cipher_setup", ret ); return( ret ); } diff --git a/programs/aes/crypt_and_hash.c b/programs/aes/crypt_and_hash.c index 67f47c270..f64c34170 100644 --- a/programs/aes/crypt_and_hash.c +++ b/programs/aes/crypt_and_hash.c @@ -173,9 +173,9 @@ int main( int argc, char *argv[] ) mbedtls_fprintf( stderr, "Cipher '%s' not found\n", argv[4] ); 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; } diff --git a/scripts/data_files/rename-1.3-2.0.txt b/scripts/data_files/rename-1.3-2.0.txt index c5c5d002c..1bd8c3c58 100644 --- a/scripts/data_files/rename-1.3-2.0.txt +++ b/scripts/data_files/rename-1.3-2.0.txt @@ -1400,7 +1400,7 @@ cipher_info_from_type mbedtls_cipher_info_from_type cipher_info_from_values mbedtls_cipher_info_from_values cipher_info_t mbedtls_cipher_info_t cipher_init mbedtls_cipher_init -cipher_init_ctx mbedtls_cipher_init_ctx +cipher_init_ctx mbedtls_cipher_setup cipher_list mbedtls_cipher_list cipher_mode_t mbedtls_cipher_mode_t cipher_padding_t mbedtls_cipher_padding_t