Kernel: Use word-sized entropy as much as possible in syscall

This commit is contained in:
Calvin Buckley 2019-10-13 12:55:58 -03:00 committed by Andreas Kling
commit 5050f7b5ee
Notes: sideshowbarker 2024-07-19 11:42:17 +09:00
2 changed files with 19 additions and 9 deletions

View file

@ -511,9 +511,6 @@ unsigned long long strtoull(const char* str, char** endptr, int base)
uint32_t arc4random(void)
{
char buf[4];
// XXX: RandomDevice does return a uint32_t but the syscall works with
// a byte at a time. It could be better optimzied for this use case
// while remaining generic.
syscall(SC_getrandom, buf, 4, 0);
return *(uint32_t*)buf;
}