summaryrefslogtreecommitdiff
path: root/crypto/shash.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2009-07-08 17:56:28 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2009-07-08 18:58:30 +0800
commit8bd80a4af6628038185f6ae9c4f87cd5c964e351 (patch)
treefd7c1a3ac2b2aafcb5112c8a145d324b962e3063 /crypto/shash.c
parent9011a7fecd642239e11acb585950b5e83f221691 (diff)
downloadlinux-crypto-8bd80a4af6628038185f6ae9c4f87cd5c964e351.tar.gz
linux-crypto-8bd80a4af6628038185f6ae9c4f87cd5c964e351.zip
crypto: shash - Add shash_attr_alg2 helper
This patch adds the helper shash_attr_alg2 which locates a shash algorithm based on the information in the given attribute. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/shash.c')
-rw-r--r--crypto/shash.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/crypto/shash.c b/crypto/shash.c
index 97f6c8ba..21bcff6b 100644
--- a/crypto/shash.c
+++ b/crypto/shash.c
@@ -518,5 +518,15 @@ int crypto_init_shash_spawn(struct crypto_shash_spawn *spawn,
}
EXPORT_SYMBOL_GPL(crypto_init_shash_spawn);
+struct shash_alg *shash_attr_alg(struct rtattr *rta, u32 type, u32 mask)
+{
+ struct crypto_alg *alg;
+
+ alg = crypto_attr_alg2(rta, &crypto_shash_type, type, mask);
+ return IS_ERR(alg) ? ERR_CAST(alg) :
+ container_of(alg, struct shash_alg, base);
+}
+EXPORT_SYMBOL_GPL(shash_attr_alg);
+
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Synchronous cryptographic hash type");