linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v5 0/3] esp, ah: improve crypto algorithm selections
@ 2020-06-15 22:13 Eric Biggers
  2020-06-15 22:13 ` [PATCH net v5 1/3] esp, ah: consolidate the " Eric Biggers
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Eric Biggers @ 2020-06-15 22:13 UTC (permalink / raw)
  To: netdev
  Cc: linux-crypto, Corentin Labbe, Greg Kroah-Hartman, Herbert Xu,
	Steffen Klassert

This series consolidates and modernizes the lists of crypto algorithms
that are selected by the IPsec kconfig options, and adds CRYPTO_SEQIV
since it no longer gets selected automatically by other things.

See previous discussion at
https://lkml.kernel.org/netdev/20200604192322.22142-1-ebiggers@kernel.org/T/#u

Changed v4 => v5:
  - Rebased onto latest net/master to resolve conflict with
    "treewide: replace '---help---' in Kconfig files with 'help'"

Changed v3 => v4:
  - Don't say that AH is "NOT RECOMMENDED" by RFC 8221.
  - Updated commit messages (added Acked-by tags, fixed a bad Fixes tag,
    added some more explanation to patch 3).

Eric Biggers (3):
  esp, ah: consolidate the crypto algorithm selections
  esp: select CRYPTO_SEQIV
  esp, ah: modernize the crypto algorithm selections

 net/ipv4/Kconfig | 34 ++++++++++++++++++----------------
 net/ipv6/Kconfig | 34 ++++++++++++++++++----------------
 net/xfrm/Kconfig | 24 ++++++++++++++++++++++++
 3 files changed, 60 insertions(+), 32 deletions(-)

-- 
2.27.0.290.gba653c62da-goog


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net v5 1/3] esp, ah: consolidate the crypto algorithm selections
  2020-06-15 22:13 [PATCH net v5 0/3] esp, ah: improve crypto algorithm selections Eric Biggers
@ 2020-06-15 22:13 ` Eric Biggers
  2020-06-15 22:13 ` [PATCH net v5 2/3] esp: select CRYPTO_SEQIV Eric Biggers
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Eric Biggers @ 2020-06-15 22:13 UTC (permalink / raw)
  To: netdev
  Cc: linux-crypto, Corentin Labbe, Greg Kroah-Hartman, Herbert Xu,
	Steffen Klassert

From: Eric Biggers <ebiggers@google.com>

Instead of duplicating the algorithm selections between INET_AH and
INET6_AH and between INET_ESP and INET6_ESP, create new tristates
XFRM_AH and XFRM_ESP that do the algorithm selections, and make these be
selected by the corresponding INET* options.

Suggested-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Corentin Labbe <clabbe@baylibre.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 net/ipv4/Kconfig | 16 ++--------------
 net/ipv6/Kconfig | 16 ++--------------
 net/xfrm/Kconfig | 20 ++++++++++++++++++++
 3 files changed, 24 insertions(+), 28 deletions(-)

diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index 6ecbb0ced177..c0653de6d00e 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -340,11 +340,7 @@ config NET_FOU_IP_TUNNELS
 
 config INET_AH
 	tristate "IP: AH transformation"
-	select XFRM_ALGO
-	select CRYPTO
-	select CRYPTO_HMAC
-	select CRYPTO_MD5
-	select CRYPTO_SHA1
+	select XFRM_AH
 	help
 	  Support for IPsec AH.
 
@@ -352,15 +348,7 @@ config INET_AH
 
 config INET_ESP
 	tristate "IP: ESP transformation"
-	select XFRM_ALGO
-	select CRYPTO
-	select CRYPTO_AUTHENC
-	select CRYPTO_HMAC
-	select CRYPTO_MD5
-	select CRYPTO_CBC
-	select CRYPTO_SHA1
-	select CRYPTO_DES
-	select CRYPTO_ECHAINIV
+	select XFRM_ESP
 	help
 	  Support for IPsec ESP.
 
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig
index 992cf45fb4f6..05f99d30b8be 100644
--- a/net/ipv6/Kconfig
+++ b/net/ipv6/Kconfig
@@ -49,11 +49,7 @@ config IPV6_OPTIMISTIC_DAD
 
 config INET6_AH
 	tristate "IPv6: AH transformation"
-	select XFRM_ALGO
-	select CRYPTO
-	select CRYPTO_HMAC
-	select CRYPTO_MD5
-	select CRYPTO_SHA1
+	select XFRM_AH
 	help
 	  Support for IPsec AH.
 
@@ -61,15 +57,7 @@ config INET6_AH
 
 config INET6_ESP
 	tristate "IPv6: ESP transformation"
-	select XFRM_ALGO
-	select CRYPTO
-	select CRYPTO_AUTHENC
-	select CRYPTO_HMAC
-	select CRYPTO_MD5
-	select CRYPTO_CBC
-	select CRYPTO_SHA1
-	select CRYPTO_DES
-	select CRYPTO_ECHAINIV
+	select XFRM_ESP
 	help
 	  Support for IPsec ESP.
 
diff --git a/net/xfrm/Kconfig b/net/xfrm/Kconfig
index b5d4a1ef04b9..d140707faddc 100644
--- a/net/xfrm/Kconfig
+++ b/net/xfrm/Kconfig
@@ -67,6 +67,26 @@ config XFRM_STATISTICS
 
 	  If unsure, say N.
 
+config XFRM_AH
+	tristate
+	select XFRM_ALGO
+	select CRYPTO
+	select CRYPTO_HMAC
+	select CRYPTO_MD5
+	select CRYPTO_SHA1
+
+config XFRM_ESP
+	tristate
+	select XFRM_ALGO
+	select CRYPTO
+	select CRYPTO_AUTHENC
+	select CRYPTO_HMAC
+	select CRYPTO_MD5
+	select CRYPTO_CBC
+	select CRYPTO_SHA1
+	select CRYPTO_DES
+	select CRYPTO_ECHAINIV
+
 config XFRM_IPCOMP
 	tristate
 	select XFRM_ALGO
-- 
2.27.0.290.gba653c62da-goog


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net v5 2/3] esp: select CRYPTO_SEQIV
  2020-06-15 22:13 [PATCH net v5 0/3] esp, ah: improve crypto algorithm selections Eric Biggers
  2020-06-15 22:13 ` [PATCH net v5 1/3] esp, ah: consolidate the " Eric Biggers
