diff options
author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-20 15:21:52 +0000 |
---|---|---|
committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-20 15:21:52 +0000 |
commit | cb0ea9ddfdfd152de3321283dda1038e2c18a809 (patch) | |
tree | 2923ff5b1fe65d2021c1d09f5786f062e3f786cc | |
parent | f79d54eadbf266271b9ee935a8bb08da1eb0bf5f (diff) |
* Backported the fix at
Mon Oct 4 09:30:42 2010 NARUSE, Yui <[email protected]>
* ext/openssl/lib/openssl/bn.rb (Integer#to_bn): OpenSSL::BN.new
accepts only Strings, so call Integer#to_s(16).
16 is for an optimization. [ruby-dev:42336]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@30275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | ext/openssl/lib/openssl/bn.rb | 2 | ||||
-rw-r--r-- | test/openssl/test_bn.rb | 12 |
3 files changed, 22 insertions, 1 deletions
@@ -1,3 +1,12 @@ +Tue Dec 21 00:19:50 2010 NAKAMURA, Hiroshi <[email protected]> + + * Backported the fix at + Mon Oct 4 09:30:42 2010 NARUSE, Yui <[email protected]> + + * ext/openssl/lib/openssl/bn.rb (Integer#to_bn): OpenSSL::BN.new + accepts only Strings, so call Integer#to_s(16). + 16 is for an optimization. [ruby-dev:42336] + Sat Dec 11 05:48:28 2010 Hidetoshi NAGAI <[email protected]> * ext/tk/lib/multi-tk.rb: infinite loop on method_missing at loading diff --git a/ext/openssl/lib/openssl/bn.rb b/ext/openssl/lib/openssl/bn.rb index e7cbf2cfaf..624c13715c 100644 --- a/ext/openssl/lib/openssl/bn.rb +++ b/ext/openssl/lib/openssl/bn.rb @@ -29,7 +29,7 @@ end # OpenSSL # class Integer def to_bn - OpenSSL::BN::new(self) + OpenSSL::BN::new(self.to_s(16), 16) end end # Integer diff --git a/test/openssl/test_bn.rb b/test/openssl/test_bn.rb new file mode 100644 index 0000000000..98ceb7dd30 --- /dev/null +++ b/test/openssl/test_bn.rb @@ -0,0 +1,12 @@ +require_relative 'utils' + +if defined?(OpenSSL) + +class OpenSSL::TestBN < Test::Unit::TestCase + def test_integer_to_bn + assert_equal(999.to_bn, OpenSSL::BN.new(999.to_s(16), 16)) + assert_equal((2 ** 107 - 1).to_bn, OpenSSL::BN.new((2 ** 107 - 1).to_s(16), 16)) + end +end + +end |