diff options
author | Nicolas Dichtel <nicolas.dichtel@6wind.com> | 2011-02-02 01:29:02 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-02-08 17:00:40 -0500 |
commit | fa9921e46fd52b78070dc67ce0d27ec301a90410 (patch) | |
tree | 8684af3cd03cf8fed1e6be9f722c181278944f7b /include | |
parent | c0c84ef5c130f8871adbdaac2ba824b9195cb6d9 (diff) |
ipsec: allow to align IPv4 AH on 32 bits
The Linux IPv4 AH stack aligns the AH header on a 64 bit boundary
(like in IPv6). This is not RFC compliant (see RFC4302, Section
3.3.3.2.1), it should be aligned on 32 bits.
For most of the authentication algorithms, the ICV size is 96 bits.
The AH header alignment on 32 or 64 bits gives the same results.
However for SHA-256-128 for instance, the wrong 64 bit alignment results
in adding useless padding in IPv4 AH, which is forbidden by the RFC.
To avoid breaking backward compatibility, we use a new flag
(XFRM_STATE_ALIGN4) do change original behavior.
Initial patch from Dang Hongwu <hongwu.dang@6wind.com> and
Christophe Gouault <christophe.gouault@6wind.com>.
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/xfrm.h | 1 | ||||
-rw-r--r-- | include/net/xfrm.h | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h index 930fdd2de79c..b93d6f598085 100644 --- a/include/linux/xfrm.h +++ b/include/linux/xfrm.h | |||
@@ -350,6 +350,7 @@ struct xfrm_usersa_info { | |||
350 | #define XFRM_STATE_WILDRECV 8 | 350 | #define XFRM_STATE_WILDRECV 8 |
351 | #define XFRM_STATE_ICMP 16 | 351 | #define XFRM_STATE_ICMP 16 |
352 | #define XFRM_STATE_AF_UNSPEC 32 | 352 | #define XFRM_STATE_AF_UNSPEC 32 |
353 | #define XFRM_STATE_ALIGN4 64 | ||
353 | }; | 354 | }; |
354 | 355 | ||
355 | struct xfrm_usersa_id { | 356 | struct xfrm_usersa_id { |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index b9f385da758e..1f6e8a0eb544 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -36,6 +36,7 @@ | |||
36 | #define XFRM_PROTO_ROUTING IPPROTO_ROUTING | 36 | #define XFRM_PROTO_ROUTING IPPROTO_ROUTING |
37 | #define XFRM_PROTO_DSTOPTS IPPROTO_DSTOPTS | 37 | #define XFRM_PROTO_DSTOPTS IPPROTO_DSTOPTS |
38 | 38 | ||
39 | #define XFRM_ALIGN4(len) (((len) + 3) & ~3) | ||
39 | #define XFRM_ALIGN8(len) (((len) + 7) & ~7) | 40 | #define XFRM_ALIGN8(len) (((len) + 7) & ~7) |
40 | #define MODULE_ALIAS_XFRM_MODE(family, encap) \ | 41 | #define MODULE_ALIAS_XFRM_MODE(family, encap) \ |
41 | MODULE_ALIAS("xfrm-mode-" __stringify(family) "-" __stringify(encap)) | 42 | MODULE_ALIAS("xfrm-mode-" __stringify(family) "-" __stringify(encap)) |