Skip to content

Commit a95eb52

Browse files
author
Netanel Gonen
committed
add comment to explain why (-1 * rc) is returned
1 parent fb40d2d commit a95eb52

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

features/mbedtls/platform/TARGET_PSA/COMPONENT_PSA_SRV_IMPL/src/default_random_seed.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,21 @@
55

66
int mbed_default_seed_read(unsigned char *buf, size_t buf_len)
77
{
8+
/* Make sure that in case of an error the value will be negative
9+
* return (-1 * rc);
10+
* Mbed TLS errors are negative values
11+
*/
812
psa_its_status_t rc = psa_its_get(PSA_CRYPTO_ITS_RANDOM_SEED_UID, 0, buf_len, buf);
913
return ( -1 * rc );
1014
}
1115

1216
int mbed_default_seed_write(unsigned char *buf, size_t buf_len)
1317
{
1418
psa_its_status_t rc = psa_its_set(PSA_CRYPTO_ITS_RANDOM_SEED_UID, buf_len, buf, 0);
19+
/* Make sure that in case of an error the value will be negative
20+
* return (-1 * rc);
21+
* Mbed TLS errors are negative values
22+
*/
1523
return ( -1 * rc );
1624
}
1725

0 commit comments

Comments
 (0)