From b8031a4517c12b2540616edba42f29a2fcaf088d Mon Sep 17 00:00:00 2001 From: shyouhei Date: Fri, 20 May 2011 22:25:35 +0000 Subject: merge revision(s) 30274:30279: * Backported the fix at Mon Oct 4 09:30:42 2010 NARUSE, Yui * 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 Make test-all run. require_relative is from 1.9. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@30278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e * Backported the fix at Mon Sep 13 09:23:58 2010 NARUSE, Yui * ext/openssl/ossl_bn.c (ossl_bn_is_prime): fix comparison with rb_scan_args. Before this fix, OpenSSL::BN#prime? is fully broken. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@30279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e Signed-off-by: URABE, Shyouhei create mode 100644 test/openssl/test_bn.rb git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@31657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/openssl/lib/openssl/bn.rb | 2 +- ext/openssl/ossl_bn.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'ext') 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/ext/openssl/ossl_bn.c b/ext/openssl/ossl_bn.c index 6e7c4b628a..be43b0eacd 100644 --- a/ext/openssl/ossl_bn.c +++ b/ext/openssl/ossl_bn.c @@ -669,7 +669,7 @@ ossl_bn_is_prime(int argc, VALUE *argv, VALUE self) VALUE vchecks; int checks = BN_prime_checks; - if (rb_scan_args(argc, argv, "01", &vchecks) == 0) { + if (rb_scan_args(argc, argv, "01", &vchecks) == 1) { checks = NUM2INT(vchecks); } GetBN(self, bn); -- cgit v1.2.3