Re: [PATCH V2] crypto: Mark intermediary memory as clean

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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







[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux