crypto: make the sha1 library optional
Subsystems (6)
Eric Biggers
maintainercover crypto: make the sha1 library optional
This series makes it possible to build the kernel without SHA-1 support, although for now this is only possible in minimal configurations, due to the uses of SHA-1 in the networking subsystem.
Eric Biggers (2):
crypto: move lib/sha1.c into lib/crypto/
crypto: make the sha1 library optional
crypto/Kconfig | 1 +
init/Kconfig | 1 +
lib/Makefile | 2 +-
lib/crypto/Kconfig | 3 +++
lib/crypto/Makefile | 3 +++
lib/{ => crypto}/sha1.c | 0
net/ipv6/Kconfig | 1 +
7 files changed, 10 insertions(+), 1 deletion(-)
rename lib/{ => crypto}/sha1.c (100%)base-commit: 79e6e2f3f3ff345947075341781e900e4f70db81
Signature · 1 line
2.37.0
Eric Biggers
maintainerPATCH 1/2 crypto: move lib/sha1.c into lib/crypto/
From: Eric Biggers <[email protected]>
SHA-1 is a crypto algorithm (or at least was intended to be -- it's not considered secure anymore), so move it out of the top-level library directory and into lib/crypto/.
---
lib/Makefile | 2 +-
lib/crypto/Makefile | 2 ++
lib/{ => crypto}/sha1.c | 0
3 files changed, 3 insertions(+), 1 deletion(-)
rename lib/{ => crypto}/sha1.c (100%)lib/Makefile +1 -1
@@ -29,7 +29,7 @@ endif lib-y := ctype.o string.o vsprintf.o cmdline.o \ rbtree.o radix-tree.o timerqueue.o xarray.o \ - idr.o extable.o sha1.o irq_regs.o argv_split.o \ + idr.o extable.o irq_regs.o argv_split.o \ flex_proportions.o ratelimit.o show_mem.o \ is_single_threaded.o plist.o decompress.o kobject_uevent.o \ earlycpio.o seq_buf.o siphash.o dec_and_lock.o \
lib/crypto/Makefile +2 -0
@@ -34,6 +34,8 @@ libpoly1305-y := poly1305-donna32.o libpoly1305-$(CONFIG_ARCH_SUPPORTS_INT128) := poly1305-donna64.o libpoly1305-y += poly1305.o +obj-y += sha1.o + obj-$(CONFIG_CRYPTO_LIB_SHA256) += libsha256.o libsha256-y := sha256.o
lib/crypto/sha1.c renamed from lib/sha1.c +0 -0
Signature · 1 line
2.37.0
Eric Biggers
maintainerPATCH 2/2 crypto: make the sha1 library optional
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
Since the Linux RNG no longer uses sha1_transform(), the SHA-1 library is no longer needed unconditionally. Make it possible to build the Linux kernel without the SHA-1 library by putting it behind a kconfig option, and selecting this new option from the kconfig options that gate the remaining users: CRYPTO_SHA1 for crypto/sha1_generic.c, BPF for kernel/bpf/core.c, and IPV6 for net/ipv6/addrconf.c.
Unfortunately, since BPF is selected by NET, for now this can only make a difference for kernels built without networking support.
--- crypto/Kconfig | 1 + init/Kconfig | 1 + lib/crypto/Kconfig | 3 +++ lib/crypto/Makefile | 3 ++- net/ipv6/Kconfig | 1 + 5 files changed, 8 insertions(+), 1 deletion(-)
crypto/Kconfig +1 -0
@@ -880,6 +880,7 @@ config CRYPTO_RMD160 config CRYPTO_SHA1 tristate "SHA1 digest algorithm" select CRYPTO_HASH + select CRYPTO_LIB_SHA1 help SHA-1 secure hash standard (FIPS 180-1/DFIPS 180-2).
init/Kconfig +1 -0
@@ -1472,6 +1472,7 @@ config HAVE_PCSPKR_PLATFORM # interpreter that classic socket filters depend on config BPF bool + select CRYPTO_LIB_SHA1 menuconfig EXPERT bool "Configure standard kernel features (expert users)"
lib/crypto/Kconfig +3 -0
@@ -121,6 +121,9 @@ config CRYPTO_LIB_CHACHA20POLY1305 select CRYPTO_LIB_POLY1305 select CRYPTO_ALGAPI +config CRYPTO_LIB_SHA1 + tristate + config CRYPTO_LIB_SHA256 tristate
lib/crypto/Makefile +2 -1
@@ -34,7 +34,8 @@ libpoly1305-y := poly1305-donna32.o libpoly1305-$(CONFIG_ARCH_SUPPORTS_INT128) := poly1305-donna64.o libpoly1305-y += poly1305.o -obj-y += sha1.o +obj-$(CONFIG_CRYPTO_LIB_SHA1) += libsha1.o +libsha1-y := sha1.o obj-$(CONFIG_CRYPTO_LIB_SHA256) += libsha256.o libsha256-y := sha256.o
net/ipv6/Kconfig +1 -0
@@ -7,6 +7,7 @@ menuconfig IPV6 tristate "The IPv6 protocol" default y + select CRYPTO_LIB_SHA1 help Support for IP version 6 (IPv6).
Signature · 1 line
2.37.0
Re: [PATCH 1/2] crypto: move lib/sha1.c into lib/crypto/
In reply to Eric BiggersQuoted 7 lines · Eric Biggers
From: Eric Biggers <[email protected]>
SHA-1 is a crypto algorithm (or at least was intended to be -- it's not considered secure anymore), so move it out of the top-level library directory and into
lib/crypto/.Signed-off-by Eric Biggers <[email protected]>
Thanks for this.
Quoted 11 lines · Eric Biggers
From: Eric Biggers <[email protected]>
Since the Linux RNG no longer uses
sha1_transform(), the SHA-1 library is no longer needed unconditionally. Make it possible to build the Linux kernel without the SHA-1 library by putting it behind a kconfig option, and selecting this new option from the kconfig options that gate the remaining users:CRYPTO_SHA1forcrypto/sha1_generic.c, BPF forkernel/bpf/core.c, and IPV6 fornet/ipv6/addrconf.c.Unfortunately, since BPF is selected by NET, for now this can only make a difference for kernels built without networking support.
Seems like a step in the right direction, thanks.
Quoted 15 lines · On Sat, 9 Jul 2022 14:18:49 -0700 Eric Biggers wrote:
Since the Linux RNG no longer uses
sha1_transform(), the SHA-1 library is no longer needed unconditionally. Make it possible to build the Linux kernel without the SHA-1 library by putting it behind a kconfig option, and selecting this new option from the kconfig options that gate the remaining users:CRYPTO_SHA1forcrypto/sha1_generic.c, BPF forkernel/bpf/core.c, and IPV6 fornet/ipv6/addrconf.c.Unfortunately, since BPF is selected by NET, for now this can only make a difference for kernels built without networking support.
init/Kconfig +0
-0
init/Kconfig config HAVE_PCSPKR_PLATFORM · line 1476
Quoted 5 lines
init/Kconfig +1
-0@@ -1472,6 +1472,7 @@ config HAVE_PCSPKR_PLATFORM # interpreter that classic socket filters depend on config BPF bool + select CRYPTO_LIB_SHA1
Let's give it an explicit CC: bpf@
net/ipv6/Kconfig line 12
Quoted 11 lines
net/ipv6/Kconfig +1
-0@@ -7,6 +7,7 @@ menuconfig IPV6 tristate "The IPv6 protocol" default y + select CRYPTO_LIB_SHA1 help Support for IP version 6 (IPv6).
FWIW:
Alexei Starovoitov
Acked-byQuoted 38 lines · Jakub Kicinski
Quoted 15 lines · On Sat, 9 Jul 2022 14:18:49 -0700 Eric Biggers wrote:
Since the Linux RNG no longer uses
sha1_transform(), the SHA-1 library is no longer needed unconditionally. Make it possible to build the Linux kernel without the SHA-1 library by putting it behind a kconfig option, and selecting this new option from the kconfig options that gate the remaining users:CRYPTO_SHA1forcrypto/sha1_generic.c, BPF forkernel/bpf/core.c, and IPV6 fornet/ipv6/addrconf.c.Unfortunately, since BPF is selected by NET, for now this can only make a difference for kernels built without networking support.
init/Kconfig +0
-0init/Kconfig config HAVE_PCSPKR_PLATFORM · line 1476
Quoted 5 lines
init/Kconfig +1
-0@@ -1472,6 +1472,7 @@ config HAVE_PCSPKR_PLATFORM # interpreter that classic socket filters depend on config BPF bool + select CRYPTO_LIB_SHA1Let's give it an explicit CC: bpf@
net/ipv6/Kconfig line 12
Quoted 11 lines
net/ipv6/Kconfig +1
-0@@ -7,6 +7,7 @@ menuconfig IPV6 tristate "The IPv6 protocol" default y + select CRYPTO_LIB_SHA1 help Support for IP version 6 (IPv6).FWIW:
Quoted 1 line
Acked-by Jakub Kicinski <[email protected]>
I believe I found the right full patch set in lore. In the future (if there are follow ups) please cc the full patchset to us.
Thanks!
Herbert Xu
maintainerQuoted 16 lines · Eric Biggers
This series makes it possible to build the kernel without SHA-1 support, although for now this is only possible in minimal configurations, due to the uses of SHA-1 in the networking subsystem.
Eric Biggers (2):
crypto: movelib/sha1.cintolib/crypto/
crypto: make the sha1 library optionalcrypto/Kconfig | 1 + init/Kconfig | 1 + lib/Makefile | 2 +- lib/crypto/Kconfig | 3 +++ lib/crypto/Makefile | 3 +++ lib/{ => crypto}/sha1.c | 0 net/ipv6/Kconfig | 1 + 7 files changed, 10 insertions(+), 1 deletion(-)
Quoted 4 lines
rename lib/{ =>
crypto}/sha1.c(100%)base-commit:
79e6e2f3f3ff345947075341781e900e4f70db81
All applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Quoted 20 lines · Herbert Xu
Quoted 19 lines · Eric Biggers
This series makes it possible to build the kernel without SHA-1 support, although for now this is only possible in minimal configurations, due to the uses of SHA-1 in the networking subsystem.
Eric Biggers (2):
crypto: movelib/sha1.cintolib/crypto/
crypto: make the sha1 library optionalcrypto/Kconfig | 1 + init/Kconfig | 1 + lib/Makefile | 2 +- lib/crypto/Kconfig | 3 +++ lib/crypto/Makefile | 3 +++ lib/{ => crypto}/sha1.c | 0 net/ipv6/Kconfig | 1 + 7 files changed, 10 insertions(+), 1 deletion(-)rename lib/{ =>
crypto}/sha1.c(100%)
Quoted 3 lines
Quoted 1 line
base-commit:
79e6e2f3f3ff345947075341781e900e4f70db81All applied. Thanks.
Eric,
linux-next-20220718 has a build error:
ERROR: modpost: missing MODULE_LICENSE() in lib/crypto/libsha1.o
Signature · 1 line
~Randy
Eric Biggers
maintainerQuoted 23 lines · Randy Dunlap
Quoted 20 lines · Herbert Xu
Quoted 19 lines · Eric Biggers
This series makes it possible to build the kernel without SHA-1 support, although for now this is only possible in minimal configurations, due to the uses of SHA-1 in the networking subsystem.
Eric Biggers (2):
crypto: movelib/sha1.cintolib/crypto/
crypto: make the sha1 library optionalcrypto/Kconfig | 1 + init/Kconfig | 1 + lib/Makefile | 2 +- lib/crypto/Kconfig | 3 +++ lib/crypto/Makefile | 3 +++ lib/{ => crypto}/sha1.c | 0 net/ipv6/Kconfig | 1 + 7 files changed, 10 insertions(+), 1 deletion(-)rename lib/{ =>
crypto}/sha1.c(100%)
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
base-commit:
79e6e2f3f3ff345947075341781e900e4f70db81All applied. Thanks.
Eric,
linux-next-20220718 has a build error:ERROR: modpost: missing
MODULE_LICENSE()inlib/crypto/libsha1.o
Thanks, https://lore.kernel.org/r/[email protected]
fixes this.
- Eric