[前][次][番号順一覧][スレッド一覧]

ruby-changes:51418

From: nobu <ko1@a...>
Date: Sun, 10 Jun 2018 15:33:20 +0900 (JST)
Subject: [ruby-changes:51418] nobu:r63624 (trunk): random.c: fix need_secure flags

nobu	2018-06-10 15:33:15 +0900 (Sun, 10 Jun 2018)

  New Revision: 63624

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63624

  Log:
    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.

  Modified files:
    trunk/random.c
Index: random.c
===================================================================
--- random.c	(revision 63623)
+++ random.c	(revision 63624)
@@ -563,7 +563,7 @@ fill_random_seed(uint32_t *seed, size_t https://github.com/ruby/ruby/blob/trunk/random.c#L563
 
     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) https://github.com/ruby/ruby/blob/trunk/random.c#L635
     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;
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]