diff --git a/ChangeLog b/ChangeLog index e3ece8073f..a9d9aac68b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Oct 22 00:12:33 2015 KOSAKI Motohiro + + * lib/securerandom.rb (SecureRandom::gen_random): use /dev/urandom + for initialize OpenSSL's rand. + Wed Oct 21 12:10:04 2015 KOSAKI Motohiro * ext/openssl/ossl_rand.c (ossl_rand_bytes): RAND_bytes could 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)