mirror of
https://github.com/cuberite/polarssl.git
synced 2025-09-09 23:26:29 -04:00
Fix ASAN error for psa_cipher_update
The ASAN gives an error for `psa_cipher_update` when the `input_length` is 0 and the `input` buffer is `NULL`. The root cause of this issue is `mbedtls_cipher_update` always need a valid pointer for the input buffer even if the length is 0. This fix avoids the `mbedtls_cipher_update` to be called if the input buffer length is 0. Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
This commit is contained in:
parent
143864c121
commit
92905be298
@ -402,7 +402,11 @@ psa_status_t mbedtls_psa_cipher_update(
|
|||||||
output_length);
|
output_length);
|
||||||
} else
|
} else
|
||||||
#endif /* MBEDTLS_PSA_BUILTIN_ALG_ECB_NO_PADDING */
|
#endif /* MBEDTLS_PSA_BUILTIN_ALG_ECB_NO_PADDING */
|
||||||
{
|
if (input_length == 0) {
|
||||||
|
/* There is no input, nothing to be done */
|
||||||
|
*output_length = 0;
|
||||||
|
status = PSA_SUCCESS;
|
||||||
|
} else {
|
||||||
status = mbedtls_to_psa_error(
|
status = mbedtls_to_psa_error(
|
||||||
mbedtls_cipher_update(&operation->ctx.cipher, input,
|
mbedtls_cipher_update(&operation->ctx.cipher, input,
|
||||||
input_length, output, output_length));
|
input_length, output, output_length));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user