From e2c1c0fb8cb91b18597496b00df6a23b77f4affa Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Tue, 22 Aug 2017 09:37:32 -0700 Subject: add blake2b/blake2s support for hmac (#3873) * add blake2b/blake2s support for hmac This was a bug, but it turns out the noise protocol suggests using the HMAC construction with BLAKE2 (rather than BLAKE2's own keyed functionality) for a few reasons, so we should support it. * actually test the thing --- src/cryptography/hazmat/backends/openssl/hmac.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/cryptography/hazmat/backends/openssl/hmac.py b/src/cryptography/hazmat/backends/openssl/hmac.py index ea834204..3577f477 100644 --- a/src/cryptography/hazmat/backends/openssl/hmac.py +++ b/src/cryptography/hazmat/backends/openssl/hmac.py @@ -25,12 +25,11 @@ class _HMACContext(object): ctx = self._backend._ffi.gc( ctx, self._backend._lib.Cryptography_HMAC_CTX_free ) - evp_md = self._backend._lib.EVP_get_digestbyname( - algorithm.name.encode('ascii')) + name = self._backend._build_openssl_digest_name(algorithm) + evp_md = self._backend._lib.EVP_get_digestbyname(name) if evp_md == self._backend._ffi.NULL: raise UnsupportedAlgorithm( - "{0} is not a supported hash on this backend.".format( - algorithm.name), + "{0} is not a supported hash on this backend".format(name), _Reasons.UNSUPPORTED_HASH ) res = self._backend._lib.HMAC_Init_ex( -- cgit v1.2.3