diff --git a/pkg/tweetnacl/Makefile.dep b/pkg/tweetnacl/Makefile.dep new file mode 100644 index 0000000000..8030144a9a --- /dev/null +++ b/pkg/tweetnacl/Makefile.dep @@ -0,0 +1 @@ +USEMODULE+=random diff --git a/pkg/tweetnacl/src/randombytes.c b/pkg/tweetnacl/src/randombytes.c index 54a5e2b315..853a26511a 100644 --- a/pkg/tweetnacl/src/randombytes.c +++ b/pkg/tweetnacl/src/randombytes.c @@ -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); }