Skip to content

Commit

Permalink
merge revision(s) 32741:
Browse files Browse the repository at this point in the history
?\012
	* 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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7@34003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
shyouhei committed Dec 10, 2011
1 parent 3dbcd24 commit b696930
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions 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
Expand Down
4 changes: 2 additions & 2 deletions lib/securerandom.rb
Expand Up @@ -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)
Expand Down

0 comments on commit b696930

Please sign in to comment.