ruby-changes:18252
From: nahi <ko1@a...>
Date: Tue, 21 Dec 2010 00:22:22 +0900 (JST)
Subject: [ruby-changes:18252] Ruby:r30275 (ruby_1_8): * Backported the fix at
nahi 2010-12-21 00:21:52 +0900 (Tue, 21 Dec 2010) New Revision: 30275 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30275 Log: * Backported the fix at Mon Oct 4 09:30:42 2010 NARUSE, Yui <naruse@r...> * 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] Added files: branches/ruby_1_8/test/openssl/test_bn.rb Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/ext/openssl/lib/openssl/bn.rb Index: ruby_1_8/ext/openssl/lib/openssl/bn.rb =================================================================== --- ruby_1_8/ext/openssl/lib/openssl/bn.rb (revision 30274) +++ ruby_1_8/ext/openssl/lib/openssl/bn.rb (revision 30275) @@ -29,7 +29,7 @@ # class Integer def to_bn - OpenSSL::BN::new(self) + OpenSSL::BN::new(self.to_s(16), 16) end end # Integer Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 30274) +++ ruby_1_8/ChangeLog (revision 30275) @@ -1,3 +1,12 @@ +Tue Dec 21 00:19:50 2010 NAKAMURA, Hiroshi <nahi@r...> + + * Backported the fix at + Mon Oct 4 09:30:42 2010 NARUSE, Yui <naruse@r...> + + * 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 <nagai@a...> * ext/tk/lib/multi-tk.rb: infinite loop on method_missing at loading Index: ruby_1_8/test/openssl/test_bn.rb =================================================================== --- ruby_1_8/test/openssl/test_bn.rb (revision 0) +++ ruby_1_8/test/openssl/test_bn.rb (revision 30275) @@ -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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/