mirror of https://github.com/ARMmbed/mbed-os.git
Update to 4 spaces/tab
parent
fcfb7de98d
commit
062ae8ceee
|
@ -29,27 +29,27 @@ static bool is_trng_enabled = false;
|
||||||
|
|
||||||
void trng_init(trng_t *obj)
|
void trng_init(trng_t *obj)
|
||||||
{
|
{
|
||||||
/* Use TRNG0 for all HW entropy collection */
|
/* Use TRNG0 for all HW entropy collection */
|
||||||
obj->instance = TRNG0;
|
obj->instance = TRNG0;
|
||||||
|
|
||||||
if(!is_trng_enabled) {
|
if(!is_trng_enabled) {
|
||||||
sl_trng_init(obj->instance);
|
sl_trng_init(obj->instance);
|
||||||
is_trng_enabled = true;
|
is_trng_enabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void trng_free(trng_t *obj)
|
void trng_free(trng_t *obj)
|
||||||
{
|
{
|
||||||
/* Don't turn off the TRNG to avoid clearing its FIFO */
|
/* Don't turn off the TRNG to avoid clearing its FIFO */
|
||||||
(void) obj;
|
(void) obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_length)
|
int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_length)
|
||||||
{
|
{
|
||||||
int ret = sl_trng_poll(obj->instance,
|
int ret = sl_trng_poll(obj->instance,
|
||||||
output,
|
output,
|
||||||
length,
|
length,
|
||||||
output_length);
|
output_length);
|
||||||
return (ret == 0) ? 0 : -1;
|
return (ret == 0) ? 0 : -1;
|
||||||
}
|
}
|
||||||
#endif /* DEVICE_TRNG */
|
#endif /* DEVICE_TRNG */
|
||||||
|
|
Loading…
Reference in New Issue