ipsec: fix AES CBC IV generation (CVE-2022-46397) 64/38164/1 stable/2106
authorBenoît Ganne <bganne@cisco.com>
Tue, 18 Jan 2022 14:56:41 +0000 (15:56 +0100)
committerBenoît Ganne <bganne@cisco.com>
Tue, 7 Feb 2023 17:30:24 +0000 (18:30 +0100)
commit2ef2ac780ee54e14e9c8b89cf7de0a61ccddfad4
treeb46a1ce4b0f8c6a4963f502924b26756194abbb3
parentbb25fbf28c3a6cbe361db74d731d145e868fc716
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