From 7104a473ea77fa34ffbf831b64b94d0e58cb68f0 Mon Sep 17 00:00:00 2001 From: kosaki Date: Mon, 30 Nov 2015 20:29:22 +0000 Subject: * lib/securerandom.rb (SecureRandom::gen_random): use /dev/urandom for initialize OpenSSL's rand. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/securerandom.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') diff --git a/lib/securerandom.rb b/lib/securerandom.rb index f53087b954..b08b62b746 100644 --- a/lib/securerandom.rb +++ b/lib/securerandom.rb @@ -56,6 +56,10 @@ module SecureRandom now = Process.clock_gettime(Process::CLOCK_REALTIME, :nanosecond) ary = [now, @pid, pid] OpenSSL::Random.random_add(ary.join("").to_s, 0.0) + seed = Random.raw_seed(16) + if (seed) + OpenSSL::Random.random_add(seed, 16) + end @pid = pid end return OpenSSL::Random.random_bytes(n) -- cgit v1.2.3