aboutsummaryrefslogtreecommitdiffstats
path: root/src/cryptography
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2017-04-29 10:00:24 -0400
committerPaul Kehrer <paul.l.kehrer@gmail.com>2017-04-29 09:00:24 -0500
commit0417d00d9ff1e19bc3ab67d39bdd18e1674768c1 (patch)
tree65757fc8981bf5d81dbe008c944aeed2f6354601 /src/cryptography
parentf2b541f16d6b4a4bba56dbb1f04be863ec66a9c6 (diff)
downloadcryptography-0417d00d9ff1e19bc3ab67d39bdd18e1674768c1.tar.gz
cryptography-0417d00d9ff1e19bc3ab67d39bdd18e1674768c1.tar.bz2
cryptography-0417d00d9ff1e19bc3ab67d39bdd18e1674768c1.zip
Don't compare cffi version using strings (#3524)
Diffstat (limited to 'src/cryptography')
-rw-r--r--src/cryptography/hazmat/primitives/ciphers/base.py4
-rw-r--r--src/cryptography/utils.py7
2 files changed, 2 insertions, 9 deletions
diff --git a/src/cryptography/hazmat/primitives/ciphers/base.py b/src/cryptography/hazmat/primitives/ciphers/base.py
index 502d9804..e9d55a10 100644
--- a/src/cryptography/hazmat/primitives/ciphers/base.py
+++ b/src/cryptography/hazmat/primitives/ciphers/base.py
@@ -147,7 +147,7 @@ class _CipherContext(object):
# cffi 1.7 supports from_buffer on bytearray, which is required. We can
# remove this check in the future when we raise our minimum PyPy version.
- if utils._version_check(cffi.__version__, "1.7"):
+ if cffi.__version_info__ >= (1, 7):
def update_into(self, data, buf):
if self._ctx is None:
raise AlreadyFinalized("Context was already finalized.")
@@ -195,7 +195,7 @@ class _AEADCipherContext(object):
# cffi 1.7 supports from_buffer on bytearray, which is required. We can
# remove this check in the future when we raise our minimum PyPy version.
- if utils._version_check(cffi.__version__, "1.7"):
+ if cffi.__version_info__ >= (1, 7):
def update_into(self, data, buf):
self._check_limit(len(data))
return self._ctx.update_into(data, buf)
diff --git a/src/cryptography/utils.py b/src/cryptography/utils.py
index 40359c62..bec56d5b 100644
--- a/src/cryptography/utils.py
+++ b/src/cryptography/utils.py
@@ -10,8 +10,6 @@ import inspect
import sys
import warnings
-from packaging.version import parse
-
# Several APIs were deprecated with no specific end-of-life date because of the
# ubiquity of their use. They should not be removed until we agree on when that
@@ -104,11 +102,6 @@ else:
return len(bin(x)) - (2 + (x <= 0))
-def _version_check(version, required_version):
- # This is used to check if we support update_into on CipherContext.
- return parse(version) >= parse(required_version)
-
-
class _DeprecatedValue(object):
def __init__(self, value, message, warning_class):
self.value = value