lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMj1kXHrPb+cNbnAC5u=6s7HF_osEbu0WPeDV6+69nUSe2evMA@mail.gmail.com>
Date:   Tue, 13 Dec 2022 12:11:47 +0100
From:   Ard Biesheuvel <ardb@...nel.org>
To:     Herbert Xu <herbert@...dor.apana.org.au>
Cc:     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, 13 Dec 2022 at 11:43, Herbert Xu <herbert@...dor.apana.org.au> wrote:
>
> On Thu, Dec 08, 2022 at 07:05:45PM +0100, Ard Biesheuvel wrote:
> >
> > We can, as the BUILD_BUG() will catch it if struct sha1_state gets
> > modified in an incompatible way.
>
> Thanks for confirming!
>
> ---8<---
> Instead of casting the function which upsets clang for some reason,
> change the assembly function siganture instead.
>
> Reported-by: kernel test robot <lkp@...el.com>
> Signed-off-by: Herbert Xu <herbert@...dor.apana.org.au>

Reviewed-by: Ard Biesheuvel <ardb@...nel.org>

>
> diff --git a/arch/arm/crypto/sha1_glue.c b/arch/arm/crypto/sha1_glue.c
> index 6c2b849e459d..95a727bcd664 100644
> --- a/arch/arm/crypto/sha1_glue.c
> +++ b/arch/arm/crypto/sha1_glue.c
> @@ -21,31 +21,29 @@
>
>  #include "sha1.h"
>
> -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);
>
>  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);
>
> -       return sha1_base_do_update(desc, data, len,
> -                                  (sha1_block_fn *)sha1_block_data_order);
> +       return sha1_base_do_update(desc, data, len, sha1_block_data_order);
>  }
>  EXPORT_SYMBOL_GPL(sha1_update_arm);
>
>  static int sha1_final(struct shash_desc *desc, u8 *out)
>  {
> -       sha1_base_do_finalize(desc, (sha1_block_fn *)sha1_block_data_order);
> +       sha1_base_do_finalize(desc, sha1_block_data_order);
>         return sha1_base_finish(desc, out);
>  }
>
>  int sha1_finup_arm(struct shash_desc *desc, const u8 *data,
>                    unsigned int len, u8 *out)
>  {
> -       sha1_base_do_update(desc, data, len,
> -                           (sha1_block_fn *)sha1_block_data_order);
> +       sha1_base_do_update(desc, data, len, sha1_block_data_order);
>         return sha1_final(desc, out);
>  }
>  EXPORT_SYMBOL_GPL(sha1_finup_arm);
> --
> Email: Herbert Xu <herbert@...dor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