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

ruby-changes:60089

From: Hiroshi <ko1@a...>
Date: Sun, 16 Feb 2020 16:09:03 +0900 (JST)
Subject: [ruby-changes:60089] 3014574800 (master): Guard for OpenSSL::PKey::EC::Group::Error with unsupported platforms

https://git.ruby-lang.org/ruby.git/commit/?id=3014574800

From 301457480039a7087129f291578a872f6e653ab6 Mon Sep 17 00:00:00 2001
From: Hiroshi SHIBATA <hsbt@r...>
Date: Sun, 16 Feb 2020 16:08:43 +0900
Subject: Guard for OpenSSL::PKey::EC::Group::Error with unsupported platforms


diff --git a/test/openssl/test_pkey_ec.rb b/test/openssl/test_pkey_ec.rb
index 1278a8b..6b83ed7 100644
--- a/test/openssl/test_pkey_ec.rb
+++ b/test/openssl/test_pkey_ec.rb
@@ -290,13 +290,18 @@ class OpenSSL::TestEC < OpenSSL::PKeyTestCase https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkey_ec.rb#L290
   end
 
   def test_ec_point_add
-    group = OpenSSL::PKey::EC::Group.new(:GFp, 17, 2, 2)
-    group.point_conversion_form = :uncompressed
-    gen = OpenSSL::PKey::EC::Point.new(group, B(%w{ 04 05 01 }))
-    group.set_generator(gen, 19, 1)
+    begin
+      group = OpenSSL::PKey::EC::Group.new(:GFp, 17, 2, 2)
+      group.point_conversion_form = :uncompressed
+      gen = OpenSSL::PKey::EC::Point.new(group, B(%w{ 04 05 01 }))
+      group.set_generator(gen, 19, 1)
 
-    point_a = OpenSSL::PKey::EC::Point.new(group, B(%w{ 04 06 03 }))
-    point_b = OpenSSL::PKey::EC::Point.new(group, B(%w{ 04 10 0D }))
+      point_a = OpenSSL::PKey::EC::Point.new(group, B(%w{ 04 06 03 }))
+      point_b = OpenSSL::PKey::EC::Point.new(group, B(%w{ 04 10 0D }))
+    rescue OpenSSL::PKey::EC::Group::Error
+      pend "Patched OpenSSL rejected curve" if /unsupported field/ =~ $!.message
+      raise
+    end
 
     result = point_a.add(point_b)
     assert_equal B(%w{ 04 0D 07 }), result.to_octet_string(:uncompressed)
-- 
cgit v0.10.2


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

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