mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 07:58:11 +00:00
Remove unnecessary parameter validation from the Cipher module
This commit is contained in:
parent
1a9df6bcb7
commit
516897a44a
2 changed files with 0 additions and 28 deletions
|
@ -1010,8 +1010,6 @@ int mbedtls_cipher_crypt( mbedtls_cipher_context_t *ctx,
|
|||
CIPHER_VALIDATE_RET( ilen == 0 || input != NULL );
|
||||
CIPHER_VALIDATE_RET( output != NULL );
|
||||
CIPHER_VALIDATE_RET( olen != NULL );
|
||||
if( ctx->cipher_info == NULL )
|
||||
return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
|
||||
|
||||
if( ( ret = mbedtls_cipher_set_iv( ctx, iv, iv_len ) ) != 0 )
|
||||
return( ret );
|
||||
|
@ -1048,8 +1046,6 @@ int mbedtls_cipher_auth_encrypt( mbedtls_cipher_context_t *ctx,
|
|||
CIPHER_VALIDATE_RET( output != NULL );
|
||||
CIPHER_VALIDATE_RET( olen != NULL );
|
||||
CIPHER_VALIDATE_RET( tag_len == 0 || tag != NULL );
|
||||
if( ctx->cipher_info == NULL )
|
||||
return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
|
||||
|
||||
#if defined(MBEDTLS_GCM_C)
|
||||
if( MBEDTLS_MODE_GCM == ctx->cipher_info->mode )
|
||||
|
@ -1105,8 +1101,6 @@ int mbedtls_cipher_auth_decrypt( mbedtls_cipher_context_t *ctx,
|
|||
CIPHER_VALIDATE_RET( output != NULL );
|
||||
CIPHER_VALIDATE_RET( olen != NULL );
|
||||
CIPHER_VALIDATE_RET( tag_len == 0 || tag != NULL );
|
||||
if( ctx->cipher_info == NULL )
|
||||
return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
|
||||
|
||||
#if defined(MBEDTLS_GCM_C)
|
||||
if( MBEDTLS_MODE_GCM == ctx->cipher_info->mode )
|
||||
|
|
|
@ -267,12 +267,6 @@ void cipher_invalid_param( )
|
|||
valid_buffer, valid_size,
|
||||
valid_buffer, valid_size,
|
||||
valid_buffer, &size_t_var ) );
|
||||
TEST_ASSERT(
|
||||
mbedtls_cipher_crypt( &invalid_ctx,
|
||||
valid_buffer, valid_size,
|
||||
valid_buffer, valid_size,
|
||||
valid_buffer, &size_t_var ) ==
|
||||
MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
|
||||
TEST_INVALID_PARAM_RET(
|
||||
MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
|
||||
mbedtls_cipher_crypt( &valid_ctx,
|
||||
|
@ -308,14 +302,6 @@ void cipher_invalid_param( )
|
|||
valid_buffer, valid_size,
|
||||
valid_buffer, &size_t_var,
|
||||
valid_buffer, valid_size ) );
|
||||
TEST_ASSERT(
|
||||
mbedtls_cipher_auth_encrypt( &invalid_ctx,
|
||||
valid_buffer, valid_size,
|
||||
valid_buffer, valid_size,
|
||||
valid_buffer, valid_size,
|
||||
valid_buffer, &size_t_var,
|
||||
valid_buffer, valid_size ) ==
|
||||
MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
|
||||
TEST_INVALID_PARAM_RET(
|
||||
MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
|
||||
mbedtls_cipher_auth_encrypt( &valid_ctx,
|
||||
|
@ -374,14 +360,6 @@ void cipher_invalid_param( )
|
|||
valid_buffer, valid_size,
|
||||
valid_buffer, &size_t_var,
|
||||
valid_buffer, valid_size ) );
|
||||
TEST_ASSERT(
|
||||
mbedtls_cipher_auth_decrypt( &invalid_ctx,
|
||||
valid_buffer, valid_size,
|
||||
valid_buffer, valid_size,
|
||||
valid_buffer, valid_size,
|
||||
valid_buffer, &size_t_var,
|
||||
valid_buffer, valid_size ) ==
|
||||
MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
|
||||
TEST_INVALID_PARAM_RET(
|
||||
MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
|
||||
mbedtls_cipher_auth_decrypt( &valid_ctx,
|
||||
|
|
Loading…
Reference in a new issue