remove psa_its_get_info from seed read function

pull/8804/head
Netanel Gonen 2018-11-22 17:08:44 +02:00 committed by mohammad1603
parent 54cd8bf51f
commit ae0fa609a9
1 changed files with 3 additions and 16 deletions

View File

@ -5,26 +5,13 @@
int mbed_default_seed_read(unsigned char *buf, size_t buf_len) int mbed_default_seed_read(unsigned char *buf, size_t buf_len)
{ {
struct psa_its_info_t info = {0, 0}; psa_its_status_t rc = psa_its_get(PSA_CRYPTO_ITS_RANDOM_SEED_UID, 0, buf_len, buf);
size_t actual_size = buf_len; return ( -1 * rc );
psa_its_get_info(PSA_CRYPTO_ITS_RANDOM_SEED_UID, &info);
if (info.size < buf_len)
{
actual_size = info.size;
}
psa_its_status_t rc = psa_its_get(PSA_CRYPTO_ITS_RANDOM_SEED_UID, 0, actual_size, buf);
/* Make sure that in case of an error the value will be negative
* Mbed TLS errors are negative values */
rc = rc < 0 ? rc : (-1 * rc);
return (rc);
} }
int mbed_default_seed_write(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); 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 */
rc = rc < 0 ? rc : (-1 * rc);
return (rc);
} }