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]
Date: Fri, 28 Jun 2024 20:12:26 +1000
From: Herbert Xu <herbert@...dor.apana.org.au>
To: WangYuli <wangyuli@...ontech.com>
Cc: davem@...emloft.net, tsbogend@...ha.franken.de,
	linux-crypto@...r.kernel.org, linux-mips@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Guan Wentao <guanwentao@...ontech.com>
Subject: Re: [PATCH] MIPS: crypto: Clean up useless assignment operations

On Fri, Jun 28, 2024 at 04:41:17PM +0800, WangYuli wrote:
> When entering the "len & sizeof(u32)" branch, len must be less than 8.
> So after one operation, len must be less than 4.
> At this time, "len -= sizeof(u32)" is not necessary for 64-bit CPUs.
> 
> A similar issue has been solved at Loongarch.
> 
> Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v6.10-rc5&id=fea1c949f6ca5059e12de00d0483645debc5b206
> Signed-off-by: Guan Wentao <guanwentao@...ontech.com>
> Signed-off-by: WangYuli <wangyuli@...ontech.com>
> ---
>  arch/mips/crypto/crc32-mips.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/mips/crypto/crc32-mips.c b/arch/mips/crypto/crc32-mips.c
> index ec6d58008f8e..505d2d897849 100644
> --- a/arch/mips/crypto/crc32-mips.c
> +++ b/arch/mips/crypto/crc32-mips.c
> @@ -94,7 +94,9 @@ static u32 crc32_mips_le_hw(u32 crc_, const u8 *p, unsigned int len)
>  
>  		CRC32(crc, value, w);
>  		p += sizeof(u32);
> +#ifndef CONFIG_64BIT
>  		len -= sizeof(u32);
> +#endif

First of all, did you verify that this actually makes a difference?
Please post the actual assembly output with and without this patch.

If it does make a difference, you should avoid doing ifdefs as they
are more likely to cause build failures.  Instead do something like

		if (!IS_ENABLED(CONFIG_64BIT))
			len -= sizeof(u32);

Cheers,
-- 
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