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:
parent
caabc15395
commit
9f3aa366a3
1
pkg/tweetnacl/Makefile.dep
Normal file
1
pkg/tweetnacl/Makefile.dep
Normal file
@ -0,0 +1 @@
|
||||
USEMODULE+=random
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user