summaryrefslogtreecommitdiff
path: root/include/crypto
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2019-12-08 13:42:53 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2019-12-11 16:48:39 +0800
commitd9e1670b8005999998b557c0e301bb68192bb1c8 (patch)
tree624e359ec0943511a5167c5dfa54cc79f1caa745 /include/crypto
parent96895693940710db24e42c4e2a248d8f7bd7ab4b (diff)
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')
-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));