diff options
| author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-06-01 14:47:08 -0500 | 
|---|---|---|
| committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-06-01 14:47:08 -0500 | 
| commit | 87d9c706dae2ce46f0191ae5aa3097fe7bbbc204 (patch) | |
| tree | f747515a3b86d20e4374e1918b993a88a086f7cb /cryptography | |
| parent | 4e52e7e50650b88d0e2c50bd5366bb0da1c5634d (diff) | |
| download | cryptography-87d9c706dae2ce46f0191ae5aa3097fe7bbbc204.tar.gz cryptography-87d9c706dae2ce46f0191ae5aa3097fe7bbbc204.tar.bz2 cryptography-87d9c706dae2ce46f0191ae5aa3097fe7bbbc204.zip | |
add some complexity back to handle 0.9.8 annoyances
Diffstat (limited to 'cryptography')
| -rw-r--r-- | cryptography/hazmat/backends/openssl/backend.py | 9 | 
1 files changed, 8 insertions, 1 deletions
| diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py index b5000d2e..4112f0e5 100644 --- a/cryptography/hazmat/backends/openssl/backend.py +++ b/cryptography/hazmat/backends/openssl/backend.py @@ -21,7 +21,8 @@ import six  from cryptography import utils  from cryptography.exceptions import ( -    InternalError, InvalidSignature, InvalidTag, UnsupportedAlgorithm, _Reasons +    AlreadyFinalized, InternalError, InvalidSignature, InvalidTag, +    UnsupportedAlgorithm, _Reasons  )  from cryptography.hazmat.backends.interfaces import (      CMACBackend, CipherBackend, DSABackend, HMACBackend, HashBackend, @@ -1341,6 +1342,9 @@ class _RSASignatureContext(object):          return self._backend._ffi.buffer(buf)[:]      def _finalize_pkcs1(self, evp_pkey, pkey_size, evp_md): +        if self._hash_ctx._ctx is None: +            raise AlreadyFinalized("Context has already been finalized.") +          sig_buf = self._backend._ffi.new("char[]", pkey_size)          sig_len = self._backend._ffi.new("unsigned int *")          res = self._backend._lib.EVP_SignFinal( @@ -1520,6 +1524,9 @@ class _RSAVerificationContext(object):              raise InvalidSignature      def _verify_pkcs1(self, evp_pkey, evp_md): +        if self._hash_ctx._ctx is None: +            raise AlreadyFinalized("Context has already been finalized.") +          res = self._backend._lib.EVP_VerifyFinal(              self._hash_ctx._ctx._ctx,              self._signature, | 
