[PATCH] lib/crypto: arm64/sha3: Use assembler for sha3 instructions

Ard Biesheuvel ardb at kernel.org
Tue Nov 24 03:11:06 PST 2026



On Sat, 14 Nov 2026, at 21:42, Eric Biggers wrote:
> All supported assemblers (binutils 2.30 and later, and clang 17.0.1 and
> later) support the sha3 instructions now.
>
> Therefore, drop the use of '.inst' in sha3-ce-core.S and just have the
> assembler generate the instructions.
>
> This requires adding '.arch armv8.2-a+sha3'.  I also tried just
> '.arch_extension sha3', but that doesn't work with binutils 2.40 and
> earlier because they consider sha3 to depend on armv8.2-a or later (and
> this file isn't built with -march=armv8.2-a or later).  This was fixed
> in binutils 2.41 commit 205e4380c800, but the kernel currently supports
> binutils 2.30 and later.
>
> Also prefix the immediate operands to 'xar' with '#', now that they no
> longer need to be plain numbers to generate an .inst.  This isn't
> required, but it follows the standard convention for immediates in arm64
> assembly, including elsewhere in the same file.
>
> No change in the resulting .text section with either binutils or clang.
>
> Signed-off-by: Eric Biggers <ebiggers at kernel.org>
> ---
>
> This patch is intended to be taken through libcrypto-next
>
>  lib/crypto/arm64/sha3-ce-core.S | 73 ++++++++++++---------------------
>  1 file changed, 26 insertions(+), 47 deletions(-)
>

Acked-by: Ard Biesheuvel <ardb at kernel.org>



More information about the linux-arm-kernel mailing list