summaryrefslogtreecommitdiff
path: root/lib/crypto/Makefile
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@kernel.org>2026-03-20 21:09:30 -0700
committerEric Biggers <ebiggers@kernel.org>2026-03-23 17:50:59 -0700
commit9f69f52b462cdaed83b782d0408ce9286f054f92 (patch)
tree9f6b39c904b08c4051ca7da3495c6353792c4471 /lib/crypto/Makefile
parented065bd06ebe8d92d1647d230a14b9c035ad5b30 (diff)
downloadlinux-next-9f69f52b462cdaed83b782d0408ce9286f054f92.tar.gz
linux-next-9f69f52b462cdaed83b782d0408ce9286f054f92.zip
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>
Diffstat (limited to 'lib/crypto/Makefile')
-rw-r--r--lib/crypto/Makefile13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile
index 19c67f70fb38..9c2718012428 100644
--- a/lib/crypto/Makefile
+++ b/lib/crypto/Makefile
@@ -368,13 +368,20 @@ endif # CONFIG_CRYPTO_LIB_SHA3_ARCH
################################################################################
+obj-$(CONFIG_CRYPTO_LIB_SM3) += libsm3.o
+libsm3-y := sm3.o
+ifeq ($(CONFIG_CRYPTO_LIB_SM3_ARCH),y)
+CFLAGS_sm3.o += -I$(src)/$(SRCARCH)
+libsm3-$(CONFIG_ARM64) += arm64/sm3-ce-core.o \
+ arm64/sm3-neon-core.o
+endif # CONFIG_CRYPTO_LIB_SM3_ARCH
+
+################################################################################
+
obj-$(CONFIG_MPILIB) += mpi/
obj-$(CONFIG_CRYPTO_SELFTESTS_FULL) += simd.o
-obj-$(CONFIG_CRYPTO_LIB_SM3) += libsm3.o
-libsm3-y := sm3.o
-
# clean-files must be defined unconditionally
clean-files += arm/sha256-core.S arm/sha512-core.S
clean-files += arm64/sha256-core.S arm64/sha512-core.S