+2020-05-31 Bruno Haible <bruno@clisp.org>
+
+ getrandom: Simplify the determination of the random number devices.
+ Suggested by Paul Eggert in
+ <https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00383.html>.
+ * lib/getrandom.c (NAME_OF_RANDOM_DEVICE, NAME_OF_NONCE_DEVICE): New
+ macros.
+ * modules/getrandom (Depends-on): Remove crypto/gc-random.
+
2020-05-31 Bruno Haible <bruno@clisp.org>
crypto/gc-random: Fix list of crypto devices for Solaris.
#include "minmax.h"
+/* These devices exist on all platforms except native Windows. */
+#if !(defined _WIN32 && ! defined __CYGWIN__)
+
+/* Name of a device through which the kernel returns high quality random
+ numbers, from an entropy pool. When the pool is empty, the call blocks
+ until entropy sources have added enough bits of entropy. */
+# ifndef NAME_OF_RANDOM_DEVICE
+# define NAME_OF_RANDOM_DEVICE "/dev/random"
+# endif
+
+/* Name of a device through which the kernel returns random or pseudo-random
+ numbers. It uses an entropy pool, but, in order to avoid blocking, adds
+ bits generated by a pseudo-random number generator, as needed. */
+# ifndef NAME_OF_NONCE_DEVICE
+# define NAME_OF_NONCE_DEVICE "/dev/urandom"
+# endif
+
+#endif
+
/* Set BUFFER (of size LENGTH) to random bytes under the control of FLAGS.
Return the number of bytes written, or -1 on error. */
ssize_t
Depends-on:
sys_random
-crypto/gc-random [test $HAVE_GETRANDOM = 0]
fcntl-h [test $HAVE_GETRANDOM = 0 || test $REPLACE_GETRANDOM = 1]
minmax [test $HAVE_GETRANDOM = 0 || test $REPLACE_GETRANDOM = 1]
open [test $HAVE_GETRANDOM = 0 || test $REPLACE_GETRANDOM = 1]