+2018-08-13 Janne Blomqvist <jb@gcc.gnu.org>
+
+ * configure.ac: Check for getentropy.
+ * intrinsics/random.c (getosrandom): Use getentropy if available.
+ * config.h.in: Regenerated.
+ * configure: Regenerated.
+
2018-07-31 Andre Vieira <andre.simoesdiasvieira@arm.com>
Revert 'AsyncI/O patch committed'
/* Define to 1 if you have the `getegid' function. */
#undef HAVE_GETEGID
+/* Define to 1 if you have the `getentropy' function. */
+#undef HAVE_GETENTROPY
+
/* Define to 1 if you have the `geteuid' function. */
#undef HAVE_GETEUID
as_fn_append ac_func_list " ftruncate"
as_fn_append ac_func_list " chsize"
as_fn_append ac_func_list " chdir"
+as_fn_append ac_func_list " getentropy"
as_fn_append ac_func_list " getlogin"
as_fn_append ac_func_list " gethostname"
as_fn_append ac_func_list " kill"
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12515 "configure"
+#line 12516 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12621 "configure"
+#line 12622 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
+
+
fi
else
AC_CHECK_FUNCS_ONCE(getrusage times mkstemp strtof strtold snprintf \
- ftruncate chsize chdir getlogin gethostname kill link symlink sleep ttyname \
+ ftruncate chsize chdir getentropy getlogin gethostname kill link symlink \
+ sleep ttyname \
alarm access fork setmode fcntl \
gettimeofday stat fstat lstat getpwuid vsnprintf dup \
getcwd localtime_r gmtime_r getpwuid_r ttyname_r clock_gettime \
rand_s (&b[i]);
return buflen;
#else
- /*
- TODO: When glibc adds a wrapper for the getrandom() system call
- on Linux, one could use that.
-
- TODO: One could use getentropy() on OpenBSD. */
+#ifdef HAVE_GETENTROPY
+ if (getentropy (buf, buflen) == 0)
+ return 0;
+#endif
int flags = O_RDONLY;
#ifdef O_CLOEXEC
flags |= O_CLOEXEC;