diff options
author | David Benjamin <davidben@google.com> | 2019-07-08 16:42:01 -0400 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2019-07-08 15:42:00 -0500 |
commit | 9a09f9690890c4b6fa6d4d1625e78dcbaffbf734 (patch) | |
tree | 8b5224be0decccc0efc22da14323c59dd6c5acea /tests/hazmat/primitives/test_ec.py | |
parent | 1e8c5a64190db6611889f45f7f8af543b291383b (diff) | |
download | cryptography-9a09f9690890c4b6fa6d4d1625e78dcbaffbf734.tar.gz cryptography-9a09f9690890c4b6fa6d4d1625e78dcbaffbf734.tar.bz2 cryptography-9a09f9690890c4b6fa6d4d1625e78dcbaffbf734.zip |
Fix some backend feature checks in tests (#4931)
* Remove irrelevant DHBackend test conditions
DHBackend provides functions for plain finite-field Diffie-Hellman.
X25519 and X448 are their own algorithms, and Ed25519 and Ed448 aren't
even Diffie-Hellman primitives.
* Add missing backend support checks.
Some new AES and EC tests did not check for whether the corresponding
mode or curve was supported by the backend.
* Add a DummyMode for coverage
Diffstat (limited to 'tests/hazmat/primitives/test_ec.py')
-rw-r--r-- | tests/hazmat/primitives/test_ec.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/hazmat/primitives/test_ec.py b/tests/hazmat/primitives/test_ec.py index cd30223c..922a25f0 100644 --- a/tests/hazmat/primitives/test_ec.py +++ b/tests/hazmat/primitives/test_ec.py @@ -1070,11 +1070,12 @@ class TestEllipticCurvePEMPublicKeySerialization(object): load_nist_vectors ) ) - def test_from_encoded_point_compressed(self, vector): + def test_from_encoded_point_compressed(self, vector, backend): curve = { b"SECP256R1": ec.SECP256R1(), b"SECP256K1": ec.SECP256K1(), }[vector["curve"]] + _skip_curve_unsupported(backend, curve) point = binascii.unhexlify(vector["point"]) pn = ec.EllipticCurvePublicKey.from_encoded_point(curve, point) public_num = pn.public_numbers() @@ -1155,6 +1156,7 @@ class TestEllipticCurvePEMPublicKeySerialization(object): b"SECP256R1": ec.SECP256R1(), b"SECP256K1": ec.SECP256K1(), }[vector["curve"]] + _skip_curve_unsupported(backend, curve) point = binascii.unhexlify(vector["point"]) key = ec.EllipticCurvePublicKey.from_encoded_point(curve, point) key2 = ec.EllipticCurvePublicKey.from_encoded_point( |