Skip to content

Commit 6b9ae8c

Browse files
author
Eric Biggers
committed
lib/crypto: powerpc/sha1: Migrate optimized code into library
Instead of exposing the powerpc-optimized SHA-1 code via powerpc-specific crypto_shash algorithms, instead just implement the sha1_blocks() library function. This is much simpler, it makes the SHA-1 library functions be powerpc-optimized, and it fixes the longstanding issue where the powerpc-optimized SHA-1 code was disabled by default. SHA-1 still remains available through crypto_shash, but individual architectures no longer need to handle it. Note: to see the diff from arch/powerpc/crypto/sha1-spe-glue.c to lib/crypto/powerpc/sha1.h, view this commit with 'git show -M10'. Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20250712232329.818226-11-ebiggers@kernel.org Signed-off-by: Eric Biggers <ebiggers@kernel.org>
1 parent b6ac1da commit 6b9ae8c

12 files changed

Lines changed: 72 additions & 208 deletions

File tree

arch/powerpc/configs/44x/akebono_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,5 @@ CONFIG_PPC_EARLY_DEBUG_44x_PHYSLOW=0x00010000
128128
CONFIG_PPC_EARLY_DEBUG_44x_PHYSHIGH=0x33f
129129
CONFIG_CRYPTO_PCBC=y
130130
CONFIG_CRYPTO_MD5=y
131-
CONFIG_CRYPTO_SHA1_PPC=y
132131
CONFIG_CRYPTO_DES=y
133132
# CONFIG_CRYPTO_HW is not set

arch/powerpc/configs/powernv_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ CONFIG_CRYPTO_PCBC=m
322322
CONFIG_CRYPTO_HMAC=y
323323
CONFIG_CRYPTO_MD5_PPC=m
324324
CONFIG_CRYPTO_MICHAEL_MIC=m
325-
CONFIG_CRYPTO_SHA1_PPC=m
326325
CONFIG_CRYPTO_SHA256=y
327326
CONFIG_CRYPTO_WP512=m
328327
CONFIG_CRYPTO_ANUBIS=m

arch/powerpc/configs/ppc64_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,6 @@ CONFIG_CRYPTO_SHA256=y
388388
CONFIG_CRYPTO_WP512=m
389389
CONFIG_CRYPTO_LZO=m
390390
CONFIG_CRYPTO_MD5_PPC=m
391-
CONFIG_CRYPTO_SHA1_PPC=m
392391
CONFIG_CRYPTO_AES_GCM_P10=m
393392
CONFIG_CRYPTO_DEV_NX=y
394393
CONFIG_CRYPTO_DEV_NX_ENCRYPT=m

arch/powerpc/crypto/Kconfig

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,6 @@ config CRYPTO_MD5_PPC
2323

2424
Architecture: powerpc
2525

26-
config CRYPTO_SHA1_PPC
27-
tristate "Hash functions: SHA-1"
28-
help
29-
SHA-1 secure hash algorithm (FIPS 180)
30-
31-
Architecture: powerpc
32-
33-
config CRYPTO_SHA1_PPC_SPE
34-
tristate "Hash functions: SHA-1 (SPE)"
35-
depends on SPE
36-
help
37-
SHA-1 secure hash algorithm (FIPS 180)
38-
39-
Architecture: powerpc using
40-
- SPE (Signal Processing Engine) extensions
41-
4226
config CRYPTO_AES_PPC_SPE
4327
tristate "Ciphers: AES, modes: ECB/CBC/CTR/XTS (SPE)"
4428
depends on SPE

arch/powerpc/crypto/Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,12 @@
77

88
obj-$(CONFIG_CRYPTO_AES_PPC_SPE) += aes-ppc-spe.o
99
obj-$(CONFIG_CRYPTO_MD5_PPC) += md5-ppc.o
10-
obj-$(CONFIG_CRYPTO_SHA1_PPC) += sha1-powerpc.o
11-
obj-$(CONFIG_CRYPTO_SHA1_PPC_SPE) += sha1-ppc-spe.o
1210
obj-$(CONFIG_CRYPTO_AES_GCM_P10) += aes-gcm-p10-crypto.o
1311
obj-$(CONFIG_CRYPTO_DEV_VMX_ENCRYPT) += vmx-crypto.o
1412
obj-$(CONFIG_CRYPTO_CURVE25519_PPC64) += curve25519-ppc64le.o
1513

1614
aes-ppc-spe-y := aes-spe-core.o aes-spe-keys.o aes-tab-4k.o aes-spe-modes.o aes-spe-glue.o
1715
md5-ppc-y := md5-asm.o md5-glue.o
18-
sha1-powerpc-y := sha1-powerpc-asm.o sha1.o
19-
sha1-ppc-spe-y := sha1-spe-asm.o sha1-spe-glue.o
2016
aes-gcm-p10-crypto-y := aes-gcm-p10-glue.o aes-gcm-p10.o ghashp10-ppc.o aesp10-ppc.o
2117
vmx-crypto-objs := vmx.o aesp8-ppc.o ghashp8-ppc.o aes.o aes_cbc.o aes_ctr.o aes_xts.o ghash.o
2218
curve25519-ppc64le-y := curve25519-ppc64le-core.o curve25519-ppc64le_asm.o

arch/powerpc/crypto/sha1-spe-glue.c

Lines changed: 0 additions & 107 deletions
This file was deleted.

arch/powerpc/crypto/sha1.c

Lines changed: 0 additions & 78 deletions
This file was deleted.

lib/crypto/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ config CRYPTO_LIB_SHA1_ARCH
149149
default y if ARM
150150
default y if ARM64 && KERNEL_MODE_NEON
151151
default y if MIPS && CPU_CAVIUM_OCTEON
152+
default y if PPC
152153

153154
config CRYPTO_LIB_SHA256
154155
tristate

lib/crypto/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ libsha1-$(CONFIG_KERNEL_MODE_NEON) += arm/sha1-armv7-neon.o \
7777
arm/sha1-ce-core.o
7878
endif
7979
libsha1-$(CONFIG_ARM64) += arm64/sha1-ce-core.o
80+
ifeq ($(CONFIG_PPC),y)
81+
libsha1-y += powerpc/sha1-powerpc-asm.o
82+
libsha1-$(CONFIG_SPE) += powerpc/sha1-spe-asm.o
83+
endif
8084
endif # CONFIG_CRYPTO_LIB_SHA1_ARCH
8185

8286
################################################################################

0 commit comments

Comments
 (0)