diff options
author | Ayrx <terrycwk1994@gmail.com> | 2014-04-22 22:24:26 +0800 |
---|---|---|
committer | Ayrx <terrycwk1994@gmail.com> | 2014-04-22 22:24:26 +0800 |
commit | f09a3d6cfa198f89eca0e012fb9f9ae0a2d9591a (patch) | |
tree | b4b6499626281c8cf92fc130470df6aab490dd4c /cryptography | |
parent | b5236fe24efa4d399353327db49c23dc6e81d1f5 (diff) | |
download | cryptography-f09a3d6cfa198f89eca0e012fb9f9ae0a2d9591a.tar.gz cryptography-f09a3d6cfa198f89eca0e012fb9f9ae0a2d9591a.tar.bz2 cryptography-f09a3d6cfa198f89eca0e012fb9f9ae0a2d9591a.zip |
Added missing tests for 100% coverage
Diffstat (limited to 'cryptography')
-rw-r--r-- | cryptography/hazmat/backends/openssl/backend.py | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py index 7d73c413..4c487e4d 100644 --- a/cryptography/hazmat/backends/openssl/backend.py +++ b/cryptography/hazmat/backends/openssl/backend.py @@ -1255,7 +1255,8 @@ class _RSAVerificationContext(object): class _CMACContext(object): def __init__(self, backend, algorithm, ctx=None): if not backend.cmac_algorithm_supported(algorithm): - raise UnsupportedAlgorithm("This backend does not support CMAC") + raise UnsupportedAlgorithm("This backend does not support CMAC", + _Reasons.UNSUPPORTED_CIPHER) self._backend = backend self._key = algorithm.key @@ -1264,20 +1265,9 @@ class _CMACContext(object): if ctx is None: registry = self._backend._cipher_registry - try: - adapter = registry[type(algorithm), CBC] - except KeyError: - raise UnsupportedAlgorithm( - "cipher {0} is not supported by this backend".format( - algorithm.name), _Reasons.UNSUPPORTED_CIPHER - ) + adapter = registry[type(algorithm), CBC] evp_cipher = adapter(self._backend, algorithm, CBC) - if evp_cipher == self._backend._ffi.NULL: - raise UnsupportedAlgorithm( - "cipher {0} is not supported by this backend".format( - algorithm.name), _Reasons.UNSUPPORTED_CIPHER - ) ctx = self._backend._lib.CMAC_CTX_new() |