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

ruby-changes:19614

From: shyouhei <ko1@a...>
Date: Sat, 21 May 2011 07:26:35 +0900 (JST)
Subject: [ruby-changes:19614] shyouhei:r31657 (ruby_1_8_7): merge revision(s) 30274:30279:

shyouhei	2011-05-21 07:25:35 +0900 (Sat, 21 May 2011)

  New Revision: 31657

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

  Log:
    merge revision(s) 30274:30279:
    
    * 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]
    
    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  <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.
    
    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 <shyouhei@r...>
    
    create mode 100644 test/openssl/test_bn.rb

  Added files:
    branches/ruby_1_8_7/test/openssl/test_bn.rb
  Modified files:
    branches/ruby_1_8_7/ChangeLog
    branches/ruby_1_8_7/ext/openssl/lib/openssl/bn.rb
    branches/ruby_1_8_7/ext/openssl/ossl_bn.c
    branches/ruby_1_8_7/version.h

Index: ruby_1_8_7/ext/openssl/lib/openssl/bn.rb
===================================================================
--- ruby_1_8_7/ext/openssl/lib/openssl/bn.rb	(revision 31656)
+++ ruby_1_8_7/ext/openssl/lib/openssl/bn.rb	(revision 31657)
@@ -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_7/ext/openssl/ossl_bn.c
===================================================================
--- ruby_1_8_7/ext/openssl/ossl_bn.c	(revision 31656)
+++ ruby_1_8_7/ext/openssl/ossl_bn.c	(revision 31657)
@@ -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_7/ChangeLog
===================================================================
--- ruby_1_8_7/ChangeLog	(revision 31656)
+++ ruby_1_8_7/ChangeLog	(revision 31657)
@@ -1,3 +1,21 @@
+Fri May 20 23:06:31 2011  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.
+
+Fri May 20 23:06:31 2011  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]
+
 Fri Feb 18 21:18:55 2011  Shugo Maeda  <shugo@r...>
 
 	* test/ruby/test_exception.rb (TestException::test_to_s_taintness_propagation):
Index: ruby_1_8_7/version.h
===================================================================
--- ruby_1_8_7/version.h	(revision 31656)
+++ ruby_1_8_7/version.h	(revision 31657)
@@ -1,15 +1,15 @@
 #define RUBY_VERSION "1.8.7"
-#define RUBY_RELEASE_DATE "2011-02-18"
+#define RUBY_RELEASE_DATE "2011-05-20"
 #define RUBY_VERSION_CODE 187
-#define RUBY_RELEASE_CODE 20110218
-#define RUBY_PATCHLEVEL 334
+#define RUBY_RELEASE_CODE 20110520
+#define RUBY_PATCHLEVEL 335
 
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 8
 #define RUBY_VERSION_TEENY 7
 #define RUBY_RELEASE_YEAR 2011
-#define RUBY_RELEASE_MONTH 2
-#define RUBY_RELEASE_DAY 18
+#define RUBY_RELEASE_MONTH 5
+#define RUBY_RELEASE_DAY 20
 
 #ifdef RUBY_EXTERN
 RUBY_EXTERN const char ruby_version[];
Index: ruby_1_8_7/test/openssl/test_bn.rb
===================================================================
--- ruby_1_8_7/test/openssl/test_bn.rb	(revision 0)
+++ ruby_1_8_7/test/openssl/test_bn.rb	(revision 31657)
@@ -0,0 +1,21 @@
+begin
+  require "openssl"
+  require File.join(File.dirname(__FILE__), "utils.rb")
+rescue LoadError
+end
+
+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
+
+  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/

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