diff options
author | Michael Hendricks <michael@ndrix.org> | 2022-03-24 12:59:29 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-24 19:59:29 +0100 |
commit | 62e177a7f002e4352f18710e29813db3889ae05a (patch) | |
tree | 0b2079480159f28032b704d9209de4b2be2e0f12 /configure.ac | |
parent | bb5e6ffc75b36d0ea846ac9fd437176c76b760f8 (diff) | |
download | ocaml-62e177a7f002e4352f18710e29813db3889ae05a.tar.gz |
Implement Random.self_init with getentropy (#10921)
Implement Random.self_init with getentropy when available
/dev/urandom is not available in chroot environments and in certain
containers. Many systems (Linux, FreeBSD, OpenBSD, Solaris, illumos)
provide getentropy for accessing small amounts of kernel entropy
directly. These systems, and an upcoming POSIX draft, declare
getentropy in unistd.h If a system supports it, use it. If not, fall
back to /dev/urandom.
Co-authored-by: Xavier Leroy <xavier.leroy@college-de-france.fr>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 834ef1083b..dd7fc9a80c 100644 --- a/configure.ac +++ b/configure.ac @@ -1297,6 +1297,13 @@ AS_IF([$has_c99_float_ops], C99 float ops unavailable, replacements enabled (ancient Visual Studio)]))])])]) +## getentropy +AC_CHECK_HEADER([unistd.h], + [AC_CHECK_DECL([getentropy], + [AC_DEFINE([HAS_GETENTROPY])], [], + [[#include <unistd.h>]])], + []) + ## getrusage AC_CHECK_FUNC([getrusage], [AC_DEFINE([HAS_GETRUSAGE])]) |