Implements getrandom's wrapper for handful of BSD.

Signed-off-by: David Carlier <devnexen@gmail.com>
This commit is contained in:
David Carlier 2020-12-28 15:51:14 +00:00
parent 3c537fedfd
commit 2b8c2657e4

View File

@ -109,6 +109,21 @@ static int getrandom_wrapper( void *buf, size_t buflen, unsigned int flags )
#endif /* SYS_getrandom */ #endif /* SYS_getrandom */
#endif /* __linux__ || __midipix__ */ #endif /* __linux__ || __midipix__ */
#if defined(__FreeBSD__) || defined(__DragonFly__)
#include <sys/param.h>
#if (defined(__FreeBSD__) && __FreeBSD_version >= 1200000) || \
(defined(__DragonFly__) && __DragonFly_version >= 500700)
#include <errno.h>
#include <sys/random.h>
#define HAVE_GETRANDOM
static int getrandom_wrapper( void *buf, size_t buflen, unsigned int flags )
{
return getrandom( buf, buflen, flags );
}
#endif /* (__FreeBSD__ && __FreeBSD_version >= 1200000) ||
(__DragonFly__ && __DragonFly_version >= 500700) */
#endif /* __FreeBSD__ || __DragonFly__ */
/* /*
* Some BSD systems provide KERN_ARND. * Some BSD systems provide KERN_ARND.
* This is equivalent to reading from /dev/urandom, only it doesn't require an * This is equivalent to reading from /dev/urandom, only it doesn't require an