[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y5jWUytRsZatKmCk@sol.localdomain>
Date: Tue, 13 Dec 2022 11:45:23 -0800
From: Eric Biggers <ebiggers@...nel.org>
To: Herbert Xu <herbert@...dor.apana.org.au>
Cc: Ard Biesheuvel <ardb@...nel.org>,
kernel test robot <lkp@...el.com>,
Robert Elliott <elliott@....com>, llvm@...ts.linux.dev,
oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
Linux Crypto Mailing List <linux-crypto@...r.kernel.org>
Subject: Re: [PATCH] crypto: arm/sha1 - Fix clang function cast warnings
On Tue, Dec 13, 2022 at 06:43:30PM +0800, Herbert Xu wrote:
> -asmlinkage void sha1_block_data_order(u32 *digest,
> - const unsigned char *data, unsigned int rounds);
> +asmlinkage void sha1_block_data_order(struct sha1_state *digest,
> + const u8 *data, int rounds);
The last parameter should be called 'blocks', not 'rounds'.
> int sha1_update_arm(struct shash_desc *desc, const u8 *data,
> unsigned int len)
> {
> - /* make sure casting to sha1_block_fn() is safe */
> + /* make sure signature matches sha1_block_fn() */
> BUILD_BUG_ON(offsetof(struct sha1_state, state) != 0);
The above comment doesn't really make sense, since making sure function
signatures match is the responsibility of the compiler.
A better comment would be:
/* sha1_block_data_order() expects the actual state at the beginning. */
It would also be helpful to add a comment to the definition of struct
sha1_state, analogous to the comment in struct blake2s_state:
struct sha1_state {
/* 'state' is used by assembly code, so keep it as-is. */
u32 state[SHA1_DIGEST_SIZE / 4];
- Eric
Powered by blists - more mailing lists