aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ipsec/ipsec_sa.h
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2022-01-18 15:56:41 +0100
committerBenoît Ganne <bganne@cisco.com>2023-02-06 17:03:39 +0100
commit752f6fe1b06e96f2c28bf846aadc79d8cdb0bdb1 (patch)
tree6cbfd63112e6e002ddd884cc4cf53a6a546cb1e0 /src/vnet/ipsec/ipsec_sa.h
parent3e0dafb74636671624a4168ea55c189c9e37929c (diff)
ipsec: fix AES CBC IV generation (CVE-2022-46397)stable/2001
For AES-CBC, the IV must be unpredictable (see NIST SP800-38a Appendix C). Chaining IVs like is done by ipsecmb and native backends for the VNET_CRYPTO_OP_FLAG_INIT_IV is fully predictable. Encrypt a counter as part of the message, making the (predictable) counter-generated IV unpredictable. Fixes: VPP-2037 Type: fix Change-Id: If4f192d62bf97dda553e7573331c75efa11822ae Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/vnet/ipsec/ipsec_sa.h')
-rw-r--r--src/vnet/ipsec/ipsec_sa.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vnet/ipsec/ipsec_sa.h b/src/vnet/ipsec/ipsec_sa.h
index e0d74e1309e..2468ea48998 100644
--- a/src/vnet/ipsec/ipsec_sa.h
+++ b/src/vnet/ipsec/ipsec_sa.h
@@ -133,6 +133,8 @@ typedef struct
/* data accessed by dataplane code should be above this comment */
CLIB_CACHE_LINE_ALIGN_MARK (cacheline1);
+ u64 iv_counter;
+
union
{
ip4_header_t ip4_hdr;
@@ -163,7 +165,6 @@ typedef struct
/* Salt used in GCM modes - stored in network byte order */
u32 salt;
- u64 gcm_iv_counter;
} ipsec_sa_t;
STATIC_ASSERT_OFFSET_OF (ipsec_sa_t, cacheline1, CLIB_CACHE_LINE_BYTES);