crypto: shash - Add __crypto_shash_cast
Herbert Xu [Wed, 8 Jul 2009 14:36:36 +0000 (22:36 +0800)]
This patch adds __crypto_shash_cast which turns a crypto_tfm
into crypto_shash.  It's analogous to the other __crypto_*_cast
functions.

It hasn't been needed until now since no existing shash algorithms
have had an init function.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

include/crypto/internal/hash.h

index f104114..3af34ca 100644 (file)
@@ -128,5 +128,10 @@ static inline void *crypto_shash_ctx_aligned(struct crypto_shash *tfm)
        return crypto_tfm_ctx_aligned(&tfm->base);
 }
 
+static inline struct crypto_shash *__crypto_shash_cast(struct crypto_tfm *tfm)
+{
+       return (struct crypto_shash *)tfm;
+}
+
 #endif /* _CRYPTO_INTERNAL_HASH_H */