mirror of
https://github.com/urbit/shrub.git
synced 2025-01-01 00:51:59 +03:00
18 lines
401 B
C
18 lines
401 B
C
|
#include <ent/ent.h>
|
||
|
|
||
|
#if defined __OPENBSD__ || (defined __linux__ && defined _DEFAULT_SOURCE)
|
||
|
# include <unistd.h>
|
||
|
# define getentropy_impl getentropy
|
||
|
#elif defined __APPLE__ && defined __MACH__
|
||
|
# include <sys/random.h>
|
||
|
# define getentropy_impl getentropy
|
||
|
#else
|
||
|
# error "Port: getentropy unimplemented"
|
||
|
#endif
|
||
|
|
||
|
int
|
||
|
ent_getentropy(void *buf, size_t buflen)
|
||
|
{
|
||
|
return getentropy_impl(buf, buflen);
|
||
|
}
|