crypto: ahash - Add ahash_alg_instance
authorHerbert Xu <herbert@gondor.apana.org.au>
Tue, 18 Aug 2020 08:25:36 +0000 (18:25 +1000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 28 Aug 2020 06:58:28 +0000 (16:58 +1000)
This patch adds the helper ahash_alg_instance which is used to
convert a crypto_ahash object into its corresponding ahash_instance.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
include/crypto/internal/hash.h

index 6d3ad5a..0a288dd 100644 (file)
@@ -164,6 +164,12 @@ static inline struct ahash_instance *ahash_instance(
        return container_of(inst, struct ahash_instance, s.base);
 }
 
+static inline struct ahash_instance *ahash_alg_instance(
+       struct crypto_ahash *ahash)
+{
+       return ahash_instance(crypto_tfm_alg_instance(&ahash->base));
+}
+
 static inline void *ahash_instance_ctx(struct ahash_instance *inst)
 {
        return crypto_instance_ctx(ahash_crypto_instance(inst));