Remove invalid buffer overflow check

Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
This commit is contained in:
gabor-mezei-arm 2021-06-29 16:39:49 +02:00
parent 95aad8378c
commit 3f860e4c18
No known key found for this signature in database
GPG Key ID: 106F5A41ECC305BD
3 changed files with 1 additions and 33 deletions

View File

@ -3513,13 +3513,6 @@ psa_status_t psa_cipher_encrypt( mbedtls_svc_key_id_t key,
key_type = slot->attr.type;
iv_length = PSA_CIPHER_IV_LENGTH( key_type, alg );
if( output_size < PSA_CIPHER_ENCRYPT_OUTPUT_SIZE( key_type, alg,
input_length ) )
{
status = PSA_ERROR_BUFFER_TOO_SMALL;
goto exit;
}
if( iv_length > 0 )
{
if( output_size < iv_length )
@ -3577,13 +3570,6 @@ psa_status_t psa_cipher_decrypt( mbedtls_svc_key_id_t key,
goto exit;
}
if( output_size < PSA_CIPHER_DECRYPT_OUTPUT_SIZE( slot->attr.type, alg,
input_length ) )
{
status = PSA_ERROR_BUFFER_TOO_SMALL;
goto exit;
}
status = psa_driver_wrapper_cipher_decrypt(
&attributes, slot->key.data, slot->key.bytes,
alg, input, input_length,

View File

@ -532,11 +532,6 @@ static psa_status_t cipher_decrypt( const psa_key_attributes_t *attributes,
if( status != PSA_SUCCESS )
goto exit;
if( output_size < accumulated_length )
{
status = PSA_ERROR_BUFFER_TOO_SMALL;
goto exit;
}
status = cipher_finish( &operation, output + accumulated_length,
output_size - accumulated_length, &olength );

View File

@ -223,13 +223,7 @@ psa_status_t mbedtls_psa_cipher_abort( mbedtls_psa_cipher_operation_t *operation
* \c key_type is the type of the key identified
* by \p key and \p alg is the cipher algorithm
* to compute.
* \param[in] output_size Size of the \p output buffer in bytes. The core
* has checked that this size is greater or equal to
* PSA_CIPHER_ENCRYPT_OUTPUT_SIZE( key_type, alg, input_length )
* where \c key_type is the type of the key
* identified by \p key, \p alg is the cipher
* algorithm to compute and \p input_length is the
* size of the \p input buffer.
* \param[in] output_size Size of the \p output buffer in bytes.
* \param[out] output_length On success, the number of bytes that make up
* the returned output. Initialized to zero
* by the core.
@ -279,13 +273,6 @@ psa_status_t mbedtls_psa_cipher_encrypt( const psa_key_attributes_t *attributes,
* \param[in] input_length Size of the \p input buffer in bytes.
* \param[out] output Buffer where the output is to be written.
* \param[in] output_size Size of the \p output buffer in bytes.
* The core has checked that this size is
* greater or equal to
* PSA_CIPHER_DECRYPT_OUTPUT_SIZE( key_type, alg, input_length )
* where \c key_type is the type of the key
* identified by \p key, \p alg is the cipher
* algorithm to compute and \p input_length is the
* size of the \p input buffer.
* \param[out] output_length On success, the number of bytes that make up
* the returned output. Initialized to zero
* by the core.