aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/crypto
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-07 17:55:49 +0100
commit11a2212087758f589859c01caf06db21b4184215 (patch)
tree5fca52ddf27b4299779ef8a6ee603154d3475431 /src/vnet/crypto
parent54f8aff02a46562868f3cd3086d1393e85ae22b1 (diff)
ipsec: fix AES CBC IV generation (CVE-2022-46397)stable/2101
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/crypto')
-rw-r--r--src/vnet/crypto/crypto.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vnet/crypto/crypto.h b/src/vnet/crypto/crypto.h
index 529c70ac088..612dac7c7bf 100644
--- a/src/vnet/crypto/crypto.h
+++ b/src/vnet/crypto/crypto.h
@@ -306,7 +306,7 @@ typedef struct
i16 integ_start_offset;
u32 crypto_total_length;
/* adj total_length for integ, e.g.4 bytes for IPSec ESN */
- u16 integ_length_adj;
+ i16 integ_length_adj;
u8 *iv;
union
{
@@ -605,7 +605,7 @@ vnet_crypto_async_add_to_frame (vlib_main_t * vm,
u32 key_index,
u32 crypto_len, i16 integ_len_adj,
i16 crypto_start_offset,
- u16 integ_start_offset,
+ i16 integ_start_offset,
u32 buffer_index,
u16 next_node,
u8 * iv, u8 * tag, u8 * aad, u8 flags)