summaryrefslogtreecommitdiff
path: root/random.c
diff options
context:
space:
mode:
authorDavid CARLIER <[email protected]>2021-01-16 12:47:33 +0000
committerNobuyoshi Nakada <[email protected]>2021-01-17 18:48:48 +0900
commit54c91185c9273b9699693910fa95383c86f2af22 ()
tree7e74e8a716beebcb131014ab5e7a62cc69e6a231 /random.c
parent8d099aa040427aede04e42c3ec9380afd431ffe3 (diff)
random generator update for Mac proposal
using getentropy for seeding, reading 256 bytes at a time to avoid the EIO errno since this is the maximum.
Notes: Merged: https://.com/ruby/ruby/pull/4081
-rw-r--r--random.c20
1 files changed, 18 insertions, 2 deletions
@@ -49,7 +49,7 @@
# include <sys/param.h>
#endif
-#if defined HAVE_GETRANDOM
# include <sys/random.h>
#elif defined __linux__ && defined __NR_getrandom
# include <linux/random.h>
@@ -425,7 +425,23 @@ random_init(int argc, VALUE *argv, VALUE obj)
# define USE_DEV_URANDOM 0
#endif
-#if USE_DEV_URANDOM
static int
fill_random_bytes_urandom(void *seed, size_t size)
{