summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-12-10 12:17:33 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-12-10 12:17:33 +0000
commit16daf9b914ce7aafd6e4ab6cb86a199c96618757 (patch)
tree638f240d79c844c1b2a61411891e022cf1538582
parentff8f8c190b5efa391f1b08260847515fea76cd90 (diff)
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 <shyouhei@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@34003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--lib/securerandom.rb4
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 <akr@fsij.org>
+
+ * 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 <nobu@ruby-lang.org>
* 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)