/* Define to 1 if you have the `getdomainname' function. */
#undef HAVE_GETDOMAINNAME
+/* Define to 1 if you have the `getentropy' function. */
+#undef HAVE_GETENTROPY
+
/* Define to 1 if you have the `getgrouplist' function. */
#undef HAVE_GETGROUPLIST
fi
done
+ if test X"$ac_cv_func_arc4random" != X"yes"; then
+ for ac_func in getentropy
+do :
+ ac_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
+if test "x$ac_cv_func_getentropy" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_GETENTROPY 1
+_ACEOF
+
+fi
+done
+
+ fi
case " $LIBOBJS " in
*" mktemp.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS mktemp.$ac_objext"
AC_CHECK_FUNCS([mkstemps mkdtemp], [], [break])
if test X"$ac_cv_func_mkstemps$ac_cv_func_mkdtemp" != X"yesyes"; then
AC_CHECK_FUNCS([arc4random random lrand48], [break])
+ if test X"$ac_cv_func_arc4random" != X"yes"; then
+ AC_CHECK_FUNCS([getentropy])
+ fi
AC_LIBOBJ(mktemp)
# If either mkdtemp() or mkstemps() is missing, replace both.
SUDO_APPEND_COMPAT_EXP(sudo_mkdtemp sudo_mkstemps)
SEED_T seed;
int fd;
+# ifdef HAVE_GETENTROPY
+ /* Not really an fd, just has to be -1 on error. */
+ fd = getentropy(&seed, sizeof(seed));
+# else
/*
* Seed from /dev/urandom if possible.
*/
if (nread != (ssize_t)sizeof(seed))
fd = -1;
}
-
+# endif /* HAVE_GETENTROPY */
/*
* If no /dev/urandom, seed from time of day and process id
* multiplied by small primes.