public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Ard Biesheuvel <ardb@kernel.org>,
	kernel test robot <lkp@intel.com>,
	Robert Elliott <elliott@hpe.com>,
	llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	linux-kernel@vger.kernel.org,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>
Subject: Re: [PATCH] crypto: arm/sha1 - Fix clang function cast warnings
Date: Tue, 13 Dec 2022 11:45:23 -0800	[thread overview]
Message-ID: <Y5jWUytRsZatKmCk@sol.localdomain> (raw)
In-Reply-To: <Y5hXUlvSmHrP8PTN@gondor.apana.org.au>

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

      parent reply	other threads:[~2022-12-13 19:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-04 11:33 arch/arm/crypto/sha1_glue.c:34:8: warning: cast from 'void (*)(u32 *, const unsigned char *, unsigned int)' (aka 'void (*)(unsigned int *, const unsigned char *, unsigned int)') to 'sha1_block_fn *' (aka 'void (*)(struct sha1_state *, const unsigned char kernel test robot
2022-12-08  4:58 ` Herbert Xu
2022-12-08 18:05   ` Ard Biesheuvel
2022-12-13 10:43     ` [PATCH] crypto: arm/sha1 - Fix clang function cast warnings Herbert Xu
2022-12-13 11:11       ` Ard Biesheuvel
2022-12-13 15:19       ` Elliott, Robert (Servers)
2022-12-13 19:45       ` Eric Biggers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y5jWUytRsZatKmCk@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=ardb@kernel.org \
    --cc=elliott@hpe.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox