Skip to content

Commit 1315074

Browse files
committed
Merge tag 'libcrypto-updates-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux
Pull crypto library updates from Eric Biggers: "This is the main crypto library pull request for 6.17. The main focus this cycle is on reorganizing the SHA-1 and SHA-2 code, providing high-quality library APIs for SHA-1 and SHA-2 including HMAC support, and establishing conventions for lib/crypto/ going forward: - Migrate the SHA-1 and SHA-512 code (and also SHA-384 which shares most of the SHA-512 code) into lib/crypto/. This includes both the generic and architecture-optimized code. Greatly simplify how the architecture-optimized code is integrated. Add an easy-to-use library API for each SHA variant, including HMAC support. Finally, reimplement the crypto_shash support on top of the library API. - Apply the same reorganization to the SHA-256 code (and also SHA-224 which shares most of the SHA-256 code). This is a somewhat smaller change, due to my earlier work on SHA-256. But this brings in all the same additional improvements that I made for SHA-1 and SHA-512. There are also some smaller changes: - Move the architecture-optimized ChaCha, Poly1305, and BLAKE2s code from arch/$(SRCARCH)/lib/crypto/ to lib/crypto/$(SRCARCH)/. For these algorithms it's just a move, not a full reorganization yet. - Fix the MIPS chacha-core.S to build with the clang assembler. - Fix the Poly1305 functions to work in all contexts. - Fix a performance regression in the x86_64 Poly1305 code. - Clean up the x86_64 SHA-NI optimized SHA-1 assembly code. Note that since the new organization of the SHA code is much simpler, the diffstat of this pull request is negative, despite the addition of new fully-documented library APIs for multiple SHA and HMAC-SHA variants. These APIs will allow further simplifications across the kernel as users start using them instead of the old-school crypto API. (I've already written a lot of such conversion patches, removing over 1000 more lines of code. But most of those will target 6.18 or later)" * tag 'libcrypto-updates-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux: (67 commits) lib/crypto: arm64/sha512-ce: Drop compatibility macros for older binutils lib/crypto: x86/sha1-ni: Convert to use rounds macros lib/crypto: x86/sha1-ni: Minor optimizations and cleanup crypto: sha1 - Remove sha1_base.h lib/crypto: x86/sha1: Migrate optimized code into library lib/crypto: sparc/sha1: Migrate optimized code into library lib/crypto: s390/sha1: Migrate optimized code into library lib/crypto: powerpc/sha1: Migrate optimized code into library lib/crypto: mips/sha1: Migrate optimized code into library lib/crypto: arm64/sha1: Migrate optimized code into library lib/crypto: arm/sha1: Migrate optimized code into library crypto: sha1 - Use same state format as legacy drivers crypto: sha1 - Wrap library and add HMAC support lib/crypto: sha1: Add HMAC support lib/crypto: sha1: Add SHA-1 library functions lib/crypto: sha1: Rename sha1_init() to sha1_init_raw() crypto: x86/sha1 - Rename conflicting symbol lib/crypto: sha2: Add hmac_sha*_init_usingrawkey() lib/crypto: arm/poly1305: Remove unneeded empty weak function lib/crypto: x86/poly1305: Fix performance regression on short messages ...
2 parents a578dd0 + debc1e5 commit 1315074

232 files changed

Lines changed: 4305 additions & 4783 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

MAINTAINERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6412,7 +6412,6 @@ L: linux-crypto@vger.kernel.org
64126412
S: Maintained
64136413
T: git https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git libcrypto-next
64146414
T: git https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git libcrypto-fixes
6415-
F: arch/*/lib/crypto/
64166415
F: lib/crypto/
64176416

64186417
CRYPTO SPEED TEST COMPARE

arch/arm/configs/exynos_defconfig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,6 @@ CONFIG_CRYPTO_USER_API_HASH=m
363363
CONFIG_CRYPTO_USER_API_SKCIPHER=m
364364
CONFIG_CRYPTO_USER_API_RNG=m
365365
CONFIG_CRYPTO_USER_API_AEAD=m
366-
CONFIG_CRYPTO_SHA1_ARM_NEON=m
367-
CONFIG_CRYPTO_SHA512_ARM=m
368366
CONFIG_CRYPTO_AES_ARM_BS=m
369367
CONFIG_CRYPTO_CHACHA20_NEON=m
370368
CONFIG_CRYPTO_DEV_EXYNOS_RNG=y

arch/arm/configs/milbeaut_m10v_defconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,6 @@ CONFIG_CRYPTO_SELFTESTS=y
9898
CONFIG_CRYPTO_AES=y
9999
CONFIG_CRYPTO_SEQIV=m
100100
CONFIG_CRYPTO_GHASH_ARM_CE=m
101-
CONFIG_CRYPTO_SHA1_ARM_NEON=m
102-
CONFIG_CRYPTO_SHA1_ARM_CE=m
103-
CONFIG_CRYPTO_SHA512_ARM=m
104101
CONFIG_CRYPTO_AES_ARM=m
105102
CONFIG_CRYPTO_AES_ARM_BS=m
106103
CONFIG_CRYPTO_AES_ARM_CE=m

arch/arm/configs/multi_v7_defconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,9 +1280,6 @@ CONFIG_CRYPTO_USER_API_SKCIPHER=m
12801280
CONFIG_CRYPTO_USER_API_RNG=m
12811281
CONFIG_CRYPTO_USER_API_AEAD=m
12821282
CONFIG_CRYPTO_GHASH_ARM_CE=m
1283-
CONFIG_CRYPTO_SHA1_ARM_NEON=m
1284-
CONFIG_CRYPTO_SHA1_ARM_CE=m
1285-
CONFIG_CRYPTO_SHA512_ARM=m
12861283
CONFIG_CRYPTO_AES_ARM=m
12871284
CONFIG_CRYPTO_AES_ARM_BS=m
12881285
CONFIG_CRYPTO_AES_ARM_CE=m

arch/arm/configs/omap2plus_defconfig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,8 +704,6 @@ CONFIG_NLS_ISO8859_1=y
704704
CONFIG_SECURITY=y
705705
CONFIG_CRYPTO_MICHAEL_MIC=y
706706
CONFIG_CRYPTO_GHASH_ARM_CE=m
707-
CONFIG_CRYPTO_SHA1_ARM_NEON=m
708-
CONFIG_CRYPTO_SHA512_ARM=m
709707
CONFIG_CRYPTO_AES_ARM=m
710708
CONFIG_CRYPTO_AES_ARM_BS=m
711709
CONFIG_CRYPTO_CHACHA20_NEON=m

arch/arm/configs/pxa_defconfig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,8 +658,6 @@ CONFIG_CRYPTO_ANUBIS=m
658658
CONFIG_CRYPTO_XCBC=m
659659
CONFIG_CRYPTO_DEFLATE=y
660660
CONFIG_CRYPTO_LZO=y
661-
CONFIG_CRYPTO_SHA1_ARM=m
662-
CONFIG_CRYPTO_SHA512_ARM=m
663661
CONFIG_CRYPTO_AES_ARM=m
664662
CONFIG_FONTS=y
665663
CONFIG_FONT_8x8=y

arch/arm/crypto/Kconfig

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -62,47 +62,6 @@ config CRYPTO_BLAKE2B_NEON
6262
much faster than the SHA-2 family and slightly faster than
6363
SHA-1.
6464

65-
config CRYPTO_SHA1_ARM
66-
tristate "Hash functions: SHA-1"
67-
select CRYPTO_SHA1
68-
select CRYPTO_HASH
69-
help
70-
SHA-1 secure hash algorithm (FIPS 180)
71-
72-
Architecture: arm
73-
74-
config CRYPTO_SHA1_ARM_NEON
75-
tristate "Hash functions: SHA-1 (NEON)"
76-
depends on KERNEL_MODE_NEON
77-
select CRYPTO_SHA1_ARM
78-
select CRYPTO_SHA1
79-
select CRYPTO_HASH
80-
help
81-
SHA-1 secure hash algorithm (FIPS 180)
82-
83-
Architecture: arm using
84-
- NEON (Advanced SIMD) extensions
85-
86-
config CRYPTO_SHA1_ARM_CE
87-
tristate "Hash functions: SHA-1 (ARMv8 Crypto Extensions)"
88-
depends on KERNEL_MODE_NEON
89-
select CRYPTO_SHA1_ARM
90-
select CRYPTO_HASH
91-
help
92-
SHA-1 secure hash algorithm (FIPS 180)
93-
94-
Architecture: arm using ARMv8 Crypto Extensions
95-
96-
config CRYPTO_SHA512_ARM
97-
tristate "Hash functions: SHA-384 and SHA-512 (NEON)"
98-
select CRYPTO_HASH
99-
depends on !CPU_V7M
100-
help
101-
SHA-384 and SHA-512 secure hash algorithms (FIPS 180)
102-
103-
Architecture: arm using
104-
- NEON (Advanced SIMD) extensions
105-
10665
config CRYPTO_AES_ARM
10766
tristate "Ciphers: AES"
10867
select CRYPTO_ALGAPI

arch/arm/crypto/Makefile

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,17 @@
55

66
obj-$(CONFIG_CRYPTO_AES_ARM) += aes-arm.o
77
obj-$(CONFIG_CRYPTO_AES_ARM_BS) += aes-arm-bs.o
8-
obj-$(CONFIG_CRYPTO_SHA1_ARM) += sha1-arm.o
9-
obj-$(CONFIG_CRYPTO_SHA1_ARM_NEON) += sha1-arm-neon.o
10-
obj-$(CONFIG_CRYPTO_SHA512_ARM) += sha512-arm.o
118
obj-$(CONFIG_CRYPTO_BLAKE2B_NEON) += blake2b-neon.o
129
obj-$(CONFIG_CRYPTO_NHPOLY1305_NEON) += nhpoly1305-neon.o
1310
obj-$(CONFIG_CRYPTO_CURVE25519_NEON) += curve25519-neon.o
1411

1512
obj-$(CONFIG_CRYPTO_AES_ARM_CE) += aes-arm-ce.o
16-
obj-$(CONFIG_CRYPTO_SHA1_ARM_CE) += sha1-arm-ce.o
1713
obj-$(CONFIG_CRYPTO_GHASH_ARM_CE) += ghash-arm-ce.o
1814

1915
aes-arm-y := aes-cipher-core.o aes-cipher-glue.o
2016
aes-arm-bs-y := aes-neonbs-core.o aes-neonbs-glue.o
21-
sha1-arm-y := sha1-armv4-large.o sha1_glue.o
22-
sha1-arm-neon-y := sha1-armv7-neon.o sha1_neon_glue.o
23-
sha512-arm-neon-$(CONFIG_KERNEL_MODE_NEON) := sha512-neon-glue.o
24-
sha512-arm-y := sha512-core.o sha512-glue.o $(sha512-arm-neon-y)
2517
blake2b-neon-y := blake2b-neon-core.o blake2b-neon-glue.o
26-
sha1-arm-ce-y := sha1-ce-core.o sha1-ce-glue.o
2718
aes-arm-ce-y := aes-ce-core.o aes-ce-glue.o
2819
ghash-arm-ce-y := ghash-ce-core.o ghash-ce-glue.o
2920
nhpoly1305-neon-y := nh-neon-core.o nhpoly1305-neon-glue.o
3021
curve25519-neon-y := curve25519-core.o curve25519-glue.o
31-
32-
quiet_cmd_perl = PERL $@
33-
cmd_perl = $(PERL) $(<) > $(@)
34-
35-
$(obj)/%-core.S: $(src)/%-armv4.pl
36-
$(call cmd,perl)
37-
38-
clean-files += sha512-core.S
39-
40-
aflags-thumb2-$(CONFIG_THUMB2_KERNEL) := -U__thumb2__ -D__thumb2__=1
41-
42-
AFLAGS_sha512-core.o += $(aflags-thumb2-y)

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

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

arch/arm/crypto/sha1_glue.c

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

0 commit comments

Comments
 (0)