[前][次][番号順一覧][スレッド一覧]

ruby-changes:18256

From: nahi <ko1@a...>
Date: Tue, 21 Dec 2010 01:07:21 +0900 (JST)
Subject: [ruby-changes:18256] Ruby:r30279 (ruby_1_8): * Backported the fix at

nahi	2010-12-21 01:07:06 +0900 (Tue, 21 Dec 2010)

  New Revision: 30279

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30279

  Log:
    * Backported the fix at
              Mon Sep 13 09:23:58 2010  NARUSE, Yui  <naruse@r...>
    
            * ext/openssl/ossl_bn.c (ossl_bn_is_prime): fix comparison
              with rb_scan_args. Before this fix, OpenSSL::BN#prime?
              is fully broken.

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/ext/openssl/ossl_bn.c
    branches/ruby_1_8/test/openssl/test_bn.rb

Index: ruby_1_8/ext/openssl/ossl_bn.c
===================================================================
--- ruby_1_8/ext/openssl/ossl_bn.c	(revision 30278)
+++ ruby_1_8/ext/openssl/ossl_bn.c	(revision 30279)
@@ -669,7 +669,7 @@
     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);
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 30278)
+++ ruby_1_8/ChangeLog	(revision 30279)
@@ -1,3 +1,12 @@
+Tue Dec 21 00:58:21 2010  NAKAMURA, Hiroshi  <nahi@r...>
+
+	* Backported the fix at
+	  Mon Sep 13 09:23:58 2010  NARUSE, Yui  <naruse@r...>
+
+	* ext/openssl/ossl_bn.c (ossl_bn_is_prime): fix comparison
+	  with rb_scan_args. Before this fix, OpenSSL::BN#prime?
+	  is fully broken.
+
 Tue Dec 21 00:19:50 2010  NAKAMURA, Hiroshi  <nahi@r...>
 
 	* Backported the fix at
Index: ruby_1_8/test/openssl/test_bn.rb
===================================================================
--- ruby_1_8/test/openssl/test_bn.rb	(revision 30278)
+++ ruby_1_8/test/openssl/test_bn.rb	(revision 30279)
@@ -11,6 +11,11 @@
     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
+
+  def test_prime_p
+    OpenSSL::BN.new((2 ** 107 - 1).to_s(16), 16).prime?
+    OpenSSL::BN.new((2 ** 127 - 1).to_s(16), 16).prime?(1)
+  end
 end
 
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]