summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-22 15:30:27 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-22 15:30:27 +0000
commita8acc95f4c3b3b6ead0586139e4205326e0bc029 (patch)
treebcc40419c1b5c563f202204c58ad19a56d2dc4af
parentdc4286a134a7ca882f92841cdc444d07fb647786 (diff)
merge revision(s) 54144,54699: [Backport #12139]
* lib/securerandom.rb (gen_random): to avoid blocking on Windows. On Windows OpenSSL RAND_bytes (underlying implementation is RAND_poll in crypto/rand/rand_win.c) may be blocked at NetStatisticsGet. https://wiki.openssl.org/index.php/Random_Numbers#Windows_Issues Instead of this, use Random.raw_seed directory (whose implementation CryptGenRandom is one of the source of entropy of RAND_poll on Windows). https://wiki.openssl.org/index.php/Random_Numbers Note: CryptGenRandom function is PRNG and doesn't check its entropy, so it won't block. [Bug #12139] https://msdn.microsoft.com/ja-jp/library/windows/desktop/aa379942.aspx https://tools.ietf.org/html/rfc4086#section-7.1.3 https://eprint.iacr.org/2007/419.pdf http://www.cs.huji.ac.il/~dolev/pubs/thesis/msc-thesis-leo.pdf Instead of this, use Random.raw_seed directly (whose implementation git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@54713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog18
-rw-r--r--lib/securerandom.rb2
-rw-r--r--version.h2
3 files changed, 20 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index c4cf0ccfdf..995f445170 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+Sat Apr 23 00:29:15 2016 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/securerandom.rb (gen_random): to avoid blocking on Windows.
+ On Windows OpenSSL RAND_bytes (underlying implementation is
+ RAND_poll in crypto/rand/rand_win.c) may be blocked at
+ NetStatisticsGet.
+ https://wiki.openssl.org/index.php/Random_Numbers#Windows_Issues
+ Instead of this, use Random.raw_seed directly (whose implementation
+ CryptGenRandom is one of the source of
+ entropy of RAND_poll on Windows).
+ https://wiki.openssl.org/index.php/Random_Numbers
+ Note: CryptGenRandom function is PRNG and doesn't check its entropy,
+ so it won't block. [Bug #12139]
+ https://msdn.microsoft.com/ja-jp/library/windows/desktop/aa379942.aspx
+ https://tools.ietf.org/html/rfc4086#section-7.1.3
+ https://eprint.iacr.org/2007/419.pdf
+ http://www.cs.huji.ac.il/~dolev/pubs/thesis/msc-thesis-leo.pdf
+
Sat Apr 23 00:25:26 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* miniinit.c (Init_enc): add some common aliases of built-in
diff --git a/lib/securerandom.rb b/lib/securerandom.rb
index b08b62b746..596d8ed389 100644
--- a/lib/securerandom.rb
+++ b/lib/securerandom.rb
@@ -48,7 +48,7 @@ end
#
module SecureRandom
- if defined? OpenSSL::Random
+ if defined?(OpenSSL::Random) && /mswin|mingw/ !~ RUBY_PLATFORM
def self.gen_random(n)
@pid = 0 unless defined?(@pid)
pid = $$
diff --git a/version.h b/version.h
index 811838bd4c..469c9617fb 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.3.0"
#define RUBY_RELEASE_DATE "2016-04-23"
-#define RUBY_PATCHLEVEL 102
+#define RUBY_PATCHLEVEL 103
#define RUBY_RELEASE_YEAR 2016
#define RUBY_RELEASE_MONTH 4