can now depend on libc having a getrandom wrapper

This commit is contained in:
Daniel Micay 2020-03-29 07:31:45 -04:00
parent a5abe5add6
commit 3af44d2e6a

View File

@ -5,17 +5,7 @@
#include "random.h" #include "random.h"
#include "util.h" #include "util.h"
#if __has_include(<sys/random.h>)
// glibc 2.25 and later
#include <sys/random.h> #include <sys/random.h>
#else
#include <unistd.h>
#include <sys/syscall.h>
static ssize_t getrandom(void *buf, size_t buflen, unsigned int flags) {
return syscall(SYS_getrandom, buf, buflen, flags);
}
#endif
static void get_random_seed(void *buf, size_t size) { static void get_random_seed(void *buf, size_t size) {
while (size) { while (size) {