1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-30 22:43:08 +03: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:26:55 +00:00
parent 3c0c6b1c4b
commit 26d1c43821

View File

@ -5332,7 +5332,7 @@ psa_status_t psa_raw_key_agreement(psa_algorithm_t alg,
output_length);
exit:
if (status != PSA_SUCCESS) {
if (status != PSA_SUCCESS && output != NULL) {
/* If an error happens and is not handled properly, the output
* 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