]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: shash - allow essiv and hmac to use OPTIONAL_KEY algorithms
authorEric Biggers <ebiggers@google.com>
Fri, 29 Nov 2019 19:35:22 +0000 (11:35 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 11 Dec 2019 08:36:57 +0000 (16:36 +0800)
commitf4c831d0f95fc6077f4f8ed2e413a1e304e1a4b2
treed7c9b219396c2150e8c0bdd1dc44ba4ed0e7aea9
parent014bc89eaef278ff81987e40e6a94f05fe3fa156
crypto: shash - allow essiv and hmac to use OPTIONAL_KEY algorithms

The essiv and hmac templates refuse to use any hash algorithm that has a
->setkey() function, which includes not just algorithms that always need
a key, but also algorithms that optionally take a key.

Previously the only optionally-keyed hash algorithms in the crypto API
were non-cryptographic algorithms like crc32, so this didn't really
matter.  But that's changed with BLAKE2 support being added.  BLAKE2
should work with essiv and hmac, just like any other cryptographic hash.

Fix this by allowing the use of both algorithms without a ->setkey()
function and algorithms that have the OPTIONAL_KEY flag set.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/essiv.c
crypto/hmac.c
crypto/shash.c
include/crypto/internal/hash.h