linux-yocto/arch/mips
Eric Biggers 87e491d6b4 lib/crypto: mips/chacha: Fix clang build and remove unneeded byteswap
commit 22375adaa0 upstream.

The MIPS32r2 ChaCha code has never been buildable with the clang
assembler.  First, clang doesn't support the 'rotl' pseudo-instruction:

    error: unknown instruction, did you mean: rol, rotr?

Second, clang requires that both operands of the 'wsbh' instruction be
explicitly given:

    error: too few operands for instruction

To fix this, align the code with the real instruction set by (1) using
the real instruction 'rotr' instead of the nonstandard pseudo-
instruction 'rotl', and (2) explicitly giving both operands to 'wsbh'.

To make removing the use of 'rotl' a bit easier, also remove the
unnecessary special-casing for big endian CPUs at
.Lchacha_mips_xor_bytes.  The tail handling is actually
endian-independent since it processes one byte at a time.  On big endian
CPUs the old code byte-swapped SAVED_X, then iterated through it in
reverse order.  But the byteswap and reverse iteration canceled out.

Tested with chacha20poly1305-selftest in QEMU using "-M malta" with both
little endian and big endian mips32r2 kernels.

Fixes: 49aa7c00ed ("crypto: mips/chacha - import 32r2 ChaCha code from Zinc")
Cc: stable@vger.kernel.org
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202505080409.EujEBwA0-lkp@intel.com/
Link: https://lore.kernel.org/r/20250619225535.679301-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-08-28 16:22:49 +02:00
..
alchemy MIPS: Alchemy: Fix an out-of-bound access in db1550_dev_setup() 2024-01-25 14:37:53 -08:00
ar7
ath25
ath79
bcm47xx MIPS: BCM47XX: Cast memcmp() of function to (void *) 2022-10-26 13:25:44 +02:00
bcm63xx MIPS: BCM63xx: Add check for NULL for clk in clk_enable 2023-01-14 10:15:22 +01:00
bmips mips: bmips: BCM6358: make sure CBR is correctly set 2024-07-05 09:12:37 +02:00
boot MIPS: Loongson64: Add missing '#interrupt-cells' for loongson64c_ls7a 2025-06-27 11:04:06 +01:00
cavium-octeon MIPS: OCTEON: warn only once if deprecated link status is being used 2023-01-14 10:15:22 +01:00
cobalt
configs Remove DECnet support from kernel 2023-06-21 15:45:38 +02:00
crypto lib/crypto: mips/chacha: Fix clang build and remove unneeded byteswap 2025-08-28 16:22:49 +02:00
dec MIPS: dec: Declare which_prom() as static 2025-05-02 07:41:08 +02:00
fw MIPS: fw: Allow firmware to pass a empty env 2023-05-17 11:47:33 +02:00
generic
include MIPS: vpe-mt: add missing prototypes for vpe_{alloc,start,stop,free} 2025-08-28 16:22:44 +02:00
ingenic
jazz
kernel MIPS: Don't crash in stack_top() for tasks without ABI or vDSO 2025-08-28 16:22:45 +02:00
kvm MIPS: KVM: Fix a build warning about variable set but not used 2023-12-08 08:46:09 +01:00
lantiq MIPS: vpe-mt: drop physical_memsize 2023-03-11 16:39:45 +01:00
lib
loongson2ef MIPS: Prefer cc-option for additions to cflags 2025-06-27 11:04:10 +01:00
loongson32
loongson64 MIPS: Loongson64: env: Hook up Loongsson-2K 2024-08-19 05:41:02 +02:00
math-emu
mm MIPS: mm: tlb-r4k: Uniquify TLB entries on init 2025-08-28 16:22:38 +02:00
mti-malta
net
netlogic
oprofile
pci MIPS: Octeron: remove source file executable bit 2024-08-19 05:40:52 +02:00
pic32 Revert "clkdev: remove CONFIG_CLKDEV_LOOKUP" 2024-12-19 18:06:12 +01:00
pistachio
power
ralink
rb532
sgi-ip22
sgi-ip27 MIPS: SGI-IP27: Fix platform-device leak in bridge_platform_create() 2022-10-26 13:25:18 +02:00
sgi-ip30 MIPS: ip30: ip30-console: Add missing include 2024-08-19 05:41:01 +02:00
sgi-ip32
sibyte
sni
tools
txx9
vdso mips: Add -std= flag specified in KBUILD_CFLAGS to vdso CFLAGS 2025-06-27 11:04:14 +01:00
vr41xx
Kbuild
Kbuild.platforms
Kconfig Revert "clkdev: remove CONFIG_CLKDEV_LOOKUP" 2024-12-19 18:06:12 +01:00
Kconfig.debug
Makefile mips: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation 2025-06-27 11:04:10 +01:00
Makefile.postlink