Re: [PATCH] [v2] ARM: crypto: fix function cast warnings

From: Herbert Xu
Date: Fri Feb 23 2024 - 19:50:35 EST


On Tue, Feb 13, 2024 at 02:49:46PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> clang-16 warns about casting between incompatible function types:
>
> arch/arm/crypto/sha256_glue.c:37:5: error: cast from 'void (*)(u32 *, const void *, unsigned int)' (aka 'void (*)(unsigned int *, const void *, unsigned int)') to 'sha256_block_fn *' (aka 'void (*)(struct sha256_state *, const unsigned char *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
> 37 | (sha256_block_fn *)sha256_block_data_order);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> arch/arm/crypto/sha512-glue.c:34:3: error: cast from 'void (*)(u64 *, const u8 *, int)' (aka 'void (*)(unsigned long long *, const unsigned char *, int)') to 'sha512_block_fn *' (aka 'void (*)(struct sha512_state *, const unsigned char *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
> 34 | (sha512_block_fn *)sha512_block_data_order);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Fix the prototypes for the assembler functions to match the typedef.
> The code already relies on the digest being the first part of the
> state structure, so there is no change in behavior.
>
> Fixes: c80ae7ca3726 ("crypto: arm/sha512 - accelerated SHA-512 using ARM generic ASM and NEON")
> Fixes: b59e2ae3690c ("crypto: arm/sha256 - move SHA-224/256 ASM/NEON implementation to base layer")
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> ---
> v2: rewrite change as suggested by Herbert Xu.
> ---
> arch/arm/crypto/sha256_glue.c | 13 +++++--------
> arch/arm/crypto/sha512-glue.c | 12 +++++-------
> 2 files changed, 10 insertions(+), 15 deletions(-)

Patch applied. Thanks.
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt