diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2014-10-22 10:12:07 -0700 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2014-10-22 10:12:07 -0700 |
commit | d918580097506197e0aadaa60c4681536b5f4adf (patch) | |
tree | 2b58223f53302e0aa953c0fc203537dda879d1fc /cryptography/hazmat/primitives/cmac.py | |
parent | 633caacfe7e86f9098bb8cb64cfc12a9fe5cc35c (diff) | |
download | cryptography-d918580097506197e0aadaa60c4681536b5f4adf.tar.gz cryptography-d918580097506197e0aadaa60c4681536b5f4adf.tar.bz2 cryptography-d918580097506197e0aadaa60c4681536b5f4adf.zip |
Statically verify interface implementations, and fix all the resulting bugs
Diffstat (limited to 'cryptography/hazmat/primitives/cmac.py')
-rw-r--r-- | cryptography/hazmat/primitives/cmac.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/cryptography/hazmat/primitives/cmac.py b/cryptography/hazmat/primitives/cmac.py index 7ae5c118..a70a9a42 100644 --- a/cryptography/hazmat/primitives/cmac.py +++ b/cryptography/hazmat/primitives/cmac.py @@ -15,10 +15,10 @@ from __future__ import absolute_import, division, print_function from cryptography import utils from cryptography.exceptions import ( - AlreadyFinalized, InvalidSignature, UnsupportedAlgorithm, _Reasons + AlreadyFinalized, UnsupportedAlgorithm, _Reasons ) from cryptography.hazmat.backends.interfaces import CMACBackend -from cryptography.hazmat.primitives import constant_time, interfaces +from cryptography.hazmat.primitives import interfaces @utils.register_interface(interfaces.MACContext) @@ -57,11 +57,7 @@ class CMAC(object): return digest def verify(self, signature): - if not isinstance(signature, bytes): - raise TypeError("signature must be bytes.") - digest = self.finalize() - if not constant_time.bytes_eq(digest, signature): - raise InvalidSignature("Signature did not match digest.") + self._ctx.verify(signature) def copy(self): if self._ctx is None: |