diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2019-07-04 22:45:45 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-04 22:45:45 +1200 |
commit | 3b2126c9fc744e862ed75ceb1801fd8e8ed235e4 (patch) | |
tree | 52fa1bb134bdaad22aff040a167efccdd68f142c /test | |
parent | 96efa29e613b2b311a85714978a70939e7eb81b0 (diff) | |
parent | aba14feb93490ca64e956bc3d4ac272a877a960f (diff) | |
download | ruby-openssl-3b2126c9fc744e862ed75ceb1801fd8e8ed235e4.tar.gz |
Merge pull request #261 from jdhollis/add-EC_POINT_add-support
Add EC_POINT_add support
Diffstat (limited to 'test')
-rw-r--r-- | test/test_pkey_ec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test_pkey_ec.rb b/test/test_pkey_ec.rb index 95b5a642..c4eb2ead 100644 --- a/test/test_pkey_ec.rb +++ b/test/test_pkey_ec.rb @@ -289,6 +289,22 @@ class OpenSSL::TestEC < OpenSSL::PKeyTestCase assert_equal true, point.on_curve? 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) + + 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 })) + + result = point_a.add(point_b) + assert_equal B(%w{ 04 0D 07 }), result.to_octet_string(:uncompressed) + + assert_raise(TypeError) { point_a.add(nil) } + assert_raise(ArgumentError) { point_a.add } + end + def test_ec_point_mul begin # y^2 = x^3 + 2x + 2 over F_17 |