[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7740195.jRhZ6ZUK3Y@tauon>
Date: Mon, 18 Aug 2025 15:13:47 +0200
From: Stephan Mueller <smueller@...onox.de>
To: Edward Adam Davis <eadavis@...com>
Cc: herbert@...dor.apana.org.au, davem@...emloft.net, eadavis@...com,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
syzbot+e8bcd7ee3db6cb5cb875@...kaller.appspotmail.com,
syzkaller-bugs@...glegroups.com
Subject: Re: [PATCH V2] crypto: Mark intermediary memory as clean
Am Montag, 18. August 2025, 14:43:36 Mitteleuropäische Sommerzeit schrieb
Edward Adam Davis:
Hi Edward,
> On Mon, 18 Aug 2025 20:30:29 +0800, Herbert Xu wrote:
> > Their values are equal, so why use sizeof to calculate?
> > Similarly, "if (sizeof(intermediary) !=
> > crypto_shash_digestsize(desc->tfm)) {", why not just use
> > SHA3_256_DIGEST_SIZE?
>
> Hi Stephan Mueller, can you explain it?
If the question is why using sizeof(intermediary) instead of
SHA3_256_DIGEST_SIZE, then it is very trivial: I always want to avoid any kind
of double work. If for any reason the buffer size of intermediary changes, the
current code only requires *one* location to fix it.
When changing the branching condition to use SHA3_256_DIGEST_SIZE, we would
have to change *two* locations which is more error-prone than to change one.
This approach is my common coding style to try to minimize the possibilities
where inconsistencies can occur.
Ciao
Stephan
Powered by blists - more mailing lists