diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2017-10-11 22:01:29 -0400 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2017-10-12 10:01:29 +0800 |
commit | 31034a03227ebfe63f4025cd95137f116cd4236a (patch) | |
tree | 33454544ff3f1f2eec9b7225a681832dd999ebd3 /tests/hazmat/primitives | |
parent | a87daea52b698a59664d852ecad567a742576265 (diff) | |
download | cryptography-31034a03227ebfe63f4025cd95137f116cd4236a.tar.gz cryptography-31034a03227ebfe63f4025cd95137f116cd4236a.tar.bz2 cryptography-31034a03227ebfe63f4025cd95137f116cd4236a.zip |
Inline calls to bit_length now that it's trivial (#3966)
* Inline calls to bit_length now that it's trivial
* unused imports
* An comment
Diffstat (limited to 'tests/hazmat/primitives')
-rw-r--r-- | tests/hazmat/primitives/test_dh.py | 4 | ||||
-rw-r--r-- | tests/hazmat/primitives/test_dsa.py | 3 |
2 files changed, 3 insertions, 4 deletions
diff --git a/tests/hazmat/primitives/test_dh.py b/tests/hazmat/primitives/test_dh.py index 25be51c9..a70ae745 100644 --- a/tests/hazmat/primitives/test_dh.py +++ b/tests/hazmat/primitives/test_dh.py @@ -13,7 +13,7 @@ from cryptography.hazmat.backends.interfaces import ( DERSerializationBackend, DHBackend, PEMSerializationBackend) from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives.asymmetric import dh -from cryptography.utils import bit_length, int_from_bytes +from cryptography.utils import int_from_bytes from ...doubles import DummyKeySerializationEncryption from ...utils import load_nist_vectors, load_vectors_from_file @@ -262,7 +262,7 @@ class TestDH(object): assert isinstance(parameters, dh.DHParametersWithSerialization) parameter_numbers = parameters.parameter_numbers() assert isinstance(parameter_numbers, dh.DHParameterNumbers) - assert bit_length(parameter_numbers.p) == key_size + assert parameter_numbers.p.bit_length() == key_size assert isinstance(public, dh.DHPublicKeyWithSerialization) assert isinstance(public.public_numbers(), dh.DHPublicNumbers) diff --git a/tests/hazmat/primitives/test_dsa.py b/tests/hazmat/primitives/test_dsa.py index 34197772..89303fed 100644 --- a/tests/hazmat/primitives/test_dsa.py +++ b/tests/hazmat/primitives/test_dsa.py @@ -18,7 +18,6 @@ from cryptography.hazmat.primitives.asymmetric import dsa from cryptography.hazmat.primitives.asymmetric.utils import ( Prehashed, encode_dss_signature ) -from cryptography.utils import bit_length from .fixtures_dsa import ( DSA_KEY_1024, DSA_KEY_2048, DSA_KEY_3072 @@ -82,7 +81,7 @@ class TestDSA(object): assert skey_parameters.p == vector['p'] assert skey_parameters.q == vector['q'] assert skey_parameters.g == vector['g'] - assert skey.key_size == bit_length(vector['p']) + assert skey.key_size == vector['p'].bit_length() assert pkey.key_size == skey.key_size public_numbers = pkey.public_numbers() assert numbers.public_numbers.y == public_numbers.y |