Commit 72fa4919 authored by Herbert Xu's avatar Herbert Xu

[CRYPTO] api: Rename crypto_alg_get to crypto_mod_get

The functions crypto_alg_get and crypto_alg_put operates on the crypto
modules rather than the algorithms.  Therefore it makes sense to call
them crypto_mod_get and crypto_alg_put respectively.

This is needed because we need to have real algorithm reference counters
for parameterised algorithms as they can be unregistered from below by
when their parameter algorithms are themselves unregistered.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eaf44088
...@@ -29,12 +29,12 @@ ...@@ -29,12 +29,12 @@
LIST_HEAD(crypto_alg_list); LIST_HEAD(crypto_alg_list);
DECLARE_RWSEM(crypto_alg_sem); DECLARE_RWSEM(crypto_alg_sem);
static inline int crypto_alg_get(struct crypto_alg *alg) static inline int crypto_mod_get(struct crypto_alg *alg)
{ {
return try_module_get(alg->cra_module); return try_module_get(alg->cra_module);
} }
static inline void crypto_alg_put(struct crypto_alg *alg) static inline void crypto_mod_put(struct crypto_alg *alg)
{ {
module_put(alg->cra_module); module_put(alg->cra_module);
} }
...@@ -57,12 +57,12 @@ static struct crypto_alg *crypto_alg_lookup(const char *name) ...@@ -57,12 +57,12 @@ static struct crypto_alg *crypto_alg_lookup(const char *name)
if (!exact && !(fuzzy && q->cra_priority > best)) if (!exact && !(fuzzy && q->cra_priority > best))
continue; continue;
if (unlikely(!crypto_alg_get(q))) if (unlikely(!crypto_mod_get(q)))
continue; continue;
best = q->cra_priority; best = q->cra_priority;
if (alg) if (alg)
crypto_alg_put(alg); crypto_mod_put(alg);
alg = q; alg = q;
if (exact) if (exact)
...@@ -202,7 +202,7 @@ out_free_tfm: ...@@ -202,7 +202,7 @@ out_free_tfm:
kfree(tfm); kfree(tfm);
tfm = NULL; tfm = NULL;
out_put: out_put:
crypto_alg_put(alg); crypto_mod_put(alg);
out: out:
return tfm; return tfm;
} }
...@@ -221,7 +221,7 @@ void crypto_free_tfm(struct crypto_tfm *tfm) ...@@ -221,7 +221,7 @@ void crypto_free_tfm(struct crypto_tfm *tfm)
if (alg->cra_exit) if (alg->cra_exit)
alg->cra_exit(tfm); alg->cra_exit(tfm);
crypto_exit_ops(tfm); crypto_exit_ops(tfm);
crypto_alg_put(alg); crypto_mod_put(alg);
memset(tfm, 0, size); memset(tfm, 0, size);
kfree(tfm); kfree(tfm);
} }
...@@ -305,7 +305,7 @@ int crypto_alg_available(const char *name, u32 flags) ...@@ -305,7 +305,7 @@ int crypto_alg_available(const char *name, u32 flags)
struct crypto_alg *alg = crypto_alg_mod_lookup(name); struct crypto_alg *alg = crypto_alg_mod_lookup(name);
if (alg) { if (alg) {
crypto_alg_put(alg); crypto_mod_put(alg);
ret = 1; ret = 1;
} }
......
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