Light-Weight Implementation Guidance (lwig) D. Migault Internet-Draft Ericsson Intended status: Informational T. Guggemos Expires:10 October25 November 2022 LMU Munich8 April24 May 2022 Minimal IP Encapsulating Security Payload (ESP)draft-ietf-lwig-minimal-esp-10draft-ietf-lwig-minimal-esp-11 Abstract This document describes the minimal properties that an IP Encapsulating Security Payload (ESP) implementation needs to meet to remain interoperable with the standard RFC4303 ESP. Such a minimal version of ESP is not intended to become a replacement of the RFC 4303 ESP. Instead, a minimal implementation is expected to be optimized for constrainedenvironmentenvironments while remaining interoperable with implementations of RFC 4303 ESP. In addition, this document also provides some considerationsto implementfor implementing minimal ESP in a constrained environment which includes limiting the number of flash writes, handling frequent wakeup / sleep states, limiting wakeup time,orand reducing the use of random generation. This document does not update or modify RFC4303, but4303. It provides a compact description of how to implement the minimal version ofthethat protocol. RFC 4303 remains the authoritative description. Status of This Memo This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at https://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." This Internet-Draft will expire on10 October25 November 2022. Copyright Notice Copyright (c) 2022 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 Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License. Table of Contents 1. Requirements notation . . . . . . . . . . . . . . . . . . . . 2 2. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 3. Security Parameter Index (SPI) (32 bit) . . . . . . . . . . . 4 3.1. Considerations over SPI generation . . . . . . . . . . .54 4. Sequence Number(SN) (32 bit) . . . . . . . . . . . . . . . . 6 5. Padding . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 6. Next Header (8 bit). . . . . . . . .and Dummy Packets . . . . . . . . . . . . 9 7. ICV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 8. Cryptographic Suites . . . . . . . . . . . . . . . . . . . . 10 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . .1211 10. Security Considerations . . . . . . . . . . . . . . . . . . .1211 11. Privacy Considerations . . . . . . . . . . . . . . . . . . .1312 12. Acknowledgment . . . . . . . . . . . . . . . . . . . . . . .1312 13. References . . . . . . . . . . . . . . . . . . . . . . . . . 13 13.1. Normative References . . . . . . . . . . . . . . . . . . 13 13.2. Informative References . . . . . . . . . . . . . . . . . 14 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 15 1. Requirements notation 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[RFC2119].BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here. 2. Introduction ESP [RFC4303] is part of the IPsec protocol suite [RFC4301]. IPsec is used to provide confidentiality, data origin authentication, connectionless integrity, an anti-replay service(a form of partial sequence integrity)and limited traffic flow confidentiality (TFC) padding. Figure 1 describes an ESP Packet. Currently, ESP is implemented in the kernel of most major multipurpose Operating Systems (OS).TheESPand IPsec suiteis usually implementedin a complete waywith all of its features to fit the multiple purpose usage of theseOSes. However, completeness of the IPsec suite as well as multipurpose scope of these OSes is often performedOSes, at the expense ofresources, or performance. As a result, constrainedresources and with no considerations for code size. Constrained devices are likely to have their own implementation of ESP optimized and adapted to theirspecificitiesspecific use, such as limiting the number of flash writes (for each packet or across wake time), handling frequent wakeup and sleep state, limiting wakeup time,orand reducing the use of random generation. With the adoption of IPsec by IoT devices with minimal IKEv2 [RFC7815] and ESP Header Compression (EHC) with [I-D.mglt-ipsecme-diet-esp] or [I-D.mglt-ipsecme-ikev2-diet-esp-extension],it becomes crucial thatthese ESPimplementation designed for constrained devicesimplementations MUST remaininter- operableinteroperable withthestandard ESPimplementation to avoid a fragmented usage of ESP.implementations. This document describes the minimal properties an ESP implementation needs to meet to remain interoperable with [RFC4303] ESP. In addition, this document also providesa set of optionsadvise toimplement these properties under certainimplementers for implementing ESP within constrained environments. This document does not update or modify RFC4303, but provides a compact description of how to implement the minimal version of the protocol. RFC 4303 remains the authoritative description.4303. For each field of the ESP packet represented in Figure 1 this document provides recommendations and guidance for minimal implementations. The primary purpose of Minimal ESP is to remain interoperable with other nodes implementing RFC 4303 ESP, while limiting the standard complexity of the implementation. 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ---- | Security Parameters Index (SPI) | ^Int. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Cov- | Sequence Number | |ered +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ---- | Payload Data* (variable) | | ^ ~ ~ | | | | |Conf. + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Cov- | | Padding (0-255 bytes) | |ered* +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | | Pad Length | Next Header | v v +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ------ | Integrity Check Value-ICV (variable) | ~ ~ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 1: ESP Packet Description 3. Security Parameter Index (SPI) (32 bit)According to the [RFC4303],[RFC4303] defines the SPIisas a mandatory 32 bitsfield and is not allowed to be removed.field. The SPI has a local significance to index the Security Association (SA). From [RFC4301] section 4.1, nodes supporting only unicast communications can index their SAonlyusing only the SPI.On the other hand, nodesNodes supporting multicast communicationsmustalso require to use the IP addresses and thus SA lookupneedsneed to be performed using the longest match. For nodes supporting only unicast communications,this document recommendsit is RECOMMENDED indexing the SAwithusing only theSPI only.SPI. The index may be based on the full 32 bits of SPI or a subset of these bits. The node may require a combination of the SPI as well as other parameters (like the IP address) to index the SA. Values 0-255must notMUST NOT be used. As per section 2.1 of [RFC4303], values 1-255 are reserved and 0 is only allowed to be used internally and itmust notMUST NOT be sentonover the wire. [RFC4303] does not require the 32 bit SPI to be randomlygenerated over 32 bits. However, thisgenerated, although that is therecommendedRECOMMENDED way to generate SPIs as it provides some privacy and security benefits andavoids, for example,avoids correlation between ESP communications. Torandomly generateobtain a usable random 32 bit SPI, the node generates a random 32 bit value and checks it does not fallinwithin the 0-255 range. If the SPI has an acceptable value, it is used to index the inboundsession, otherwisesession. Otherwise theSPIgenerated value isre-generateddiscarded and the process repeats untilan acceptablea valid value is found.However, someSome constrainednodes may bedevices are less concernedbywith the privacy properties associated toSPIsrandomlygenerated.generated SPIs. Examples of suchnodesdevices might include sensors looking to reduce their codecomplexity, in which case thecomplexity. The use of a predictive function to generate the SPI might be preferred over the generation and handling of random values. Anexampleimplementation of such predictable functionmay considercould use the combination of a fixed value and the memory address of the SAD structure. For every incoming packet, the node will be able to point to the SAD structure directly from the SPI value. This avoids having a separate and additional bindingbetween SPIandSAD entries that is involvedlookup function for the SPI to its SAD entry for every incoming packet. 3.1. Considerations over SPI generationSPISPIs that are not randomly generated over 32 bits maylead tohave privacy and security concerns. As a result, the use of alternative designs requires careful security and privacy reviews. This section provides some considerations upon the adoption of alternative designs.Note thatThe SPI value isusedonly looked up for inboundtraffic, as such thetraffic. The SPI negotiated with IKEv2 [RFC7296] or Minimal IKEv2 [RFC7815] by apeer,peer is the value used by the remote peer when it sends traffic. The main advantage of using a rekeying mechanism is to enable a rekey, that is performed by replacing an old SA by a new SA, both indexed with distinct SPIs. As the SPI is only used for inbound traffic by the peer, this allows each peer to manage the set of SPIs used for its inbound traffic. The necessary number of SPI reflects the number of inbound SAs as well as the ability to rekey these SAs. Typically, rekeying a SA is performed by creating a new SA (with a dedicated SPI) before the old SA is deleted. This results in an additional SA and the need to support an additional SPI. Similarly, the privacy concerns associated with the generation ofnon random SPInon-random SPIs is also limited to the incoming traffic.When alternate designs are considered, it is likely that the number of possible SPIsAlternatively, some constrained devices will not implement IKEv2 or Minimal IKEv2 and as such will not belimited. This limit should both consider theable to manage a roll-over between two distinct SAs. In addition, some of these constrained devices are also likely to have a limited number ofinboundSAs -possibly per IP addresses - as well aslikely to be indexed over 3 bytes only for example. One possible way to enable a rekey mechanism with these devices is to use theabilitySPI where for example thenode to rekey.first 3 bytes designates the SA while the remaining byte indicates a rekey index. SPI numbers cantypicallybe used to implementa key update with the SPI indicatingtracking thekeyinbound SAs when rekeying isbeing used. For example,taking place. When rekeying a SPI, the new SPImight be encoded withcould use theSecurity Association Database (SAD) entry on a subset ofSPI bytes(for example 3 bytes), while the remaining byte indicatesto indicate therekeyrekeying index. The use of asmaller numbersmall limited set ofSPIsSPI numbers across communications comes with privacy and security concerns.Typically, someSome specific values or subset of SPI valuesmaycould reveal the models or manufacturer of the node implementing ESP.This may raise some privacy issuesIt could also reveal some state such asan observer is likely to be able to determine the"not yet rekeyed" or "rekeyed 10 times". If a constraineddevices of the network. In some cases, these nodes mayhost uses a very limitednumber of applications - typically a single application - in which caseor even just one application, the SPIwould provide some information related to the applicationitself could indicate what kind of traffic (eg theuser. In addition, the device orkind of applicationmay be associated with some vulnerabilities, in which case specific SPI values maytypically running) is transmitted. This could beusedfurther correlated byan attackerencrypted data size todiscover vulnerabilities. Whilefurther leak information to an observer on the network. In addition, use ofrandomly generated SPIs may reduce the leakagespecific hardcoded SPI numbers could reveal a manufacturer orprivacy of security related informationdevice version. If updated devices use different SPI numbers, an attacker could locate vulnerable devices byESP itself, these piecestheir use ofinformation may also be leaked otherwise. As a result, aspecific SPI numbers. A privacy analysis should consider at least the type of information as well the traffic pattern beforedetermining a non random SPI can be used. Typically,deciding whether non-random SPIs are safe to use. Typically temperature sensors, wind sensors, used outdoors may not leak privacy sensitive information and most of its traffic is expected to be outbound traffic. When used indoors, a sensor that reportsevery minutean encrypted status ofthea door (closed or opened)mayevery minute, might not leaktruly little privacysensitive information outside the local network. In these examples, the privacy aspect of the information itself might be limited. Being able to determine the version of the sensor to potentially take control of it may also have some limited security consequences. Of course this depends on the context these sensors are being used. If the risks associated to privacy and security are acceptable, arandomized SPI is not necessary. In any case, for such constrained sensors, it remains better to have secure communications with non randomnon-randomized SPIas opposed to no security.can be used. 4. Sequence Number(SN) (32 bit)According to [RFC4303], theThe Sequence Number (SN) in [RFC4303] is a mandatory 32 bits field in the packet. The SN is set by the sender so the receiver can implement anti-replay protection. The SN is derived from any strictly increasing function that guarantees: if packet B is sent after packet A, then SN of packet B isstrictly greaterhigher than the SN of packet A. Some constrained devices may establish communication with specificdevices, like a specific gateway, or nodes similar to them. As a result, the sender may knowdevices where it is known whether or not thereceiverpeer implements anti- replayprotection or not. Even though the sender may know the receiver does not implement anti-replay protection,protection. As per [RFC4303], the sendermustMUST still implementan alwaysa strictly increasing function to generate the SN.Usually, SNThe RECOMMENDED way for multipurpose ESP implementation isgenerated by incrementingto increment a counter for each packet sent.AHowever, a constrained device may avoid maintaining this context and use another source that is known to always increase. Typically, constrainednodes usingdevices use 802.15.4 Time Slotted Channel Hopping(TSCH), whose(TSCH). This communication is heavily dependent ontime,time. A contrained device can take advantage oftheirthis clock mechanism to generate the SN. A lot of IoT devices are in a sleep state most of the time and wake upand areonlyawaketo perform a specific operation before going back to sleep.TheyThese devices do have separate hardware that allows them to wake up after a certaintimeout,timeout andmost likelytypically also timers that start running when the device was booted up, so they might have a concept of time with certain granularity. This requires to store any information in a stable storage - such as flash memory - that can be restored across sleeps. Storing information associated with the SA such as SN requires some read andwritingwrite operation on a stable storage after each packet is sent as opposed to a SPI number or cryptographic keys that are only written to stable storage at the creation of the SA.SuchWrite operationsare likely towear out theflash, andflash storage. Write operations also slow down the systemgreatly,significantly, as writing to flash isnot as fast as reading. Theirmuch slower than reading from flash. While these devices have internalclocks/timersclocks or timers that might not be very accurate,but they should bethese are good enough toknowguarantee that each timethey wakethe device wakes up from sleep that their time is greater than what it waslast time they woke up.before the device went to sleep. Using time for the SN would guarantee a strictly increasing function and avoid storing any additional values or context related to theSN. Of course, one should only consider use of a clockSN on flash. In addition togenerate SNs iftheapplication will inherentlytime value, a RAM based counter can be used to ensure thatno twoif the device sends multiple packetswith a givenover an SAare sent withwithin one wake up period, that thesame time value.serial numbers are still increasing and unique. Notehoweverthat standard receivers are generally configured with incrementing counters and, if not appropriately configured, the use of a significantly larger SNdifference maythan the previous packet can result inthethat packetoutfalling outside of thereceiver's windows andpeer's receiver window which could cause that packetbeingto be discarded. For inbound traffic,this document recommendsit is RECOMMENDED that receiversimplements anti-replay protection, and theimplement anti- replay protection. The size of the windowdependsshould depend on theabilityproperty of the network to deliver packets out of order.As a result, inIn an environment where out of order packetsisare notpossiblepossible, the window size can be set to one.However, while recommended, there are no requirementsAn ESP implementation may choose to not implement an anti-replayprotection mechanism implemented by IPsec. Similarly to the SN theprotection. An implementation ofantianti- replay protection may require the device to write the received SN for everypacket, which may in some cases come withpacket to stable storage. This will have the samedrawbacksissues asthose exposed fordiscussed earlier with the SN.As a result, someSome constrained device implementations maydrop a non required anti replay protection especially when the necessary resource involved overcomes the benefit of the mechanism. These resources need alsochoose tobalance that absence ofnot implement the optional anti-replaymechanism, may lead to unnecessary integrity check operations that might be significantly more expensive as well.protection. A typical example might consider an IoT device such as a temperature sensor that is sending a temperature measurement every 60 seconds, and that receives an acknowledgment from the receiver. In such cases, the ability to spoof and replay an acknowledgement is of limited interest and might not justify the implementation of anantianti- replay mechanism. Receiving peers may also use ESP anti-replay mechanism adapted to a specific application. Typically, when the sending peer is using SN based on time, anti-replay may be implemented by discarding any packets that present a SN whose value is too much in the past.Note that suchSuch mechanisms may consider clock drifting in various ways in addition to acceptable delay induced by the network to avoid the anti replay windows rejecting legitimate packets.When a packetIt could accept any SN as long as it isreceived at a regular time interval, some variant of time based mechanisms may not even use the value ofhigher than theSN, but insteadpreviously received SN. Another mechanism could be used where onlyconsiderthereceivingreceived timeofon the device is used to consider a packet as valid, without looking at thepacket.SN at all. The SN can beencoded overrepresented as a 32bitsbit number, or as a 64bits -bit number, known as Extended Sequence Number (ESN). As per [RFC4303],thesupport of ESN is notmandatory. The determination of themandatory and its useofis negotiated via IKEv2 [RFC7296]. A ESN isbased onused for high speed links to ensure there can be more than 2^32 packets before the SA needs to be rekeyed to prevent thelargest possible value aSNcan take over a session. Whenfrom rolling over. This assumes the SN is incremented by 1 for eachpacket, the number of packets sent over the lifetime of a session may be considered. However, whenpacket. When the SN is incremented differently - such as when time is used -the maximum value SNrekeying needs tobe considered instead. Note thathappen based on how thelimit of messages being sentSN isprimarily determined by the security associated with the key rather thanincremented to prevent theSN.SN from rolling over. The security of all data protected under a given key decreases slightly with each message and a node must ensure the limit is not reached - even though the SN would permit it. Estimation of the maximum number of packets to be sent by a node is not alwayschallengingpredicatable andas suchlarge margins should beconsidered cautiouslyused espcially as nodes could be online for much more time than expected. Even for constrained devices,this document recommends implementingit is RECOMMENDED to implement some rekey mechanisms (see Section 10). 5. PaddingThe purpose of paddingPadding is required torespectkeep the 32 bit alignment ofESP orESP. It is also required for some encryption transforms that need a specific block sizeexpected by an encryption transform -of input, such asAES-CBC for example.ENCR_AES_CBC. ESPmust have at least onespecifies paddingbytein the Pad Lengththat indicates the padding length. ESP padding bytes are generatedbyte, followed bya succession of unsigned bytes starting with 1, 2, 3 with the last byte setup toPad Length, where Pad Length designates the length255 bytes ofthe padding bytes.padding. Checking the padding structure is not mandatory, sotheconstraineddevicedevices may omitsuch checks, however, in order to interoperate with existingthese checks on received ESPimplementations, it must build thepackets. For outgoing ESP packets, paddingbytesmust be applied asrecommendedrequired by ESP. In some situation the padding bytes may take a fixed value. This would typically be the case when the Data Payload is of fixed size. ESP [RFC4303]alsoadditionally provides Traffic Flow Confidentiality (TFC) as a way to perform padding to hide trafficcharacteristics, which differs from respecting a 32 bit alignment.characteristics. TFC is not mandatory andmust beis negotiated with the SA managementprotocol.protocol, such as IKEv2. TFC hasnotbeen widelyadoptedimplemented but it is not widely deployed forstandardESP traffic.One possible reason is that it requires to shape the traffic according to one traffic pattern that needs to be maintained. ThisIt islikelyNOT RECOMMENDED torequire extra processing as well as providingimplement TFC for a"well recognized" traffic shape which could end up being counterproductive. As such, this document does not recommend thatminimalESP implementation supports TFC.ESP. As aresult,consequence, communication protection thatwas relyingrelies on TFCwillwould be more sensitive to trafficshaping.patterns without TFC. Thiscould expose thecan leak application information as well as thedevicesmanifacturor or model of the device used to a passive monitoring attacker. Such informationcouldcan beusedused, for example, bythean attacker in case a vulnerability isdisclosed onknown for the specificdevice.device or application. In addition, some application use - such as health applications -may also revealcould leak important privacy oriented information.Some constrained nodesConstrained devices that have limited battery lifetime mayalsopreferavoidingto avoid sending extra padding bytes.However, the same nodes may also be very specific to an application and device. As a result, they are also likely to be the main target for traffic shaping.In most cases, the payload carried by thesenodesdevices is quite small, and the standard padding mechanismmay alsocan be used as an alternative toTFC, with a sufficient tradeoff between the required energy to send additional payload and the exposure to traffic shaping attacks. In addition, theTFC. Alternatively, any informationleaked byleak based on thetraffic shaping maysize - or presence - of the packet can also be addressedbyat the applicationlevel. For example, itlevel, before the packet ispreferredencrypted with ESP. If application packets vary between 1 tohave30 bytes, the application could always send 32 byte responses to ensure all traffic sent is of identical length. To prevent leaking information that a sensorsending somechanged state, such as "temperature changed" or "door opened", an application could send this information at regular time interval, rather than when a specific event ishappening. Typically, ahappening, even if the sensormonitoring the temperature, or a door is expected to send regularly the information - i.e. the temperature of the room or whether the door is closed or open) instead of only sending the information when the temperature has raised or when the door is being opened.state did not change. 6. Next Header (8 bit)According to [RFC4303],and Dummy Packets ESP [RFC4303] defines the Next Headerisas a mandatory 8 bits field in the packet. The Nextheaderheader, only visible after decryption, specifies the data contained in thepayload as well as dummy packet, i.e. packets with the Next Header with a value 59 meaning "no next header".payload. In addition, the Next Header may also carry an indication on how to process the packet [I-D.nikander-esp-beet-mode]. The Next Header can point to a dummy packet, i.e. packets with the Next Header value set to 59 meaning "no next header". The data following to "no next header" is unstructured dummy data. The ability to generate and to receive and ignore dummy packets is required by [RFC4303]. An implementation can omit ever generating and sending dummy packets. For interoperability, a minimal ESP implementationmustMUST be able to process and discard dummy packets without indicating an error.Note that such recommendation only applies for nodes receiving packets, and that nodes designed to only send data might not implement this capability. As the generation of dummy packets is subject to local management and based on a per-SA basis, a minimal ESP implementation may not generate such dummy packet. Specifically, inIn constrainedenvironmentenvironments, sending dummy packets may have too much impact on the device lifetime,andin which case dummy packets should not beavoided.generated and sent. On the other hand,constrained nodesConstrained devices running specific applications that would leak too much information by not generating and sending dummy packets may implement this functionality or even implement something similar at the application layer. Note also that similarly to padding and TFC that can bededicatedused tospecific applications, in which case,hide some trafficpatterncharacteristics (see Section 5), dummy packet mayexpose the application oralso reveal some patterns that can be used to identify thetype of node.application. Forthese nodes, not sendingexample, an application may send dummy data to hide some traffic pattern. Suppose such such application sends a 1 byte data when a change occurs. This results in sending a packet notifying a change has occurred. Dummy packet mayhave some privacy implication that needsbe used to prevent such information to bemeasured. However, forleaked by sending a 1 byte packet every second when thesame reasons exposed in Section 5 traffic shaping atinformation is not changed. After an upgrade the data becomes two bytes. At that point, theIPsec layer may also introduce some traffic pattern,dummy packets do not hide anything andon constrained deviceshaving 1 byte regularly versus 2 bytes make even theapplication is probablyidentification of themost appropriated layerapplication, version easier tolimitidentify. This generaly makes theriskuse ofleaking information by traffic shaping.dummy packets more appropriated on high speed links. In some cases, devices are dedicated to a single application or a single transport protocol, in which case, the Next Header has a fixed value. Specific processing indications have not been standardized yet [I-D.nikander-esp-beet-mode] and is expected to result from an agreement between the peers. As a result, itshould notSHOULD NOT be part of a minimal implementation of ESP. 7. ICV The ICV depends on the cryptographic suite used.Currently, [RFC8221] only recommends cryptographic suites with an ICV which makes the ICV a mandatory field.As detailed in [RFC8221] authentication or authenticated encryption arerecommendedRECOMMENDED and as such the ICV field must be present with a size different from zero. Its length is defined by the security recommendations only. 8. Cryptographic Suites Thecryptographic suites implemented are an important component of ESP. Therecommended algorithms to use are expected to evolve over time and implementersshouldSHOULD follow the recommendations provided by [RFC8221] and updates. This section lists some of the criteria that may be considered to selectthean appropriate cryptographic suite. The list is not expected to be exhaustive and may also evolve over time: 1. Security: Security is the criteria that should be considered first for the selection of encryption algorithm transform. The security of encryption algorithm transforms is expected to evolve over time, and it is of primary importance to follow up-to-date security guidance and recommendations. The chosen encryption algorithmmust notMUST NOT be vulnerable or weak (see [RFC8221] for outdated ciphers). ESP can be used to authenticate only (ENCR_NULL) or to encrypt the communication. In the latter case, authenticated encryption (AEAD) is RECOMMENDED [RFC8221]. 2. Resilience to nonce re-use: Some transforms -including AES-GCM - arevery sensitivevulnerable to nonce collision with a given key. While the generation of the nonce may prevent such collision during a session, the mechanisms are unlikely to provide such protection across sleep states or reboot. This causes an issue for devices that are configured using static keys (called manual keying) and manual keying should not be used witha key.these encryption algorithms. When the key is likely to be re-used across reboots, algorithms that are nonce misuse resistant such as, for example, AES-SIV [RFC5297], AES-GCM-SIV [RFC8452] or Deoxys-II [DeoxysII] are RECOMMENDED. Note however that currently none ofthem hasthese are yetbeendefined for use with ESP. 3. Interoperability:Interoperability considers the encryption algorithm transforms shared with the other nodes. Note that it is not because anconstrained devices usually only implement one or very few different encryption algorithmtransform is widely deployed that it is secured. As a result, security should not be weakened for interoperability.transforms. [RFC8221]and successors considertakes the life cycle of encryption algorithm transformssufficiently long to provide interoperability. Constrained devices may have limited interoperability requirements which makes possible to reduces the number of encryption algorithm transforms to implement.and device manufactoring into consideration in its recommendations for mandatory-to-implement ("MTI") algorithms. 4. Power Consumption and Cipher Suite Complexity: Complexity of the encryption algorithm transformorand the energy cost associated with it are especiallyconsidered whenimportant considerations for devices that have limited resources or areusing some batteries, in which case thebatterydetermines thepowered. The battery life might determine the lifetime of the entire device. The choice of a cryptographic functionmayshould consider re-using specific libraries or to take advantage of hardware acceleration provided by the device. For example, if the device benefits from AES hardware modules and usesAES-CTR,ENCR_AES_CTR, it may preferAUTH_AES-XCBCAUTH_AES- XCBC for its authentication. In addition, some devices may also embed radio modules with hardware acceleration for AES-CCM, in which case, thismodetransform may be preferred. 5. Power Consumption and Bandwidth Consumption:Similarly to the encryption algorithm transform complexity, reducingReducing the payloadsent,sent may significantly reduce the energy consumption of the device.As a result, encryptionEncryption algorithm transforms with low overheadmay be considered.are strongly preferred. To reduce the overall payload size one may, for example: 1. Use of counter-based ciphers without fixed block length (e.g. AES-CTR, or ChaCha20-Poly1305). 2. Use of ciphers with capability of using implicit IVs [RFC8750]. 3. Use of ciphers recommended for IoT [RFC8221]. 4. Avoid Padding by sending payload data which are aligned to the cipher block length - 2 for the ESP trailer. 9. IANA Considerations There are no IANA consideration for this document. 10. Security Considerations SecurityconsiderationsConsiderations are those of [RFC4303]. In addition, this document provided security recommendations and guidance over the implementation choices for each ESP field. The security of a communication provided by ESP is closely related to the security associated with the management of that key. This usually includes mechanisms to prevent a nonce from repeating, for example. When a node is provisioned with a session key that is used across reboot, the implementermustMUST ensure that the mechanisms put in place remain valid across reboot as well.This document recommendsIt is RECOMMENDED to use ESP in conjunction with key management protocols such as for example IKEv2 [RFC7296] or minimal IKEv2 [RFC7815]. Such mechanisms are responsible for negotiating fresh session keys as well as prevent a session key being use beyond its lifetime. When such mechanisms cannot beimplemented andimplemented, such as when the the session keyis, for example,is provisioned, thenodes mustdevice MUST ensure that keys are not used beyond their lifetime and that theappropriate use ofthe key remains used in compliance will all security requirements across reboots - e.g. conditions on counters and nonces remains valid. When anodedevice generates its own key or when random value such as nonces are generated, the random generationmustMUST follow [RFC4086]. In addition, [SP-800-90A-Rev-1] providesappropriatedguidance on how to build random generators based on deterministic random functions. 11. Privacy Considerations Preventing the leakage of privacy sensitive information is a hard problem to solve and usually result in balancing the information potentially being leaked to the cost associated with the counter measures. This problem is not inherent to the minimal ESP described in this document and also concerns the use of ESP in general. This document targets minimal implementations of ESP and as such describes some minimalistic way to implement ESP. In some cases, this may result in potentiallyexposingrevealing privacy sensitive pieces of information. This document describes these privacy implications so thedesignerimplementer can take the appropriate decisions given the specificities of a given environment and deployment. The main risks associated with privacy is the ability to identify an application or a device by analyzing the traffic which is designated as traffic shaping. As discussed in Section 3, the use in some very specific context of non randomly generated SPI might in some cases ease the determination of the deviceofor the application. Similarly, padding provides limited capabilities to obfuscate the traffic compared to those provided by TFC. Such consequence on privacy as detailed in Section 5. 12. Acknowledgment The authors would like to thank Daniel Palomares, Scott Fluhrer, Tero Kivinen, Valery Smyslov, Yoav Nir, Michael Richardson, Thomas Peyrin, Eric Thormarker, Nancy Cam-Winget and Bob Briscoe for their valuable comments. In particular Scott Fluhrer suggested including the rekey index in the SPI. Tero Kivinenprovidedalso provided multiple clarifications and examples of deployment ESP within constrained devices with their associated optimizations. Thomas Peyrin Eric Thormarker and Scott Fluhrer suggested and clarified the use of transform resilient to nonce misuse. 13. References 13.1. Normative References [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, <https://www.rfc-editor.org/info/rfc2119>. [RFC4086] Eastlake 3rd, D., Schiller, J., and S. Crocker, "Randomness Requirements for Security", BCP 106, RFC 4086, DOI 10.17487/RFC4086, June 2005, <https://www.rfc-editor.org/info/rfc4086>. [RFC4301] Kent, S. and K. Seo, "Security Architecture for the Internet Protocol", RFC 4301, DOI 10.17487/RFC4301, December 2005, <https://www.rfc-editor.org/info/rfc4301>. [RFC4303] Kent, S., "IP Encapsulating Security Payload (ESP)", RFC 4303, DOI 10.17487/RFC4303, December 2005, <https://www.rfc-editor.org/info/rfc4303>. [RFC7296] Kaufman, C., Hoffman, P., Nir, Y., Eronen, P., and T. Kivinen, "Internet Key Exchange Protocol Version 2 (IKEv2)", STD 79, RFC 7296, DOI 10.17487/RFC7296, October 2014, <https://www.rfc-editor.org/info/rfc7296>. [RFC7815] Kivinen, T., "Minimal Internet Key Exchange Version 2 (IKEv2) Initiator Implementation", RFC 7815, DOI 10.17487/RFC7815, March 2016, <https://www.rfc-editor.org/info/rfc7815>. [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, <https://www.rfc-editor.org/info/rfc8174>. [RFC8221] Wouters, P., Migault, D., Mattsson, J., Nir, Y., and T. Kivinen, "Cryptographic Algorithm Implementation Requirements and Usage Guidance for Encapsulating Security Payload (ESP) and Authentication Header (AH)", RFC 8221, DOI 10.17487/RFC8221, October 2017, <https://www.rfc-editor.org/info/rfc8221>. [RFC8750] Migault, D., Guggemos, T., and Y. Nir, "Implicit Initialization Vector (IV) for Counter-Based Ciphers in Encapsulating Security Payload (ESP)", RFC 8750, DOI 10.17487/RFC8750, March 2020, <https://www.rfc-editor.org/info/rfc8750>. 13.2. Informative References [DeoxysII] Jeremy, J. J., Ivica, I. N., Thomas, T. P., and Y. S. Yannick, "Deoxys v1.41", October 2016, <https://competitions.cr.yp.to/round3/deoxysv141.pdf>. [I-D.mglt-ipsecme-diet-esp] Migault, D., Guggemos, T., Bormann, C., and D. Schinazi, "ESP Header Compression and Diet-ESP", Work in Progress, Internet-Draft,draft-mglt-ipsecme-diet-esp-07, 11 March 2019,draft-mglt-ipsecme-diet-esp-08, 13 May 2022, <https://www.ietf.org/archive/id/draft-mglt-ipsecme-diet-esp-07.txt>.diet-esp-08.txt>. [I-D.mglt-ipsecme-ikev2-diet-esp-extension] Migault, D., Guggemos, T., and D. Schinazi, "Internet Key Exchange version 2 (IKEv2) extension for the ESP Header Compression (EHC) Strategy", Work in Progress, Internet- Draft,draft-mglt-ipsecme-ikev2-diet-esp-extension-01, 26 June 2018,draft-mglt-ipsecme-ikev2-diet-esp-extension-02, 13 May 2022, <https://www.ietf.org/archive/id/draft-mglt-ipsecme-ikev2-diet-esp-extension-01.txt>.ipsecme-ikev2-diet-esp-extension-02.txt>. [I-D.nikander-esp-beet-mode] Nikander, P. and J. Melen, "A Bound End-to-End Tunnel (BEET) mode for ESP", Work in Progress, Internet-Draft, draft-nikander-esp-beet-mode-09, 5 August 2008, <https://www.ietf.org/archive/id/draft-nikander-esp-beet- mode-09.txt>. [RFC5297] Harkins, D., "Synthetic Initialization Vector (SIV) Authenticated Encryption Using the Advanced Encryption Standard (AES)", RFC 5297, DOI 10.17487/RFC5297, October 2008, <https://www.rfc-editor.org/info/rfc5297>. [RFC8452] Gueron, S., Langley, A., and Y. Lindell, "AES-GCM-SIV: Nonce Misuse-Resistant Authenticated Encryption", RFC 8452, DOI 10.17487/RFC8452, April 2019, <https://www.rfc-editor.org/info/rfc8452>. [SP-800-90A-Rev-1] Elain, E. B. and J. K. Kelsey, "Recommendation for Random Number Generation Using Deterministic Random Bit Generators", <https://csrc.nist.gov/publications/detail/ sp/800-90a/rev-1/final>. Authors' Addresses Daniel Migault Ericsson 8400 boulevard Decarie Montreal, QC H4P 2N2 Canada Email: daniel.migault@ericsson.com Tobias Guggemos LMU Munich MNM-Team Oettingenstr. 67 80538 Munich Germany Email: guggemos@mnm-team.org