summaryrefslogtreecommitdiff
path: root/random.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-06-10 06:33:15 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-06-10 06:33:15 +0000
commit8389f8c3c37d973ead1587d2b45b6a793e1afcec (patch)
tree66b5fc083f5b95fe6c3b1f1d466432ae9e48026c /random.c
parent744b0bdb7b9d87158491099fa55719f027c7140b (diff)
random.c: fix need_secure flags
* random.c (fill_random_seed): do not need to be secure, to get rid of blocking at the start-up time. [ruby-core:87462] [Bug #14837] * random.c (random_raw_seed): expected to be a cryptographically secure, as documented. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'random.c')
-rw-r--r--random.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/random.c b/random.c
index 0c1fdbe425..7a3b6494d5 100644
--- a/random.c
+++ b/random.c
@@ -563,7 +563,7 @@ fill_random_seed(uint32_t *seed, size_t cnt)
memset(seed, 0, len);
- fill_random_bytes(seed, len, TRUE);
+ fill_random_bytes(seed, len, FALSE);
gettimeofday(&tv, 0);
seed[0] ^= tv.tv_usec;
@@ -635,7 +635,7 @@ random_raw_seed(VALUE self, VALUE size)
long n = NUM2ULONG(size);
VALUE buf = rb_str_new(0, n);
if (n == 0) return buf;
- if (fill_random_bytes(RSTRING_PTR(buf), n, FALSE))
+ if (fill_random_bytes(RSTRING_PTR(buf), n, TRUE))
rb_raise(rb_eRuntimeError, "failed to get urandom");
return buf;
}