ruby-changes:28061
From: nagachika <ko1@a...>
Date: Fri, 5 Apr 2013 00:56:11 +0900 (JST)
Subject: [ruby-changes:28061] nagachika:r40113 (ruby_2_0_0): merge revision(s) 40090:
nagachika 2013-04-05 00:56:00 +0900 (Fri, 05 Apr 2013) New Revision: 40113 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40113 Log: merge revision(s) 40090: * ext/openssl/ossl_bn.c (ossl_bn_initialize): fix can't create from bn. Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/ext/openssl/ossl_bn.c branches/ruby_2_0_0/test/openssl/test_bn.rb branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 40112) +++ ruby_2_0_0/ChangeLog (revision 40113) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Fri Apr 5 00:54:08 2013 NARUSE, Yui <naruse@r...> + + * ext/openssl/ossl_bn.c (ossl_bn_initialize): fix can't create from bn. + Thu Apr 4 02:27:12 2013 Tanaka Akira <akr@f...> * lib/resolv-replace.rb (TCPSocket#initialize): resolve the 3rd Index: ruby_2_0_0/ext/openssl/ossl_bn.c =================================================================== --- ruby_2_0_0/ext/openssl/ossl_bn.c (revision 40112) +++ ruby_2_0_0/ext/openssl/ossl_bn.c (revision 40113) @@ -119,11 +119,11 @@ ossl_bn_initialize(int argc, VALUE *argv https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ext/openssl/ossl_bn.c#L119 if (rb_scan_args(argc, argv, "11", &str, &bs) == 2) { base = NUM2INT(bs); } - StringValue(str); - GetBN(self, bn); + if (RTEST(rb_obj_is_kind_of(str, cBN))) { BIGNUM *other; + GetBN(self, bn); GetBN(str, other); /* Safe - we checked kind_of? above */ if (!BN_copy(bn, other)) { ossl_raise(eBNError, NULL); @@ -131,6 +131,8 @@ ossl_bn_initialize(int argc, VALUE *argv https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ext/openssl/ossl_bn.c#L131 return self; } + StringValue(str); + GetBN(self, bn); switch (base) { case 0: if (!BN_mpi2bn((unsigned char *)RSTRING_PTR(str), RSTRING_LENINT(str), bn)) { Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 40112) +++ ruby_2_0_0/version.h (revision 40113) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" -#define RUBY_RELEASE_DATE "2013-04-04" -#define RUBY_PATCHLEVEL 105 +#define RUBY_RELEASE_DATE "2013-04-05" +#define RUBY_PATCHLEVEL 106 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 4 -#define RUBY_RELEASE_DAY 4 +#define RUBY_RELEASE_DAY 5 #include "ruby/version.h" Index: ruby_2_0_0/test/openssl/test_bn.rb =================================================================== --- ruby_2_0_0/test/openssl/test_bn.rb (revision 40112) +++ ruby_2_0_0/test/openssl/test_bn.rb (revision 40113) @@ -3,6 +3,10 @@ require_relative 'utils' https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/openssl/test_bn.rb#L3 if defined?(OpenSSL) class OpenSSL::TestBN < Test::Unit::TestCase + def test_bn_to_bn + assert_equal(999.to_bn, OpenSSL::BN.new(999.to_bn)) + end + 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)) Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r40090 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/