diff --git a/pkg/tweetnacl/Makefile.dep b/pkg/tweetnacl/Makefile.dep new file mode 100644 index 0000000000000000000000000000000000000000..8030144a9aacc54c6cba99fc905e02843373ae17 --- /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 54a5e2b3150429859ad0eb697ee5b0cd165e9421..853a26511a53c10ea3c694c23cca7c57c4ec9d10 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); }