Enable getentropy for FreeBSD 12

As for Linux with its getrandom's syscall, giving the possibility to fill buffer with native call for good quality but falling back to /dev/urandom in worst case similarly.

Reviewers: vitalybuka, krytarowski

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D48804

llvm-svn: 339318
This commit is contained in:
David Carlier 2018-08-09 08:11:48 +00:00
parent c5a458cc53
commit 9d03a90f15
1 changed files with 6 additions and 1 deletions

View File

@ -55,6 +55,7 @@
#include <sched.h>
#include <signal.h>
#include <sys/mman.h>
#include <sys/param.h>
#if !SANITIZER_SOLARIS
#include <sys/ptrace.h>
#endif
@ -149,7 +150,11 @@ extern void internal_sigreturn();
#if SANITIZER_OPENBSD
# define SANITIZER_USE_GETENTROPY 1
#else
# define SANITIZER_USE_GETENTROPY 0
# if SANITIZER_FREEBSD && __FreeBSD_version >= 1200000
# define SANITIZER_USE_GETENTROPY 1
# else
# define SANITIZER_USE_GETENTROPY 0
# endif
#endif // SANITIZER_USE_GETENTROPY
namespace __sanitizer {