idnits 2.17.1 draft-ietf-hip-rfc5202-bis-05.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (November 18, 2013) is 3783 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Outdated reference: A later version (-20) exists of draft-ietf-hip-rfc5201-bis-14 ** Downref: Normative reference to an Informational RFC: RFC 4493 == Outdated reference: A later version (-20) exists of draft-ietf-hip-rfc4423-bis-06 -- Obsolete informational reference (is this intentional?): RFC 5206 (Obsoleted by RFC 8046) -- Obsolete informational reference (is this intentional?): RFC 5996 (Obsoleted by RFC 7296) Summary: 1 error (**), 0 flaws (~~), 3 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group P. Jokela 3 Internet-Draft Ericsson Research NomadicLab 4 Obsoletes: 5202 (if approved) R. Moskowitz 5 Intended status: Standards Track ICSAlabs, An Independent 6 Expires: May 22, 2014 Division of Verizon Business 7 Systems 8 J. Melen 9 Ericsson Research NomadicLab 10 November 18, 2013 12 Using the Encapsulating Security Payload (ESP) Transport Format with the 13 Host Identity Protocol (HIP) 14 draft-ietf-hip-rfc5202-bis-05 16 Abstract 18 This memo specifies an Encapsulated Security Payload (ESP) based 19 mechanism for transmission of user data packets, to be used with the 20 Host Identity Protocol (HIP). This document obsoletes RFC 5202. 22 Status of This Memo 24 This Internet-Draft is submitted in full conformance with the 25 provisions of BCP 78 and BCP 79. 27 Internet-Drafts are working documents of the Internet Engineering 28 Task Force (IETF). Note that other groups may also distribute 29 working documents as Internet-Drafts. The list of current Internet- 30 Drafts is at http://datatracker.ietf.org/drafts/current/. 32 Internet-Drafts are draft documents valid for a maximum of six months 33 and may be updated, replaced, or obsoleted by other documents at any 34 time. It is inappropriate to use Internet-Drafts as reference 35 material or to cite them other than as "work in progress." 37 This Internet-Draft will expire on May 22, 2014. 39 Copyright Notice 41 Copyright (c) 2013 IETF Trust and the persons identified as the 42 document authors. All rights reserved. 44 This document is subject to BCP 78 and the IETF Trust's Legal 45 Provisions Relating to IETF Documents 46 (http://trustee.ietf.org/license-info) in effect on the date of 47 publication of this document. Please review these documents 48 carefully, as they describe your rights and restrictions with respect 49 to this document. Code Components extracted from this document must 50 include Simplified BSD License text as described in Section 4.e of 51 the Trust Legal Provisions and are provided without warranty as 52 described in the Simplified BSD License. 54 Table of Contents 56 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 57 2. Conventions Used in This Document . . . . . . . . . . . . . . 4 58 3. Using ESP with HIP . . . . . . . . . . . . . . . . . . . . . . 5 59 3.1. ESP Packet Format . . . . . . . . . . . . . . . . . . . . 5 60 3.2. Conceptual ESP Packet Processing . . . . . . . . . . . . . 5 61 3.2.1. Semantics of the Security Parameter Index (SPI) . . . 6 62 3.3. Security Association Establishment and Maintenance . . . . 7 63 3.3.1. ESP Security Associations . . . . . . . . . . . . . . 7 64 3.3.2. Rekeying . . . . . . . . . . . . . . . . . . . . . . . 7 65 3.3.3. Security Association Management . . . . . . . . . . . 8 66 3.3.4. Security Parameter Index (SPI) . . . . . . . . . . . . 8 67 3.3.5. Supported Ciphers . . . . . . . . . . . . . . . . . . 9 68 3.3.6. Sequence Number . . . . . . . . . . . . . . . . . . . 9 69 3.3.7. Lifetimes and Timers . . . . . . . . . . . . . . . . . 9 70 3.4. IPsec and HIP ESP Implementation Considerations . . . . . 9 71 3.4.1. Data Packet Processing Considerations . . . . . . . . 10 72 3.4.2. HIP Signaling Packet Considerations . . . . . . . . . 10 73 4. The Protocol . . . . . . . . . . . . . . . . . . . . . . . . . 11 74 4.1. ESP in HIP . . . . . . . . . . . . . . . . . . . . . . . . 11 75 4.1.1. IPsec ESP Transport Format Type . . . . . . . . . . . 11 76 4.1.2. Setting Up an ESP Security Association . . . . . . . . 11 77 4.1.3. Updating an Existing ESP SA . . . . . . . . . . . . . 12 78 5. Parameter and Packet Formats . . . . . . . . . . . . . . . . . 13 79 5.1. New Parameters . . . . . . . . . . . . . . . . . . . . . . 13 80 5.1.1. ESP_INFO . . . . . . . . . . . . . . . . . . . . . . . 13 81 5.1.2. ESP_TRANSFORM . . . . . . . . . . . . . . . . . . . . 15 82 5.1.3. NOTIFICATION Parameter . . . . . . . . . . . . . . . . 16 83 5.2. HIP ESP Security Association Setup . . . . . . . . . . . . 16 84 5.2.1. Setup During Base Exchange . . . . . . . . . . . . . . 16 85 5.3. HIP ESP Rekeying . . . . . . . . . . . . . . . . . . . . . 18 86 5.3.1. Initializing Rekeying . . . . . . . . . . . . . . . . 18 87 5.3.2. Responding to the Rekeying Initialization . . . . . . 19 88 5.4. ICMP Messages . . . . . . . . . . . . . . . . . . . . . . 19 89 5.4.1. Unknown SPI . . . . . . . . . . . . . . . . . . . . . 19 90 6. Packet Processing . . . . . . . . . . . . . . . . . . . . . . 20 91 6.1. Processing Outgoing Application Data . . . . . . . . . . . 20 92 6.2. Processing Incoming Application Data . . . . . . . . . . . 20 93 6.3. HMAC and SIGNATURE Calculation and Verification . . . . . 21 94 6.4. Processing Incoming ESP SA Initialization (R1) . . . . . . 21 95 6.5. Processing Incoming Initialization Reply (I2) . . . . . . 22 96 6.6. Processing Incoming ESP SA Setup Finalization (R2) . . . . 22 97 6.7. Dropping HIP Associations . . . . . . . . . . . . . . . . 22 98 6.8. Initiating ESP SA Rekeying . . . . . . . . . . . . . . . . 22 99 6.9. Processing Incoming UPDATE Packets . . . . . . . . . . . . 24 100 6.9.1. Processing UPDATE Packet: No Outstanding Rekeying 101 Request . . . . . . . . . . . . . . . . . . . . . . . 24 102 6.10. Finalizing Rekeying . . . . . . . . . . . . . . . . . . . 25 103 6.11. Processing NOTIFY Packets . . . . . . . . . . . . . . . . 26 104 7. Keying Material . . . . . . . . . . . . . . . . . . . . . . . 26 105 8. Security Considerations . . . . . . . . . . . . . . . . . . . 26 106 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 27 107 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 27 108 11. References . . . . . . . . . . . . . . . . . . . . . . . . . . 28 109 11.1. Normative references . . . . . . . . . . . . . . . . . . . 28 110 11.2. Informative references . . . . . . . . . . . . . . . . . . 29 111 Appendix A. A Note on Implementation Options . . . . . . . . . . 30 112 Appendix B. Bound End-to-End Tunnel mode for ESP . . . . . . . . 30 113 B.1. Protocol definition . . . . . . . . . . . . . . . . . . . 31 114 B.1.1. Changes to Security Association data structures . . . 31 115 B.1.2. Packet format . . . . . . . . . . . . . . . . . . . . 31 116 B.1.3. Cryptographic processing . . . . . . . . . . . . . . . 33 117 B.1.4. IP header processing . . . . . . . . . . . . . . . . . 33 118 B.1.5. Handling of outgoing packets . . . . . . . . . . . . . 34 119 B.1.6. Handling of incoming packets . . . . . . . . . . . . . 35 120 B.1.7. IPv4 options handling . . . . . . . . . . . . . . . . 35 122 1. Introduction 124 In the Host Identity Protocol Architecture 125 [I-D.ietf-hip-rfc4423-bis], hosts are identified with public keys. 126 The Host Identity Protocol [I-D.ietf-hip-rfc5201-bis] base exchange 127 allows any two HIP-supporting hosts to authenticate each other and to 128 create a HIP association between themselves. During the base 129 exchange, the hosts generate a piece of shared keying material using 130 an authenticated Diffie-Hellman exchange. 132 The HIP base exchange specification [I-D.ietf-hip-rfc5201-bis] does 133 not describe any transport formats or methods for user data to be 134 used during the actual communication; it only defines that it is 135 mandatory to implement the Encapsulated Security Payload (ESP) 136 [RFC4303] based transport format and method. This document specifies 137 how ESP is used with HIP to carry actual user data. 139 To be more specific, this document specifies a set of HIP protocol 140 extensions and their handling. Using these extensions, a pair of ESP 141 Security Associations (SAs) is created between the hosts during the 142 base exchange. The resulting ESP Security Associations use keys 143 drawn from the keying material (KEYMAT) generated during the base 144 exchange. After the HIP association and required ESP SAs have been 145 established between the hosts, the user data communication is 146 protected using ESP. In addition, this document specifies methods to 147 update an existing ESP Security Association. 149 It should be noted that representations of Host Identity are not 150 carried explicitly in the headers of user data packets. Instead, the 151 ESP Security Parameter Index (SPI) is used to indicate the right host 152 context. The SPIs are selected during the HIP ESP setup exchange. 153 For user data packets, ESP SPIs (in possible combination with IP 154 addresses) are used indirectly to identify the host context, thereby 155 avoiding any additional explicit protocol headers. 157 HIP and ESP traffic have known issues with middlebox traversal RFC 158 5207 [RFC5207]. Other specifications exist for operating HIP and ESP 159 over UDP (RFC 5770 [RFC5770] is an experimental specification, and 160 others are being developed). Middlebox traversal is out of scope for 161 this document. 163 This document obsoletes RFC 5202. 165 2. Conventions Used in This Document 167 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 168 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 169 document are to be interpreted as described in RFC 2119 [RFC2119]. 171 3. Using ESP with HIP 173 The HIP base exchange is used to set up a HIP association between two 174 hosts. The base exchange provides two-way host authentication and 175 key material generation, but it does not provide any means for 176 protecting data communication between the hosts. In this document, 177 we specify the use of ESP for protecting user data traffic after the 178 HIP base exchange. Note that this use of ESP is intended only for 179 host-to-host traffic; security gateways are not supported. 181 To support ESP use, the HIP base exchange messages require some minor 182 additions to the parameters transported. In the R1 packet, the 183 Responder adds the possible ESP transforms in an ESP_TRANSFORM 184 parameter before sending it to the Initiator. The Initiator gets the 185 proposed transforms, selects one of those proposed transforms, and 186 adds it to the I2 packet in an ESP_TRANSFORM parameter. In this I2 187 packet, the Initiator also sends the SPI value that it wants to be 188 used for ESP traffic flowing from the Responder to the Initiator. 189 This information is carried using the ESP_INFO parameter. When 190 finalizing the ESP SA setup, the Responder sends its SPI value to the 191 Initiator in the R2 packet, again using ESP_INFO. 193 3.1. ESP Packet Format 195 The ESP specification [RFC4303] defines the ESP packet format for 196 IPsec. The HIP ESP packet looks exactly the same as the IPsec ESP 197 transport format packet. The semantics, however, are a bit different 198 and are described in more detail in the next subsection. 200 3.2. Conceptual ESP Packet Processing 202 ESP packet processing can be implemented in different ways in HIP. 203 It is possible to implement it in a way that a standards compliant, 204 unmodified IPsec implementation [RFC4303] can be used in conjunction 205 with some additional transport checksum processing above it, and if 206 IP addresses are used as indexes to the right host context. 208 When a standards compliant IPsec implementation that uses IP 209 addresses in the SPD and Security Association Database (SAD) is used, 210 the packet processing may take the following steps. For outgoing 211 packets, assuming that the upper-layer pseudoheader has been built 212 using IP addresses, the implementation recalculates upper-layer 213 checksums using Host Identity Tags (HITs) and, after that, changes 214 the packet source and destination addresses back to corresponding IP 215 addresses. The packet is sent to the IPsec ESP for transport mode 216 handling and from there the encrypted packet is sent to the network. 217 When an ESP packet is received, the packet is first put to the IPsec 218 ESP transport mode handling, and after decryption, the source and 219 destination IP addresses are replaced with HITs and finally, upper- 220 layer checksums are verified before passing the packet to the upper 221 layer. 223 An alternative way to implement packet processing is the BEET (Bound 224 End-to-End Tunnel) mode (see Appendix B). In BEET mode, the ESP 225 packet is formatted as a transport mode packet, but the semantics of 226 the connection are the same as for tunnel mode. The "outer" 227 addresses of the packet are the IP addresses and the "inner" 228 addresses are the HITs. For outgoing traffic, after the packet has 229 been encrypted, the packet's IP header is changed to a new one that 230 contains IP addresses instead of HITs, and the packet is sent to the 231 network. When the ESP packet is received, the SPI value, together 232 with the integrity protection, allow the packet to be securely 233 associated with the right HIT pair. The packet header is replaced 234 with a new header containing HITs, and the packet is decrypted. BEET 235 mode is completely internal for host and doesn't require that the 236 corresponding host implements it, instead the corresponding host can 237 have ESP transport mode and do HIT IP conversions outside ESP. 239 3.2.1. Semantics of the Security Parameter Index (SPI) 241 SPIs are used in ESP to find the right Security Association for 242 received packets. The ESP SPIs have added significance when used 243 with HIP; they are a compressed representation of a pair of HITs. 244 Thus, SPIs MAY be used by intermediary systems in providing services 245 like address mapping. Note that since the SPI has significance at 246 the receiver, only the < DST, SPI >, where DST is a destination IP 247 address, uniquely identifies the receiver HIT at any given point of 248 time. The same SPI value may be used by several hosts. A single < 249 DST, SPI > value may denote different hosts and contexts at different 250 points of time, depending on the host that is currently reachable at 251 the DST. 253 Each host selects for itself the SPI it wants to see in packets 254 received from its peer. This allows it to select different SPIs for 255 different peers. The SPI selection SHOULD be random; the rules of 256 Section 2.1 of the ESP specification [RFC4303] must be followed. A 257 different SPI SHOULD be used for each HIP exchange with a particular 258 host; this is to avoid a replay attack. Additionally, when a host 259 rekeys, the SPI MUST be changed. Furthermore, if a host changes over 260 to use a different IP address, it MAY change the SPI. 262 One method for SPI creation that meets the above criteria would be to 263 concatenate the HIT with a 32-bit random or sequential number, hash 264 this (using SHA1), and then use the high-order 32 bits as the SPI. 266 The selected SPI is communicated to the peer in the third (I2) and 267 fourth (R2) packets of the base HIP exchange. Changes in SPI are 268 signaled with ESP_INFO parameters. 270 3.3. Security Association Establishment and Maintenance 272 3.3.1. ESP Security Associations 274 In HIP, ESP Security Associations are setup between the HIP nodes 275 during the base exchange [I-D.ietf-hip-rfc5201-bis]. Existing ESP 276 SAs can be updated later using UPDATE messages. The reason for 277 updating the ESP SA later can be, for example, a need for rekeying 278 the SA because of sequence number rollover. 280 Upon setting up a HIP association, each association is linked to two 281 ESP SAs, one for incoming packets and one for outgoing packets. The 282 Initiator's incoming SA corresponds with the Responder's outgoing 283 one, and vice versa. The Initiator defines the SPI for its incoming 284 association, as defined in Section 3.2.1. This SA is herein called 285 SA-RI, and the corresponding SPI is called SPI-RI. Respectively, the 286 Responder's incoming SA corresponds with the Initiator's outgoing SA 287 and is called SA-IR, with the SPI being called SPI-IR. 289 The Initiator creates SA-RI as a part of R1 processing, before 290 sending out the I2, as explained in Section 6.4. The keys are 291 derived from KEYMAT, as defined in Section 7. The Responder creates 292 SA-RI as a part of I2 processing; see Section 6.5. 294 The Responder creates SA-IR as a part of I2 processing, before 295 sending out R2; see Section 6.5. The Initiator creates SA-IR when 296 processing R2; see Section 6.6. 298 The initial session keys are drawn from the generated keying 299 material, KEYMAT, after the HIP keys have been drawn as specified in 300 [I-D.ietf-hip-rfc5201-bis]. 302 When the HIP association is removed, the related ESP SAs MUST also be 303 removed. 305 3.3.2. Rekeying 307 After the initial HIP base exchange and SA establishment, both hosts 308 are in the ESTABLISHED state. There are no longer Initiator and 309 Responder roles and the association is symmetric. In this 310 subsection, the party that initiates the rekey procedure is denoted 311 with I' and the peer with R'. 313 An existing HIP-created ESP SA may need updating during the lifetime 314 of the HIP association. This document specifies the rekeying of an 315 existing HIP-created ESP SA, using the UPDATE message. The ESP_INFO 316 parameter introduced above is used for this purpose. 318 I' initiates the ESP SA updating process when needed (see 319 Section 6.8). It creates an UPDATE packet with required information 320 and sends it to the peer node. The old SAs are still in use, local 321 policy permitting. 323 R', after receiving and processing the UPDATE (see Section 6.9), 324 generates new SAs: SA-I'R' and SA-R'I'. It does not take the new 325 outgoing SA into use, but still uses the old one, so there 326 temporarily exists two SA pairs towards the same peer host. The SPI 327 for the new outgoing SA, SPI-R'I', is specified in the received 328 ESP_INFO parameter in the UPDATE packet. For the new incoming SA, R' 329 generates the new SPI value, SPI-I'R', and includes it in the 330 response UPDATE packet. 332 When I' receives a response UPDATE from R', it generates new SAs, as 333 described in Section 6.9: SA-I'R' and SA-R'I'. It starts using the 334 new outgoing SA immediately. 336 R' starts using the new outgoing SA when it receives traffic on the 337 new incoming SA or when it receives the UPDATE ACK confirming 338 completion of rekeying. After this, R' can remove the old SAs. 339 Similarly, when the I' receives traffic from the new incoming SA, it 340 can safely remove the old SAs. 342 3.3.3. Security Association Management 344 An SA pair is indexed by the 2 SPIs and 2 HITs (both local and remote 345 HITs since a system can have more than one HIT). An inactivity timer 346 is RECOMMENDED for all SAs. If the state dictates the deletion of an 347 SA, a timer is set to allow for any late arriving packets. 349 3.3.4. Security Parameter Index (SPI) 351 The SPIs in ESP provide a simple compression of the HIP data from all 352 packets after the HIP exchange. This does require a per HIT-pair 353 Security Association (and SPI), and a decrease of policy granularity 354 over other Key Management Protocols like Internet Key Exchange (IKE) 355 [RFC5996]. 357 When a host updates the ESP SA, it provides a new inbound SPI to and 358 gets a new outbound SPI from its peer. 360 3.3.5. Supported Ciphers 362 All HIP implementations MUST support AES-128-CBC and AES-256-CBC 363 [RFC3602]. If the Initiator does not support any of the transforms 364 offered by the Responder, it should abandon the negotiation and 365 inform the peer with a NOTIFY message about a non-supported 366 transform. 368 In addition to AES-128-CBC, all implementations MUST implement the 369 ESP NULL encryption algorithm. When the ESP NULL encryption is used, 370 it MUST be used together with SHA-256 authentication as specified in 371 Section 5.1.2 373 3.3.6. Sequence Number 375 The Sequence Number field is MANDATORY when ESP is used with HIP. 376 Anti-replay protection MUST be used in an ESP SA established with 377 HIP. When ESP is used with HIP, a 64-bit sequence number MUST be 378 used. This means that each host MUST rekey before its sequence 379 number reaches 2^64. 381 When using a 64-bit sequence number, the higher 32 bits are NOT 382 included in the ESP header, but are simply kept local to both peers. 383 See [RFC4301]. 385 3.3.7. Lifetimes and Timers 387 HIP does not negotiate any lifetimes. All ESP lifetimes are local 388 policy. The only lifetimes a HIP implementation MUST support are 389 sequence number rollover (for replay protection), and SHOULD support 390 timing out inactive ESP SAs. An SA times out if no packets are 391 received using that SA. Implementations SHOULD support a 392 configurable SA timeout value. Implementations MAY support lifetimes 393 for the various ESP transforms. Each implementation SHOULD implement 394 per-HIT configuration of the inactivity timeout, allowing statically 395 configured HIP associations to stay alive for days, even when 396 inactive. 398 3.4. IPsec and HIP ESP Implementation Considerations 400 When HIP is run on a node where a standards compliant IPsec is used, 401 some issues have to be considered. 403 The HIP implementation must be able to co-exist with other IPsec 404 keying protocols. When the HIP implementation selects the SPI value, 405 it may lead to a collision if not implemented properly. To avoid the 406 possibility for a collision, the HIP implementation MUST ensure that 407 the SPI values used for HIP SAs are not used for IPsec or other SAs, 408 and vice versa. 410 Incoming packets using an SA that is not negotiated by HIP MUST NOT 411 be processed as described in Section 3.2, paragraph 2. The SPI will 412 identify the correct SA for packet decryption and MUST be used to 413 identify that the packet has an upper-layer checksum that is 414 calculated as specified in [I-D.ietf-hip-rfc5201-bis]. 416 3.4.1. Data Packet Processing Considerations 418 For outbound traffic, the SPD or (coordinated) SPDs if there are two 419 (one for HIP and one for IPsec) MUST ensure that packets intended for 420 HIP processing are given a HIP-enabled SA and that packets intended 421 for IPsec processing are given an IPsec-enabled SA. The SP then MUST 422 be bound to the matching SA and non-HIP packets will not be processed 423 by this SA. Data originating from a socket that is not using HIP 424 MUST NOT have checksum recalculated (as described in Section 3.2, 425 paragraph 2) and data MUST NOT be passed to the SP or SA created by 426 the HIP. 428 It is possible that in case of overlapping policies, the outgoing 429 packet would be handled both by the IPsec and HIP. In this case, it 430 is possible that the HIP association is end-to-end, while the IPsec 431 SA is for encryption between the HIP host and a Security Gateway. In 432 case of a Security Gateway ESP association, the ESP uses always 433 tunnel mode. 435 In case of IPsec tunnel mode, it is hard to see during the HIP SA 436 processing if the IPsec ESP SA has the same final destination. Thus, 437 traffic MUST be encrypted both with the HIP ESP SA and with the IPsec 438 SA when the IPsec ESP SA is used in tunnel mode. 440 In case of IPsec transport mode, the connection end-points are the 441 same. However, for HIP data packets it is not possible to avoid HIP 442 SA processing, while mapping the HIP data packet's IP addresses to 443 the corresponding HITs requires SPI values from the ESP header. In 444 case of transport mode IPsec SA, the IPsec encryption MAY be skipped 445 to avoid double encryption, if the local policy allows. 447 3.4.2. HIP Signaling Packet Considerations 449 In general, HIP signaling packets should follow the same processing 450 as HIP data packets. 452 In case of IPsec tunnel mode, the HIP signaling packets are always 453 encrypted using IPsec ESP SA. Note, that this hides the HIP 454 signaling packets from the eventual HIP middle boxes on the path 455 between the originating host and the Security Gateway. 457 In case of IPsec transport mode, the HIP signaling packets MAY skip 458 the IPsec ESP SA encryption if the local policy allows. This allows 459 the eventual HIP middle boxes to handle the passing HIP signaling 460 packets. 462 4. The Protocol 464 In this section, the protocol for setting up an ESP association to be 465 used with HIP association is described. 467 4.1. ESP in HIP 469 4.1.1. IPsec ESP Transport Format Type 471 The HIP handshake signals the TRANSPORT_FORMAT_LIST parameter in the 472 R1 and I2 messages. This parameter contains a list of the supported 473 HIP transport formats of the sending host in the order of preference. 474 The transport format type for IPsec ESP is the type number of the 475 ESP_TRANSFORM parameter, i.e., 4095. 477 4.1.2. Setting Up an ESP Security Association 479 Setting up an ESP Security Association between hosts using HIP 480 consists of three messages passed between the hosts. The parameters 481 are included in R1, I2, and R2 messages during base exchange. 483 Initiator Responder 485 I1 486 ----------------------------------> 488 R1: ESP_TRANSFORM 489 <---------------------------------- 491 I2: ESP_TRANSFORM, ESP_INFO 492 ----------------------------------> 494 R2: ESP_INFO 495 <---------------------------------- 497 Setting up an ESP Security Association between HIP hosts requires 498 three messages to exchange the information that is required during an 499 ESP communication. 501 The R1 message contains the ESP_TRANSFORM parameter, in which the 502 sending host defines the possible ESP transforms it is willing to use 503 for the ESP SA. 505 Including the ESP_TRANSFORM parameter in the R1 message adds clarity 506 to the TRANSPORT_FORMAT_LIST, but may initiate negotiations for 507 possibly unselected transforms. However, resource-constrained 508 devices will most likely restrict support to a single transform for 509 the sake of minimizing ROM overhead and the additional parameter adds 510 negligible overhead with unconstrained devices. 512 The I2 message contains the response to an ESP_TRANSFORM received in 513 the R1 message. The sender must select one of the proposed ESP 514 transforms from the ESP_TRANSFORM parameter in the R1 message and 515 include the selected one in the ESP_TRANSFORM parameter in the I2 516 packet. In addition to the transform, the host includes the ESP_INFO 517 parameter containing the SPI value to be used by the peer host. 519 In the R2 message, the ESP SA setup is finalized. The packet 520 contains the SPI information required by the Initiator for the ESP 521 SA. 523 4.1.3. Updating an Existing ESP SA 525 The update process is accomplished using two messages. The HIP 526 UPDATE message is used to update the parameters of an existing ESP 527 SA. The UPDATE mechanism and message is defined in 528 [I-D.ietf-hip-rfc5201-bis], and the additional parameters for 529 updating an existing ESP SA are described here. 531 The following picture shows a typical exchange when an existing ESP 532 SA is updated. Messages include SEQ and ACK parameters required by 533 the UPDATE mechanism. 535 H1 H2 536 UPDATE: SEQ, ESP_INFO [, DIFFIE_HELLMAN] 537 -----------------------------------------------------> 539 UPDATE: SEQ, ACK, ESP_INFO [, DIFFIE_HELLMAN] 540 <----------------------------------------------------- 542 UPDATE: ACK 543 -----------------------------------------------------> 545 The host willing to update the ESP SA creates and sends an UPDATE 546 message. The message contains the ESP_INFO parameter containing the 547 old SPI value that was used, the new SPI value to be used, and the 548 index value for the keying material, giving the point from where the 549 next keys will be drawn. If new keying material must be generated, 550 the UPDATE message will also contain the DIFFIE_HELLMAN parameter 551 defined in [I-D.ietf-hip-rfc5201-bis]. 553 The host receiving the UPDATE message requesting update of an 554 existing ESP SA MUST reply with an UPDATE message. In the reply 555 message, the host sends the ESP_INFO parameter containing the 556 corresponding values: old SPI, new SPI, and the keying material 557 index. If the incoming UPDATE contained a DIFFIE_HELLMAN parameter, 558 the reply packet MUST also contain a DIFFIE_HELLMAN parameter. 560 5. Parameter and Packet Formats 562 In this section, new and modified HIP parameters are presented, as 563 well as modified HIP packets. 565 5.1. New Parameters 567 Two new HIP parameters are defined for setting up ESP transport 568 format associations in HIP communication and for rekeying existing 569 ones. Also, the NOTIFICATION parameter, described in 570 [I-D.ietf-hip-rfc5201-bis], has two new error parameters. 572 Parameter Type Length Data 574 ESP_INFO 65 12 Remote's old SPI, 575 new SPI, and other info 576 ESP_TRANSFORM 4095 variable ESP Encryption and 577 Authentication Transform(s) 579 5.1.1. ESP_INFO 581 During the establishment and update of an ESP SA, the SPI value of 582 both hosts must be transmitted between the hosts. In addition, hosts 583 need the index value to the KEYMAT when they are drawing keys from 584 the generated keying material. The ESP_INFO parameter is used to 585 transmit the SPI values and the KEYMAT index information between the 586 hosts. 588 During the initial ESP SA setup, the hosts send the SPI value that 589 they want the peer to use when sending ESP data to them. The value 590 is set in the NEW SPI field of the ESP_INFO parameter. In the 591 initial setup, an old value for the SPI does not exist, thus the OLD 592 SPI value field is set to zero. The OLD SPI field value may also be 593 zero when additional SAs are set up between HIP hosts, e.g., in case 594 of multihomed HIP hosts [RFC5206]. However, such use is beyond the 595 scope of this specification. 597 The KEYMAT index value points to the place in the KEYMAT from where 598 the keying material for the ESP SAs is drawn. The KEYMAT index value 599 is zero only when the ESP_INFO is sent during a rekeying process and 600 new keying material is generated. 602 During the life of an SA established by HIP, one of the hosts may 603 need to reset the Sequence Number to one and rekey. The reason for 604 rekeying might be an approaching sequence number wrap in ESP, or a 605 local policy on use of a key. Rekeying ends the current SAs and 606 starts new ones on both peers. 608 During the rekeying process, the ESP_INFO parameter is used to 609 transmit the changed SPI values and the keying material index. 611 0 1 2 3 612 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 613 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 614 | Type | Length | 615 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 616 | Reserved | KEYMAT Index | 617 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 618 | OLD SPI | 619 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 620 | NEW SPI | 621 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 623 Type 65 624 Length 12 625 KEYMAT Index Index, in bytes, where to continue to draw ESP keys 626 from KEYMAT. If the packet includes a new 627 Diffie-Hellman key and the ESP_INFO is sent in an 628 UPDATE packet, the field MUST be zero. If the 629 ESP_INFO is included in base exchange messages, the 630 KEYMAT Index must have the index value of the point 631 from where the ESP SA keys are drawn. Note that 632 the length of this field limits the amount of 633 keying material that can be drawn from KEYMAT. If 634 that amount is exceeded, the packet MUST contain 635 a new Diffie-Hellman key. 636 OLD SPI old SPI for data sent to address(es) associated 637 with this SA. If this is an initial SA setup, the 638 OLD SPI value is zero. 639 NEW SPI new SPI for data sent to address(es) associated 640 with this SA. 642 5.1.2. ESP_TRANSFORM 644 The ESP_TRANSFORM parameter is used during ESP SA establishment. The 645 first party sends a selection of transform families in the 646 ESP_TRANSFORM parameter, and the peer must select one of the proposed 647 values and include it in the response ESP_TRANSFORM parameter. 649 0 1 2 3 650 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 651 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 652 | Type | Length | 653 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 654 | Reserved | Suite ID #1 | 655 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 656 | Suite ID #2 | Suite ID #3 | 657 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 658 | Suite ID #n | Padding | 659 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 661 Type 4095 662 Length length in octets, excluding Type, Length, and 663 padding 664 Reserved zero when sent, ignored when received 665 Suite ID defines the ESP Suite to be used 667 The following Suite IDs can be used: 669 Suite ID Value 671 RESERVED 0 672 AES-128-CBC with HMAC-SHA1 1 [RFC3602], [RFC2404] 673 DEPRECATED 2 674 DEPRECATED 3 675 DEPRECATED 4 676 DEPRECATED 5 677 DEPRECATED 6 678 NULL-ENCRYPT with HMAC-SHA-256 7 [RFC2410], [RFC4868] 679 AES-128-CBC with HMAC-SHA-256 8 [RFC3602], [RFC4868] 680 AES-256-CBC with HMAC-SHA-256 9 [RFC3602], [RFC4868] 681 AES-CCM-8 10 [RFC4309] 682 AES-CCM-16 11 [RFC4309] 683 AES-GCM with a 8 octet ICV 12 [RFC4106] 684 AES-GCM with a 16 octet ICV 13 [RFC4106] 685 AES-CMAC-96 14 [RFC4493], [RFC4494] 686 AES-GMAC 15 [RFC4543] 688 The sender of an ESP transform parameter MUST make sure that there 689 are no more than six (6) Suite IDs in one ESP transform parameter. 691 Conversely, a recipient MUST be prepared to handle received transform 692 parameters that contain more than six Suite IDs. The limited number 693 of Suite IDs sets the maximum size of the ESP_TRANSFORM parameter. 694 As the default configuration, the ESP_TRANSFORM parameter MUST 695 contain at least one of the mandatory Suite IDs. There MAY be a 696 configuration option that allows the administrator to override this 697 default. 699 Mandatory implementations: AES-128-CBC with HMAC-SHA-256 and NULL 700 with HMAC-SHA-256. 702 Under some conditions, it is possible to use Traffic Flow 703 Confidentiality (TFC) [RFC4303] with ESP in BEET mode. However, the 704 definition of such operation is future work and must be done in a 705 separate specification. 707 5.1.3. NOTIFICATION Parameter 709 The HIP base specification defines a set of NOTIFICATION error types. 710 The following error types are required for describing errors in ESP 711 Transform crypto suites during negotiation. 713 NOTIFICATION PARAMETER - ERROR TYPES Value 714 ------------------------------------ ----- 716 NO_ESP_PROPOSAL_CHOSEN 18 718 None of the proposed ESP Transform crypto suites was 719 acceptable. 721 INVALID_ESP_TRANSFORM_CHOSEN 19 723 The ESP Transform crypto suite does not correspond to 724 one offered by the Responder. 726 5.2. HIP ESP Security Association Setup 728 The ESP Security Association is set up during the base exchange. The 729 following subsections define the ESP SA setup procedure using both 730 base exchange messages (R1, I2, R2) and UPDATE messages. 732 5.2.1. Setup During Base Exchange 734 5.2.1.1. Modifications in R1 736 The ESP_TRANSFORM contains the ESP modes supported by the sender, in 737 the order of preference. All implementations MUST support AES-128- 738 CBC [RFC3602] with HMAC-SHA-256 [RFC4868]. 740 The following figure shows the resulting R1 packet layout. 742 The HIP parameters for the R1 packet: 744 IP ( HIP ( [ R1_COUNTER, ] 745 PUZZLE, 746 DIFFIE_HELLMAN, 747 HIP_CIPHER, 748 ESP_TRANSFORM, 749 HOST_ID, 750 [ ECHO_REQUEST, ] 751 HIP_SIGNATURE_2 ) 752 [, ECHO_REQUEST ]) 754 5.2.1.2. Modifications in I2 756 The ESP_INFO contains the sender's SPI for this association as well 757 as the KEYMAT index from where the ESP SA keys will be drawn. The 758 old SPI value is set to zero. 760 The ESP_TRANSFORM contains the ESP mode selected by the sender of R1. 761 All implementations MUST support AES-128-CBC [RFC3602] with HMAC-SHA- 762 256 [RFC4868]. 764 The following figure shows the resulting I2 packet layout. 766 The HIP parameters for the I2 packet: 768 IP ( HIP ( ESP_INFO, 769 [R1_COUNTER,] 770 SOLUTION, 771 DIFFIE_HELLMAN, 772 HIP_CIPHER, 773 ESP_TRANSFORM, 774 ENCRYPTED { HOST_ID }, 775 [ ECHO_RESPONSE ,] 776 HMAC, 777 HIP_SIGNATURE 778 [, ECHO_RESPONSE] ) ) 780 5.2.1.3. Modifications in R2 782 The R2 contains an ESP_INFO parameter, which has the SPI value of the 783 sender of the R2 for this association. The ESP_INFO also has the 784 KEYMAT index value specifying where the ESP SA keys are drawn. 786 The following figure shows the resulting R2 packet layout. 788 The HIP parameters for the R2 packet: 790 IP ( HIP ( ESP_INFO, HMAC_2, HIP_SIGNATURE ) ) 792 5.3. HIP ESP Rekeying 794 In this section, the procedure for rekeying an existing ESP SA is 795 presented. 797 Conceptually, the process can be represented by the following message 798 sequence using the host names I' and R' defined in Section 3.3.2. 799 For simplicity, HMAC and HIP_SIGNATURE are not depicted, and 800 DIFFIE_HELLMAN keys are optional. The UPDATE with ACK_I need not be 801 piggybacked with the UPDATE with SEQ_R; it may be ACKed separately 802 (in which case the sequence would include four packets). 804 I' R' 806 UPDATE(ESP_INFO, SEQ_I, [DIFFIE_HELLMAN]) 807 -----------------------------------> 808 UPDATE(ESP_INFO, SEQ_R, ACK_I, [DIFFIE_HELLMAN]) 809 <----------------------------------- 810 UPDATE(ACK_R) 811 -----------------------------------> 813 Below, the first two packets in this figure are explained. 815 5.3.1. Initializing Rekeying 817 When HIP is used with ESP, the UPDATE packet is used to initiate 818 rekeying. The UPDATE packet MUST carry an ESP_INFO and MAY carry a 819 DIFFIE_HELLMAN parameter. 821 Intermediate systems that use the SPI will have to inspect HIP 822 packets for those that carry rekeying information. The packet is 823 signed for the benefit of the intermediate systems. Since 824 intermediate systems may need the new SPI values, the contents cannot 825 be encrypted. 827 The following figure shows the contents of a rekeying initialization 828 UPDATE packet. 830 The HIP parameters for the UPDATE packet initiating rekeying: 832 IP ( HIP ( ESP_INFO, 833 SEQ, 834 [DIFFIE_HELLMAN, ] 835 HMAC, 836 HIP_SIGNATURE ) ) 838 5.3.2. Responding to the Rekeying Initialization 840 The UPDATE ACK is used to acknowledge the received UPDATE rekeying 841 initialization. The acknowledgment UPDATE packet MUST carry an 842 ESP_INFO and MAY carry a DIFFIE_HELLMAN parameter. 844 Intermediate systems that use the SPI will have to inspect HIP 845 packets for packets carrying rekeying information. The packet is 846 signed for the benefit of the intermediate systems. Since 847 intermediate systems may need the new SPI values, the contents cannot 848 be encrypted. 850 The following figure shows the contents of a rekeying acknowledgment 851 UPDATE packet. 853 The HIP parameters for the UPDATE packet: 855 IP ( HIP ( ESP_INFO, 856 SEQ, 857 ACK, 858 [ DIFFIE_HELLMAN, ] 859 HMAC, 860 HIP_SIGNATURE ) ) 862 5.4. ICMP Messages 864 ICMP message handling is mainly described in the HIP base 865 specification [I-D.ietf-hip-rfc5201-bis]. In this section, we 866 describe the actions related to ESP security associations. 868 5.4.1. Unknown SPI 870 If a HIP implementation receives an ESP packet that has an 871 unrecognized SPI number, it MAY respond (subject to rate limiting the 872 responses) with an ICMP packet with type "Parameter Problem", with 873 the pointer pointing to the beginning of SPI field in the ESP header. 875 6. Packet Processing 877 Packet processing is mainly defined in the HIP base specification 878 [I-D.ietf-hip-rfc5201-bis]. This section describes the changes and 879 new requirements for packet handling when the ESP transport format is 880 used. Note that all HIP packets (currently protocol 139) MUST bypass 881 ESP processing. 883 6.1. Processing Outgoing Application Data 885 Outgoing application data handling is specified in the HIP base 886 specification [I-D.ietf-hip-rfc5201-bis]. When the ESP transport 887 format is used, and there is an active HIP session for the given < 888 source, destination > HIT pair, the outgoing datagram is protected 889 using the ESP security association. The following additional steps 890 define the conceptual processing rules for outgoing ESP protected 891 datagrams. 893 1. Detect the proper ESP SA using the HITs in the packet header or 894 other information associated with the packet 896 2. Process the packet normally, as if the SA was a transport mode 897 SA. 899 3. Ensure that the outgoing ESP protected packet has proper IP 900 header format depending on the used IP address family, and proper 901 IP addresses in its IP header, e.g., by replacing HITs left by 902 the ESP processing. Note that this placement of proper IP 903 addresses MAY also be performed at some other point in the stack, 904 e.g., before ESP processing. 906 6.2. Processing Incoming Application Data 908 Incoming HIP user data packets arrive as ESP protected packets. In 909 the usual case, the receiving host has a corresponding ESP security 910 association, identified by the SPI and destination IP address in the 911 packet. However, if the host has crashed or otherwise lost its HIP 912 state, it may not have such an SA. 914 The basic incoming data handling is specified in the HIP base 915 specification. Additional steps are required when ESP is used for 916 protecting the data traffic. The following steps define the 917 conceptual processing rules for incoming ESP protected datagrams 918 targeted to an ESP security association created with HIP. 920 1. Detect the proper ESP SA using the SPI. If the resulting SA is a 921 non-HIP ESP SA, process the packet according to standard IPsec 922 rules. If there are no SAs identified with the SPI, the host MAY 923 send an ICMP packet as defined in Section 5.4. How to handle 924 lost state is an implementation issue. 926 2. If the SPI matches with an active HIP-based ESP SA, the IP 927 addresses in the datagram are replaced with the HITs associated 928 with the SPI. Note that this IP-address-to-HIT conversion step 929 MAY also be performed at some other point in the stack, e.g., 930 after ESP processing. Note also that if the incoming packet has 931 IPv4 addresses, the packet must be converted to IPv6 format 932 before replacing the addresses with HITs (such that the transport 933 checksum will pass if there are no errors). 935 3. The transformed packet is next processed normally by ESP, as if 936 the packet were a transport mode packet. The packet may be 937 dropped by ESP, as usual. In a typical implementation, the 938 result of successful ESP decryption and verification is a 939 datagram with the associated HITs as source and destination. 941 4. The datagram is delivered to the upper layer. Demultiplexing the 942 datagram to the right upper layer socket is performed as usual, 943 except that the HITs are used in place of IP addresses during the 944 demultiplexing. 946 6.3. HMAC and SIGNATURE Calculation and Verification 948 The new HIP parameters described in this document, ESP_INFO and 949 ESP_TRANSFORM, must be protected using HMAC and signature 950 calculations. In a typical implementation, they are included in R1, 951 I2, R2, and UPDATE packet HMAC and SIGNATURE calculations as 952 described in [I-D.ietf-hip-rfc5201-bis]. 954 6.4. Processing Incoming ESP SA Initialization (R1) 956 The ESP SA setup is initialized in the R1 message. The receiving 957 host (Initiator) selects one of the ESP transforms from the presented 958 values. If no suitable value is found, the negotiation is 959 terminated. The selected values are subsequently used when 960 generating and using encryption keys, and when sending the reply 961 packet. If the proposed alternatives are not acceptable to the 962 system, it may abandon the ESP SA establishment negotiation, or it 963 may resend the I1 message within the retry bounds. 965 After selecting the ESP transform and performing other R1 processing, 966 the system prepares and creates an incoming ESP security association. 967 It may also prepare a security association for outgoing traffic, but 968 since it does not have the correct SPI value yet, it cannot activate 969 it. 971 6.5. Processing Incoming Initialization Reply (I2) 973 The following steps are required to process the incoming ESP SA 974 initialization replies in I2. The steps below assume that the I2 has 975 been accepted for processing (e.g., has not been dropped due to HIT 976 comparisons as described in [I-D.ietf-hip-rfc5201-bis]). 978 o The ESP_TRANSFORM parameter is verified and it MUST contain a 979 single value in the parameter, and it MUST match one of the values 980 offered in the initialization packet. 982 o The ESP_INFO NEW SPI field is parsed to obtain the SPI that will 983 be used for the Security Association outbound from the Responder 984 and inbound to the Initiator. For this initial ESP SA 985 establishment, the old SPI value MUST be zero. The KEYMAT Index 986 field MUST contain the index value to the KEYMAT from where the 987 ESP SA keys are drawn. 989 o The system prepares and creates both incoming and outgoing ESP 990 security associations. 992 o Upon successful processing of the initialization reply message, 993 the possible old Security Associations (as left over from an 994 earlier incarnation of the HIP association) are dropped and the 995 new ones are installed, and a finalizing packet, R2, is sent. 996 Possible ongoing rekeying attempts are dropped. 998 6.6. Processing Incoming ESP SA Setup Finalization (R2) 1000 Before the ESP SA can be finalized, the ESP_INFO NEW SPI field is 1001 parsed to obtain the SPI that will be used for the ESP Security 1002 Association inbound to the sender of the finalization message R2. 1003 The system uses this SPI to create or activate the outgoing ESP 1004 security association used for sending packets to the peer. 1006 6.7. Dropping HIP Associations 1008 When the system drops a HIP association, as described in the HIP base 1009 specification, the associated ESP SAs MUST also be dropped. 1011 6.8. Initiating ESP SA Rekeying 1013 During ESP SA rekeying, the hosts draw new keys from the existing 1014 keying material, or new keying material is generated from where the 1015 new keys are drawn. 1017 A system may initiate the SA rekeying procedure at any time. It MUST 1018 initiate a rekey if its incoming ESP sequence counter is about to 1019 overflow. The system MUST NOT replace its keying material until the 1020 rekeying packet exchange successfully completes. 1022 Optionally, a system may include a new Diffie-Hellman key for use in 1023 new KEYMAT generation. New KEYMAT generation occurs prior to drawing 1024 the new keys. 1026 The rekeying procedure uses the UPDATE mechanism defined in 1027 [I-D.ietf-hip-rfc5201-bis]. Because each peer must update its half 1028 of the security association pair (including new SPI creation), the 1029 rekeying process requires that each side both send and receive an 1030 UPDATE. A system will then rekey the ESP SA when it has sent 1031 parameters to the peer and has received both an ACK of the relevant 1032 UPDATE message and corresponding peer's parameters. It may be that 1033 the ACK and the required HIP parameters arrive in different UPDATE 1034 messages. This is always true if a system does not initiate ESP SA 1035 update but responds to an update request from the peer, and may also 1036 occur if two systems initiate update nearly simultaneously. In such 1037 a case, if the system has an outstanding update request, it saves the 1038 one parameter and waits for the other before completing rekeying. 1040 The following steps define the processing rules for initiating an ESP 1041 SA update: 1043 1. The system decides whether to continue to use the existing KEYMAT 1044 or to generate a new KEYMAT. In the latter case, the system MUST 1045 generate a new Diffie-Hellman public key. 1047 2. The system creates an UPDATE packet, which contains the ESP_INFO 1048 parameter. In addition, the host may include the optional 1049 DIFFIE_HELLMAN parameter. If the UPDATE contains the 1050 DIFFIE_HELLMAN parameter, the KEYMAT Index in the ESP_INFO 1051 parameter MUST be zero, and the Diffie-Hellman group ID must be 1052 unchanged from that used in the initial handshake. If the UPDATE 1053 does not contain DIFFIE_HELLMAN, the ESP_INFO KEYMAT Index MUST 1054 be greater than or equal to the index of the next byte to be 1055 drawn from the current KEYMAT. 1057 3. The system sends the UPDATE packet. For reliability, the 1058 underlying UPDATE retransmission mechanism MUST be used. 1060 4. The system MUST NOT delete its existing SAs, but continue using 1061 them if its policy still allows. The rekeying procedure SHOULD 1062 be initiated early enough to make sure that the SA replay 1063 counters do not overflow. 1065 5. In case a protocol error occurs and the peer system acknowledges 1066 the UPDATE but does not itself send an ESP_INFO, the system may 1067 not finalize the outstanding ESP SA update request. To guard 1068 against this, a system MAY re-initiate the ESP SA update 1069 procedure after some time waiting for the peer to respond, or it 1070 MAY decide to abort the ESP SA after waiting for an 1071 implementation-dependent time. The system MUST NOT keep an 1072 outstanding ESP SA update request for an indefinite time. 1074 To simplify the state machine, a host MUST NOT generate new UPDATEs 1075 while it has an outstanding ESP SA update request, unless it is 1076 restarting the update process. 1078 6.9. Processing Incoming UPDATE Packets 1080 When a system receives an UPDATE packet, it must be processed if the 1081 following conditions hold (in addition to the generic conditions 1082 specified for UPDATE processing in Section 6.12 of 1083 [I-D.ietf-hip-rfc5201-bis]): 1085 1. A corresponding HIP association must exist. This is usually 1086 ensured by the underlying UPDATE mechanism. 1088 2. The state of the HIP association is ESTABLISHED or R2-SENT. 1090 If the above conditions hold, the following steps define the 1091 conceptual processing rules for handling the received UPDATE packet: 1093 1. If the received UPDATE contains a DIFFIE_HELLMAN parameter, the 1094 received KEYMAT Index MUST be zero and the Group ID must match 1095 the Group ID in use on the association. If this test fails, the 1096 packet SHOULD be dropped and the system SHOULD log an error 1097 message. 1099 2. If there is no outstanding rekeying request, the packet 1100 processing continues as specified in Section 6.9.1. 1102 3. If there is an outstanding rekeying request, the UPDATE MUST be 1103 acknowledged, the received ESP_INFO (and possibly DIFFIE_HELLMAN) 1104 parameters must be saved, and the packet processing continues as 1105 specified in Section 6.10. 1107 6.9.1. Processing UPDATE Packet: No Outstanding Rekeying Request 1109 The following steps define the conceptual processing rules for 1110 handling a received UPDATE packet with the ESP_INFO parameter: 1112 1. The system consults its policy to see if it needs to generate a 1113 new Diffie-Hellman key, and generates a new key (with same Group 1114 ID) if needed. The system records any newly generated or 1115 received Diffie-Hellman keys for use in KEYMAT generation upon 1116 finalizing the ESP SA update. 1118 2. If the system generated a new Diffie-Hellman key in the previous 1119 step, or if it received a DIFFIE_HELLMAN parameter, it sets the 1120 ESP_INFO KEYMAT Index to zero. Otherwise, the ESP_INFO KEYMAT 1121 Index MUST be greater than or equal to the index of the next byte 1122 to be drawn from the current KEYMAT. In this case, it is 1123 RECOMMENDED that the host use the KEYMAT Index requested by the 1124 peer in the received ESP_INFO. 1126 3. The system creates an UPDATE packet, which contains an ESP_INFO 1127 parameter and the optional DIFFIE_HELLMAN parameter. This UPDATE 1128 would also typically acknowledge the peer's UPDATE with an ACK 1129 parameter, although a separate UPDATE ACK may be sent. 1131 4. The system sends the UPDATE packet and stores any received 1132 ESP_INFO and DIFFIE_HELLMAN parameters. At this point, it only 1133 needs to receive an acknowledgment for the newly sent UPDATE to 1134 finish ESP SA update. In the usual case, the acknowledgment is 1135 handled by the underlying UPDATE mechanism. 1137 6.10. Finalizing Rekeying 1139 A system finalizes rekeying when it has both received the 1140 corresponding UPDATE acknowledgment packet from the peer and it has 1141 successfully received the peer's UPDATE. The following steps are 1142 taken: 1144 1. If the received UPDATE messages contain a new Diffie-Hellman key, 1145 the system has a new Diffie-Hellman key due to initiating ESP SA 1146 update, or both, the system generates a new KEYMAT. If there is 1147 only one new Diffie-Hellman key, the old existing key is used as 1148 the other key. 1150 2. If the system generated a new KEYMAT in the previous step, it 1151 sets the KEYMAT Index to zero, independent of whether the 1152 received UPDATE included a Diffie-Hellman key or not. If the 1153 system did not generate a new KEYMAT, it uses the greater KEYMAT 1154 Index of the two (sent and received) ESP_INFO parameters. 1156 3. The system draws keys for new incoming and outgoing ESP SAs, 1157 starting from the KEYMAT Index, and prepares new incoming and 1158 outgoing ESP SAs. The SPI for the outgoing SA is the new SPI 1159 value received in an ESP_INFO parameter. The SPI for the 1160 incoming SA was generated when the ESP_INFO was sent to the peer. 1161 The order of the keys retrieved from the KEYMAT during the 1162 rekeying process is similar to that described in Section 7. 1164 Note, that only IPsec ESP keys are retrieved during the rekeying 1165 process, not the HIP keys. 1167 4. The system starts to send to the new outgoing SA and prepares to 1168 start receiving data on the new incoming SA. Once the system 1169 receives data on the new incoming SA, it may safely delete the 1170 old SAs. 1172 6.11. Processing NOTIFY Packets 1174 The processing of NOTIFY packets is described in the HIP base 1175 specification. 1177 7. Keying Material 1179 The keying material is generated as described in the HIP base 1180 specification. During the base exchange, the initial keys are drawn 1181 from the generated material. After the HIP association keys have 1182 been drawn, the ESP keys are drawn in the following order: 1184 SA-gl ESP encryption key for HOST_g's outgoing traffic 1186 SA-gl ESP authentication key for HOST_g's outgoing traffic 1188 SA-lg ESP encryption key for HOST_l's outgoing traffic 1190 SA-lg ESP authentication key for HOST_l's outgoing traffic 1192 HOST_g denotes the host with the greater HIT value, and HOST_l 1193 denotes the host with the lower HIT value. When HIT values are 1194 compared, they are interpreted as positive (unsigned) 128-bit 1195 integers in network byte order. 1197 The four HIP keys are only drawn from KEYMAT during a HIP I1->R2 1198 exchange. Subsequent rekeys using UPDATE will only draw the four ESP 1199 keys from KEYMAT. Section 6.9 describes the rules for reusing or 1200 regenerating KEYMAT based on the rekeying. 1202 The number of bits drawn for a given algorithm is the "natural" size 1203 of the keys, as specified in Section 6.5 of 1204 [I-D.ietf-hip-rfc5201-bis]. 1206 8. Security Considerations 1208 In this document, the usage of ESP [RFC4303] between HIP hosts to 1209 protect data traffic is introduced. The Security Considerations for 1210 ESP are discussed in the ESP specification. 1212 There are different ways to establish an ESP Security Association 1213 between two nodes. This can be done, e.g., using IKE [RFC5996]. 1214 This document specifies how the Host Identity Protocol is used to 1215 establish ESP Security Associations. 1217 The following issues are new or have changed from the standard ESP 1218 usage: 1220 o Initial keying material generation 1222 o Updating the keying material 1224 The initial keying material is generated using the Host Identity 1225 Protocol [I-D.ietf-hip-rfc5201-bis] using the Diffie-Hellman 1226 procedure. This document extends the usage of the UPDATE packet, 1227 defined in the base specification, to modify existing ESP SAs. The 1228 hosts may rekey, i.e., force the generation of new keying material 1229 using the Diffie-Hellman procedure. The initial setup of ESP SA 1230 between the hosts is done during the base exchange, and the message 1231 exchange is protected using methods provided by base exchange. 1232 Changes in connection parameters means basically that the old ESP SA 1233 is removed and a new one is generated once the UPDATE message 1234 exchange has been completed. The message exchange is protected using 1235 the HIP association keys. Both HMAC and signing of packets is used. 1237 9. IANA Considerations 1239 This document defines additional parameters and NOTIFY error types 1240 for the Host Identity Protocol [I-D.ietf-hip-rfc5201-bis]. 1242 The new parameters and their type numbers are defined in 1243 Section 5.1.1 and Section 5.1.2, and they have been added to the 1244 Parameter Type namespace specified in [I-D.ietf-hip-rfc5201-bis]. 1246 The new NOTIFY error types and their values are defined in 1247 Section 5.1.3, and they have been added to the Notify Message Type 1248 namespace specified in [I-D.ietf-hip-rfc5201-bis]. 1250 10. Acknowledgments 1252 This document was separated from the base "Host Identity Protocol" 1253 specification in the beginning of 2005. Since then, a number of 1254 people have contributed to the text by providing comments and 1255 modification proposals. The list of people include Tom Henderson, 1256 Jeff Ahrenholz, Jan Melen, Jukka Ylitalo, and Miika Komu. 1257 Especially, the authors want to thank Pekka Nikander for his 1258 invaluable contributions to the document since the first draft 1259 version. The authors want to thank also Charlie Kaufman for 1260 reviewing the document with his eye on the usage of crypto 1261 algorithms. 1263 Due to the history of this document, most of the ideas are inherited 1264 from the base "Host Identity Protocol" specification. Thus, the list 1265 of people in the Acknowledgments section of that specification is 1266 also valid for this document. Many people have given valuable 1267 feedback, and our apologies to anyone whose name is missing. 1269 11. References 1271 11.1. Normative references 1273 [I-D.ietf-hip-rfc5201-bis] Moskowitz, R., Heer, T., Jokela, P., and 1274 T. Henderson, "Host Identity Protocol 1275 Version 2 (HIPv2)", 1276 draft-ietf-hip-rfc5201-bis-14 (work in 1277 progress), October 2013. 1279 [RFC2119] Bradner, S., "Key words for use in RFCs 1280 to Indicate Requirement Levels", BCP 14, 1281 RFC 2119, March 1997. 1283 [RFC2404] Madson, C. and R. Glenn, "The Use of 1284 HMAC-SHA-1-96 within ESP and AH", 1285 RFC 2404, November 1998. 1287 [RFC2410] Glenn, R. and S. Kent, "The NULL 1288 Encryption Algorithm and Its Use With 1289 IPsec", RFC 2410, November 1998. 1291 [RFC3602] Frankel, S., Glenn, R., and S. Kelly, 1292 "The AES-CBC Cipher Algorithm and Its Use 1293 with IPsec", RFC 3602, September 2003. 1295 [RFC4106] Viega, J. and D. McGrew, "The Use of 1296 Galois/Counter Mode (GCM) in IPsec 1297 Encapsulating Security Payload (ESP)", 1298 RFC 4106, June 2005. 1300 [RFC4303] Kent, S., "IP Encapsulating Security 1301 Payload (ESP)", RFC 4303, December 2005. 1303 [RFC4309] Housley, R., "Using Advanced Encryption 1304 Standard (AES) CCM Mode with IPsec 1305 Encapsulating Security Payload (ESP)", 1306 RFC 4309, December 2005. 1308 [RFC4493] Song, JH., Poovendran, R., Lee, J., and 1309 T. Iwata, "The AES-CMAC Algorithm", 1310 RFC 4493, June 2006. 1312 [RFC4494] Song, JH., Poovendran, R., and J. Lee, 1313 "The AES-CMAC-96 Algorithm and Its Use 1314 with IPsec", RFC 4494, June 2006. 1316 [RFC4543] McGrew, D. and J. Viega, "The Use of 1317 Galois Message Authentication Code (GMAC) 1318 in IPsec ESP and AH", RFC 4543, May 2006. 1320 [RFC4868] Kelly, S. and S. Frankel, "Using HMAC- 1321 SHA-256, HMAC-SHA-384, and HMAC-SHA-512 1322 with IPsec", RFC 4868, May 2007. 1324 11.2. Informative references 1326 [I-D.ietf-hip-rfc4423-bis] Moskowitz, R. and M. Komu, "Host Identity 1327 Protocol Architecture", 1328 draft-ietf-hip-rfc4423-bis-06 (work in 1329 progress), November 2013. 1331 [RFC0791] Postel, J., "Internet Protocol", STD 5, 1332 RFC 791, September 1981. 1334 [RFC4301] Kent, S. and K. Seo, "Security 1335 Architecture for the Internet Protocol", 1336 RFC 4301, December 2005. 1338 [RFC5206] Henderson, T., Ed., "End-Host Mobility 1339 and Multihoming with the Host Identity 1340 Protocol", RFC 5206, April 2008. 1342 [RFC5207] Stiemerling, M., Quittek, J., and L. 1343 Eggert, "NAT and Firewall Traversal 1344 Issues of Host Identity Protocol (HIP) 1345 Communication", RFC 5207, April 2008. 1347 [RFC5770] Komu, M., Henderson, T., Tschofenig, H., 1348 Melen, J., and A. Keranen, "Basic Host 1349 Identity Protocol (HIP) Extensions for 1350 Traversal of Network Address 1351 Translators", RFC 5770, April 2010. 1353 [RFC5996] Kaufman, C., Hoffman, P., Nir, Y., and P. 1354 Eronen, "Internet Key Exchange Protocol 1355 Version 2 (IKEv2)", RFC 5996, 1356 September 2010. 1358 Appendix A. A Note on Implementation Options 1360 It is possible to implement this specification in multiple different 1361 ways. As noted above, one possible way of implementing this is to 1362 rewrite IP headers below IPsec. In such an implementation, IPsec is 1363 used as if it was processing IPv6 transport mode packets, with the 1364 IPv6 header containing HITs instead of IP addresses in the source and 1365 destination address fields. In outgoing packets, after IPsec 1366 processing, the HITs are replaced with actual IP addresses, based on 1367 the HITs and the SPI. In incoming packets, before IPsec processing, 1368 the IP addresses are replaced with HITs, based on the SPI in the 1369 incoming packet. In such an implementation, all IPsec policies are 1370 based on HITs and the upper layers only see packets with HITs in the 1371 place of IP addresses. Consequently, support of HIP does not 1372 conflict with other uses of IPsec as long as the SPI spaces are kept 1373 separate. Appendix B describes another way to implement this 1374 specification. 1376 Appendix B. Bound End-to-End Tunnel mode for ESP 1378 This section introduces an alternative way of implementing the 1379 necessary functions for HIP ESP transport. Compared to the option of 1380 implementing the required address rewrites outside of IPsec, BEET has 1381 one implementation level benefit. In BEET-way of implementing, the 1382 address rewriting information is kept in one place, at the SAD. On 1383 the other hand, when address rewriting is implemented separately, the 1384 implementation MUST make sure that the information in the SAD and the 1385 separate address rewriting DB are kept in synchrony. As a result, 1386 the BEET-mode-based way of implementing this specification is 1387 RECOMMENDED over the separate implementation as it keeps the binds 1388 the identities, encryption and locators tightly together. It should 1389 be noted that implementing BEET mode doesn't require that 1390 corresponding hosts implement it as the behavior is only visible 1391 internally in a host. 1393 The BEET mode is a combination of IPsec tunnel and transport modes 1394 and provides some of the features from both. The HIP uses HITs as 1395 the "inner" addresses and IP addresses as "outer" addresses, like IP 1396 addresses are used in the tunnel mode. Instead of tunneling packets 1397 between hosts, a conversion between inner and outer addresses is made 1398 at end-hosts and the inner address is never sent on the wire after 1399 the initial HIP negotiation. BEET provides IPsec transport mode 1400 syntax (no inner headers) with limited tunnel mode semantics (fixed 1401 logical inner addresses - the HITs - and changeable outer IP 1402 addresses). 1404 B.1. Protocol definition 1406 In this section we define the exact protocol formats and operations. 1408 B.1.1. Changes to Security Association data structures 1410 A BEET mode Security Association contains the same data as a regular 1411 tunnel mode Security Association, with the exception that the inner 1412 selectors must be single addresses and cannot be subnets. The data 1413 includes the following: 1415 A pair of inner IP addresses. 1417 A pair of outer IP addresses. 1419 Cryptographic keys and other data as defined in RFC4301 [RFC4301] 1420 Section 4.4.2. 1422 A conforming implementation MAY store the data in a way similar to a 1423 regular tunnel mode Security Association. 1425 Note that in a conforming implementation the inner and outer 1426 addresses MAY belong to different address families. All 1427 implementations that support both IPv4 and IPv6 SHOULD support both 1428 IPv4-over-IPv6 and IPv6-over-IPv4 tunneling. 1430 B.1.2. Packet format 1432 The wire packet format is identical to the ESP transport mode wire 1433 format as defined in [RFC4303] Section 3.1.1. However, the resulting 1434 packet contains outer IP addresses instead of the inner IP addresses 1435 received from the upper layer. The construction of the outer headers 1436 is defined in RFC4301 [RFC4301] Section 5.1.2. The following diagram 1437 illustrates ESP BEET mode positioning for typical IPv4 and IPv6 1438 packets. 1440 IPv4 INNER ADDRESSES 1441 -------------------- 1443 BEFORE APPLYING ESP 1444 ------------------------------ 1445 | inner IP hdr | | | 1446 | | TCP | Data | 1447 ------------------------------ 1449 AFTER APPLYING ESP, OUTER v4 ADDRESSES 1450 ---------------------------------------------------- 1451 | outer IP hdr | | | | ESP | ESP | 1452 | (any options) | ESP | TCP | Data | Trailer | ICV | 1453 ---------------------------------------------------- 1454 |<---- encryption ---->| 1455 |<-------- integrity ------->| 1457 AFTER APPLYING ESP, OUTER v6 ADDRESSES 1458 ------------------------------------------------------ 1459 | outer | new ext | | | | ESP | ESP | 1460 | IP hdr | hdrs. | ESP | TCP | Data | Trailer| ICV | 1461 ------------------------------------------------------ 1462 |<--- encryption ---->| 1463 |<------- integrity ------->| 1465 IPv4 INNER ADDRESSES with options 1466 --------------------------------- 1468 BEFORE APPLYING ESP 1469 ------------------------------ 1470 | inner IP hdr | | | 1471 | + options | TCP | Data | 1472 ------------------------------ 1474 AFTER APPLYING ESP, OUTER v4 ADDRESSES 1475 ---------------------------------------------------------- 1476 | outer IP hdr | | | | | ESP | ESP | 1477 | (any options) | ESP | PH | TCP | Data | Trailer | ICV | 1478 ---------------------------------------------------------- 1479 |<------- encryption ------->| 1480 |<----------- integrity ---------->| 1482 AFTER APPLYING ESP, OUTER v6 ADDRESSES 1483 ------------------------------------------------------------ 1484 | outer | new ext | | | | | ESP | ESP | 1485 | IP hdr | hdrs. | ESP | PH | TCP | Data | Trailer| ICV | 1486 ------------------------------------------------------------ 1487 |<------ encryption ------->| 1488 |<---------- integrity ---------->| 1490 PH Pseudo Header for IPv4 options 1492 IPv6 INNER ADDRESSES 1493 -------------------- 1495 BEFORE APPLYING ESP 1496 ------------------------------------------ 1497 | | ext hdrs | | | 1498 | inner IP hdr | if present | TCP | Data | 1499 ------------------------------------------ 1501 AFTER APPLYING ESP, OUTER v6 ADDRESSES 1502 -------------------------------------------------------------- 1503 | outer | new ext | | dest | | | ESP | ESP | 1504 | IP hdr | hdrs. | ESP | opts.| TCP | Data | Trailer | ICV | 1505 -------------------------------------------------------------- 1506 |<---- encryption ---->| 1507 |<------- integrity ------>| 1509 AFTER APPLYING ESP, OUTER v4 ADDRESSES 1510 ---------------------------------------------------- 1511 | outer | | dest | | | ESP | ESP | 1512 | IP hdr | ESP | opts.| TCP | Data | Trailer | ICV | 1513 ---------------------------------------------------- 1514 |<------- encryption -------->| 1515 |<----------- integrity ----------->| 1517 B.1.3. Cryptographic processing 1519 The outgoing packets MUST be protected exactly as in ESP transport 1520 mode [RFC4303]. That is, the upper layer protocol packet is wrapped 1521 into an ESP header, encrypted, and authenticated exactly as if 1522 regular transport mode was used. The resulting ESP packet is subject 1523 to IP header processing as defined in Appendix B.1.4 and 1524 Appendix B.1.5. The incoming ESP protected messages are verified and 1525 decrypted exactly as if regular transport mode was used. The 1526 resulting clear text packet is subject to IP header processing as 1527 defined in Appendix B.1.4 and Appendix B.1.6. 1529 B.1.4. IP header processing 1531 The biggest difference between the BEET mode and the other two modes 1532 is in IP header processing. In the regular transport mode the IP 1533 header is kept intact. In the regular tunnel mode an outer IP header 1534 is created on output and discarded on input. In the BEET mode the IP 1535 header is replaced with another one on both input and output. 1537 On the BEET mode output side, the IP header processing MUST first 1538 ensure that the IP addresses in the original IP header contain the 1539 inner addresses as specified in the SA. This MAY be ensured by 1540 proper policy processing, and it is possible that no checks are 1541 needed at the SA processing time. Once the IP header has been 1542 verified to contain the right IP inner addresses, it is discarded. A 1543 new IP header is created, using the discarded inner header as a hint 1544 for other fields but the IP addresses. The IP addresses in the new 1545 header MUST be the outer tunnel addresses. 1547 On input side, the received IP header is simply discarded. Since the 1548 packet has been decrypted and verified, no further checks are 1549 necessary. A new IP header, corresponding to a tunnel mode inner 1550 header, is created, using the discarded outer header as a hint for 1551 other fields but the IP addresses. The IP addresses in the new 1552 header MUST be the inner addresses. 1554 As the outer header fields are used as hint for creating inner 1555 header, it must be noted that inner header differs as compared to 1556 tunnel-mode inner header. In BEET mode the inner header will have 1557 the TTL, DF-bit and other option values from the outer header. The 1558 TTL, DF-bit and other option values of the inner header MUST be 1559 processed by the stack. 1561 B.1.5. Handling of outgoing packets 1563 The outgoing BEET mode packets are processed as follows: 1565 1. The system MUST verify that the IP header contains the inner 1566 source and destination addresses, exactly as defined in the SA. 1567 This verification MAY be explicit, or it MAY be implicit, for 1568 example, as a result of prior policy processing. Note that in 1569 some implementations there may be no real IP header at this time 1570 but the source and destination addresses may be carried out-of- 1571 band. In case the source address is still unassigned, it SHOULD 1572 be ensured that the designated inner source address would be 1573 selected at a later stage. 1575 2. The IP payload (the contents of the packet beyond the IP header) 1576 is wrapped into an ESP header as defined in [RFC4303] Section 1577 3.3. 1579 3. A new IP header is constructed, replacing the original one. The 1580 new IP header MUST contain the outer source and destination 1581 addresses, as defined in the SA. Note that in some 1582 implementations there may be no real IP header at this time but 1583 the source and destination addresses may be carried out-of-band. 1584 In the case where the source address must be left unassigned, it 1585 SHOULD be made sure that the right source address is selected at 1586 a later stage. Other than the addresses, it is RECOMMENDED that 1587 the new IP header copies the fields from the original IP header. 1589 4. If there are any IPv4 options in the original packet, it is 1590 RECOMMENDED that they are discarded. If the inner header 1591 contains one or more options that need to be transported between 1592 the tunnel end-points, sender MUST encapsulate the options as 1593 defined in Appendix B.1.7 1595 Instead of literally discarding the IP header and constructing a new 1596 one, a conforming implementation MAY simply replace the addresses in 1597 an existing header. However, if the RECOMMENDED feature of allowing 1598 the inner and outer addresses from different address families is 1599 used, this simple strategy does not work. 1601 B.1.6. Handling of incoming packets 1603 The incoming BEET mode packets are processed as follows: 1605 1. The system MUST verify and decrypt the incoming packet 1606 successfully, as defined in [RFC4303] section 3.4. If the 1607 verification or decryption fails, the packet MUST be discarded. 1609 2. The original IP header is simply discarded, without any checks. 1610 Since the ESP verification succeeded, the packet can be safely 1611 assumed to have arrived from the right sender. 1613 3. A new IP header is constructed, replacing the original one. The 1614 new IP header MUST contain the inner source and destination 1615 addresses, as defined in the SA. If the sender has set the ESP 1616 next protocol field to 94 and included the pseudo header as 1617 described in Appendix B.1.7, the receiver MUST include the 1618 options after the constructed IP header. Note, that in some 1619 implementations the real IP header may have already been 1620 discarded and the source and destination addresses are carried 1621 out-of-band. In such case the out-of-band addresses MUST be the 1622 inner addresses. Other than the addresses, it is RECOMMENDED 1623 that the new IP header copies the fields from the original IP 1624 header. 1626 Instead of literally discarding the IP header and constructing a new 1627 one a conforming implementation MAY simply replace the addresses in 1628 an existing header. However, if the RECOMMENDED feature of allowing 1629 the inner and outer addresses from different address families is 1630 used, this simple strategy does not work. 1632 B.1.7. IPv4 options handling 1634 In BEET mode, if IPv4 options are transported inside the tunnel, the 1635 sender MUST include a pseudo-header after ESP header. The pseudo- 1636 header identifies that IPv4 options from the original packet are to 1637 be applied on the packet on input side. 1639 The sender MUST set the next protocol field on the ESP header as 94. 1640 The resulting pseudo header including the IPv4 options MUST be padded 1641 to 8 octet boundary. The padding length is expressed in octets, 1642 valid padding lengths are 0 or 4 octets as the original IPv4 options 1643 are already padded to 4 octet boundary. The padding MUST be filled 1644 with NOP options as defined in Internet Protocol [RFC0791] section 1645 3.1 Internet header format. The padding is added in front of the 1646 original options to ensure that the receiver is able to reconstruct 1647 the original IPv4 datagram. The Header Length field contains the 1648 length of the IPv4 options, and padding in 8 octets units. 1650 0 1 2 3 1651 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 1652 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1653 | Next Header | Header Len | Pad Len | Reserved | 1654 +---------------+---------------+-------------------------------+ 1655 | Padding (if needed) | 1656 +---------------------------------------------------------------+ 1657 | IPv4 options ... | 1658 | | 1659 +---------------------------------------------------------------+ 1661 Next Header Identifies the data following this header 1662 Length in octets 8-bit unsigned integer. Length of the 1663 pseudo header in 8-octet units, not 1664 including the first 8 octets. 1666 The receiver MUST remove this pseudo-header and padding as a part of 1667 BEET processing, in order reconstruct the original IPv4 datagram. 1668 The IPv4 options included into the pseudo-header MUST be added after 1669 the reconstructed IPv4 (inner) header on the receiving side. 1671 Authors' Addresses 1673 Petri Jokela 1674 Ericsson Research NomadicLab 1675 JORVAS FIN-02420 1676 FINLAND 1678 Phone: +358 9 299 1 1679 EMail: petri.jokela@nomadiclab.com 1681 Robert Moskowitz 1682 ICSAlabs, An Independent Division of Verizon Business Systems 1683 1000 Bent Creek Blvd, Suite 200 1684 Mechanicsburg, PA 1685 USA 1687 EMail: rgm@icsalabs.com 1688 Jan Melen 1689 Ericsson Research NomadicLab 1690 JORVAS FIN-02420 1691 FINLAND 1693 Phone: +358 9 299 1 1694 EMail: jan.melen@nomadiclab.com