Fix bug of not refilling after random bytes are requested.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2022-02-17 19:45:23 +01:00
parent c2733e8977
commit f7553a0a75

View File

@@ -49,11 +49,13 @@ void random_fini (void)
/*
* Return pointer to random 32-byte
*/
void random_bytes_free (const uint8_t *p);
const uint8_t * random_bytes_get (void)
{
static uint32_t return_word[RANDOM_BYTES_LENGTH/sizeof (uint32_t)];
neug_wait_full ();
memcpy(return_word, random_word, sizeof(return_word));
random_bytes_free((const uint8_t *)random_word);
return (const uint8_t *)return_word;
}