Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 87b16756 authored by Herbert Xu's avatar Herbert Xu
Browse files

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: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 1f723710
Loading
Loading
Loading
Loading
+2 −6
Original line number Original line Diff line number Diff line
@@ -551,17 +551,13 @@ int crypto_register_instance(struct crypto_template *tmpl,
}
}
EXPORT_SYMBOL_GPL(crypto_register_instance);
EXPORT_SYMBOL_GPL(crypto_register_instance);


int crypto_unregister_instance(struct crypto_alg *alg)
int crypto_unregister_instance(struct crypto_instance *inst)
{
{
	struct crypto_instance *inst = (void *)alg;
	LIST_HEAD(list);
	LIST_HEAD(list);


	if (!(alg->cra_flags & CRYPTO_ALG_INSTANCE))
		return -EINVAL;

	down_write(&crypto_alg_sem);
	down_write(&crypto_alg_sem);


	crypto_remove_spawns(alg, &list, NULL);
	crypto_remove_spawns(&inst->alg, &list, NULL);
	crypto_remove_instance(inst, &list);
	crypto_remove_instance(inst, &list);


	up_write(&crypto_alg_sem);
	up_write(&crypto_alg_sem);
+1 −1
Original line number Original line Diff line number Diff line
@@ -316,7 +316,7 @@ static int crypto_del_alg(struct sk_buff *skb, struct nlmsghdr *nlh,
	if (atomic_read(&alg->cra_refcnt) != 1)
	if (atomic_read(&alg->cra_refcnt) != 1)
		return -EBUSY;
		return -EBUSY;


	return crypto_unregister_instance(alg);
	return crypto_unregister_instance((struct crypto_instance *)alg);
}
}


static struct crypto_alg *crypto_user_skcipher_alg(const char *name, u32 type,
static struct crypto_alg *crypto_user_skcipher_alg(const char *name, u32 type,
+1 −1
Original line number Original line Diff line number Diff line
@@ -137,7 +137,7 @@ struct crypto_template *crypto_lookup_template(const char *name);


int crypto_register_instance(struct crypto_template *tmpl,
int crypto_register_instance(struct crypto_template *tmpl,
			     struct crypto_instance *inst);
			     struct crypto_instance *inst);
int crypto_unregister_instance(struct crypto_alg *alg);
int crypto_unregister_instance(struct crypto_instance *inst);


int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg,
int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg,
		      struct crypto_instance *inst, u32 mask);
		      struct crypto_instance *inst, u32 mask);