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

ruby-changes:28020

From: akr <ko1@a...>
Date: Wed, 3 Apr 2013 00:10:33 +0900 (JST)
Subject: [ruby-changes:28020] akr:r40072 (trunk): * lib/securerandom.rb (SecureRandom.random_bytes): Use

akr	2013-04-03 00:09:36 +0900 (Wed, 03 Apr 2013)

  New Revision: 40072

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40072

  Log:
    * lib/securerandom.rb (SecureRandom.random_bytes): Use
      OpenSSL::Random.random_add instead of OpenSSL::Random.seed and
      specify 0.0 as the entropy.
      [ruby-core:47308] [Bug #6928]

  Modified files:
    trunk/ChangeLog
    trunk/lib/securerandom.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40071)
+++ ChangeLog	(revision 40072)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Apr  2 23:56:03 2013  Tanaka Akira  <akr@f...>
+
+	* lib/securerandom.rb (SecureRandom.random_bytes): Use
+	  OpenSSL::Random.random_add instead of OpenSSL::Random.seed and
+	  specify 0.0 as the entropy.
+	  [ruby-core:47308] [Bug #6928]
+
 Tue Apr  2 20:24:52 2013  Tanaka Akira  <akr@f...>
 
 	* pack.c: Support Q! and q! for long long.
Index: lib/securerandom.rb
===================================================================
--- lib/securerandom.rb	(revision 40071)
+++ lib/securerandom.rb	(revision 40072)
@@ -62,7 +62,7 @@ module SecureRandom https://github.com/ruby/ruby/blob/trunk/lib/securerandom.rb#L62
       if @pid != pid
         now = Time.now
         ary = [now.to_i, now.nsec, @pid, pid]
-        OpenSSL::Random.seed(ary.join("").to_s)
+        OpenSSL::Random.random_add(ary.join("").to_s, 0.0)
         @pid = pid
       end
       return OpenSSL::Random.random_bytes(n)

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

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