@ 2020-06-15 22:13 ` Eric Biggers
  2020-06-15 22:13 ` [PATCH net v5 3/3] esp, ah: modernize the crypto algorithm selections Eric Biggers
  2020-06-16  6:02 ` [PATCH net v5 0/3] esp, ah: improve " Steffen Klassert
  3 siblings, 0 replies; 6+ messages in thread
From: Eric Biggers @ 2020-06-15 22:13 UTC (permalink / raw)
  To: netdev
  Cc: linux-crypto, Corentin Labbe, Greg Kroah-Hartman, Herbert Xu,
	Steffen Klassert

From: Eric Biggers <ebiggers@google.com>

Commit f23efcbcc523 ("crypto: ctr - no longer needs CRYPTO_SEQIV") made
CRYPTO_CTR stop selecting CRYPTO_SEQIV.  This breaks IPsec for most
users since GCM and several other encryption algorithms require "seqiv"
-- and RFC 8221 lists AES-GCM as "MUST" be implemented.

Just make XFRM_ESP select CRYPTO_SEQIV.

Fixes: f23efcbcc523 ("crypto: ctr - no longer needs CRYPTO_SEQIV")
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Corentin Labbe <clabbe@baylibre.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 net/xfrm/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/xfrm/Kconfig b/net/xfrm/Kconfig
index d140707faddc..bfb45ee56e5f 100644
--- a/net/xfrm/Kconfig
+++ b/net/xfrm/Kconfig
@@ -86,6 +86,7 @@ config XFRM_ESP
 	select CRYPTO_SHA1
 	select CRYPTO_DES
 	select CRYPTO_ECHAINIV
+	select CRYPTO_SEQIV
 
 config XFRM_IPCOMP
 	tristate
-- 
2.27.0.290.gba653c62da-goog


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net v5 3/3] esp, ah: modernize the crypto algorithm selections
  2020-06-15 22:13 [PATCH net v5 0/3] esp, ah: improve crypto algorithm selections Eric Biggers
  2020-06-15 22:13 ` [PATCH net v5 1/3] esp, ah: consolidate the " Eric Biggers
  2020-06-15 22:13 ` [PATCH net v5 2/3] esp: select CRYPTO_SEQIV Eric Biggers
@ 2020-06-15 22:13 ` Eric Biggers
  2020-06-16  6:02 ` [PATCH net v5 0/3] esp, ah: improve " Steffen Klassert
  3 siblings, 0 replies; 6+ messages in thread
From: Eric Biggers @ 2020-06-15 22:13 UTC (permalink / raw)
  To: netdev
  Cc: linux-crypto, Corentin Labbe, Greg Kroah-Hartman, Herbert Xu,
	Steffen Klassert

From: Eric Biggers <ebiggers@google.com>

The crypto algorithms selected by the ESP and AH kconfig options are
out-of-date with the guidance of RFC 8221, which lists the legacy
algorithms MD5 and DES as "MUST NOT" be implemented, and some more
modern algorithms like AES-GCM and HMAC-SHA256 as "MUST" be implemented.
But the options select the legacy algorithms, not the modern ones.

Therefore, modify these options to select the MUST algorithms --
and *only* the MUST algorithms.

Also improve the help text.

Note that other algorithms may still be explicitly enabled in the
kconfig, and the choice of which to actually use is still controlled by
userspace.  This change only modifies the list of algorithms for which
kernel support is guaranteed to be present.

Suggested-by: Herbert Xu <herbert@gondor.apana.org.au>
Suggested-by: Steffen Klassert <steffen.klassert@secunet.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Corentin Labbe <clabbe@baylibre.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 net/ipv4/Kconfig | 18 ++++++++++++++++--
 net/ipv6/Kconfig | 18 ++++++++++++++++--
 net/xfrm/Kconfig | 15 +++++++++------
 3 files changed, 41 insertions(+), 10 deletions(-)

diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index c0653de6d00e..e64e59b536d3 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -342,7 +342,14 @@ config INET_AH
 	tristate "IP: AH transformation"
 	select XFRM_AH
 	help
-	  Support for IPsec AH.
+	  Support for IPsec AH (Authentication Header).
+
+	  AH can be used with various authentication algorithms.  Besides
+	  enabling AH support itself, this option enables the generic
+	  implementations of the algorithms that RFC 8221 lists as MUST be
+	  implemented.  If you need any other algorithms, you'll need to enable
+	  them in the crypto API.  You should also enable accelerated
+	  implementations of any needed algorithms when available.
 
 	  If unsure, say Y.
 
@@ -350,7 +357,14 @@ config INET_ESP
 	tristate "IP: ESP transformation"
 	select XFRM_ESP
 	help
-	  Support for IPsec ESP.
+	  Support for IPsec ESP (Encapsulating Security Payload).
+
+	  ESP can be used with various encryption and authentication algorithms.
+	  Besides enabling ESP support itself, this option enables the generic
+	  implementations of the algorithms that RFC 8221 lists as MUST be
+	  implemented.  If you need any other algorithms, you'll need to enable
+	  them in the crypto API.  You should also enable accelerated
+	  implementations of any needed algorithms when available.
 
 	  If unsure, say Y.
 
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig
index 05f99d30b8be..f4f19e89af5e 100644
--- a/net/ipv6/Kconfig
+++ b/net/ipv6/Kconfig
@@ -51,7 +51,14 @@ config INET6_AH
 	tristate "IPv6: AH transformation"
 	select XFRM_AH
 	help
-	  Support for IPsec AH.
+	  Support for IPsec AH (Authentication Header).
+
+	  AH can be used with various authentication algorithms.  Besides
+	  enabling AH support itself, this option enables the generic
+	  implementations of the algorithms that RFC 8221 lists as MUST be
+	  implemented.  If you need any other algorithms, you'll need to enable
+	  them in the crypto API.  You should also enable accelerated
+	  implementations of any needed algorithms when available.
 
 	  If unsure, say Y.
 
@@ -59,7 +66,14 @@ config INET6_ESP
 	tristate "IPv6: ESP transformation"
 	select XFRM_ESP
 	help
-	  Support for IPsec ESP.
+	  Support for IPsec ESP (Encapsulating Security Payload).
+
+	  ESP can be used with various encryption and authentication algorithms.
+	  Besides enabling ESP support itself, this option enables the generic
+	  implementations of the algorithms that RFC 8221 lists as MUST be
+	  implemented.  If you need any other algorithms, you'll need to enable
+	  them in the crypto API.  You should also enable accelerated
+	  implementations of any needed algorithms when available.
 
 	  If unsure, say Y.
 
diff --git a/net/xfrm/Kconfig b/net/xfrm/Kconfig
index bfb45ee56e5f..5b9a5ab48111 100644
--- a/net/xfrm/Kconfig
+++ b/net/xfrm/Kconfig
@@ -67,26 +67,29 @@ config XFRM_STATISTICS
 
 	  If unsure, say N.
 
+# This option selects XFRM_ALGO along with the AH authentication algorithms that
+# RFC 8221 lists as MUST be implemented.
 config XFRM_AH
 	tristate
 	select XFRM_ALGO
 	select CRYPTO
 	select CRYPTO_HMAC
-	select CRYPTO_MD5
-	select CRYPTO_SHA1
+	select CRYPTO_SHA256
 
+# This option selects XFRM_ALGO along with the ESP encryption and authentication
+# algorithms that RFC 8221 lists as MUST be implemented.
 config XFRM_ESP
 	tristate
 	select XFRM_ALGO
 	select CRYPTO
+	select CRYPTO_AES
 	select CRYPTO_AUTHENC
-	select CRYPTO_HMAC
-	select CRYPTO_MD5
 	select CRYPTO_CBC
-	select CRYPTO_SHA1
-	select CRYPTO_DES
 	select CRYPTO_ECHAINIV
+	select CRYPTO_GCM
+	select CRYPTO_HMAC
 	select CRYPTO_SEQIV
+	select CRYPTO_SHA256
 
 config XFRM_IPCOMP
 	tristate
-- 
2.27.0.290.gba653c62da-goog


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net v5 0/3] esp, ah: improve crypto algorithm selections
  2020-06-15 22:13 [PATCH net v5 0/3] esp, ah: improve crypto algorithm selections Eric Biggers
                   ` (2 preceding siblings ...)
  2020-06-15 22:13 ` [PATCH net v5 3/3] esp, ah: modernize the crypto algorithm selections Eric Biggers
@ 2020-06-16  6:02 ` Steffen Klassert
  2020-06-16 16:51   ` Eric Biggers
  3 siblings, 1 reply; 6+ messages in thread
From: Steffen Klassert @ 2020-06-16  6:02 UTC (permalink / raw)
  To: Eric Biggers
  Cc: netdev, linux-crypto, Corentin Labbe, Greg Kroah-Hartman, Herbert Xu

On Mon, Jun 15, 2020 at 03:13:15PM -0700, Eric Biggers wrote:
> This series consolidates and modernizes the lists of crypto algorithms
> that are selected by the IPsec kconfig options, and adds CRYPTO_SEQIV
> since it no longer gets selected automatically by other things.
> 
> See previous discussion at
> https://lkml.kernel.org/netdev/20200604192322.22142-1-ebiggers@kernel.org/T/#u
> 
> Changed v4 => v5:
>   - Rebased onto latest net/master to resolve conflict with
>     "treewide: replace '---help---' in Kconfig files with 'help'"

The target trees for IPsec patches is the ipsec and ipsec-next tree.
I have the v4 patchset already in the testing branch of the ipsec tree
and plan to merge it to master. This conflict has to be resolved
when the ipsec tree is merged into the net tree.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net v5 0/3] esp, ah: improve crypto algorithm selections
  2020-06-16  6:02 ` [PATCH net v5 0/3] esp, ah: improve " Steffen Klassert
