lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DA00621C-305F-4126-8D04-9F6D86E959D1@toblux.com>
Date: Mon, 5 Aug 2024 22:32:26 +0200
From: Thorsten Blum <thorsten.blum@...lux.com>
To: Eric Biggers <ebiggers@...nel.org>
Cc: herbert@...dor.apana.org.au,
 davem@...emloft.net,
 kees@...nel.org,
 gustavoars@...nel.org,
 linux-crypto@...r.kernel.org,
 linux-kernel@...r.kernel.org,
 linux-hardening@...r.kernel.org
Subject: Re: [PATCH] crypto: chacha20poly1305 - Annotate struct chachapoly_ctx
 with __counted_by()

On 5. Aug 2024, at 19:59, Eric Biggers <ebiggers@...nel.org> wrote:
> 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?

There's nothing wrong with it, but I find using the helper macro
struct_size_t() more straightforward. It's just a refactoring; happy to
take it out if there's a preference for the open coded version.

Thanks,
Thorsten

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