mirror of https://github.com/D4-project/d4-core
chg: [client] use alternative to getrandom as it is not available on openbsd
parent
e92094571f
commit
c1ea2c2e00
|
@ -14,7 +14,6 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
#include <sys/random.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
//#include "c.h"
|
//#include "c.h"
|
||||||
|
@ -118,7 +117,7 @@ void random_get_bytes(void *buf, size_t nbytes)
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
x = getrandom(cp, n, GRND_NONBLOCK);
|
x = getentropy(cp, n);
|
||||||
if (x > 0) { /* success */
|
if (x > 0) { /* success */
|
||||||
n -= x;
|
n -= x;
|
||||||
cp += x;
|
cp += x;
|
||||||
|
|
Loading…
Reference in New Issue