1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

openssl: fix test failure of OpenSSL::TestEC#test_ec_point_mul

* test/openssl/test_pkey_ec.rb (test_ec_point_mul): CentOS 7 patches
OpenSSL to reject curves defined over a small field.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
rhe 2016-05-18 08:52:37 +00:00
parent bbc4fd8895
commit 1d1efeeafa

View file

@ -185,6 +185,7 @@ class OpenSSL::TestEC < OpenSSL::TestCase
end end
def test_ec_point_mul def test_ec_point_mul
begin
# y^2 = x^3 + 2x + 2 over F_17 # y^2 = x^3 + 2x + 2 over F_17
# generator is (5, 1) # generator is (5, 1)
group = OpenSSL::PKey::EC::Group.new(:GFp, 17, 2, 2) group = OpenSSL::PKey::EC::Group.new(:GFp, 17, 2, 2)
@ -207,6 +208,10 @@ class OpenSSL::TestEC < OpenSSL::TestCase
# 3 * point_a + 5 * point_a.group.generator = 3 * (6, 3) + 5 * (5, 1) = (13, 10) # 3 * point_a + 5 * point_a.group.generator = 3 * (6, 3) + 5 * (5, 1) = (13, 10)
result_b1 = point_a.mul([3.to_bn], [], 5) result_b1 = point_a.mul([3.to_bn], [], 5)
assert_equal("040D0A", result_b1.to_bn.to_s(16)) assert_equal("040D0A", result_b1.to_bn.to_s(16))
rescue OpenSSL::PKey::EC::Group::Error
# CentOS patches OpenSSL to reject curves defined over Fp where p < 256 bits
raise if e.message !~ /unsupported field/
end
p256_key = OpenSSL::TestUtils::TEST_KEY_EC_P256V1 p256_key = OpenSSL::TestUtils::TEST_KEY_EC_P256V1
p256_g = p256_key.group p256_g = p256_key.group