diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2017-05-23 20:31:03 -0700 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2017-05-23 20:31:03 -0700 |
commit | 6091e11cae1e2ca43709266d0e3ba84ded12ddfc (patch) | |
tree | 070abc134d8afff90dcb4a09ed0c659b999a8a1d /src | |
parent | 70e8f90b250ba65167943f67cb851495bc7b8add (diff) | |
download | cryptography-6091e11cae1e2ca43709266d0e3ba84ded12ddfc.tar.gz cryptography-6091e11cae1e2ca43709266d0e3ba84ded12ddfc.tar.bz2 cryptography-6091e11cae1e2ca43709266d0e3ba84ded12ddfc.zip |
Bump the minimum PyPy/cffi version and simplify as a result (#3585)
* Bump the minimum PyPy/cffi version and simplify as a result
* unused imports
* grumble, fix
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptography/hazmat/primitives/ciphers/base.py | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/src/cryptography/hazmat/primitives/ciphers/base.py b/src/cryptography/hazmat/primitives/ciphers/base.py index 826e23ef..f8570414 100644 --- a/src/cryptography/hazmat/primitives/ciphers/base.py +++ b/src/cryptography/hazmat/primitives/ciphers/base.py @@ -6,8 +6,6 @@ from __future__ import absolute_import, division, print_function import abc -import cffi - import six from cryptography import utils @@ -150,19 +148,10 @@ class _CipherContext(object): raise AlreadyFinalized("Context was already finalized.") return self._ctx.update(data) - # 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 cffi.__version_info__ >= (1, 7): - def update_into(self, data, buf): - if self._ctx is None: - raise AlreadyFinalized("Context was already finalized.") - return self._ctx.update_into(data, buf) - else: - def update_into(self, data, buf): - raise NotImplementedError( - "update_into requires cffi 1.7+. To use this method please " - "update cffi." - ) + def update_into(self, data, buf): + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + return self._ctx.update_into(data, buf) def finalize(self): if self._ctx is None: @@ -199,18 +188,9 @@ class _AEADCipherContext(object): self._check_limit(len(data)) return self._ctx.update(data) - # 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 cffi.__version_info__ >= (1, 7): - def update_into(self, data, buf): - self._check_limit(len(data)) - return self._ctx.update_into(data, buf) - else: - def update_into(self, data, buf): - raise NotImplementedError( - "update_into requires cffi 1.7+. To use this method please " - "update cffi." - ) + def update_into(self, data, buf): + self._check_limit(len(data)) + return self._ctx.update_into(data, buf) def finalize(self): if self._ctx is None: |