aboutsummaryrefslogtreecommitdiffstats
path: root/cryptography/hazmat/primitives/hmac.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-10-25 17:59:56 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2014-10-25 17:59:56 -0700
commitd55fa5b92e92675ef160c26126feb01751d91fb0 (patch)
tree4f6c1936efb8f72e2dbfb810cf5c49d0b5612aec /cryptography/hazmat/primitives/hmac.py
parente7e3ed04bb5e7c74e2b61938626fe13c581f2656 (diff)
downloadcryptography-d55fa5b92e92675ef160c26126feb01751d91fb0.tar.gz
cryptography-d55fa5b92e92675ef160c26126feb01751d91fb0.tar.bz2
cryptography-d55fa5b92e92675ef160c26126feb01751d91fb0.zip
make things happy
Diffstat (limited to 'cryptography/hazmat/primitives/hmac.py')
-rw-r--r--cryptography/hazmat/primitives/hmac.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/cryptography/hazmat/primitives/hmac.py b/cryptography/hazmat/primitives/hmac.py
index 22a31391..4ef2c301 100644
--- a/cryptography/hazmat/primitives/hmac.py
+++ b/cryptography/hazmat/primitives/hmac.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 HMACBackend
-from cryptography.hazmat.primitives import constant_time, interfaces
+from cryptography.hazmat.primitives import interfaces
@utils.register_interface(interfaces.MACContext)
@@ -69,8 +69,4 @@ class HMAC(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.")
+ return self._ctx.verify(signature)