Skip to content

Commit 1e1b6db

Browse files
committed
arm/crc32: expose CRC32 functions through lib
Move the arm CRC32 assembly code into the lib directory and wire it up to the library interface. This allows it to be used without going through the crypto API. It remains usable via the crypto API too via the shash algorithms that use the library interface. Thus all the arch-specific "shash" code becomes unnecessary and is removed. Note: to see the diff from arch/arm/crypto/crc32-ce-glue.c to arch/arm/lib/crc32-glue.c, view this commit with 'git show -M10'. Reviewed-by: Ard Biesheuvel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Eric Biggers <[email protected]>
1 parent 780acb2 commit 1e1b6db

File tree

9 files changed

+129
-268
lines changed

9 files changed

+129
-268
lines changed

arch/arm/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ config ARM
77
select ARCH_HAS_BINFMT_FLAT
88
select ARCH_HAS_CPU_CACHE_ALIASING
99
select ARCH_HAS_CPU_FINALIZE_INIT if MMU
10+
select ARCH_HAS_CRC32 if KERNEL_MODE_NEON
1011
select ARCH_HAS_CURRENT_STACK_POINTER
1112
select ARCH_HAS_DEBUG_VIRTUAL if MMU
1213
select ARCH_HAS_DMA_ALLOC if MMU

arch/arm/configs/milbeaut_m10v_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ CONFIG_CRYPTO_AES_ARM=m
107107
CONFIG_CRYPTO_AES_ARM_BS=m
108108
CONFIG_CRYPTO_AES_ARM_CE=m
109109
CONFIG_CRYPTO_CHACHA20_NEON=m
110-
CONFIG_CRYPTO_CRC32_ARM_CE=m
111110
# CONFIG_CRYPTO_HW is not set
112111
CONFIG_CRC_CCITT=m
113112
CONFIG_CRC_ITU_T=m

arch/arm/configs/multi_v7_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1306,7 +1306,6 @@ CONFIG_CRYPTO_AES_ARM=m
13061306
CONFIG_CRYPTO_AES_ARM_BS=m
13071307
CONFIG_CRYPTO_AES_ARM_CE=m
13081308
CONFIG_CRYPTO_CHACHA20_NEON=m
1309-
CONFIG_CRYPTO_CRC32_ARM_CE=m
13101309
CONFIG_CRYPTO_DEV_SUN4I_SS=m
13111310
CONFIG_CRYPTO_DEV_FSL_CAAM=m
13121311
CONFIG_CRYPTO_DEV_EXYNOS_RNG=m

arch/arm/crypto/Kconfig

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -222,20 +222,6 @@ config CRYPTO_CHACHA20_NEON
222222
Architecture: arm using:
223223
- NEON (Advanced SIMD) extensions
224224

225-
config CRYPTO_CRC32_ARM_CE
226-
tristate "CRC32C and CRC32"
227-
depends on KERNEL_MODE_NEON
228-
depends on CRC32
229-
select CRYPTO_HASH
230-
help
231-
CRC32c CRC algorithm with the iSCSI polynomial (RFC 3385 and RFC 3720)
232-
and CRC32 CRC algorithm (IEEE 802.3)
233-
234-
Architecture: arm using:
235-
- CRC and/or PMULL instructions
236-
237-
Drivers: crc32-arm-ce and crc32c-arm-ce
238-
239225
config CRYPTO_CRCT10DIF_ARM_CE
240226
tristate "CRCT10DIF"
241227
depends on KERNEL_MODE_NEON

arch/arm/crypto/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ obj-$(CONFIG_CRYPTO_SHA1_ARM_CE) += sha1-arm-ce.o
2121
obj-$(CONFIG_CRYPTO_SHA2_ARM_CE) += sha2-arm-ce.o
2222
obj-$(CONFIG_CRYPTO_GHASH_ARM_CE) += ghash-arm-ce.o
2323
obj-$(CONFIG_CRYPTO_CRCT10DIF_ARM_CE) += crct10dif-arm-ce.o
24-
obj-$(CONFIG_CRYPTO_CRC32_ARM_CE) += crc32-arm-ce.o
2524

2625
aes-arm-y := aes-cipher-core.o aes-cipher-glue.o
2726
aes-arm-bs-y := aes-neonbs-core.o aes-neonbs-glue.o
@@ -38,7 +37,6 @@ sha2-arm-ce-y := sha2-ce-core.o sha2-ce-glue.o
3837
aes-arm-ce-y := aes-ce-core.o aes-ce-glue.o
3938
ghash-arm-ce-y := ghash-ce-core.o ghash-ce-glue.o
4039
crct10dif-arm-ce-y := crct10dif-ce-core.o crct10dif-ce-glue.o
41-
crc32-arm-ce-y:= crc32-ce-core.o crc32-ce-glue.o
4240
chacha-neon-y := chacha-scalar-core.o chacha-glue.o
4341
chacha-neon-$(CONFIG_KERNEL_MODE_NEON) += chacha-neon-core.o
4442
poly1305-arm-y := poly1305-core.o poly1305-glue.o

arch/arm/crypto/crc32-ce-glue.c

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

arch/arm/lib/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,6 @@ ifeq ($(CONFIG_KERNEL_MODE_NEON),y)
4545
endif
4646

4747
obj-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o
48+
49+
obj-$(CONFIG_CRC32_ARCH) += crc32-arm.o
50+
crc32-arm-y := crc32-glue.o crc32-core.o

arch/arm/crypto/crc32-ce-core.S renamed to arch/arm/lib/crc32-core.S

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
*/
4949

5050
#include <linux/linkage.h>
51-
#include <linux/cfi_types.h>
5251
#include <asm/assembler.h>
5352

5453
.text
@@ -297,11 +296,11 @@ ARM_BE8(rev16 r3, r3 )
297296
.endm
298297

299298
.align 5
300-
SYM_TYPED_FUNC_START(crc32_armv8_le)
299+
SYM_FUNC_START(crc32_armv8_le)
301300
__crc32
302301
SYM_FUNC_END(crc32_armv8_le)
303302

304303
.align 5
305-
SYM_TYPED_FUNC_START(crc32c_armv8_le)
304+
SYM_FUNC_START(crc32c_armv8_le)
306305
__crc32 c
307306
SYM_FUNC_END(crc32c_armv8_le)

0 commit comments

Comments
 (0)