Commit 7d6f5640 authored by Herbert Xu's avatar Herbert Xu

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: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent d06854f0
...@@ -518,5 +518,15 @@ int crypto_init_shash_spawn(struct crypto_shash_spawn *spawn, ...@@ -518,5 +518,15 @@ int crypto_init_shash_spawn(struct crypto_shash_spawn *spawn,
} }
EXPORT_SYMBOL_GPL(crypto_init_shash_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_LICENSE("GPL");
MODULE_DESCRIPTION("Synchronous cryptographic hash type"); MODULE_DESCRIPTION("Synchronous cryptographic hash type");
...@@ -60,6 +60,8 @@ int crypto_init_shash_spawn(struct crypto_shash_spawn *spawn, ...@@ -60,6 +60,8 @@ int crypto_init_shash_spawn(struct crypto_shash_spawn *spawn,
struct shash_alg *alg, struct shash_alg *alg,
struct crypto_instance *inst); struct crypto_instance *inst);
struct shash_alg *shash_attr_alg(struct rtattr *rta, u32 type, u32 mask);
static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm) static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm)
{ {
return crypto_tfm_ctx(&tfm->base); return crypto_tfm_ctx(&tfm->base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment