1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

merges r32050 from trunk into ruby_1_9_2.

--
* lib/securerandom.rb (SecureRandom.random_bytes): modify PRNG state
  to prevent random number sequence repeatation at forked child
  process which has same pid.
  reported by Eric Wong.  [ruby-core:35765]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@32381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
yugui 2011-07-03 12:23:58 +00:00
parent 909a92ea6d
commit 970ce1fd09
3 changed files with 16 additions and 1 deletions

View file

@ -1,3 +1,10 @@
Mon Jun 13 18:33:04 2011 Tanaka Akira <akr@fsij.org>
* lib/securerandom.rb (SecureRandom.random_bytes): modify PRNG state
to prevent random number sequence repeatation at forked child
process which has same pid.
reported by Eric Wong. [ruby-core:35765]
Sat Jun 11 18:02:09 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (io_getc): should be 7bit if ascii. fixes #4557

View file

@ -57,6 +57,14 @@ module SecureRandom
n ||= 16
if defined? OpenSSL::Random
@pid = $$ if !defined?(@pid)
pid = $$
if @pid != pid
now = Time.now
ary = [now.to_i, now.nsec, @pid, pid]
OpenSSL::Random.seed(ary.to_s)
@pid = pid
end
return OpenSSL::Random.random_bytes(n)
end

View file

@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.2"
#define RUBY_PATCHLEVEL 280
#define RUBY_PATCHLEVEL 281
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 9
#define RUBY_VERSION_TEENY 1