ipsec: fix AES CBC IV generation (CVE-2022-46397) 57/37557/6
authorBenoît Ganne <bganne@cisco.com>
Tue, 18 Jan 2022 14:56:41 +0000 (15:56 +0100)
committerDave Wallace <dwallacelf@gmail.com>
Wed, 8 Feb 2023 01:06:39 +0000 (01:06 +0000)
commit02dfd296342525a0802132d85d0ea51da841e5ce
treea4bdb7dbb25c30e8c6e9a9c379ee5e443de8fbab
parentaaad4f977cd7337b37cc6f00019f601f07abdced
ipsec: fix AES CBC IV generation (CVE-2022-46397)

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>
src/vnet/crypto/crypto.h
src/vnet/ipsec/esp_encrypt.c
src/vnet/ipsec/ipsec_sa.h