1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

pkg: tweetnacl: use random_bytes()

This commit is contained in:
Kaspar Schleiser 2018-03-14 18:01:12 +01:00
parent caabc15395
commit 9f3aa366a3
2 changed files with 3 additions and 11 deletions

View File

@ -0,0 +1 @@
USEMODULE+=random

View File

@ -15,15 +15,6 @@
void randombytes(uint8_t *target, uint64_t n)
{
uint32_t random;
uint8_t *random_pos = (uint8_t*)&random;
unsigned _n = 0;
while (n--) {
if (! (_n++ & 0x3)) {
random = random_uint32();
random_pos = (uint8_t *) &random;
}
*target++ = *random_pos++;
}
/* tweetnacl needs uint64_t as "n" parameter, random provides uint32 */
random_bytes(target, n);
}