aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2020-02-16 19:03:15 +0900
committerGitHub <noreply@github.com>2020-02-16 19:03:15 +0900
commitcecc89aa844ede0cdc2f40be340789cb4b9c73b3 (patch)
tree779cf2d8715e907d586b0e067a951df3ae81993b
parentf49e7110ca1e63f9f013297cb9b155b8b22f2f93 (diff)
parent9b65e9d82cfdfb11f3c2e42e8bdde155c651c649 (diff)
downloadruby-openssl-cecc89aa844ede0cdc2f40be340789cb4b9c73b3.tar.gz
Merge pull request #330 from ruby/guard-pkey-ec-add
Guard for OpenSSL::PKey::EC::Group::Error with unsupported platforms
-rw-r--r--test/test_pkey_ec.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/test/test_pkey_ec.rb b/test/test_pkey_ec.rb
index 1278a8b1..6b83ed76 100644
--- a/test/test_pkey_ec.rb
+++ b/test/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)