aboutsummaryrefslogtreecommitdiffstats
path: root/cryptography
diff options
context:
space:
mode:
authorDavid Reid <dreid@dreid.org>2013-11-01 15:11:45 -0700
committerDavid Reid <dreid@dreid.org>2013-11-01 15:11:45 -0700
commitb864db11a3577ff6b117f6ce73e43f3c1e7b3e84 (patch)
treed7acb894e16504134c2d11f0207f325f707aab67 /cryptography
parent9d65b613384b1d4781efd65588639ad68261e8d7 (diff)
downloadcryptography-b864db11a3577ff6b117f6ce73e43f3c1e7b3e84.tar.gz
cryptography-b864db11a3577ff6b117f6ce73e43f3c1e7b3e84.tar.bz2
cryptography-b864db11a3577ff6b117f6ce73e43f3c1e7b3e84.zip
Enforce HMAC taking an instance of HashAlgorithm
Diffstat (limited to 'cryptography')
-rw-r--r--cryptography/hazmat/primitives/hmac.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/cryptography/hazmat/primitives/hmac.py b/cryptography/hazmat/primitives/hmac.py
index fc5e777c..1457ed78 100644
--- a/cryptography/hazmat/primitives/hmac.py
+++ b/cryptography/hazmat/primitives/hmac.py
@@ -22,6 +22,8 @@ from cryptography.hazmat.primitives import interfaces
class HMAC(object):
def __init__(self, key, algorithm, ctx=None, backend=None):
super(HMAC, self).__init__()
+ if not isinstance(algorithm, interfaces.HashAlgorithm):
+ raise TypeError("Expected instance of interfaces.HashAlgorithm.")
self.algorithm = algorithm
if backend is None: