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

Commit 846f97df authored by Herbert Xu's avatar Herbert Xu
Browse files

crypto: pcrypt - Propagate new AEAD implementation flag



This patch allows the CRYPTO_ALG_AEAD_NEW flag to be propagated.

It also restores the ASYNC bit that went missing during the AEAD
conversion.

Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent ba75e15f
Loading
Loading
Loading
Loading
+11 −1
Original line number Original line Diff line number Diff line
@@ -274,11 +274,16 @@ static int pcrypt_create_aead(struct crypto_template *tmpl, struct rtattr **tb,
			      u32 type, u32 mask)
			      u32 type, u32 mask)
{
{
	struct pcrypt_instance_ctx *ctx;
	struct pcrypt_instance_ctx *ctx;
	struct crypto_attr_type *algt;
	struct aead_instance *inst;
	struct aead_instance *inst;
	struct aead_alg *alg;
	struct aead_alg *alg;
	const char *name;
	const char *name;
	int err;
	int err;


	algt = crypto_get_attr_type(tb);
	if (IS_ERR(algt))
		return PTR_ERR(algt);

	name = crypto_attr_alg_name(tb[1]);
	name = crypto_attr_alg_name(tb[1]);
	if (IS_ERR(name))
	if (IS_ERR(name))
		return PTR_ERR(name);
		return PTR_ERR(name);
@@ -290,7 +295,9 @@ static int pcrypt_create_aead(struct crypto_template *tmpl, struct rtattr **tb,
	ctx = aead_instance_ctx(inst);
	ctx = aead_instance_ctx(inst);
	crypto_set_aead_spawn(&ctx->spawn, aead_crypto_instance(inst));
	crypto_set_aead_spawn(&ctx->spawn, aead_crypto_instance(inst));


	err = crypto_grab_aead(&ctx->spawn, name, 0, 0);
	err = crypto_grab_aead(&ctx->spawn, name,
			       algt->type & CRYPTO_ALG_AEAD_NEW,
			       algt->mask & CRYPTO_ALG_AEAD_NEW);
	if (err)
	if (err)
		goto out_free_inst;
		goto out_free_inst;


@@ -299,6 +306,9 @@ static int pcrypt_create_aead(struct crypto_template *tmpl, struct rtattr **tb,
	if (err)
	if (err)
		goto out_drop_aead;
		goto out_drop_aead;


	inst->alg.base.cra_flags = CRYPTO_ALG_ASYNC;
	inst->alg.base.cra_flags |= alg->base.cra_flags & CRYPTO_ALG_AEAD_NEW;

	inst->alg.ivsize = crypto_aead_alg_ivsize(alg);
	inst->alg.ivsize = crypto_aead_alg_ivsize(alg);
	inst->alg.maxauthsize = crypto_aead_alg_maxauthsize(alg);
	inst->alg.maxauthsize = crypto_aead_alg_maxauthsize(alg);