add comment to explain why (-1 * rc) is returned

pull/8804/head
Netanel Gonen 2018-11-25 09:31:48 +02:00 committed by mohammad1603
parent 73cb013ac6
commit 4816266205
1 changed files with 8 additions and 0 deletions

View File

@ -5,6 +5,10 @@
int mbed_default_seed_read(unsigned char *buf, size_t buf_len)
{
/* Make sure that in case of an error the value will be negative
* return (-1 * rc);
* Mbed TLS errors are negative values
*/
psa_its_status_t rc = psa_its_get(PSA_CRYPTO_ITS_RANDOM_SEED_UID, 0, buf_len, buf);
return ( -1 * rc );
}
@ -12,6 +16,10 @@ int mbed_default_seed_read(unsigned char *buf, size_t buf_len)
int mbed_default_seed_write(unsigned char *buf, size_t buf_len)
{
psa_its_status_t rc = psa_its_set(PSA_CRYPTO_ITS_RANDOM_SEED_UID, buf_len, buf, 0);
/* Make sure that in case of an error the value will be negative
* return (-1 * rc);
* Mbed TLS errors are negative values
*/
return ( -1 * rc );
}