summaryrefslogtreecommitdiffstats
path: root/include/crypto/internal/hash.h
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2019-12-08 06:42:53 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2019-12-11 09:48:39 +0100
commitd9e1670b8005999998b557c0e301bb68192bb1c8 (patch)
tree624e359ec0943511a5167c5dfa54cc79f1caa745 /include/crypto/internal/hash.h
parentcrypto: padlock-sha - Use init_tfm/exit_tfm interface (diff)
downloadlinux-d9e1670b8005999998b557c0e301bb68192bb1c8.tar.xz
linux-d9e1670b8005999998b557c0e301bb68192bb1c8.zip
crypto: hmac - Use init_tfm/exit_tfm interface
This patch switches hmac over to the new init_tfm/exit_tfm interface as opposed to cra_init/cra_exit. This way the shash API can make sure that descsize does not exceed the maximum. This patch also adds the API helper shash_alg_instance. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Reviewed-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto/internal/hash.h')
-rw-r--r--include/crypto/internal/hash.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h
index f68dab38f160..cf8d7f99c93d 100644
--- a/include/crypto/internal/hash.h
+++ b/include/crypto/internal/hash.h
@@ -220,6 +220,12 @@ static inline struct shash_instance *shash_instance(
struct shash_instance, alg);
}
+static inline struct shash_instance *shash_alg_instance(
+ struct crypto_shash *shash)
+{
+ return shash_instance(crypto_tfm_alg_instance(&shash->base));
+}
+
static inline void *shash_instance_ctx(struct shash_instance *inst)
{
return crypto_instance_ctx(shash_crypto_instance(inst));