RFC 8750 | Implicit IV in ESP | March 2020 |
Migault, et al. | Standards Track | [Page] |
Encapsulating Security Payload (ESP) sends an initialization vector (IV) in each packet. The size of the IV depends on the applied transform and is usually 8 or 16 octets for the transforms defined at the time this document was written. When used with IPsec, some algorithms, such as AES-GCM, AES-CCM, and ChaCha20-Poly1305, take the IV to generate a nonce that is used as an input parameter for encrypting and decrypting. This IV must be unique but can be predictable. As a result, the value provided in the ESP Sequence Number (SN) can be used instead to generate the nonce. This avoids sending the IV itself and saves 8 octets per packet in the case of AES-GCM, AES-CCM, and ChaCha20-Poly1305. This document describes how to do this.¶
This is an Internet Standards Track document.¶
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 7841.¶
Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at https://www.rfc-editor.org/info/rfc8750.¶
Copyright (c) 2020 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.¶
Counter-based AES modes of operation such as AES-CCM [RFC4309] and AES-GCM [RFC4106] require the specification of a nonce for each ESP packet. The same applies for ChaCha20-Poly1305 [RFC7634]. Currently, this nonce is generated thanks to the initialization vector (IV) provided in each ESP packet [RFC4303]. This practice is designated in this document as "explicit IV".¶
In some contexts, such as the Internet of Things (IoT), it may be preferable to avoid carrying the extra bytes associated to the IV and instead generate it locally on each peer. The local generation of the IV is designated in this document as "implicit IV".¶
The size of this IV depends on the specific algorithm, but all of the algorithms mentioned above take an 8-octet IV.¶
This document defines how to compute the IV locally when it is implicit. It also specifies how peers agree with the Internet Key Exchange version 2 (IKEv2) [RFC7296] on using an implicit IV versus an explicit IV.¶
This document limits its scope to the algorithms mentioned above. Other algorithms with similar properties may later be defined to use similar mechanisms.¶
This document does not consider AES-CBC [RFC3602], as AES-CBC requires the IV to be unpredictable. Deriving it directly from the packet counter as described below is insecure, as mentioned in Section 6 of [RFC3602], and has led to real-world chosen plaintext attacks such as BEAST [BEAST].¶
This document does not consider AES-CTR [RFC3686], as it focuses on the recommended Authenticated Encryption with Associated Data (AEAD) suites provided in [RFC8221].¶
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.¶
With the algorithms listed in Section 1, the 8-byte IV MUST NOT repeat for a given key. The binding between an ESP packet and its IV is provided using the Sequence Number or the Extended Sequence Number. Figures 1 and 2 represent the IV with a regular 4-byte Sequence Number and an 8-byte Extended Sequence Number, respectively.¶
This document solely defines the IV generation of the algorithms defined in [RFC4106] for AES-GCM, [RFC4309] for AES-CCM, and [RFC7634] for ChaCha20-Poly1305. All other aspects and parameters of those algorithms are unchanged and are used as defined in their respective specifications.¶
An initiator supporting this feature SHOULD propose implicit IV (IIV) algorithms in the Transform Type 1 (Encryption Algorithm) Substructure of the Proposal Substructure inside the Security Association (SA) payload in the IKEv2 Exchange. To facilitate backward compatibility with non-supporting peers, the initiator SHOULD also include those same algorithms with explicit IV as separate transforms.¶
The rules of SA payload processing require that the responder pick its algorithms from the proposal sent by the initiator, thus ensuring that the responder will never send an SA payload containing the IIV transform to an initiator that did not propose it.¶
Nonce generation for these algorithms has not been explicitly defined. It has been left to the implementation as long as certain security requirements are met. Typically, for AES-GCM, AES-CCM, and ChaCha20-Poly1305, the IV is not allowed to be repeated for one particular key. This document provides an explicit and normative way to generate IVs. The mechanism described in this document meets the IV security requirements of all relevant algorithms.¶
As the IV must not repeat for one SA when Counter-Mode ciphers are used, implicit IV as described in this document MUST NOT be used in setups with the chance that the Sequence Number overlaps for one SA. The sender's counter and the receiver's counter MUST be reset (by establishing a new SA and thus a new key) prior to the transmission of the 2^32nd packet for an SA that does not use an Extended Sequence Number and prior to the transmission of the 2^64th packet for an SA that does use an Extended Sequence Number. This prevents Sequence Number overlaps for the mundane point-to-point case. Multicast as described in [RFC5374], [RFC6407], and [G-IKEv2] is a prominent example in which many senders share one secret and thus one SA. As such, implicit IV may only be used with Multicast if some mechanisms are employed that prevent the Sequence Number from overlapping for one SA; otherwise, implicit IV MUST NOT be used with Multicast.¶
This document defines three new encryption transforms that use implicit IV. Unlike most encryption transforms defined to date, which can be used for both ESP and IKEv2, these transforms are defined for ESP only and cannot be used in IKEv2. The reason for this is that IKEv2 messages don't contain a unique per-message value that can be used for IV generation. The Message-ID field in the IKEv2 header is similar to the SN field in the ESP header, but recent IKEv2 extensions [RFC6311] [RFC7383] do allow it to repeat, so there is not an easy way to derive unique IV from IKEv2 header fields.¶
IANA has updated the "Internet Key Exchange Version 2 (IKEv2) Parameters" registry [RFC7296] by adding the following new code points to the "Transform Type 1 - Encryption Algorithm Transform IDs" subregistry under the "Transform Type Values" registry [IANA]:¶
Number | Name | ESP Reference | IKEv2 Reference |
---|---|---|---|
29 | ENCR_AES_CCM_8_IIV | RFC 8750 | Not allowed |
30 | ENCR_AES_GCM_16_IIV | RFC 8750 | Not allowed |
31 | ENCR_CHACHA20_POLY1305_IIV | RFC 8750 | Not allowed |
We would like to thank Valery Smyslov, Éric Vyncke, Alexey Melnikov, Adam Roach, and Magnus Nyström (security directorate) as well as our three Security ADs -- Eric Rescorla, Benjamin Kaduk, and Roman Danyliw -- for their valuable comments. We also would like to thank David Schinazi for his implementation as well as Tero Kivinen and David Waltermire (the IPSECME Chairs) for moving this work forward.¶