From 16daf9b914ce7aafd6e4ab6cb86a199c96618757 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Sat, 10 Dec 2011 12:17:33 +0000 Subject: merge revision(s) 32741: * lib/securerandom.rb: call OpenSSL::Random.seed at the SecureRandom.random_bytes call. based on the patch by Masahiro Tomita. [ruby-dev:44270] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@32741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e Signed-off-by: URABE, Shyouhei git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@34003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ lib/securerandom.rb | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6877e57c7e..e001f25239 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sat Dec 10 20:44:23 2011 Tanaka Akira + + * lib/securerandom.rb: call OpenSSL::Random.seed at the + SecureRandom.random_bytes call. + insert separators for array join. + patch by Masahiro Tomita. [ruby-dev:44270] + Mon Oct 17 04:20:22 2011 Nobuyoshi Nakada * mkconfig.rb: fix for continued lines. based on a patch from diff --git a/lib/securerandom.rb b/lib/securerandom.rb index a957687a82..b37ab4b4a8 100644 --- a/lib/securerandom.rb +++ b/lib/securerandom.rb @@ -50,12 +50,12 @@ module SecureRandom def self.random_bytes(n=nil) n ||= 16 if defined? OpenSSL::Random - @pid = $$ if !defined?(@pid) + @pid = 0 if !defined?(@pid) pid = $$ if @pid != pid now = Time.now ary = [now.to_i, now.usec, @pid, pid] - OpenSSL::Random.seed(ary.to_s) + OpenSSL::Random.seed(ary.join('.')) @pid = pid end return OpenSSL::Random.random_bytes(n) -- cgit v1.2.3