@ 2020-06-16 16:51   ` Eric Biggers
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Biggers @ 2020-06-16 16:51 UTC (permalink / raw)
  To: Steffen Klassert
  Cc: netdev, linux-crypto, Corentin Labbe, Greg Kroah-Hartman, Herbert Xu

On Tue, Jun 16, 2020 at 08:02:58AM +0200, Steffen Klassert wrote:
> On Mon, Jun 15, 2020 at 03:13:15PM -0700, Eric Biggers wrote:
> > This series consolidates and modernizes the lists of crypto algorithms
> > that are selected by the IPsec kconfig options, and adds CRYPTO_SEQIV
> > since it no longer gets selected automatically by other things.
> > 
> > See previous discussion at
> > https://lkml.kernel.org/netdev/20200604192322.22142-1-ebiggers@kernel.org/T/#u
> > 
> > Changed v4 => v5:
> >   - Rebased onto latest net/master to resolve conflict with
> >     "treewide: replace '---help---' in Kconfig files with 'help'"
> 
> The target trees for IPsec patches is the ipsec and ipsec-next tree.
> I have the v4 patchset already in the testing branch of the ipsec tree
> and plan to merge it to master. This conflict has to be resolved
> when the ipsec tree is merged into the net tree.
> 

Okay, great!  I didn't know about the ipsec tree or that you had already applied
the patches.

- Eric

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-06-16 16:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-15 22:13 [PATCH net v5 0/3] esp, ah: improve crypto algorithm selections Eric Biggers
2020-06-15 22:13 ` [PATCH net v5 1/3] esp, ah: consolidate the " Eric Biggers
2020-06-15 22:13 ` [PATCH net v5 2/3] esp: select CRYPTO_SEQIV Eric Biggers
2020-06-15 22:13 ` [PATCH net v5 3/3] esp, ah: modernize the crypto algorithm selections Eric Biggers
2020-06-16  6:02 ` [PATCH net v5 0/3] esp, ah: improve " Steffen Klassert
2020-06-16 16:51   ` Eric Biggers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).