1
0
mirror of https://github.com/ARMmbed/mbedtls.git synced 2025-07-27 13:36:01 +08:00

Check output allocated before randomising

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
This commit is contained in:
Thomas Daubney 2024-02-20 11:24:07 +00:00
parent 50f58fc3e4
commit d997e7ad9a

View File

@ -7429,7 +7429,7 @@ psa_status_t psa_raw_key_agreement(psa_algorithm_t alg,
output_length); output_length);
exit: exit:
if (status != PSA_SUCCESS) { if (status != PSA_SUCCESS && output != NULL) {
/* If an error happens and is not handled properly, the output /* If an error happens and is not handled properly, the output
* may be used as a key to protect sensitive data. Arrange for such * may be used as a key to protect sensitive data. Arrange for such
* a key to be random, which is likely to result in decryption or * a key to be random, which is likely to result in decryption or