summaryrefslogtreecommitdiff
path: root/test/openssl/test_pkey_ec.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2020-02-16 16:08:43 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-02-16 16:08:43 +0900
commit301457480039a7087129f291578a872f6e653ab6 (patch)
treee2b6e8cf6403fd2b9749e8662acc7ed18d7753d9 /test/openssl/test_pkey_ec.rb
parentb99775b163ce44079c1f8727ce9b4ed8bb03489d (diff)
Guard for OpenSSL::PKey::EC::Group::Error with unsupported platforms
Diffstat (limited to 'test/openssl/test_pkey_ec.rb')
-rw-r--r--test/openssl/test_pkey_ec.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/test/openssl/test_pkey_ec.rb b/test/openssl/test_pkey_ec.rb
index 1278a8b1ba..6b83ed76b9 100644
--- a/test/openssl/test_pkey_ec.rb
+++ b/test/openssl/test_pkey_ec.rb
@@ -290,13 +290,18 @@ class OpenSSL::TestEC < OpenSSL::PKeyTestCase
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)