diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-09-25 07:40:24 -0500 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-09-26 16:02:37 -0500 |
commit | fc5f4f97c52b07f0345efd11b03b7996ff1168d6 (patch) | |
tree | 4bf12245db600fcf6484f45942c75f8b29f783c1 | |
parent | c5e43429c26dd1b1baddeec9fddf3cb5d98bcfc1 (diff) | |
download | cryptography-fc5f4f97c52b07f0345efd11b03b7996ff1168d6.tar.gz cryptography-fc5f4f97c52b07f0345efd11b03b7996ff1168d6.tar.bz2 cryptography-fc5f4f97c52b07f0345efd11b03b7996ff1168d6.zip |
CURVE_TYPES back to private, removed unneeded point creation
-rw-r--r-- | cryptography/hazmat/backends/openssl/backend.py | 5 | ||||
-rw-r--r-- | cryptography/hazmat/primitives/asymmetric/ec.py | 2 | ||||
-rw-r--r-- | tests/hazmat/primitives/test_ec.py | 8 |
3 files changed, 6 insertions, 9 deletions
diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py index 65fcbcb1..46ecde15 100644 --- a/cryptography/hazmat/backends/openssl/backend.py +++ b/cryptography/hazmat/backends/openssl/backend.py @@ -492,9 +492,6 @@ class Backend(object): curve = self._sn_to_elliptic_curve(sn) - point = self._lib.EC_POINT_new(group) - assert point != self._ffi.NULL - point = self._ffi.gc(point, self._lib.EC_POINT_free) return _EllipticCurvePrivateKey(self, ec_cdata, curve) else: raise UnsupportedAlgorithm("Unsupported key type.") @@ -1066,7 +1063,7 @@ class Backend(object): def _sn_to_elliptic_curve(self, sn): try: - return ec.CURVE_TYPES[sn]() + return ec._CURVE_TYPES[sn]() except KeyError: raise UnsupportedAlgorithm( "{0} is not a supported elliptic curve".format(sn), diff --git a/cryptography/hazmat/primitives/asymmetric/ec.py b/cryptography/hazmat/primitives/asymmetric/ec.py index 813e2c9e..98eca276 100644 --- a/cryptography/hazmat/primitives/asymmetric/ec.py +++ b/cryptography/hazmat/primitives/asymmetric/ec.py @@ -184,7 +184,7 @@ class SECP192R1(object): return 192 -CURVE_TYPES = { +_CURVE_TYPES = { "prime192v1": SECP192R1, "prime256v1": SECP256R1, diff --git a/tests/hazmat/primitives/test_ec.py b/tests/hazmat/primitives/test_ec.py index 84a25868..65461f70 100644 --- a/tests/hazmat/primitives/test_ec.py +++ b/tests/hazmat/primitives/test_ec.py @@ -142,7 +142,7 @@ class TestECDSAVectors(object): )) ) def test_signing_with_example_keys(self, backend, vector, hash_type): - curve_type = ec.CURVE_TYPES[vector['curve']] + curve_type = ec._CURVE_TYPES[vector['curve']] _skip_ecdsa_vector(backend, curve_type, hash_type) @@ -168,7 +168,7 @@ class TestECDSAVectors(object): verifier.verify() @pytest.mark.parametrize( - "curve", ec.CURVE_TYPES.values() + "curve", ec._CURVE_TYPES.values() ) def test_generate_vector_curves(self, backend, curve): _skip_curve_unsupported(backend, curve()) @@ -224,7 +224,7 @@ class TestECDSAVectors(object): ) def test_signatures(self, backend, vector): hash_type = _HASH_TYPES[vector['digest_algorithm']] - curve_type = ec.CURVE_TYPES[vector['curve']] + curve_type = ec._CURVE_TYPES[vector['curve']] _skip_ecdsa_vector(backend, curve_type, hash_type) @@ -256,7 +256,7 @@ class TestECDSAVectors(object): ) def test_signature_failures(self, backend, vector): hash_type = _HASH_TYPES[vector['digest_algorithm']] - curve_type = ec.CURVE_TYPES[vector['curve']] + curve_type = ec._CURVE_TYPES[vector['curve']] _skip_ecdsa_vector(backend, curve_type, hash_type) |