]> git.ipfire.org Git - thirdparty/linux.git/commit
lib/crypto: arm64/sm3: Migrate optimized code into library
authorEric Biggers <ebiggers@kernel.org>
Sat, 21 Mar 2026 04:09:30 +0000 (21:09 -0700)
committerEric Biggers <ebiggers@kernel.org>
Tue, 24 Mar 2026 00:50:59 +0000 (17:50 -0700)
commit9f69f52b462cdaed83b782d0408ce9286f054f92
tree9f6b39c904b08c4051ca7da3495c6353792c4471
parented065bd06ebe8d92d1647d230a14b9c035ad5b30
lib/crypto: arm64/sm3: Migrate optimized code into library

Instead of exposing the arm64-optimized SM3 code via arm64-specific
crypto_shash algorithms, instead just implement the sm3_blocks() library
function.  This is much simpler, it makes the SM3 library functions be
arm64-optimized, and it fixes the longstanding issue where the
arm64-optimized SM3 code was disabled by default.  SM3 still remains
available through crypto_shash, but individual architectures no longer
need to handle it.

Tweak the SM3 assembly function prototypes to match what the library
expects, including changing the block count from 'int' to 'size_t'.
sm3_ce_transform() had to be updated to access 'x2' instead of 'w2',
while sm3_neon_transform() already used 'x2'.

Remove the CFI stubs which are no longer needed because the SM3 assembly
functions are no longer ever indirectly called.

Remove the dependency on KERNEL_MODE_NEON.  It was unnecessary, because
KERNEL_MODE_NEON is always enabled on arm64.

Acked-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20260321040935.410034-8-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
arch/arm64/configs/defconfig
arch/arm64/crypto/Kconfig
arch/arm64/crypto/Makefile
arch/arm64/crypto/sm3-ce-glue.c [deleted file]
arch/arm64/crypto/sm3-neon-glue.c [deleted file]
lib/crypto/Kconfig
lib/crypto/Makefile
lib/crypto/arm64/sm3-ce-core.S [moved from arch/arm64/crypto/sm3-ce-core.S with 93% similarity]
lib/crypto/arm64/sm3-neon-core.S [moved from arch/arm64/crypto/sm3-neon-core.S with 98% similarity]
lib/crypto/arm64/sm3.h [new file with mode: 0644]