mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-09 02:57:42 -04:00
Instead of providing crypto_shash algorithms for the arch-optimized SHA-256 code, instead implement the SHA-256 library. This is much simpler, it makes the SHA-256 library functions be arch-optimized, and it fixes the longstanding issue where the arch-optimized SHA-256 was disabled by default. SHA-256 still remains available through crypto_shash, but individual architectures no longer need to handle it. To merge the scalar, NEON, and CE code all into one module cleanly, add !CPU_V7M as a direct dependency of the CE code. Previously, !CPU_V7M was only a direct dependency of the scalar and NEON code. The result is still the same because CPU_V7M implies !KERNEL_MODE_NEON, so !CPU_V7M was already an indirect dependency of the CE code. To match sha256_blocks_arch(), change the type of the nblocks parameter of the assembly functions from int to size_t. The assembly functions actually already treated it as size_t. While renaming the assembly files, also fix the naming quirk where "sha2" meant sha256. (SHA-512 is also part of SHA-2.) Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
33 lines
1.1 KiB
Makefile
33 lines
1.1 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
obj-$(CONFIG_CRYPTO_BLAKE2S_ARM) += libblake2s-arm.o
|
|
libblake2s-arm-y := blake2s-core.o blake2s-glue.o
|
|
|
|
obj-$(CONFIG_CRYPTO_CHACHA20_NEON) += chacha-neon.o
|
|
chacha-neon-y := chacha-scalar-core.o chacha-glue.o
|
|
chacha-neon-$(CONFIG_KERNEL_MODE_NEON) += chacha-neon-core.o
|
|
|
|
obj-$(CONFIG_CRYPTO_POLY1305_ARM) += poly1305-arm.o
|
|
poly1305-arm-y := poly1305-core.o poly1305-glue.o
|
|
|
|
obj-$(CONFIG_CRYPTO_SHA256_ARM) += sha256-arm.o
|
|
sha256-arm-y := sha256.o sha256-core.o
|
|
sha256-arm-$(CONFIG_KERNEL_MODE_NEON) += sha256-ce.o
|
|
|
|
quiet_cmd_perl = PERL $@
|
|
cmd_perl = $(PERL) $(<) > $(@)
|
|
|
|
$(obj)/%-core.S: $(src)/%-armv4.pl
|
|
$(call cmd,perl)
|
|
|
|
clean-files += poly1305-core.S sha256-core.S
|
|
|
|
aflags-thumb2-$(CONFIG_THUMB2_KERNEL) := -U__thumb2__ -D__thumb2__=1
|
|
|
|
# massage the perlasm code a bit so we only get the NEON routine if we need it
|
|
poly1305-aflags-$(CONFIG_CPU_V7) := -U__LINUX_ARM_ARCH__ -D__LINUX_ARM_ARCH__=5
|
|
poly1305-aflags-$(CONFIG_KERNEL_MODE_NEON) := -U__LINUX_ARM_ARCH__ -D__LINUX_ARM_ARCH__=7
|
|
AFLAGS_poly1305-core.o += $(poly1305-aflags-y) $(aflags-thumb2-y)
|
|
|
|
AFLAGS_sha256-core.o += $(aflags-thumb2-y)
|