can now depend on libc having a getrandom wrapper
This commit is contained in:
parent
a5abe5add6
commit
3af44d2e6a
10
random.c
10
random.c
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user