Re: [PATCH] crypto: chacha20poly1305 - Annotate struct chachapoly_ctx with __counted_by()

From: Eric Biggers
Date: Mon Aug 05 2024 - 14:08:31 EST


On Mon, Aug 05, 2024 at 07:52:38PM +0200, Thorsten Blum wrote:
> struct poly_req {
> @@ -611,8 +611,8 @@ static int chachapoly_create(struct crypto_template *tmpl, struct rtattr **tb,
> poly->base.cra_priority) / 2;
> inst->alg.base.cra_blocksize = 1;
> inst->alg.base.cra_alignmask = chacha->base.cra_alignmask;
> - inst->alg.base.cra_ctxsize = sizeof(struct chachapoly_ctx) +
> - ctx->saltlen;
> + inst->alg.base.cra_ctxsize = struct_size_t(struct chachapoly_ctx, salt,
> + ctx->saltlen);

What was wrong with the more straightforward code it had before?

- Eric