Skip to content

Commit 0e5f9d5

Browse files
committed
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec
Steffen Klassert says: ==================== pull request (net): ipsec 2020-06-19 1) Fix double ESP trailer insertion in IPsec crypto offload if netif_xmit_frozen_or_stopped is true. From Huy Nguyen. 2) Merge fixup for "remove output_finish indirection from xfrm_state_afinfo". From Stephen Rothwell. 3) Select CRYPTO_SEQIV for ESP as this is needed for GCM and several other encryption algorithms. Also modernize the crypto algorithm selections for ESP and AH, remove those that are maked as "MUST NOT" and add those that are marked as "MUST" be implemented in RFC 8221. From Eric Biggers. Please note the merge conflict between commit: a7f7f62 ("treewide: replace '---help---' in Kconfig files with 'help'") from Linus' tree and commits: 7d4e391 ("esp, ah: consolidate the crypto algorithm selections") be01369 ("esp, ah: modernize the crypto algorithm selections") from the ipsec tree. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 7b075ad + be01369 commit 0e5f9d5

File tree

6 files changed

+64
-37
lines changed

6 files changed

+64
-37
lines changed

include/net/xfrm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,7 @@ struct xfrm_offload {
10081008
#define XFRM_GRO 32
10091009
#define XFRM_ESP_NO_TRAILER 64
10101010
#define XFRM_DEV_RESUME 128
1011+
#define XFRM_XMIT 256
10111012

10121013
__u32 status;
10131014
#define CRYPTO_SUCCESS 1

net/ipv4/Kconfig

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -340,29 +340,31 @@ config NET_FOU_IP_TUNNELS
340340

341341
config INET_AH
342342
tristate "IP: AH transformation"
343-
select XFRM_ALGO
344-
select CRYPTO
345-
select CRYPTO_HMAC
346-
select CRYPTO_MD5
347-
select CRYPTO_SHA1
343+
select XFRM_AH
348344
help
349-
Support for IPsec AH.
345+
Support for IPsec AH (Authentication Header).
346+
347+
AH can be used with various authentication algorithms. Besides
348+
enabling AH support itself, this option enables the generic
349+
implementations of the algorithms that RFC 8221 lists as MUST be
350+
implemented. If you need any other algorithms, you'll need to enable
351+
them in the crypto API. You should also enable accelerated
352+
implementations of any needed algorithms when available.
350353

351354
If unsure, say Y.
352355

353356
config INET_ESP
354357
tristate "IP: ESP transformation"
355-
select XFRM_ALGO
356-
select CRYPTO
357-
select CRYPTO_AUTHENC
358-
select CRYPTO_HMAC
359-
select CRYPTO_MD5
360-
select CRYPTO_CBC
361-
select CRYPTO_SHA1
362-
select CRYPTO_DES
363-
select CRYPTO_ECHAINIV
358+
select XFRM_ESP
364359
help
365-
Support for IPsec ESP.
360+
Support for IPsec ESP (Encapsulating Security Payload).
361+
362+
ESP can be used with various encryption and authentication algorithms.
363+
Besides enabling ESP support itself, this option enables the generic
364+
implementations of the algorithms that RFC 8221 lists as MUST be
365+
implemented. If you need any other algorithms, you'll need to enable
366+
them in the crypto API. You should also enable accelerated
367+
implementations of any needed algorithms when available.
366368

367369
If unsure, say Y.
368370

net/ipv6/Kconfig

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,29 +49,31 @@ config IPV6_OPTIMISTIC_DAD
4949

5050
config INET6_AH
5151
tristate "IPv6: AH transformation"
52-
select XFRM_ALGO
53-
select CRYPTO
54-
select CRYPTO_HMAC
55-
select CRYPTO_MD5
56-
select CRYPTO_SHA1
52+
select XFRM_AH
5753
help
58-
Support for IPsec AH.
54+
Support for IPsec AH (Authentication Header).
55+
56+
AH can be used with various authentication algorithms. Besides
57+
enabling AH support itself, this option enables the generic
58+
implementations of the algorithms that RFC 8221 lists as MUST be
59+
implemented. If you need any other algorithms, you'll need to enable
60+
them in the crypto API. You should also enable accelerated
61+
implementations of any needed algorithms when available.
5962

6063
If unsure, say Y.
6164

6265
config INET6_ESP
6366
tristate "IPv6: ESP transformation"
64-
select XFRM_ALGO
65-
select CRYPTO
66-
select CRYPTO_AUTHENC
67-
select CRYPTO_HMAC
68-
select CRYPTO_MD5
69-
select CRYPTO_CBC
70-
select CRYPTO_SHA1
71-
select CRYPTO_DES
72-
select CRYPTO_ECHAINIV
67+
select XFRM_ESP
7368
help
74-
Support for IPsec ESP.
69+
Support for IPsec ESP (Encapsulating Security Payload).
70+
71+
ESP can be used with various encryption and authentication algorithms.
72+
Besides enabling ESP support itself, this option enables the generic
73+
implementations of the algorithms that RFC 8221 lists as MUST be
74+
implemented. If you need any other algorithms, you'll need to enable
75+
them in the crypto API. You should also enable accelerated
76+
implementations of any needed algorithms when available.
7577

7678
If unsure, say Y.
7779

net/xfrm/Kconfig

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,30 @@ config XFRM_STATISTICS
6767

6868
If unsure, say N.
6969

70+
# This option selects XFRM_ALGO along with the AH authentication algorithms that
71+
# RFC 8221 lists as MUST be implemented.
72+
config XFRM_AH
73+
tristate
74+
select XFRM_ALGO
75+
select CRYPTO
76+
select CRYPTO_HMAC
77+
select CRYPTO_SHA256
78+
79+
# This option selects XFRM_ALGO along with the ESP encryption and authentication
80+
# algorithms that RFC 8221 lists as MUST be implemented.
81+
config XFRM_ESP
82+
tristate
83+
select XFRM_ALGO
84+
select CRYPTO
85+
select CRYPTO_AES
86+
select CRYPTO_AUTHENC
87+
select CRYPTO_CBC
88+
select CRYPTO_ECHAINIV
89+
select CRYPTO_GCM
90+
select CRYPTO_HMAC
91+
select CRYPTO_SEQIV
92+
select CRYPTO_SHA256
93+
7094
config XFRM_IPCOMP
7195
tristate
7296
select XFRM_ALGO

net/xfrm/xfrm_device.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t featur
108108
struct xfrm_offload *xo = xfrm_offload(skb);
109109
struct sec_path *sp;
110110

111-
if (!xo)
111+
if (!xo || (xo->flags & XFRM_XMIT))
112112
return skb;
113113

114114
if (!(features & NETIF_F_HW_ESP))
@@ -129,6 +129,8 @@ struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t featur
129129
return skb;
130130
}
131131

132+
xo->flags |= XFRM_XMIT;
133+
132134
if (skb_is_gso(skb)) {
133135
struct net_device *dev = skb->dev;
134136

net/xfrm/xfrm_output.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -574,16 +574,12 @@ int xfrm_output(struct sock *sk, struct sk_buff *skb)
574574
switch (x->outer_mode.family) {
575575
case AF_INET:
576576
memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
577-
#ifdef CONFIG_NETFILTER
578577
IPCB(skb)->flags |= IPSKB_XFRM_TRANSFORMED;
579-
#endif
580578
break;
581579
case AF_INET6:
582580
memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));
583581

584-
#ifdef CONFIG_NETFILTER
585582
IP6CB(skb)->flags |= IP6SKB_XFRM_TRANSFORMED;
586-
#endif
587583
break;
588584
}
589585

0 commit comments

Comments
 (0)