crypto: api - Add crypto_type_has_alg helper
This patch adds the helper crypto_type_has_alg which is meant to replace crypto_has_alg for new-style crypto types. Rather than hard-coding type/mask information they're now retrieved from the crypto_type object. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
b24dcaae87
commit
4cbda579cd
2 changed files with 18 additions and 0 deletions
|
@ -988,6 +988,21 @@ unsigned int crypto_alg_extsize(struct crypto_alg *alg)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(crypto_alg_extsize);
|
EXPORT_SYMBOL_GPL(crypto_alg_extsize);
|
||||||
|
|
||||||
|
int crypto_type_has_alg(const char *name, const struct crypto_type *frontend,
|
||||||
|
u32 type, u32 mask)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
struct crypto_alg *alg = crypto_find_alg(name, frontend, type, mask);
|
||||||
|
|
||||||
|
if (!IS_ERR(alg)) {
|
||||||
|
crypto_mod_put(alg);
|
||||||
|
ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(crypto_type_has_alg);
|
||||||
|
|
||||||
static int __init crypto_algapi_init(void)
|
static int __init crypto_algapi_init(void)
|
||||||
{
|
{
|
||||||
crypto_init_proc();
|
crypto_init_proc();
|
||||||
|
|
|
@ -104,6 +104,9 @@ int crypto_probing_notify(unsigned long val, void *v);
|
||||||
|
|
||||||
unsigned int crypto_alg_extsize(struct crypto_alg *alg);
|
unsigned int crypto_alg_extsize(struct crypto_alg *alg);
|
||||||
|
|
||||||
|
int crypto_type_has_alg(const char *name, const struct crypto_type *frontend,
|
||||||
|
u32 type, u32 mask);
|
||||||
|
|
||||||
static inline struct crypto_alg *crypto_alg_get(struct crypto_alg *alg)
|
static inline struct crypto_alg *crypto_alg_get(struct crypto_alg *alg)
|
||||||
{
|
{
|
||||||
atomic_inc(&alg->cra_refcnt);
|
atomic_inc(&alg->cra_refcnt);
|
||||||
|
|
Loading…
Add table
Reference in a new issue