aboutsummaryrefslogtreecommitdiffstats
path: root/cryptography/hazmat/primitives/hmac.py
diff options
context:
space:
mode:
authorDavid Reid <dreid@dreid.org>2013-11-12 13:24:56 -0800
committerDavid Reid <dreid@dreid.org>2013-11-12 13:24:56 -0800
commit0bcbb41964014926c3c604efff68f2d11b592035 (patch)
treea7d47beb517277d4480fca85ac79f68060216ca0 /cryptography/hazmat/primitives/hmac.py
parent5e981fc4bad969750a1a8e109ee6391fb5d4bfbc (diff)
downloadcryptography-0bcbb41964014926c3c604efff68f2d11b592035.tar.gz
cryptography-0bcbb41964014926c3c604efff68f2d11b592035.tar.bz2
cryptography-0bcbb41964014926c3c604efff68f2d11b592035.zip
Get a HashContext from the hmac backend like we do a CipherContext
Diffstat (limited to 'cryptography/hazmat/primitives/hmac.py')
-rw-r--r--cryptography/hazmat/primitives/hmac.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/cryptography/hazmat/primitives/hmac.py b/cryptography/hazmat/primitives/hmac.py
index 1457ed78..27bc0fee 100644
--- a/cryptography/hazmat/primitives/hmac.py
+++ b/cryptography/hazmat/primitives/hmac.py
@@ -40,12 +40,13 @@ class HMAC(object):
def update(self, msg):
if isinstance(msg, six.text_type):
raise TypeError("Unicode-objects must be encoded before hashing")
- self._backend.hmacs.update_ctx(self._ctx, msg)
+ self._ctx.update(msg)
def copy(self):
- return self.__class__(self._key, self.algorithm, backend=self._backend,
- ctx=self._backend.hmacs.copy_ctx(self._ctx))
+ return self.__class__(
+ self._key, self.algorithm, ctx=self._ctx.copy(),
+ backend=self._backend
+ )
def finalize(self):
- return self._backend.hmacs.finalize_ctx(self._ctx,
- self.algorithm.digest_size)
+ return self._ctx.finalize()