aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2015-04-02 10:39:40 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2015-04-03 05:53:32 -0400
commit87b1675634e1e9f1570445c55604204771ac9078 (patch)
tree94de40f13b4e73cb4e925278a2119a8bdf3df764
parent1f7237109951ebe8dc194461716443a5d8caf308 (diff)
crypto: api - Change crypto_unregister_instance argument type
This patch makes crypto_unregister_instance take a crypto_instance instead of a crypto_alg. This allows us to remove a duplicate CRYPTO_ALG_INSTANCE check in crypto_unregister_instance. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--crypto/algapi.c8
-rw-r--r--crypto/crypto_user.c2
-rw-r--r--include/crypto/algapi.h2
3 files changed, 4 insertions, 8 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c
index 0f1976eceb27..f1d0307b1d08 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -551,17 +551,13 @@ err:
551} 551}
552EXPORT_SYMBOL_GPL(crypto_register_instance); 552EXPORT_SYMBOL_GPL(crypto_register_instance);
553 553
554int crypto_unregister_instance(struct crypto_alg *alg) 554int crypto_unregister_instance(struct crypto_instance *inst)
555{ 555{
556 struct crypto_instance *inst = (void *)alg;
557 LIST_HEAD(list); 556 LIST_HEAD(list);
558 557
559 if (!(alg->cra_flags & CRYPTO_ALG_INSTANCE))
560 return -EINVAL;
561
562 down_write(&crypto_alg_sem); 558 down_write(&crypto_alg_sem);
563 559
564 crypto_remove_spawns(alg, &list, NULL); 560 crypto_remove_spawns(&inst->alg, &list, NULL);
565 crypto_remove_instance(inst, &list); 561 crypto_remove_instance(inst, &list);
566 562
567 up_write(&crypto_alg_sem); 563 up_write(&crypto_alg_sem);
diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c
index c5148a35ae0a..eab249723830 100644
--- a/crypto/crypto_user.c
+++ b/crypto/crypto_user.c
@@ -316,7 +316,7 @@ static int crypto_del_alg(struct sk_buff *skb, struct nlmsghdr *nlh,
316 if (atomic_read(&alg->cra_refcnt) != 1) 316 if (atomic_read(&alg->cra_refcnt) != 1)
317 return -EBUSY; 317 return -EBUSY;
318 318
319 return crypto_unregister_instance(alg); 319 return crypto_unregister_instance((struct crypto_instance *)alg);
320} 320}
321 321
322static struct crypto_alg *crypto_user_skcipher_alg(const char *name, u32 type, 322static struct crypto_alg *crypto_user_skcipher_alg(const char *name, u32 type,
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index 623a59c1ff5a..0ecb7688af71 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -137,7 +137,7 @@ struct crypto_template *crypto_lookup_template(const char *name);
137 137
138int crypto_register_instance(struct crypto_template *tmpl, 138int crypto_register_instance(struct crypto_template *tmpl,
139 struct crypto_instance *inst); 139 struct crypto_instance *inst);
140int crypto_unregister_instance(struct crypto_alg *alg); 140int crypto_unregister_instance(struct crypto_instance *inst);
141 141
142int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg, 142int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg,
143 struct crypto_instance *inst, u32 mask); 143 struct crypto_instance *inst, u32 mask);