psa_cipher_update_ecb: remove parameter output_size

This parameter was set but not used, which was pointless. Clang 14 detects
this and legitimately complains.

Remove the parameter. This is an internal function, only called once. The
caller already has a sufficient check on the output buffer size which
applies in more cases, so there is no real gain in robustness in adding the
same check inside the internal function.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2021-09-13 09:36:28 +02:00
parent 7b1c916fe8
commit a63ba6cd93
2 changed files with 4 additions and 7 deletions

View File

@ -0,0 +1,2 @@
Bugfix
* Fix a parameter set but unused in psa_crypto_cipher.c. Fixes #4935.

View File

@ -271,9 +271,8 @@ static psa_status_t cipher_set_iv( mbedtls_psa_cipher_operation_t *operation,
* This does not need to be aligned to a block boundary.
* If there is a partial block at the end of the input,
* it is stored in \p ctx for future processing.
* \param output The buffer where the output is written.
* \param output_size The size of \p output in bytes.
* It must be at least `floor((p + input_length) / BS)`
* \param output The buffer where the output is written. Its size
* must be at least `floor((p + input_length) / BS)`
* where `p` is the number of bytes in the unprocessed
* partial block in \p ctx (`0 <= p <= BS - 1`) and
* `BS` is the block size.
@ -287,7 +286,6 @@ static psa_status_t psa_cipher_update_ecb(
const uint8_t *input,
size_t input_length,
uint8_t *output,
size_t output_size,
size_t *output_length )
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@ -327,7 +325,6 @@ static psa_status_t psa_cipher_update_ecb(
goto exit;
output += internal_output_length;
output_size -= internal_output_length;
*output_length += internal_output_length;
ctx->unprocessed_len = 0;
}
@ -348,7 +345,6 @@ static psa_status_t psa_cipher_update_ecb(
input += block_size;
output += internal_output_length;
output_size -= internal_output_length;
*output_length += internal_output_length;
}
@ -403,7 +399,6 @@ static psa_status_t cipher_update( mbedtls_psa_cipher_operation_t *operation,
input,
input_length,
output,
output_size,
output_length );
}
else