idnits 2.17.1 draft-ietf-hip-rfc5201-bis-00.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 : ---------------------------------------------------------------------------- == There are 1 instance of lines with private range IPv4 addresses in the document. If these are generic example addresses, they should be changed to use any of the ranges defined in RFC 6890 (or successor): 192.0.2.x, 198.51.100.x or 203.0.113.x. == There are 2 instances of lines with non-RFC3849-compliant IPv6 addresses in the document. If these are example addresses, they should be changed. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 1754 has weird spacing: '...c Value leng...' == Line 1756 has weird spacing: '...c Value the ...' == Line 2141 has weird spacing: '...ication info...' == Line 2267 has weird spacing: '...ue data opaqu...' == Line 2299 has weird spacing: '...ue data opaqu...' == (2 more instances...) == The document seems to contain a disclaimer for pre-RFC5378 work, but was first submitted on or after 10 November 2008. The disclaimer is usually necessary only for documents that revise or obsolete older RFCs, and that take significant amounts of text from those RFCs. If you can contact all authors of the source material and they are willing to grant the BCP78 rights to the IETF Trust, you can and should remove the disclaimer. Otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (August 20, 2010) is 4998 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) ** Obsolete normative reference: RFC 2460 (Obsoleted by RFC 8200) ** Obsolete normative reference: RFC 2463 (Obsoleted by RFC 4443) ** Obsolete normative reference: RFC 2898 (Obsoleted by RFC 8018) ** Obsolete normative reference: RFC 3484 (Obsoleted by RFC 6724) ** Obsolete normative reference: RFC 4282 (Obsoleted by RFC 7542) ** Obsolete normative reference: RFC 4307 (Obsoleted by RFC 8247) ** Obsolete normative reference: RFC 4843 (Obsoleted by RFC 7343) ** Obsolete normative reference: RFC 5202 (Obsoleted by RFC 7402) -- Obsolete informational reference (is this intentional?): RFC 2434 (Obsoleted by RFC 5226) -- Obsolete informational reference (is this intentional?): RFC 4306 (Obsoleted by RFC 5996) -- Obsolete informational reference (is this intentional?): RFC 5204 (Obsoleted by RFC 8004) -- Obsolete informational reference (is this intentional?): RFC 5205 (Obsoleted by RFC 8005) -- Obsolete informational reference (is this intentional?): RFC 5206 (Obsoleted by RFC 8046) Summary: 8 errors (**), 0 flaws (~~), 10 warnings (==), 6 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group R. Moskowitz 3 Internet-Draft ICSAlabs 4 Obsoletes: 5201 (if approved) P. Jokela, Ed. 5 Intended status: Standards Track Ericsson Research NomadicLab 6 Expires: February 21, 2011 T. Henderson 7 The Boeing Company 8 August 20, 2010 10 Host Identity Protocol 11 draft-ietf-hip-rfc5201-bis-00 13 Abstract 15 This document specifies the details of the Host Identity Protocol 16 (HIP). HIP allows consenting hosts to securely establish and 17 maintain shared IP-layer state, allowing separation of the identifier 18 and locator roles of IP addresses, thereby enabling continuity of 19 communications across IP address changes. HIP is based on a Sigma- 20 compliant Diffie-Hellman key exchange, using public key identifiers 21 from a new Host Identity namespace for mutual peer authentication. 22 The protocol is designed to be resistant to denial-of-service (DoS) 23 and man-in-the-middle (MitM) attacks. When used together with 24 another suitable security protocol, such as the Encapsulated Security 25 Payload (ESP), it provides integrity protection and optional 26 encryption for upper-layer protocols, such as TCP and UDP. 28 This document obsoletes RFC 5201 and addresses the concerns raised by 29 the IESG, particularly that of crypto agility. It also incorporates 30 lessons learned from the implementations of RFC 5201. 32 Status of This Memo 34 This Internet-Draft is submitted in full conformance with the 35 provisions of BCP 78 and BCP 79. 37 Internet-Drafts are working documents of the Internet Engineering 38 Task Force (IETF). Note that other groups may also distribute 39 working documents as Internet-Drafts. The list of current Internet- 40 Drafts is at http://datatracker.ietf.org/drafts/current/. 42 Internet-Drafts are draft documents valid for a maximum of six months 43 and may be updated, replaced, or obsoleted by other documents at any 44 time. It is inappropriate to use Internet-Drafts as reference 45 material or to cite them other than as "work in progress." 47 This Internet-Draft will expire on February 21, 2011. 49 Copyright Notice 51 Copyright (c) 2010 IETF Trust and the persons identified as the 52 document authors. All rights reserved. 54 This document is subject to BCP 78 and the IETF Trust's Legal 55 Provisions Relating to IETF Documents 56 (http://trustee.ietf.org/license-info) in effect on the date of 57 publication of this document. Please review these documents 58 carefully, as they describe your rights and restrictions with respect 59 to this document. Code Components extracted from this document must 60 include Simplified BSD License text as described in Section 4.e of 61 the Trust Legal Provisions and are provided without warranty as 62 described in the Simplified BSD License. 64 This document may contain material from IETF Documents or IETF 65 Contributions published or made publicly available before November 66 10, 2008. The person(s) controlling the copyright in some of this 67 material may not have granted the IETF Trust the right to allow 68 modifications of such material outside the IETF Standards Process. 69 Without obtaining an adequate license from the person(s) controlling 70 the copyright in such materials, this document may not be modified 71 outside the IETF Standards Process, and derivative works of it may 72 not be created outside the IETF Standards Process, except to format 73 it for publication as an RFC or to translate it into languages other 74 than English. 76 Table of Contents 78 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 6 79 1.1. A New Namespace and Identifiers . . . . . . . . . . . . . 6 80 1.2. The HIP Base Exchange . . . . . . . . . . . . . . . . . . 7 81 1.3. Memo Structure . . . . . . . . . . . . . . . . . . . . . 8 82 2. Terms and Definitions . . . . . . . . . . . . . . . . . . . . 8 83 2.1. Requirements Terminology . . . . . . . . . . . . . . . . 8 84 2.2. Notation . . . . . . . . . . . . . . . . . . . . . . . . 8 85 2.3. Definitions . . . . . . . . . . . . . . . . . . . . . . . 8 86 3. Host Identifier (HI) and Its Representations . . . . . . . . 9 87 3.1. Host Identity Tag (HIT) . . . . . . . . . . . . . . . . . 10 88 3.2. Generating a HIT from an HI . . . . . . . . . . . . . . . 10 89 4. Protocol Overview . . . . . . . . . . . . . . . . . . . . . . 11 90 4.1. Creating a HIP Association . . . . . . . . . . . . . . . 11 91 4.1.1. HIP Puzzle Mechanism . . . . . . . . . . . . . . . . 13 92 4.1.2. Puzzle Exchange . . . . . . . . . . . . . . . . . . . 14 93 4.1.3. Authenticated Diffie-Hellman Protocol . . . . . . . . 15 94 4.1.4. HIP Replay Protection . . . . . . . . . . . . . . . . 16 95 4.1.5. Refusing a HIP Exchange . . . . . . . . . . . . . . . 17 96 4.1.6. HIP Opportunistic Mode . . . . . . . . . . . . . . . 17 98 4.2. Updating a HIP Association . . . . . . . . . . . . . . . 19 99 4.3. Error Processing . . . . . . . . . . . . . . . . . . . . 19 100 4.4. HIP State Machine . . . . . . . . . . . . . . . . . . . . 20 101 4.4.1. HIP States . . . . . . . . . . . . . . . . . . . . . 21 102 4.4.2. HIP State Processes . . . . . . . . . . . . . . . . . 22 103 4.4.3. Simplified HIP State Diagram . . . . . . . . . . . . 29 104 4.5. User Data Considerations . . . . . . . . . . . . . . . . 31 105 4.5.1. TCP and UDP Pseudo-Header Computation for User Data . 31 106 4.5.2. Sending Data on HIP Packets . . . . . . . . . . . . . 31 107 4.5.3. Transport Formats . . . . . . . . . . . . . . . . . . 31 108 4.5.4. Reboot and SA Timeout Restart of HIP . . . . . . . . 31 109 4.6. Certificate Distribution . . . . . . . . . . . . . . . . 32 110 5. Packet Formats . . . . . . . . . . . . . . . . . . . . . . . 32 111 5.1. Payload Format . . . . . . . . . . . . . . . . . . . . . 32 112 5.1.1. Checksum . . . . . . . . . . . . . . . . . . . . . . 33 113 5.1.2. HIP Controls . . . . . . . . . . . . . . . . . . . . 34 114 5.1.3. HIP Fragmentation Support . . . . . . . . . . . . . . 34 115 5.2. HIP Parameters . . . . . . . . . . . . . . . . . . . . . 35 116 5.2.1. TLV Format . . . . . . . . . . . . . . . . . . . . . 37 117 5.2.2. Defining New Parameters . . . . . . . . . . . . . . . 39 118 5.2.3. R1_COUNTER . . . . . . . . . . . . . . . . . . . . . 40 119 5.2.4. PUZZLE . . . . . . . . . . . . . . . . . . . . . . . 41 120 5.2.5. SOLUTION . . . . . . . . . . . . . . . . . . . . . . 42 121 5.2.6. DIFFIE_HELLMAN . . . . . . . . . . . . . . . . . . . 43 122 5.2.7. HIP_TRANSFORM . . . . . . . . . . . . . . . . . . . . 44 123 5.2.8. HOST_ID . . . . . . . . . . . . . . . . . . . . . . . 45 124 5.2.9. HMAC . . . . . . . . . . . . . . . . . . . . . . . . 46 125 5.2.10. HMAC_2 . . . . . . . . . . . . . . . . . . . . . . . 47 126 5.2.11. HIP_SIGNATURE . . . . . . . . . . . . . . . . . . . . 47 127 5.2.12. HIP_SIGNATURE_2 . . . . . . . . . . . . . . . . . . . 48 128 5.2.13. SEQ . . . . . . . . . . . . . . . . . . . . . . . . . 49 129 5.2.14. ACK . . . . . . . . . . . . . . . . . . . . . . . . . 49 130 5.2.15. ENCRYPTED . . . . . . . . . . . . . . . . . . . . . . 50 131 5.2.16. NOTIFICATION . . . . . . . . . . . . . . . . . . . . 51 132 5.2.17. ECHO_REQUEST_SIGNED . . . . . . . . . . . . . . . . . 55 133 5.2.18. ECHO_REQUEST_UNSIGNED . . . . . . . . . . . . . . . . 55 134 5.2.19. ECHO_RESPONSE_SIGNED . . . . . . . . . . . . . . . . 56 135 5.2.20. ECHO_RESPONSE_UNSIGNED . . . . . . . . . . . . . . . 57 136 5.3. HIP Packets . . . . . . . . . . . . . . . . . . . . . . . 57 137 5.3.1. I1 - the HIP Initiator Packet . . . . . . . . . . . . 58 138 5.3.2. R1 - the HIP Responder Packet . . . . . . . . . . . . 59 139 5.3.3. I2 - the Second HIP Initiator Packet . . . . . . . . 61 140 5.3.4. R2 - the Second HIP Responder Packet . . . . . . . . 62 141 5.3.5. UPDATE - the HIP Update Packet . . . . . . . . . . . 63 142 5.3.6. NOTIFY - the HIP Notify Packet . . . . . . . . . . . 64 143 5.3.7. CLOSE - the HIP Association Closing Packet . . . . . 64 144 5.3.8. CLOSE_ACK - the HIP Closing Acknowledgment Packet . . 65 145 5.4. ICMP Messages . . . . . . . . . . . . . . . . . . . . . . 65 146 5.4.1. Invalid Version . . . . . . . . . . . . . . . . . . . 66 147 5.4.2. Other Problems with the HIP Header and Packet 148 Structure . . . . . . . . . . . . . . . . . . . . . . 66 149 5.4.3. Invalid Puzzle Solution . . . . . . . . . . . . . . . 66 150 5.4.4. Non-Existing HIP Association . . . . . . . . . . . . 66 151 6. Packet Processing . . . . . . . . . . . . . . . . . . . . . . 67 152 6.1. Processing Outgoing Application Data . . . . . . . . . . 67 153 6.2. Processing Incoming Application Data . . . . . . . . . . 68 154 6.3. Solving the Puzzle . . . . . . . . . . . . . . . . . . . 69 155 6.4. HMAC and SIGNATURE Calculation and Verification . . . . . 70 156 6.4.1. HMAC Calculation . . . . . . . . . . . . . . . . . . 70 157 6.4.2. Signature Calculation . . . . . . . . . . . . . . . . 72 158 6.5. HIP KEYMAT Generation . . . . . . . . . . . . . . . . . . 74 159 6.6. Initiation of a HIP Exchange . . . . . . . . . . . . . . 76 160 6.6.1. Sending Multiple I1s in Parallel . . . . . . . . . . 77 161 6.6.2. Processing Incoming ICMP Protocol Unreachable 162 Messages . . . . . . . . . . . . . . . . . . . . . . 77 163 6.7. Processing Incoming I1 Packets . . . . . . . . . . . . . 77 164 6.7.1. R1 Management . . . . . . . . . . . . . . . . . . . . 79 165 6.7.2. Handling Malformed Messages . . . . . . . . . . . . . 79 166 6.8. Processing Incoming R1 Packets . . . . . . . . . . . . . 79 167 6.8.1. Handling Malformed Messages . . . . . . . . . . . . . 81 168 6.9. Processing Incoming I2 Packets . . . . . . . . . . . . . 81 169 6.9.1. Handling Malformed Messages . . . . . . . . . . . . . 84 170 6.10. Processing Incoming R2 Packets . . . . . . . . . . . . . 84 171 6.11. Sending UPDATE Packets . . . . . . . . . . . . . . . . . 85 172 6.12. Receiving UPDATE Packets . . . . . . . . . . . . . . . . 86 173 6.12.1. Handling a SEQ Parameter in a Received UPDATE 174 Message . . . . . . . . . . . . . . . . . . . . . . . 86 175 6.12.2. Handling an ACK Parameter in a Received UPDATE 176 Packet . . . . . . . . . . . . . . . . . . . . . . . 87 177 6.13. Processing NOTIFY Packets . . . . . . . . . . . . . . . . 88 178 6.14. Processing CLOSE Packets . . . . . . . . . . . . . . . . 88 179 6.15. Processing CLOSE_ACK Packets . . . . . . . . . . . . . . 88 180 6.16. Handling State Loss . . . . . . . . . . . . . . . . . . . 89 181 7. HIP Policies . . . . . . . . . . . . . . . . . . . . . . . . 89 182 8. Security Considerations . . . . . . . . . . . . . . . . . . . 89 183 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 92 184 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 94 185 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 95 186 11.1. Normative References . . . . . . . . . . . . . . . . . . 95 187 11.2. Informative References . . . . . . . . . . . . . . . . . 96 188 Appendix A. Using Responder Puzzles . . . . . . . . . . . . . . 98 189 Appendix B. Generating a Public Key Encoding from an HI . . . . 99 190 Appendix C. Example Checksums for HIP Packets . . . . . . . . . 100 191 C.1. IPv6 HIP Example (I1) . . . . . . . . . . . . . . . . . . 101 192 C.2. IPv4 HIP Packet (I1) . . . . . . . . . . . . . . . . . . 101 193 C.3. TCP Segment . . . . . . . . . . . . . . . . . . . . . . . 101 195 Appendix D. 384-Bit Group . . . . . . . . . . . . . . . . . . . 102 196 Appendix E. OAKLEY Well-Known Group 1 . . . . . . . . . . . . . 102 198 1. Introduction 200 This memo specifies the details of the Host Identity Protocol (HIP). 201 A high-level description of the protocol and the underlying 202 architectural thinking is available in the separate HIP architecture 203 description [rfc4423-bis]. Briefly, the HIP architecture proposes an 204 alternative to the dual use of IP addresses as "locators" (routing 205 labels) and "identifiers" (endpoint, or host, identifiers). In HIP, 206 public cryptographic keys, of a public/private key pair, are used as 207 Host Identifiers, to which higher layer protocols are bound instead 208 of an IP address. By using public keys (and their representations) 209 as host identifiers, dynamic changes to IP address sets can be 210 directly authenticated between hosts, and if desired, strong 211 authentication between hosts at the TCP/IP stack level can be 212 obtained. 214 This memo specifies the base HIP protocol ("base exchange") used 215 between hosts to establish an IP-layer communications context, called 216 HIP association, prior to communications. It also defines a packet 217 format and procedures for updating an active HIP association. Other 218 elements of the HIP architecture are specified in other documents, 219 such as. 221 o "Using the Encapsulating Security Payload (ESP) Transport Format 222 with the Host Identity Protocol (HIP)" [RFC5202]: how to use the 223 Encapsulating Security Payload (ESP) for integrity protection and 224 optional encryption 226 o "End-Host Mobility and Multihoming with the Host Identity 227 Protocol" [RFC5206]: how to support mobility and multihoming in 228 HIP 230 o "Host Identity Protocol (HIP) Domain Name System (DNS) Extensions" 231 [RFC5205]: how to extend DNS to contain Host Identity information 233 o "Host Identity Protocol (HIP) Rendezvous Extension" [RFC5204]: 234 using a rendezvous mechanism to contact mobile HIP hosts 236 1.1. A New Namespace and Identifiers 238 The Host Identity Protocol introduces a new namespace, the Host 239 Identity namespace. Some ramifications of this new namespace are 240 explained in the HIP architecture description [rfc4423-bis]. 242 There are two main representations of the Host Identity, the full 243 Host Identifier (HI) and the Host Identity Tag (HIT). The HI is a 244 public key and directly represents the Identity. Since there are 245 different public key algorithms that can be used with different key 246 lengths, the HI is not good for use as a packet identifier, or as an 247 index into the various operational tables needed to support HIP. 248 Consequently, a hash of the HI, the Host Identity Tag (HIT), becomes 249 the operational representation. It is 128 bits long and is used in 250 the HIP payloads and to index the corresponding state in the end 251 hosts. The HIT has an important security property in that it is 252 self-certifying (see Section 3). 254 1.2. The HIP Base Exchange 256 The HIP base exchange is a two-party cryptographic protocol used to 257 establish communications context between hosts. The base exchange is 258 a Sigma-compliant [KRA03] four-packet exchange. The first party is 259 called the Initiator and the second party the Responder. The four- 260 packet design helps to make HIP DoS resilient. The protocol 261 exchanges Diffie-Hellman keys in the 2nd and 3rd packets, and 262 authenticates the parties in the 3rd and 4th packets. Additionally, 263 the Responder starts a puzzle exchange in the 2nd packet, with the 264 Initiator completing it in the 3rd packet before the Responder stores 265 any state from the exchange. 267 The exchange can use the Diffie-Hellman output to encrypt the Host 268 Identity of the Initiator in the 3rd packet (although Aura, et al., 269 [AUR03] notes that such operation may interfere with packet- 270 inspecting middleboxes), or the Host Identity may instead be sent 271 unencrypted. The Responder's Host Identity is not protected. It 272 should be noted, however, that both the Initiator's and the 273 Responder's HITs are transported as such (in cleartext) in the 274 packets, allowing an eavesdropper with a priori knowledge about the 275 parties to verify their identities. 277 Data packets start to flow after the 4th packet. The 3rd and 4th HIP 278 packets may carry a data payload in the future. However, the details 279 of this are to be defined later as more implementation experience is 280 gained. 282 An existing HIP association can be updated using the update mechanism 283 defined in this document, and when the association is no longer 284 needed, it can be closed using the defined closing mechanism. 286 Finally, HIP is designed as an end-to-end authentication and key 287 establishment protocol, to be used with Encapsulated Security Payload 288 (ESP) [RFC5202] and other end-to-end security protocols. The base 289 protocol does not cover all the fine-grained policy control found in 290 Internet Key Exchange (IKE) [RFC4306] that allows IKE to support 291 complex gateway policies. Thus, HIP is not a replacement for IKE. 293 1.3. Memo Structure 295 The rest of this memo is structured as follows. Section 2 defines 296 the central keywords, notation, and terms used throughout the rest of 297 the document. Section 3 defines the structure of the Host Identity 298 and its various representations. Section 4 gives an overview of the 299 HIP base exchange protocol. Sections 5 and 6 define the detail 300 packet formats and rules for packet processing. Finally, Sections 7, 301 8, and 9 discuss policy, security, and IANA considerations, 302 respectively. 304 2. Terms and Definitions 306 2.1. Requirements Terminology 308 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 309 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 310 document are to be interpreted as described in RFC 2119 [RFC2119]. 312 2.2. Notation 314 [x] indicates that x is optional. 316 {x} indicates that x is encrypted. 318 X(y) indicates that y is a parameter of X. 320 i indicates that x exists i times. 322 --> signifies "Initiator to Responder" communication (requests). 324 <-- signifies "Responder to Initiator" communication (replies). 326 | signifies concatenation of information-- e.g., X | Y is the 327 concatenation of X with Y. 329 Ltrunc (SHA-1(), K) denotes the lowest order K bits of the SHA-1 330 result. 332 2.3. Definitions 334 Unused Association Lifetime (UAL): Implementation-specific time for 335 which, if no packet is sent or received for this time interval, a 336 host MAY begin to tear down an active association. 338 Maximum Segment Lifetime (MSL): Maximum time that a TCP segment is 339 expected to spend in the network. 341 Exchange Complete (EC): Time that the host spends at the R2-SENT 342 before it moves to ESTABLISHED state. The time is n * I2 343 retransmission timeout, where n is about I2_RETRIES_MAX. 345 HIT Hash Algorithm: Hash algorithm used to generate a Host Identity 346 Tag (HIT) from the Host Identity public key. Currently SHA-1 347 [FIPS.95-1.1993] is used. 349 Responder's HIT Hash Algorithm (RHASH): Hash algorithm used for 350 various hash calculations in this document. The algorithm is the 351 same as is used to generate the Responder's HIT. RHASH is defined 352 by the Orchid Context ID. For HIP, the present RHASH algorithm is 353 defined in Section 3.2. A future version of HIP may define a new 354 RHASH algorithm by defining a new Context ID. 356 Opportunistic mode: HIP base exchange where the Responder's HIT is 357 not known a priori to the Initiator. 359 3. Host Identifier (HI) and Its Representations 361 In this section, the properties of the Host Identifier and Host 362 Identifier Tag are discussed, and the exact format for them is 363 defined. In HIP, the public key of an asymmetric key pair is used as 364 the Host Identifier (HI). Correspondingly, the host itself is 365 defined as the entity that holds the private key from the key pair. 366 See the HIP architecture specification [rfc4423-bis] for more details 367 about the difference between an identity and the corresponding 368 identifier. 370 HIP implementations MUST support the Rivest Shamir Adelman (RSA/SHA1) 371 [RFC3110] public key algorithm, and SHOULD support the Digital 372 Signature Algorithm (DSA) [RFC2536] algorithm; other algorithms MAY 373 be supported. 375 A hashed encoding of the HI, the Host Identity Tag (HIT), is used in 376 protocols to represent the Host Identity. The HIT is 128 bits long 377 and has the following three key properties: i) it is the same length 378 as an IPv6 address and can be used in address-sized fields in APIs 379 and protocols, ii) it is self-certifying (i.e., given a HIT, it is 380 computationally hard to find a Host Identity key that matches the 381 HIT), and iii) the probability of HIT collision between two hosts is 382 very low. 384 Carrying HIs and HITs in the header of user data packets would 385 increase the overhead of packets. Thus, it is not expected that they 386 are carried in every packet, but other methods are used to map the 387 data packets to the corresponding HIs. In some cases, this makes it 388 possible to use HIP without any additional headers in the user data 389 packets. For example, if ESP is used to protect data traffic, the 390 Security Parameter Index (SPI) carried in the ESP header can be used 391 to map the encrypted data packet to the correct HIP association. 393 3.1. Host Identity Tag (HIT) 395 The Host Identity Tag is a 128-bit value -- a hashed encoding of the 396 Host Identifier. There are two advantages of using a hashed encoding 397 over the actual Host Identity public key in protocols. Firstly, its 398 fixed length makes for easier protocol coding and also better manages 399 the packet size cost of this technology. Secondly, it presents a 400 consistent format to the protocol whatever underlying identity 401 technology is used. 403 RFC 4843 [RFC4843] specifies 128-bit hash-based identifiers, called 404 Overlay Routable Cryptographic Hash Identifiers (ORCHIDs). Their 405 prefix, allocated from the IPv6 address block, is defined in 406 [RFC4843]. The Host Identity Tag is a type of ORCHID, based on a 407 SHA-1 hash of the Host Identity, as defined in Section 2 of 408 [RFC4843]. 410 3.2. Generating a HIT from an HI 412 The HIT MUST be generated according to the ORCHID generation method 413 described in [RFC4843] using a context ID value of 0xF0EF F02F BFF4 414 3D0F E793 0C3C 6E61 74EA (this tag value has been generated randomly 415 by the editor of this specification), and an input that encodes the 416 Host Identity field (see Section 5.2.8) present in a HIP payload 417 packet. The hash algorithm SHA-1 has to be used when generating HITs 418 with this context ID. If a new ORCHID hash algorithm is needed in 419 the future for HIT generation, a new version of HIP has to be 420 specified with a new ORCHID context ID associated with the new hash 421 algorithm. 423 For Identities that are either RSA or Digital Signature Algorithm 424 (DSA) public keys, this input consists of the public key encoding as 425 specified in the corresponding DNSSEC document, taking the algorithm- 426 specific portion of the RDATA part of the KEY RR. There are 427 currently only two defined public key algorithms: RSA/SHA1 and DSA. 428 Hence, either of the following applies: 430 The RSA public key is encoded as defined in [RFC3110] Section 2, 431 taking the exponent length (e_len), exponent (e), and modulus (n) 432 fields concatenated. The length (n_len) of the modulus (n) can be 433 determined from the total HI Length and the preceding HI fields 434 including the exponent (e). Thus, the data to be hashed has the 435 same length as the HI. The fields MUST be encoded in network byte 436 order, as defined in [RFC3110]. 438 The DSA public key is encoded as defined in [RFC2536] Section 2, 439 taking the fields T, Q, P, G, and Y, concatenated. Thus, the data 440 to be hashed is 1 + 20 + 3 * 64 + 3 * 8 * T octets long, where T 441 is the size parameter as defined in [RFC2536]. The size parameter 442 T, affecting the field lengths, MUST be selected as the minimum 443 value that is long enough to accommodate P, G, and Y. The fields 444 MUST be encoded in network byte order, as defined in [RFC2536]. 446 In Appendix B, the public key encoding process is illustrated using 447 pseudo-code. 449 4. Protocol Overview 451 The following material is an overview of the HIP protocol operation, 452 and does not contain all details of the packet formats or the packet 453 processing steps. Sections 5 and 6 describe in more detail the 454 packet formats and packet processing steps, respectively, and are 455 normative in case of any conflicts with this section. 457 The protocol number 139 has been assigned by IANA to the Host 458 Identity Protocol. 460 The HIP payload (Section 5.1) header could be carried in every IP 461 datagram. However, since HIP headers are relatively large (40 462 bytes), it is desirable to 'compress' the HIP header so that the HIP 463 header only occurs in control packets used to establish or change HIP 464 association state. The actual method for header 'compression' and 465 for matching data packets with existing HIP associations (if any) is 466 defined in separate documents, describing transport formats and 467 methods. All HIP implementations MUST implement, at minimum, the ESP 468 transport format for HIP [RFC5202]. 470 4.1. Creating a HIP Association 472 By definition, the system initiating a HIP exchange is the Initiator, 473 and the peer is the Responder. This distinction is forgotten once 474 the base exchange completes, and either party can become the 475 Initiator in future communications. 477 The HIP base exchange serves to manage the establishment of state 478 between an Initiator and a Responder. The first packet, I1, 479 initiates the exchange, and the last three packets, R1, I2, and R2, 480 constitute an authenticated Diffie-Hellman [DIF76] key exchange for 481 session key generation. During the Diffie-Hellman key exchange, a 482 piece of keying material is generated. The HIP association keys are 483 drawn from this keying material. If other cryptographic keys are 484 needed, e.g., to be used with ESP, they are expected to be drawn from 485 the same keying material. 487 The Initiator first sends a trigger packet, I1, to the Responder. 488 The packet contains only the HIT of the Initiator and possibly the 489 HIT of the Responder, if it is known. Note that in some cases it may 490 be possible to replace this trigger packet by some other form of a 491 trigger, in which case the protocol starts with the Responder sending 492 the R1 packet. 494 The second packet, R1, starts the actual exchange. It contains a 495 puzzle -- a cryptographic challenge that the Initiator must solve 496 before continuing the exchange. The level of difficulty of the 497 puzzle can be adjusted based on level of trust with the Initiator, 498 current load, or other factors. In addition, the R1 contains the 499 initial Diffie-Hellman parameters and a signature, covering part of 500 the message. Some fields are left outside the signature to support 501 pre-created R1s. 503 In the I2 packet, the Initiator must display the solution to the 504 received puzzle. Without a correct solution, the I2 message is 505 discarded. The I2 also contains a Diffie-Hellman parameter that 506 carries needed information for the Responder. The packet is signed 507 by the sender. 509 The R2 packet finalizes the base exchange. The packet is signed. 511 The base exchange is illustrated below. The term "key" refers to the 512 Host Identity public key, and "sig" represents a signature using such 513 a key. The packets contain other parameters not shown in this 514 figure. 516 Initiator Responder 518 I1: trigger exchange 519 --------------------------> 520 select precomputed R1 521 R1: puzzle, D-H, key, sig 522 <------------------------- 523 check sig remain stateless 524 solve puzzle 525 I2: solution, D-H, {key}, sig 526 --------------------------> 527 compute D-H check puzzle 528 check sig 529 R2: sig 530 <-------------------------- 531 check sig compute D-H 533 4.1.1. HIP Puzzle Mechanism 535 The purpose of the HIP puzzle mechanism is to protect the Responder 536 from a number of denial-of-service threats. It allows the Responder 537 to delay state creation until receiving I2. Furthermore, the puzzle 538 allows the Responder to use a fairly cheap calculation to check that 539 the Initiator is "sincere" in the sense that it has churned CPU 540 cycles in solving the puzzle. 542 The puzzle mechanism has been explicitly designed to give space for 543 various implementation options. It allows a Responder implementation 544 to completely delay session-specific state creation until a valid I2 545 is received. In such a case, a correctly formatted I2 can be 546 rejected only once the Responder has checked its validity by 547 computing one hash function. On the other hand, the design also 548 allows a Responder implementation to keep state about received I1s, 549 and match the received I2s against the state, thereby allowing the 550 implementation to avoid the computational cost of the hash function. 551 The drawback of this latter approach is the requirement of creating 552 state. Finally, it also allows an implementation to use other 553 combinations of the space-saving and computation-saving mechanisms. 555 The Responder can remain stateless and drop most spoofed I2s because 556 puzzle calculation is based on the Initiator's Host Identity Tag. 557 The idea is that the Responder has a (perhaps varying) number of pre- 558 calculated R1 packets, and it selects one of these based on the 559 information carried in I1. When the Responder then later receives 560 I2, it can verify that the puzzle has been solved using the 561 Initiator's HIT. This makes it impractical for the attacker to first 562 exchange one I1/R1, and then generate a large number of spoofed I2s 563 that seemingly come from different HITs. The method does not protect 564 from an attacker that uses fixed HITs, though. Against such an 565 attacker a viable approach may be to create a piece of local state, 566 and remember that the puzzle check has previously failed. See 567 Appendix A for one possible implementation. Implementations SHOULD 568 include sufficient randomness to the algorithm so that algorithmic 569 complexity attacks become impossible [CRO03]. 571 The Responder can set the puzzle difficulty for Initiator, based on 572 its level of trust of the Initiator. Because the puzzle is not 573 included in the signature calculation, the Responder can use pre- 574 calculated R1 packets and include the puzzle just before sending the 575 R1 to the Initiator. The Responder SHOULD use heuristics to 576 determine when it is under a denial-of-service attack, and set the 577 puzzle difficulty value K appropriately; see below. 579 4.1.2. Puzzle Exchange 581 The Responder starts the puzzle exchange when it receives an I1. The 582 Responder supplies a random number I, and requires the Initiator to 583 find a number J. To select a proper J, the Initiator must create the 584 concatenation of I, the HITs of the parties, and J, and take a hash 585 over this concatenation using the RHASH algorithm. The lowest order 586 K bits of the result MUST be zeros. The value K sets the difficulty 587 of the puzzle. 589 To generate a proper number J, the Initiator will have to generate a 590 number of Js until one produces the hash target of zeros. The 591 Initiator SHOULD give up after exceeding the puzzle lifetime in the 592 PUZZLE parameter (Section 5.2.4). The Responder needs to re-create 593 the concatenation of I, the HITs, and the provided J, and compute the 594 hash once to prove that the Initiator did its assigned task. 596 To prevent precomputation attacks, the Responder MUST select the 597 number I in such a way that the Initiator cannot guess it. 598 Furthermore, the construction MUST allow the Responder to verify that 599 the value was indeed selected by it and not by the Initiator. See 600 Appendix A for an example on how to implement this. 602 Using the Opaque data field in an ECHO_REQUEST_SIGNED 603 (Section 5.2.17) or in an ECHO_REQUEST_UNSIGNED parameter 604 (Section 5.2.18), the Responder can include some data in R1 that the 605 Initiator must copy unmodified in the corresponding I2 packet. The 606 Responder can generate the Opaque data in various ways; e.g., using 607 some secret, the sent I, and possibly other related data. Using the 608 same secret, the received I (from the I2), and the other related data 609 (if any), the Receiver can verify that it has itself sent the I to 610 the Initiator. The Responder MUST periodically change such a used 611 secret. 613 It is RECOMMENDED that the Responder generates a new puzzle and a new 614 R1 once every few minutes. Furthermore, it is RECOMMENDED that the 615 Responder remembers an old puzzle at least 2*Lifetime seconds after 616 the puzzle has been deprecated. These time values allow a slower 617 Initiator to solve the puzzle while limiting the usability that an 618 old, solved puzzle has to an attacker. 620 NOTE: The protocol developers explicitly considered whether R1 should 621 include a timestamp in order to protect the Initiator from replay 622 attacks. The decision was to NOT include a timestamp. 624 NOTE: The protocol developers explicitly considered whether a memory 625 bound function should be used for the puzzle instead of a CPU-bound 626 function. The decision was not to use memory-bound functions. At 627 the time of the decision, the idea of memory-bound functions was 628 relatively new and their IPR status were unknown. Once there is more 629 experience about memory-bound functions and once their IPR status is 630 better known, it may be reasonable to reconsider this decision. 632 4.1.3. Authenticated Diffie-Hellman Protocol 634 The packets R1, I2, and R2 implement a standard authenticated Diffie- 635 Hellman exchange. The Responder sends one or two public Diffie- 636 Hellman keys and its public authentication key, i.e., its Host 637 Identity, in R1. The signature in R1 allows the Initiator to verify 638 that the R1 has been once generated by the Responder. However, since 639 it is precomputed and therefore does not cover all of the packet, it 640 does not protect from replay attacks. 642 When the Initiator receives an R1, it gets one or two public Diffie- 643 Hellman values from the Responder. If there are two values, it 644 selects the value corresponding to the strongest supported Group ID 645 and computes the Diffie-Hellman session key (Kij). It creates a HIP 646 association using keying material from the session key (see 647 Section 6.5), and may use the association to encrypt its public 648 authentication key, i.e., Host Identity. The resulting I2 contains 649 the Initiator's Diffie-Hellman key and its (optionally encrypted) 650 public authentication key. The signature in I2 covers all of the 651 packet. 653 The Responder extracts the Initiator Diffie-Hellman public key from 654 the I2, computes the Diffie-Hellman session key, creates a 655 corresponding HIP association, and decrypts the Initiator's public 656 authentication key. It can then verify the signature using the 657 authentication key. 659 The final message, R2, is needed to protect the Initiator from replay 660 attacks. 662 4.1.4. HIP Replay Protection 664 The HIP protocol includes the following mechanisms to protect against 665 malicious replays. Responders are protected against replays of I1 666 packets by virtue of the stateless response to I1s with presigned R1 667 messages. Initiators are protected against R1 replays by a 668 monotonically increasing "R1 generation counter" included in the R1. 669 Responders are protected against replays or false I2s by the puzzle 670 mechanism (Section 4.1.1 above), and optional use of opaque data. 671 Hosts are protected against replays to R2s and UPDATEs by use of a 672 less expensive HMAC verification preceding HIP signature 673 verification. 675 The R1 generation counter is a monotonically increasing 64-bit 676 counter that may be initialized to any value. The scope of the 677 counter MAY be system-wide but SHOULD be per Host Identity, if there 678 is more than one local host identity. The value of this counter 679 SHOULD be kept across system reboots and invocations of the HIP base 680 exchange. This counter indicates the current generation of puzzles. 681 Implementations MUST accept puzzles from the current generation and 682 MAY accept puzzles from earlier generations. A system's local 683 counter MUST be incremented at least as often as every time old R1s 684 cease to be valid, and SHOULD never be decremented, lest the host 685 expose its peers to the replay of previously generated, higher 686 numbered R1s. The R1 counter SHOULD NOT roll over. 688 A host may receive more than one R1, either due to sending multiple 689 I1s (Section 6.6.1) or due to a replay of an old R1. When sending 690 multiple I1s, an Initiator SHOULD wait for a small amount of time (a 691 reasonable time may be 2 * expected RTT) after the first R1 reception 692 to allow possibly multiple R1s to arrive, and it SHOULD respond to an 693 R1 among the set with the largest R1 generation counter. If an 694 Initiator is processing an R1 or has already sent an I2 (still 695 waiting for R2) and it receives another R1 with a larger R1 696 generation counter, it MAY elect to restart R1 processing with the 697 fresher R1, as if it were the first R1 to arrive. 699 Upon conclusion of an active HIP association with another host, the 700 R1 generation counter associated with the peer host SHOULD be 701 flushed. A local policy MAY override the default flushing of R1 702 counters on a per-HIT basis. The reason for recommending the 703 flushing of this counter is that there may be hosts where the R1 704 generation counter (occasionally) decreases; e.g., due to hardware 705 failure. 707 4.1.5. Refusing a HIP Exchange 709 A HIP-aware host may choose not to accept a HIP exchange. If the 710 host's policy is to only be an Initiator, it should begin its own HIP 711 exchange. A host MAY choose to have such a policy since only the 712 Initiator's HI is protected in the exchange. There is a risk of a 713 race condition if each host's policy is to only be an Initiator, at 714 which point the HIP exchange will fail. 716 If the host's policy does not permit it to enter into a HIP exchange 717 with the Initiator, it should send an ICMP 'Destination Unreachable, 718 Administratively Prohibited' message. A more complex HIP packet is 719 not used here as it actually opens up more potential DoS attacks than 720 a simple ICMP message. 722 4.1.6. HIP Opportunistic Mode 724 It is possible to initiate a HIP negotiation even if the Responder's 725 HI (and HIT) is unknown. In this case, the connection initializing 726 I1 packet contains NULL (all zeros) as the destination HIT. This 727 kind of connection setup is called opportunistic mode. 729 There are both security and API issues involved with the 730 opportunistic mode. 732 Given that the Responder's HI is not known by the Initiator, there 733 must be suitable API calls that allow the Initiator to request, 734 directly or indirectly, that the underlying kernel initiate the HIP 735 base exchange solely based on locators. The Responder's HI will be 736 tentatively available in the R1 packet, and in an authenticated form 737 once the R2 packet has been received and verified. Hence, it could 738 be communicated to the application via new API mechanisms. However, 739 with a backwards-compatible API the application sees only the 740 locators used for the initial contact. Depending on the desired 741 semantics of the API, this can raise the following issues: 743 o The actual locators may later change if an UPDATE message is used, 744 even if from the API perspective the session still appears to be 745 between specific locators. The locator update is still secure, 746 however, and the session is still between the same nodes. 748 o Different sessions between the same locators may result in 749 connections to different nodes, if the implementation no longer 750 remembers which identifier the peer had in another session. This 751 is possible when the peer's locator has changed for legitimate 752 reasons or when an attacker pretends to be a node that has the 753 peer's locator. Therefore, when using opportunistic mode, HIP 754 MUST NOT place any expectation that the peer's HI returned in the 755 R1 message matches any HI previously seen from that address. 757 If the HIP implementation and application do not have the same 758 understanding of what constitutes a session, this may even happen 759 within the same session. For instance, an implementation may not 760 know when HIP state can be purged for UDP-based applications. 762 o As with all HIP exchanges, the handling of locator-based or 763 interface-based policy is unclear for opportunistic mode HIP. An 764 application may make a connection to a specific locator because 765 the application has knowledge of the security properties along the 766 network to that locator. If one of the nodes moves and the 767 locators are updated, these security properties may not be 768 maintained. Depending on the security policy of the application, 769 this may be a problem. This is an area of ongoing study. As an 770 example, there is work to create an API that applications can use 771 to specify their security requirements in a similar context 772 [I-D.ietf-btns-c-api]. 774 In addition, the following security considerations apply. The 775 generation counter mechanism will be less efficient in protecting 776 against replays of the R1 packet, given that the Responder can choose 777 a replay that uses any HI, not just the one given in the I1 packet. 779 More importantly, the opportunistic exchange is vulnerable to man-in- 780 the-middle attacks, because the Initiator does not have any public 781 key information about the peer. To assess the impacts of this 782 vulnerability, we compare it to vulnerabilities in current, non-HIP- 783 capable communications. 785 An attacker on the path between the two peers can insert itself as a 786 man-in-the-middle by providing its own identifier to the Initiator 787 and then initiating another HIP session towards the Responder. For 788 this to be possible, the Initiator must employ opportunistic mode, 789 and the Responder must be configured to accept a connection from any 790 HIP-enabled node. 792 An attacker outside the path will be unable to do so, given that it 793 cannot respond to the messages in the base exchange. 795 These properties are characteristic also of communications in the 796 current Internet. A client contacting a server without employing 797 end-to-end security may find itself talking to the server via a man- 798 in-the-middle, assuming again that the server is willing to talk to 799 anyone. 801 If end-to-end security is in place, then the worst that can happen in 802 both the opportunistic HIP and normal IP cases is denial-of-service; 803 an entity on the path can disrupt communications, but will be unable 804 to insert itself as a man-in-the-middle. 806 However, once the opportunistic exchange has successfully completed, 807 HIP provides integrity protection and confidentiality for the 808 communications, and can securely change the locators of the 809 endpoints. 811 As a result, it is believed that the HIP opportunistic mode is at 812 least as secure as current IP. 814 4.2. Updating a HIP Association 816 A HIP association between two hosts may need to be updated over time. 817 Examples include the need to rekey expiring user data security 818 associations, add new security associations, or change IP addresses 819 associated with hosts. The UPDATE packet is used for those and other 820 similar purposes. This document only specifies the UPDATE packet 821 format and basic processing rules, with mandatory parameters. The 822 actual usage is defined in separate specifications. 824 HIP provides a general purpose UPDATE packet, which can carry 825 multiple HIP parameters, for updating the HIP state between two 826 peers. The UPDATE mechanism has the following properties: 828 UPDATE messages carry a monotonically increasing sequence number 829 and are explicitly acknowledged by the peer. Lost UPDATEs or 830 acknowledgments may be recovered via retransmission. Multiple 831 UPDATE messages may be outstanding under certain circumstances. 833 UPDATE is protected by both HMAC and HIP_SIGNATURE parameters, 834 since processing UPDATE signatures alone is a potential DoS attack 835 against intermediate systems. 837 UPDATE packets are explicitly acknowledged by the use of an 838 acknowledgment parameter that echoes an individual sequence number 839 received from the peer. A single UPDATE packet may contain both a 840 sequence number and one or more acknowledgment numbers (i.e., 841 piggybacked acknowledgment(s) for the peer's UPDATE). 843 The UPDATE packet is defined in Section 5.3.5. 845 4.3. Error Processing 847 HIP error processing behavior depends on whether or not there exists 848 an active HIP association. In general, if a HIP association exists 849 between the sender and receiver of a packet causing an error 850 condition, the receiver SHOULD respond with a NOTIFY packet. On the 851 other hand, if there are no existing HIP associations between the 852 sender and receiver, or the receiver cannot reasonably determine the 853 identity of the sender, the receiver MAY respond with a suitable ICMP 854 message; see Section 5.4 for more details. 856 The HIP protocol and state machine is designed to recover from one of 857 the parties crashing and losing its state. The following scenarios 858 describe the main use cases covered by the design. 860 No prior state between the two systems. 862 The system with data to send is the Initiator. The process 863 follows the standard four-packet base exchange, establishing 864 the HIP association. 866 The system with data to send has no state with the receiver, but 867 the receiver has a residual HIP association. 869 The system with data to send is the Initiator. The Initiator 870 acts as in no prior state, sending I1 and getting R1. When the 871 Responder receives a valid I2, the old association is 872 'discovered' and deleted, and the new association is 873 established. 875 The system with data to send has a HIP association, but the 876 receiver does not. 878 The system sends data on the outbound user data security 879 association. The receiver 'detects' the situation when it 880 receives a user data packet that it cannot match to any HIP 881 association. The receiving host MUST discard this packet. 883 Optionally, the receiving host MAY send an ICMP packet, with 884 the type Parameter Problem, to inform the sender that the HIP 885 association does not exist (see Section 5.4), and it MAY 886 initiate a new HIP negotiation. However, responding with these 887 optional mechanisms is implementation or policy dependent. 889 4.4. HIP State Machine 891 The HIP protocol itself has little state. In the HIP base exchange, 892 there is an Initiator and a Responder. Once the security 893 associations (SAs) are established, this distinction is lost. If the 894 HIP state needs to be re-established, the controlling parameters are 895 which peer still has state and which has a datagram to send to its 896 peer. The following state machine attempts to capture these 897 processes. 899 The state machine is presented in a single system view, representing 900 either an Initiator or a Responder. There is not a complete overlap 901 of processing logic here and in the packet definitions. Both are 902 needed to completely implement HIP. 904 Implementors must understand that the state machine, as described 905 here, is informational. Specific implementations are free to 906 implement the actual functions differently. Section 6 describes the 907 packet processing rules in more detail. This state machine focuses 908 on the HIP I1, R1, I2, and R2 packets only. Other states may be 909 introduced by mechanisms in other specifications (such as mobility 910 and multihoming). 912 4.4.1. HIP States 914 +---------------------+---------------------------------------------+ 915 | State | Explanation | 916 +---------------------+---------------------------------------------+ 917 | UNASSOCIATED | State machine start | 918 | | | 919 | I1-SENT | Initiating base exchange | 920 | | | 921 | I2-SENT | Waiting to complete base exchange | 922 | | | 923 | R2-SENT | Waiting to complete base exchange | 924 | | | 925 | ESTABLISHED | HIP association established | 926 | | | 927 | CLOSING | HIP association closing, no data can be | 928 | | sent | 929 | | | 930 | CLOSED | HIP association closed, no data can be sent | 931 | | | 932 | E-FAILED | HIP exchange failed | 933 +---------------------+---------------------------------------------+ 935 Table 1: HIP States 937 4.4.2. HIP State Processes 939 System behavior in state UNASSOCIATED, Table 2. 941 +---------------------+---------------------------------------------+ 942 | Trigger | Action | 943 +---------------------+---------------------------------------------+ 944 | User data to send, | Send I1 and go to I1-SENT | 945 | requiring a new HIP | | 946 | association | | 947 | | | 948 | Receive I1 | Send R1 and stay at UNASSOCIATED | 949 | | | 950 | Receive I2, process | If successful, send R2 and go to R2-SENT | 951 | | | 952 | | If fail, stay at UNASSOCIATED | 953 | | | 954 | Receive user data | Optionally send ICMP as defined in | 955 | for unknown HIP | Section 5.4 and stay at UNASSOCIATED | 956 | association | | 957 | | | 958 | Receive CLOSE | Optionally send ICMP Parameter Problem and | 959 | | stay at UNASSOCIATED | 960 | | | 961 | Receive ANYOTHER | Drop and stay at UNASSOCIATED | 962 +---------------------+---------------------------------------------+ 964 Table 2: UNASSOCIATED - Start state 966 System behavior in state I1-SENT, Table 3. 968 +---------------------+---------------------------------------------+ 969 | Trigger | Action | 970 +---------------------+---------------------------------------------+ 971 | Receive I1 | If the local HIT is smaller than the peer | 972 | | HIT, drop I1 and stay at I1-SENT | 973 | | | 974 | | If the local HIT is greater than the peer | 975 | | HIT, send R1 and stay at I1_SENT | 976 | | | 977 | Receive I2, process | If successful, send R2 and go to R2-SENT | 978 | | | 979 | | If fail, stay at I1-SENT | 980 | | | 981 | Receive R1, process | If successful, send I2 and go to I2-SENT | 982 | | | 983 | | If fail, stay at I1-SENT | 984 | | | 985 | Receive ANYOTHER | Drop and stay at I1-SENT | 986 | | | 987 | Timeout, increment | If counter is less than I1_RETRIES_MAX, | 988 | timeout counter | send I1 and stay at I1-SENT | 989 | | | 990 | | If counter is greater than I1_RETRIES_MAX, | 991 | | go to E-FAILED | 992 +---------------------+---------------------------------------------+ 994 Table 3: I1-SENT - Initiating HIP 996 System behavior in state I2-SENT, Table 4. 998 +---------------------+---------------------------------------------+ 999 | Trigger | Action | 1000 +---------------------+---------------------------------------------+ 1001 | Receive I1 | Send R1 and stay at I2-SENT | 1002 | | | 1003 | Receive R1, process | If successful, send I2 and cycle at I2-SENT | 1004 | | | 1005 | | If fail, stay at I2-SENT | 1006 | | | 1007 | Receive I2, process | If successful and local HIT is smaller than | 1008 | | the peer HIT, drop I2 and stay at I2-SENT | 1009 | | | 1010 | | If successful and local HIT is greater than | 1011 | | the peer HIT, send R2 and go to R2-SENT | 1012 | | | 1013 | | If fail, stay at I2-SENT | 1014 | | | 1015 | Receive R2, process | If successful, go to ESTABLISHED | 1016 | | | 1017 | | If fail, stay at I2-SENT | 1018 | | | 1019 | Receive ANYOTHER | Drop and stay at I2-SENT | 1020 | | | 1021 | Timeout, increment | If counter is less than I2_RETRIES_MAX, | 1022 | timeout counter | send I2 and stay at I2-SENT | 1023 | | | 1024 | | If counter is greater than I2_RETRIES_MAX, | 1025 | | go to E-FAILED | 1026 +---------------------+---------------------------------------------+ 1028 Table 4: I2-SENT - Waiting to finish HIP 1030 System behavior in state R2-SENT, Table 5. 1032 +---------------------+---------------------------------------------+ 1033 | Trigger | Action | 1034 +---------------------+---------------------------------------------+ 1035 | Receive I1 | Send R1 and stay at R2-SENT | 1036 | | | 1037 | Receive I2, process | If successful, send R2 and cycle at R2-SENT | 1038 | | | 1039 | | If fail, stay at R2-SENT | 1040 | | | 1041 | Receive R1 | Drop and stay at R2-SENT | 1042 | | | 1043 | Receive R2 | Drop and stay at R2-SENT | 1044 | | | 1045 | Receive data or | Move to ESTABLISHED | 1046 | UPDATE | | 1047 | | | 1048 | Exchange Complete | Move to ESTABLISHED | 1049 | Timeout | | 1050 +---------------------+---------------------------------------------+ 1052 Table 5: R2-SENT - Waiting to finish HIP 1054 System behavior in state ESTABLISHED, Table 6. 1056 +---------------------+---------------------------------------------+ 1057 | Trigger | Action | 1058 +---------------------+---------------------------------------------+ 1059 | Receive I1 | Send R1 and stay at ESTABLISHED | 1060 | | | 1061 | Receive I2, process | If successful, send R2, drop old HIP | 1062 | with puzzle and | association, establish a new HIP | 1063 | possible Opaque | association, go to R2-SENT | 1064 | data verification | | 1065 | | | 1066 | | If fail, stay at ESTABLISHED | 1067 | | | 1068 | Receive R1 | Drop and stay at ESTABLISHED | 1069 | | | 1070 | Receive R2 | Drop and stay at ESTABLISHED | 1071 | | | 1072 | Receive user data | Process and stay at ESTABLISHED | 1073 | for HIP association | | 1074 | | | 1075 | No packet | Send CLOSE and go to CLOSING | 1076 | sent/received | | 1077 | during UAL minutes | | 1078 | | | 1079 | Receive CLOSE, | If successful, send CLOSE_ACK and go to | 1080 | process | CLOSED | 1081 | | | 1082 | | If fail, stay at ESTABLISHED | 1083 +---------------------+---------------------------------------------+ 1085 Table 6: ESTABLISHED - HIP association established 1087 System behavior in state CLOSING, Table 7. 1089 +---------------------+---------------------------------------------+ 1090 | Trigger | Action | 1091 +---------------------+---------------------------------------------+ 1092 | User data to send, | Send I1 and stay at CLOSING | 1093 | requires the | | 1094 | creation of another | | 1095 | incarnation of the | | 1096 | HIP association | | 1097 | | | 1098 | Receive I1 | Send R1 and stay at CLOSING | 1099 | | | 1100 | Receive I2, process | If successful, send R2 and go to R2-SENT | 1101 | | | 1102 | | If fail, stay at CLOSING | 1103 | | | 1104 | Receive R1, process | If successful, send I2 and go to I2-SENT | 1105 | | | 1106 | | If fail, stay at CLOSING | 1107 | | | 1108 | Receive CLOSE, | If successful, send CLOSE_ACK, discard | 1109 | process | state and go to CLOSED | 1110 | | | 1111 | | If fail, stay at CLOSING | 1112 | | | 1113 | Receive CLOSE_ACK, | If successful, discard state and go to | 1114 | process | UNASSOCIATED | 1115 | | | 1116 | | If fail, stay at CLOSING | 1117 | | | 1118 | Receive ANYOTHER | Drop and stay at CLOSING | 1119 | | | 1120 | Timeout, increment | If timeout sum is less than UAL+MSL | 1121 | timeout sum, reset | minutes, retransmit CLOSE and stay at | 1122 | timer | CLOSING | 1123 | | | 1124 | | If timeout sum is greater than UAL+MSL | 1125 | | minutes, go to UNASSOCIATED | 1126 +---------------------+---------------------------------------------+ 1128 Table 7: CLOSING - HIP association has not been used for UAL minutes 1129 System behavior in state CLOSED, Table 8. 1131 +---------------------+---------------------------------------------+ 1132 | Trigger | Action | 1133 +---------------------+---------------------------------------------+ 1134 | Datagram to send, | Send I1, and stay at CLOSED | 1135 | requires the | | 1136 | creation of another | | 1137 | incarnation of the | | 1138 | HIP association | | 1139 | | | 1140 | Receive I1 | Send R1 and stay at CLOSED | 1141 | | | 1142 | Receive I2, process | If successful, send R2 and go to R2-SENT | 1143 | | | 1144 | | If fail, stay at CLOSED | 1145 | | | 1146 | Receive R1, process | If successful, send I2 and go to I2-SENT | 1147 | | | 1148 | | If fail, stay at CLOSED | 1149 | | | 1150 | Receive CLOSE, | If successful, send CLOSE_ACK, stay at | 1151 | process | CLOSED | 1152 | | | 1153 | | If fail, stay at CLOSED | 1154 | | | 1155 | Receive CLOSE_ACK, | If successful, discard state and go to | 1156 | process | UNASSOCIATED | 1157 | | | 1158 | | If fail, stay at CLOSED | 1159 | | | 1160 | Receive ANYOTHER | Drop and stay at CLOSED | 1161 | | | 1162 | Timeout (UAL+2MSL) | Discard state, and go to UNASSOCIATED | 1163 +---------------------+---------------------------------------------+ 1165 Table 8: CLOSED - CLOSE_ACK sent, resending CLOSE_ACK if necessary 1167 System behavior in state E-FAILED, Table 9. 1169 +-------------------------+-----------------------------------------+ 1170 | Trigger | Action | 1171 +-------------------------+-----------------------------------------+ 1172 | Wait for | Go to UNASSOCIATED. Re-negotiation is | 1173 | implementation-specific | possible after moving to UNASSOCIATED | 1174 | time | state. | 1175 +-------------------------+-----------------------------------------+ 1176 Table 9: E-FAILED - HIP failed to establish association with peer 1178 4.4.3. Simplified HIP State Diagram 1180 The following diagram shows the major state transitions. Transitions 1181 based on received packets implicitly assume that the packets are 1182 successfully authenticated or processed. 1184 +-+ +---------------------------+ 1185 I1 received, send R1 | | | | 1186 | v v | 1187 Datagram to send +--------------+ I2 received, send R2 | 1188 +---------------| UNASSOCIATED |---------------+ | 1189 Send I1 | +--------------+ | | 1190 v | | 1191 +---------+ I2 received, send R2 | | 1192 +---->| I1-SENT |---------------------------------------+ | | 1193 | +---------+ | | | 1194 | | +------------------------+ | | | 1195 | | R1 received, | I2 received, send R2 | | | | 1196 | v send I2 | v v v | 1197 | +---------+ | +---------+ | 1198 | +->| I2-SENT |------------+ | R2-SENT |<----+ | 1199 | | +---------+ +---------+ | | 1200 | | | | | | 1201 | | | data| | | 1202 | |receive | or| | | 1203 | |R1, send | EC timeout| receive I2,| | 1204 | |I2 |R2 received +--------------+ | send R2| | 1205 | | +----------->| ESTABLISHED |<-------+| | | 1206 | | +--------------+ | | 1207 | | | | | receive I2, send R2 | | 1208 | | recv+------------+ | +------------------------+ | 1209 | | CLOSE,| | | | 1210 | | send| No packet sent| | | 1211 | | CLOSE_ACK| /received for | timeout | | 1212 | | | UAL min, send | +---------+<-+ (UAL+MSL) | | 1213 | | | CLOSE +--->| CLOSING |--+ retransmit | | 1214 | | | +---------+ CLOSE | | 1215 +--|------------|----------------------+ | | | | | | 1216 +------------|------------------------+ | | +----------------+ | 1217 | | +-----------+ +------------------|--+ 1218 | +------------+ | receive CLOSE, CLOSE_ACK | | 1219 | | | send CLOSE_ACK received or | | 1220 | | | timeout | | 1221 | | | (UAL+MSL) | | 1222 | v v | | 1223 | +--------+ receive I2, send R2 | | 1224 +------------------------| CLOSED |---------------------------+ | 1225 +--------+ /----------------------+ 1226 ^ | \-------/ timeout (UAL+2MSL), 1227 +-+ move to UNASSOCIATED 1228 CLOSE received, send CLOSE_ACK 1230 4.5. User Data Considerations 1232 4.5.1. TCP and UDP Pseudo-Header Computation for User Data 1234 When computing TCP and UDP checksums on user data packets that flow 1235 through sockets bound to HITs, the IPv6 pseudo-header format 1236 [RFC2460] MUST be used, even if the actual addresses on the packet 1237 are IPv4 addresses. Additionally, the HITs MUST be used in the place 1238 of the IPv6 addresses in the IPv6 pseudo-header. Note that the 1239 pseudo-header for actual HIP payloads is computed differently; see 1240 Section 5.1.1. 1242 4.5.2. Sending Data on HIP Packets 1244 A future version of this document may define how to include user data 1245 on various HIP packets. However, currently the HIP header is a 1246 terminal header, and not followed by any other headers. 1248 4.5.3. Transport Formats 1250 The actual data transmission format, used for user data after the HIP 1251 base exchange, is not defined in this document. Such transport 1252 formats and methods are described in separate specifications. All 1253 HIP implementations MUST implement, at minimum, the ESP transport 1254 format for HIP [RFC5202]. 1256 When new transport formats are defined, they get the type value from 1257 the HIP Transform type value space 2048-4095. The order in which the 1258 transport formats are presented in the R1 packet, is the preferred 1259 order. The last of the transport formats MUST be ESP transport 1260 format, represented by the ESP_TRANSFORM parameter. 1262 4.5.4. Reboot and SA Timeout Restart of HIP 1264 Simulating a loss of state is a potential DoS attack. The following 1265 process has been crafted to manage state recovery without presenting 1266 a DoS opportunity. 1268 If a host reboots or the HIP association times out, it has lost its 1269 HIP state. If the host that lost state has a datagram to send to the 1270 peer, it simply restarts the HIP base exchange. After the base 1271 exchange has completed, the Initiator can create a new SA and start 1272 sending data. The peer does not reset its state until it receives a 1273 valid I2 HIP packet. 1275 If a system receives a user data packet that cannot be matched to any 1276 existing HIP association, it is possible that it has lost the state 1277 and its peer has not. It MAY send an ICMP packet with the Parameter 1278 Problem type, and with the pointer pointing to the referred HIP- 1279 related association information. Reacting to such traffic depends on 1280 the implementation and the environment where the implementation is 1281 used. 1283 If the host, that apparently has lost its state, decides to restart 1284 the HIP base exchange, it sends an I1 packet to the peer. After the 1285 base exchange has been completed successfully, the Initiator can 1286 create a new HIP association and the peer drops its old SA and 1287 creates a new one. 1289 4.6. Certificate Distribution 1291 This document does not define how to use certificates or how to 1292 transfer them between hosts. These functions are expected to be 1293 defined in a future specification. A parameter type value, meant to 1294 be used for carrying certificates, is reserved, though: CERT, Type 1295 768; see Section 5.2. 1297 5. Packet Formats 1299 5.1. Payload Format 1301 All HIP packets start with a fixed header. 1303 0 1 2 3 1304 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 1305 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1306 | Next Header | Header Length |0| Packet Type | VER. | RES.|1| 1307 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1308 | Checksum | Controls | 1309 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1310 | Sender's Host Identity Tag (HIT) | 1311 | | 1312 | | 1313 | | 1314 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1315 | Receiver's Host Identity Tag (HIT) | 1316 | | 1317 | | 1318 | | 1319 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1320 | | 1321 / HIP Parameters / 1322 / / 1323 | | 1324 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1325 The HIP header is logically an IPv6 extension header. However, this 1326 document does not describe processing for Next Header values other 1327 than decimal 59, IPPROTO_NONE, the IPv6 'no next header' value. 1328 Future documents MAY do so. However, current implementations MUST 1329 ignore trailing data if an unimplemented Next Header value is 1330 received. 1332 The Header Length field contains the length of the HIP Header and HIP 1333 parameters in 8-byte units, excluding the first 8 bytes. Since all 1334 HIP headers MUST contain the sender's and receiver's HIT fields, the 1335 minimum value for this field is 4, and conversely, the maximum length 1336 of the HIP Parameters field is (255*8)-32 = 2008 bytes. Note: this 1337 sets an additional limit for sizes of parameters included in the 1338 Parameters field, independent of the individual parameter maximum 1339 lengths. 1341 The Packet Type indicates the HIP packet type. The individual packet 1342 types are defined in the relevant sections. If a HIP host receives a 1343 HIP packet that contains an unknown packet type, it MUST drop the 1344 packet. 1346 The HIP Version is four bits. The current version is 1. The version 1347 number is expected to be incremented only if there are incompatible 1348 changes to the protocol. Most extensions can be handled by defining 1349 new packet types, new parameter types, or new controls. 1351 The following three bits are reserved for future use. They MUST be 1352 zero when sent, and they SHOULD be ignored when handling a received 1353 packet. 1355 The two fixed bits in the header are reserved for potential SHIM6 1356 compatibility [RFC5533]. For implementations adhering (only) to this 1357 specification, they MUST be set as shown when sending and MUST be 1358 ignored when receiving. This is to ensure optimal forward 1359 compatibility. Note that for implementations that implement other 1360 compatible specifications in addition to this specification, the 1361 corresponding rules may well be different. For example, in the case 1362 that the forthcoming SHIM6 protocol happens to be compatible with 1363 this specification, an implementation that implements both this 1364 specification and the SHIM6 protocol may need to check these bits in 1365 order to determine how to handle the packet. 1367 The HIT fields are always 128 bits (16 bytes) long. 1369 5.1.1. Checksum 1371 Since the checksum covers the source and destination addresses in the 1372 IP header, it must be recomputed on HIP-aware NAT devices. 1374 If IPv6 is used to carry the HIP packet, the pseudo-header [RFC2460] 1375 contains the source and destination IPv6 addresses, HIP packet length 1376 in the pseudo-header length field, a zero field, and the HIP protocol 1377 number (see Section 4) in the Next Header field. The length field is 1378 in bytes and can be calculated from the HIP header length field: (HIP 1379 Header Length + 1) * 8. 1381 In case of using IPv4, the IPv4 UDP pseudo-header format [RFC0768] is 1382 used. In the pseudo-header, the source and destination addresses are 1383 those used in the IP header, the zero field is obviously zero, the 1384 protocol is the HIP protocol number (see Section 4), and the length 1385 is calculated as in the IPv6 case. 1387 5.1.2. HIP Controls 1389 The HIP Controls section conveys information about the structure of 1390 the packet and capabilities of the host. 1392 The following fields have been defined: 1394 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1395 | | | | | | | | | | | | | | | |A| 1396 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1398 A - Anonymous: If this is set, the sender's HI in this packet is 1399 anonymous, i.e., one not listed in a directory. Anonymous HIs 1400 SHOULD NOT be stored. This control is set in packets R1 and/or 1401 I2. The peer receiving an anonymous HI may choose to refuse it. 1403 The rest of the fields are reserved for future use and MUST be set to 1404 zero on sent packets and ignored on received packets. 1406 5.1.3. HIP Fragmentation Support 1408 A HIP implementation must support IP fragmentation/reassembly. 1409 Fragment reassembly MUST be implemented in both IPv4 and IPv6, but 1410 fragment generation is REQUIRED to be implemented in IPv4 (IPv4 1411 stacks and networks will usually do this by default) and RECOMMENDED 1412 to be implemented in IPv6. In IPv6 networks, the minimum MTU is 1413 larger, 1280 bytes, than in IPv4 networks. The larger MTU size is 1414 usually sufficient for most HIP packets, and therefore fragment 1415 generation may not be needed. If a host expects to send HIP packets 1416 that are larger than the minimum IPv6 MTU, it MUST implement fragment 1417 generation even for IPv6. 1419 In IPv4 networks, HIP packets may encounter low MTUs along their 1420 routed path. Since HIP does not provide a mechanism to use multiple 1421 IP datagrams for a single HIP packet, support for path MTU discovery 1422 does not bring any value to HIP in IPv4 networks. HIP-aware NAT 1423 devices MUST perform any IPv4 reassembly/fragmentation. 1425 All HIP implementations have to be careful while employing a 1426 reassembly algorithm so that the algorithm is sufficiently resistant 1427 to DoS attacks. 1429 Because certificate chains can cause the packet to be fragmented and 1430 fragmentation can open implementation to denial-of-service attacks 1431 [KAU03], it is strongly recommended that the separate document 1432 specifying the certificate usage in the HIP Base Exchange defines the 1433 usage of "Hash and URL" formats rather than including certificates in 1434 exchanges. With this, most problems related to DoS attacks with 1435 fragmentation can be avoided. 1437 5.2. HIP Parameters 1439 The HIP Parameters are used to carry the public key associated with 1440 the sender's HIT, together with related security and other 1441 information. They consist of ordered parameters, encoded in TLV 1442 format. 1444 The following parameter types are currently defined. 1446 +------------------------+-------+----------+-----------------------+ 1447 | TLV | Type | Length | Data | 1448 +------------------------+-------+----------+-----------------------+ 1449 | R1_COUNTER | 128 | 12 | System Boot Counter | 1450 | | | | | 1451 | PUZZLE | 257 | 12 | K and Random #I | 1452 | | | | | 1453 | SOLUTION | 321 | 20 | K, Random #I and | 1454 | | | | puzzle solution J | 1455 | | | | | 1456 | SEQ | 385 | 4 | Update packet ID | 1457 | | | | number | 1458 | | | | | 1459 | ACK | 449 | variable | Update packet ID | 1460 | | | | number | 1461 | | | | | 1462 | DIFFIE_HELLMAN | 513 | variable | public key | 1463 | | | | | 1464 | HIP_TRANSFORM | 577 | variable | HIP Encryption and | 1465 | | | | Integrity Transform | 1466 | | | | | 1467 | ENCRYPTED | 641 | variable | Encrypted part of I2 | 1468 | | | | packet | 1469 | | | | | 1470 | HOST_ID | 705 | variable | Host Identity with | 1471 | | | | Fully-Qualified | 1472 | | | | Domain FQDN (Name) or | 1473 | | | | Network Access | 1474 | | | | Identifier (NAI) | 1475 | | | | | 1476 | CERT | 768 | variable | HI Certificate; used | 1477 | | | | to transfer | 1478 | | | | certificates. Usage | 1479 | | | | is not currently | 1480 | | | | defined, but it will | 1481 | | | | be specified in a | 1482 | | | | separate document | 1483 | | | | once needed. | 1484 | | | | | 1485 | NOTIFICATION | 832 | variable | Informational data | 1486 | | | | | 1487 | ECHO_REQUEST_SIGNED | 897 | variable | Opaque data to be | 1488 | | | | echoed back; under | 1489 | | | | signature | 1490 | | | | | 1491 | ECHO_RESPONSE_SIGNED | 961 | variable | Opaque data echoed | 1492 | | | | back; under signature | 1493 | | | | | 1494 | HMAC | 61505 | variable | HMAC-based message | 1495 | | | | authentication code, | 1496 | | | | with key material | 1497 | | | | from HIP_TRANSFORM | 1498 | | | | | 1499 | HMAC_2 | 61569 | variable | HMAC based message | 1500 | | | | authentication code, | 1501 | | | | with key material | 1502 | | | | from HIP_TRANSFORM. | 1503 | | | | Compared to HMAC, the | 1504 | | | | HOST_ID parameter is | 1505 | | | | included in HMAC_2 | 1506 | | | | calculation. | 1507 | | | | | 1508 | HIP_SIGNATURE_2 | 61633 | variable | Signature of the R1 | 1509 | | | | packet | 1510 | | | | | 1511 | HIP_SIGNATURE | 61697 | variable | Signature of the | 1512 | | | | packet | 1513 | | | | | 1514 | ECHO_REQUEST_UNSIGNED | 63661 | variable | Opaque data to be | 1515 | | | | echoed back; after | 1516 | | | | signature | 1517 | | | | | 1518 | ECHO_RESPONSE_UNSIGNED | 63425 | variable | Opaque data echoed | 1519 | | | | back; after signature | 1520 +------------------------+-------+----------+-----------------------+ 1522 Because the ordering (from lowest to highest) of HIP parameters is 1523 strictly enforced (see Section 5.2.1), the parameter type values for 1524 existing parameters have been spaced to allow for future protocol 1525 extensions. Parameters numbered between 0-1023 are used in HIP 1526 handshake and update procedures and are covered by signatures. 1527 Parameters numbered between 1024-2047 are reserved. Parameters 1528 numbered between 2048-4095 are used for parameters related to HIP 1529 transform types. Parameters numbered between 4096 and (2^16 - 2^12) 1530 61439 are reserved. Parameters numbered between 61440-62463 are used 1531 for signatures and signed MACs. Parameters numbered between 62464- 1532 63487 are used for parameters that fall outside of the signed area of 1533 the packet. Parameters numbered between 63488-64511 are used for 1534 rendezvous and other relaying services. Parameters numbered between 1535 64512-65535 are reserved. 1537 5.2.1. TLV Format 1539 The TLV-encoded parameters are described in the following 1540 subsections. The type-field value also describes the order of these 1541 fields in the packet, except for type values from 2048 to 4095 which 1542 are reserved for new transport forms. The parameters MUST be 1543 included in the packet such that their types form an increasing 1544 order. If the parameter can exist multiple times in the packet, the 1545 type value may be the same in consecutive parameters. If the order 1546 does not follow this rule, the packet is considered to be malformed 1547 and it MUST be discarded. 1549 Parameters using type values from 2048 up to 4095 are transport 1550 formats. Currently, one transport format is defined: the ESP 1551 transport format [RFC5202]. The order of these parameters does not 1552 follow the order of their type value, but they are put in the packet 1553 in order of preference. The first of the transport formats it the 1554 most preferred, and so on. 1556 All of the TLV parameters have a length (including Type and Length 1557 fields), which is a multiple of 8 bytes. When needed, padding MUST 1558 be added to the end of the parameter so that the total length becomes 1559 a multiple of 8 bytes. This rule ensures proper alignment of data. 1560 Any added padding bytes MUST be zeroed by the sender, and their 1561 values SHOULD NOT be checked by the receiver. 1563 Consequently, the Length field indicates the length of the Contents 1564 field (in bytes). The total length of the TLV parameter (including 1565 Type, Length, Contents, and Padding) is related to the Length field 1566 according to the following formula: 1568 Total Length = 11 + Length - (Length + 3) % 8; 1570 where % is the modulo operator 1571 0 1 2 3 1572 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 1573 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1574 | Type |C| Length | 1575 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1576 | | 1577 / Contents / 1578 / +-+-+-+-+-+-+-+-+ 1579 | | Padding | 1580 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1582 Type Type code for the parameter. 16 bits long, C-bit 1583 being part of the Type code. 1584 C Critical. One if this parameter is critical, and 1585 MUST be recognized by the recipient, zero otherwise. 1586 The C bit is considered to be a part of the Type 1587 field. Consequently, critical parameters are always 1588 odd and non-critical ones have an even value. 1589 Length Length of the Contents, in bytes. 1590 Contents Parameter specific, defined by Type 1591 Padding Padding, 0-7 bytes, added if needed 1593 Critical parameters MUST be recognized by the recipient. If a 1594 recipient encounters a critical parameter that it does not recognize, 1595 it MUST NOT process the packet any further. It MAY send an ICMP or 1596 NOTIFY, as defined in Section 4.3. 1598 Non-critical parameters MAY be safely ignored. If a recipient 1599 encounters a non-critical parameter that it does not recognize, it 1600 SHOULD proceed as if the parameter was not present in the received 1601 packet. 1603 5.2.2. Defining New Parameters 1605 Future specifications may define new parameters as needed. When 1606 defining new parameters, care must be taken to ensure that the 1607 parameter type values are appropriate and leave suitable space for 1608 other future extensions. One must remember that the parameters MUST 1609 always be arranged in increasing order by Type code, thereby limiting 1610 the order of parameters (see Section 5.2.1). 1612 The following rules must be followed when defining new parameters. 1614 1. The low-order bit C of the Type code is used to distinguish 1615 between critical and non-critical parameters. 1617 2. A new parameter may be critical only if an old recipient ignoring 1618 it would cause security problems. In general, new parameters 1619 SHOULD be defined as non-critical, and expect a reply from the 1620 recipient. 1622 3. If a system implements a new critical parameter, it MUST provide 1623 the ability to set the associated feature off, such that the 1624 critical parameter is not sent at all. The configuration option 1625 must be well documented. Implementations operating in a mode 1626 adhering to this specification MUST disable the sending of new 1627 critical parameters. In other words, the management interface 1628 MUST allow vanilla standards-only mode as a default configuration 1629 setting, and MAY allow new critical payloads to be configured on 1630 (and off). 1632 4. See Section 9 for allocation rules regarding Type codes. 1634 5.2.3. R1_COUNTER 1636 0 1 2 3 1637 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 1638 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1639 | Type | Length | 1640 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1641 | Reserved, 4 bytes | 1642 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1643 | R1 generation counter, 8 bytes | 1644 | | 1645 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1647 Type 128 1648 Length 12 1649 R1 generation 1650 counter The current generation of valid puzzles 1652 The R1_COUNTER parameter contains a 64-bit unsigned integer in 1653 network-byte order, indicating the current generation of valid 1654 puzzles. The sender is supposed to increment this counter 1655 periodically. It is RECOMMENDED that the counter value is 1656 incremented at least as often as old PUZZLE values are deprecated so 1657 that SOLUTIONs to them are no longer accepted. 1659 The R1_COUNTER parameter is optional. It SHOULD be included in the 1660 R1 (in which case, it is covered by the signature), and if present in 1661 the R1, it MAY be echoed (including the Reserved field verbatim) by 1662 the Initiator in the I2. 1664 5.2.4. PUZZLE 1666 0 1 2 3 1667 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 1668 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1669 | Type | Length | 1670 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1671 | K, 1 byte | Lifetime | Opaque, 2 bytes | 1672 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1673 | Random #I, 8 bytes | 1674 | | 1675 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1677 Type 257 1678 Length 12 1679 K K is the number of verified bits 1680 Lifetime puzzle lifetime 2^(value-32) seconds 1681 Opaque data set by the Responder, indexing the puzzle 1682 Random #I random number 1684 Random #I is represented as a 64-bit integer, K and Lifetime as 8-bit 1685 integers, all in network byte order. 1687 The PUZZLE parameter contains the puzzle difficulty K and a 64-bit 1688 puzzle random integer #I. The Puzzle Lifetime indicates the time 1689 during which the puzzle solution is valid, and sets a time limit that 1690 should not be exceeded by the Initiator while it attempts to solve 1691 the puzzle. The lifetime is indicated as a power of 2 using the 1692 formula 2^(Lifetime-32) seconds. A puzzle MAY be augmented with an 1693 ECHO_REQUEST_SIGNED or an ECHO_REQUEST_UNSIGNED parameter included in 1694 the R1; the contents of the echo request are then echoed back in the 1695 ECHO_RESPONSE_SIGNED or in the ECHO_RESPONSE_UNSIGNED, allowing the 1696 Responder to use the included information as a part of its puzzle 1697 processing. 1699 The Opaque and Random #I field are not covered by the HIP_SIGNATURE_2 1700 parameter. 1702 5.2.5. SOLUTION 1704 0 1 2 3 1705 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 1706 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1707 | Type | Length | 1708 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1709 | K, 1 byte | Reserved | Opaque, 2 bytes | 1710 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1711 | Random #I, 8 bytes | 1712 | | 1713 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1714 | Puzzle solution #J, 8 bytes | 1715 | | 1716 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1718 Type 321 1719 Length 20 1720 K K is the number of verified bits 1721 Reserved zero when sent, ignored when received 1722 Opaque copied unmodified from the received PUZZLE 1723 parameter 1724 Random #I random number 1725 Puzzle solution #J random number 1727 Random #I and Random #J are represented as 64-bit integers, K as an 1728 8-bit integer, all in network byte order. 1730 The SOLUTION parameter contains a solution to a puzzle. It also 1731 echoes back the random difficulty K, the Opaque field, and the puzzle 1732 integer #I. 1734 5.2.6. DIFFIE_HELLMAN 1736 0 1 2 3 1737 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 1738 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1739 | Type | Length | 1740 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1741 | Group ID | Public Value Length | Public Value / 1742 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1743 / | 1744 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1745 | Group ID | Public Value Length | Public Value / 1746 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1747 / | padding | 1748 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1750 Type 513 1751 Length length in octets, excluding Type, Length, and 1752 padding 1753 Group ID defines values for p and g 1754 Public Value length of the following Public Value in octets 1755 Length 1756 Public Value the sender's public Diffie-Hellman key 1758 The following Group IDs have been defined: 1760 Group Value 1761 Reserved 0 1762 384-bit group 1 1763 OAKLEY well-known group 1 2 1764 1536-bit MODP group 3 1765 3072-bit MODP group 4 1766 6144-bit MODP group 5 1767 8192-bit MODP group 6 1769 The MODP Diffie-Hellman groups are defined in [RFC3526]. The OAKLEY 1770 well-known group 1 is defined in Appendix E. 1772 The sender can include at most two different Diffie-Hellman public 1773 values in the DIFFIE_HELLMAN parameter. This gives the possibility, 1774 e.g., for a server to provide a weaker encryption possibility for a 1775 PDA host that is not powerful enough. It is RECOMMENDED that the 1776 Initiator, receiving more than one public value, selects the stronger 1777 one, if it supports it. 1779 A HIP implementation MUST implement Group IDs 1 and 3. The 384-bit 1780 group can be used when lower security is enough (e.g., web surfing) 1781 and when the equipment is not powerful enough (e.g., some PDAs). It 1782 is REQUIRED that the default configuration allows Group ID 1 usage, 1783 but it is RECOMMENDED that applications that need stronger security 1784 turn Group ID 1 support off. Equipment powerful enough SHOULD 1785 implement also Group ID 5. The 384-bit group is defined in 1786 Appendix D. 1788 To avoid unnecessary failures during the base exchange, the rest of 1789 the groups SHOULD be implemented in hosts where resources are 1790 adequate. 1792 5.2.7. HIP_TRANSFORM 1794 0 1 2 3 1795 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 1796 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1797 | Type | Length | 1798 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1799 | Suite ID #1 | Suite ID #2 | 1800 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1801 | Suite ID #n | Padding | 1802 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1804 Type 577 1805 Length length in octets, excluding Type, Length, and 1806 padding 1807 Suite ID defines the HIP Suite to be used 1809 The following Suite IDs are defined ([RFC4307],[RFC2451]): 1811 Suite ID Value 1813 RESERVED 0 1814 AES-CBC with HMAC-SHA1 1 1815 3DES-CBC with HMAC-SHA1 2 1816 3DES-CBC with HMAC-MD5 3 1817 BLOWFISH-CBC with HMAC-SHA1 4 1818 NULL-ENCRYPT with HMAC-SHA1 5 1819 NULL-ENCRYPT with HMAC-MD5 6 1821 The sender of a HIP_TRANSFORM parameter MUST make sure that there are 1822 no more than six (6) HIP Suite IDs in one HIP_TRANSFORM parameter. 1823 Conversely, a recipient MUST be prepared to handle received transport 1824 parameters that contain more than six Suite IDs by accepting the 1825 first six Suite IDs and dropping the rest. The limited number of 1826 transforms sets the maximum size of HIP_TRANSFORM parameter. As the 1827 default configuration, the HIP_TRANSFORM parameter MUST contain at 1828 least one of the mandatory Suite IDs. There MAY be a configuration 1829 option that allows the administrator to override this default. 1831 The Responder lists supported and desired Suite IDs in order of 1832 preference in the R1, up to the maximum of six Suite IDs. The 1833 Initiator MUST choose only one of the corresponding Suite IDs. That 1834 Suite ID will be used for generating the I2. 1836 Mandatory implementations: AES-CBC with HMAC-SHA1 and NULL-ENCRYPTION 1837 with HMAC-SHA1. 1839 5.2.8. HOST_ID 1841 0 1 2 3 1842 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 1843 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1844 | Type | Length | 1845 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1846 | HI Length |DI-type| DI Length | 1847 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1848 | Host Identity / 1849 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1850 / | Domain Identifier / 1851 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1852 / | Padding | 1853 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1855 Type 705 1856 Length length in octets, excluding Type, Length, and 1857 Padding 1858 HI Length length of the Host Identity in octets 1859 DI-type type of the following Domain Identifier field 1860 DI Length length of the FQDN or NAI in octets 1861 Host Identity actual Host Identity 1862 Domain Identifier the identifier of the sender 1864 The Host Identity is represented in RFC 4034 [RFC4034] format. The 1865 algorithms used in RDATA format are the following: 1867 Algorithms Values 1869 RESERVED 0 1870 DSA 3 [RFC2536] (RECOMMENDED) 1871 RSA/SHA1 5 [RFC3110] (REQUIRED) 1873 The following DI-types have been defined: 1875 Type Value 1876 none included 0 1877 FQDN 1 1878 NAI 2 1880 FQDN Fully Qualified Domain Name, in binary format. 1881 NAI Network Access Identifier 1883 The format for the FQDN is defined in RFC 1035 [RFC1035] Section 3.1. 1884 The format for NAI is defined in [RFC4282] 1886 If there is no Domain Identifier, i.e., the DI-type field is zero, 1887 the DI Length field is set to zero as well. 1889 5.2.9. HMAC 1891 0 1 2 3 1892 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 1893 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1894 | Type | Length | 1895 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1896 | | 1897 | HMAC | 1898 / / 1899 / +-------------------------------+ 1900 | | Padding | 1901 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1903 Type 61505 1904 Length length in octets, excluding Type, Length, and 1905 Padding 1906 HMAC HMAC computed over the HIP packet, excluding the 1907 HMAC parameter and any following parameters, such 1908 as HIP_SIGNATURE, HIP_SIGNATURE_2, 1909 ECHO_REQUEST_UNSIGNED, or ECHO_RESPONSE_UNSIGNED. 1910 The checksum field MUST be set to zero and the HIP 1911 header length in the HIP common header MUST be 1912 calculated not to cover any excluded parameters 1913 when the HMAC is calculated. The size of the 1914 HMAC is the natural size of the hash computation 1915 output depending on the used hash function. 1917 The HMAC calculation and verification process is presented in 1918 Section 6.4.1. 1920 5.2.10. HMAC_2 1922 The parameter structure is the same as in Section 5.2.9. The fields 1923 are: 1925 Type 61569 1926 Length length in octets, excluding Type, Length, and 1927 Padding 1928 HMAC HMAC computed over the HIP packet, excluding the 1929 HMAC parameter and any following parameters such 1930 as HIP_SIGNATURE, HIP_SIGNATURE_2, 1931 ECHO_REQUEST_UNSIGNED, or ECHO_RESPONSE_UNSIGNED, 1932 and including an additional sender's HOST_ID 1933 parameter during the HMAC calculation. The 1934 checksum field MUST be set to zero and the HIP 1935 header length in the HIP common header MUST be 1936 calculated not to cover any excluded parameters 1937 when the HMAC is calculated. The size of the 1938 HMAC is the natural size of the hash computation 1939 output depending on the used hash function. 1941 The HMAC calculation and verification process is presented in 1942 Section 6.4.1. 1944 5.2.11. HIP_SIGNATURE 1946 0 1 2 3 1947 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 1948 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1949 | Type | Length | 1950 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1951 | SIG alg | Signature / 1952 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1953 / | Padding | 1954 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1956 Type 61697 1957 Length length in octets, excluding Type, Length, and 1958 Padding 1959 SIG alg signature algorithm 1960 Signature the signature is calculated over the HIP packet, 1961 excluding the HIP_SIGNATURE parameter and any 1962 parameters that follow the HIP_SIGNATURE parameter. 1963 The checksum field MUST be set to zero, and the HIP 1964 header length in the HIP common header MUST be 1965 calculated only to the beginning of the 1966 HIP_SIGNATURE parameter when the signature is 1967 calculated. 1969 The signature algorithms are defined in Section 5.2.8. The signature 1970 in the Signature field is encoded using the proper method depending 1971 on the signature algorithm (e.g., according to [RFC3110] in case of 1972 RSA/SHA1, or according to [RFC2536] in case of DSA). 1974 The HIP_SIGNATURE calculation and verification process is presented 1975 in Section 6.4.2. 1977 5.2.12. HIP_SIGNATURE_2 1979 The parameter structure is the same as in Section 5.2.11. The fields 1980 are: 1982 Type 61633 1983 Length length in octets, excluding Type, Length, and 1984 Padding 1985 SIG alg signature algorithm 1986 Signature Within the R1 packet that contains the HIP_SIGNATURE_2 1987 parameter, the Initiator's HIT, the checksum 1988 field, and the Opaque and Random #I fields in the 1989 PUZZLE parameter MUST be set to zero while 1990 computing the HIP_SIGNATURE_2 signature. Further, 1991 the HIP packet length in the HIP header MUST be 1992 adjusted as if the HIP_SIGNATURE_2 was not in the 1993 packet during the signature calculation, i.e., the 1994 HIP packet length points to the beginning of 1995 the HIP_SIGNATURE_2 parameter during signing and 1996 verification. 1998 Zeroing the Initiator's HIT makes it possible to create R1 packets 1999 beforehand, to minimize the effects of possible DoS attacks. Zeroing 2000 the Random #I and Opaque fields within the PUZZLE parameter allows 2001 these fields to be populated dynamically on precomputed R1s. 2003 Signature calculation and verification follows the process in 2004 Section 6.4.2. 2006 5.2.13. SEQ 2008 0 1 2 3 2009 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 2010 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2011 | Type | Length | 2012 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2013 | Update ID | 2014 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2016 Type 385 2017 Length 4 2018 Update ID 32-bit sequence number 2020 The Update ID is an unsigned quantity, initialized by a host to zero 2021 upon moving to ESTABLISHED state. The Update ID has scope within a 2022 single HIP association, and not across multiple associations or 2023 multiple hosts. The Update ID is incremented by one before each new 2024 UPDATE that is sent by the host; the first UPDATE packet originated 2025 by a host has an Update ID of 0. 2027 5.2.14. ACK 2029 0 1 2 3 2030 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 2031 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2032 | Type | Length | 2033 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2034 | peer Update ID | 2035 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2037 Type 449 2038 Length variable (multiple of 4) 2039 peer Update ID 32-bit sequence number corresponding to the 2040 Update ID being ACKed. 2042 The ACK parameter includes one or more Update IDs that have been 2043 received from the peer. The Length field identifies the number of 2044 peer Update IDs that are present in the parameter. 2046 5.2.15. ENCRYPTED 2048 0 1 2 3 2049 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 2050 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2051 | Type | Length | 2052 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2053 | Reserved | 2054 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2055 | IV / 2056 / / 2057 / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2058 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / 2059 / Encrypted data / 2060 / / 2061 / +-------------------------------+ 2062 / | Padding | 2063 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2065 Type 641 2066 Length length in octets, excluding Type, Length, and 2067 Padding 2068 Reserved zero when sent, ignored when received 2069 IV Initialization vector, if needed, otherwise 2070 nonexistent. The length of the IV is inferred from 2071 the HIP transform. 2072 Encrypted The data is encrypted using an encryption algorithm 2073 data as defined in HIP transform. 2075 The ENCRYPTED parameter encapsulates another parameter, the encrypted 2076 data, which holds one or more HIP parameters in block encrypted form. 2078 Consequently, the first fields in the encapsulated parameter(s) are 2079 Type and Length of the first such parameter, allowing the contents to 2080 be easily parsed after decryption. 2082 The field labelled "Encrypted data" consists of the output of one or 2083 more HIP parameters concatenated together that have been passed 2084 through an encryption algorithm. Each of these inner parameters is 2085 padded according to the rules of Section 5.2.1 for padding individual 2086 parameters. As a result, the concatenated parameters will be a block 2087 of data that is 8-byte aligned. 2089 Some encryption algorithms require that the data to be encrypted must 2090 be a multiple of the cipher algorithm block size. In this case, the 2091 above block of data MUST include additional padding, as specified by 2092 the encryption algorithm. The size of the extra padding is selected 2093 so that the length of the unencrypted data block is a multiple of the 2094 cipher block size. The encryption algorithm may specify padding 2095 bytes other than zero; for example, AES [FIPS.197.2001] uses the 2096 PKCS5 padding scheme (see section 6.1.1 of [RFC2898]) where the 2097 remaining n bytes to fill the block each have the value n. This 2098 yields an "unencrypted data" block that is transformed to an 2099 "encrypted data" block by the cipher suite. This extra padding added 2100 to the set of parameters to satisfy the cipher block alignment rules 2101 is not counted in HIP TLV length fields, and this extra padding 2102 should be removed by the cipher suite upon decryption. 2104 Note that the length of the cipher suite output may be smaller or 2105 larger than the length of the set of parameters to be encrypted, 2106 since the encryption process may compress the data or add additional 2107 padding to the data. 2109 Once this encryption process is completed, the Encrypted data field 2110 is ready for inclusion in the Parameter. If necessary, additional 2111 Padding for 8-byte alignment is then added according to the rules of 2112 Section 5.2.1. 2114 5.2.16. NOTIFICATION 2116 The NOTIFICATION parameter is used to transmit informational data, 2117 such as error conditions and state transitions, to a HIP peer. A 2118 NOTIFICATION parameter may appear in the NOTIFY packet type. The use 2119 of the NOTIFICATION parameter in other packet types is for further 2120 study. 2122 0 1 2 3 2123 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 2124 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2125 | Type | Length | 2126 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2127 | Reserved | Notify Message Type | 2128 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2129 | / 2130 / Notification Data / 2131 / +---------------+ 2132 / | Padding | 2133 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2135 Type 832 2136 Length length in octets, excluding Type, Length, and 2137 Padding 2138 Reserved zero when sent, ignored when received 2139 Notify Message specifies the type of notification 2140 Type 2141 Notification informational or error data transmitted in addition 2142 Data to the Notify Message Type. Values for this field 2143 are type specific (see below). 2144 Padding any Padding, if necessary, to make the parameter a 2145 multiple of 8 bytes. 2147 Notification information can be error messages specifying why an SA 2148 could not be established. It can also be status data that a process 2149 managing an SA database wishes to communicate with a peer process. 2150 The table below lists the Notification messages and their 2151 corresponding values. 2153 To avoid certain types of attacks, a Responder SHOULD avoid sending a 2154 NOTIFICATION to any host with which it has not successfully verified 2155 a puzzle solution. 2157 Types in the range 0-16383 are intended for reporting errors and in 2158 the range 16384-65535 for other status information. An 2159 implementation that receives a NOTIFY packet with a NOTIFICATION 2160 error parameter in response to a request packet (e.g., I1, I2, 2161 UPDATE) SHOULD assume that the corresponding request has failed 2162 entirely. Unrecognized error types MUST be ignored except that they 2163 SHOULD be logged. 2165 Notify payloads with status types MUST be ignored if not recognized. 2167 NOTIFICATION PARAMETER - ERROR TYPES Value 2168 ------------------------------------ ----- 2169 UNSUPPORTED_CRITICAL_PARAMETER_TYPE 1 2171 Sent if the parameter type has the "critical" bit set and the 2172 parameter type is not recognized. Notification Data contains 2173 the two-octet parameter type. 2175 INVALID_SYNTAX 7 2177 Indicates that the HIP message received was invalid because 2178 some type, length, or value was out of range or because the 2179 request was rejected for policy reasons. To avoid a denial- 2180 of-service attack using forged messages, this status may only be 2181 returned for packets whose HMAC (if present) and SIGNATURE have 2182 been verified. This status MUST be sent in response to any 2183 error not covered by one of the other status types, and should 2184 not contain details to avoid leaking information to someone 2185 probing a node. To aid debugging, more detailed error 2186 information SHOULD be written to a console or log. 2188 NO_DH_PROPOSAL_CHOSEN 14 2190 None of the proposed group IDs was acceptable. 2192 INVALID_DH_CHOSEN 15 2194 The D-H Group ID field does not correspond to one offered 2195 by the Responder. 2197 NO_HIP_PROPOSAL_CHOSEN 16 2199 None of the proposed HIP Transform crypto suites was 2200 acceptable. 2202 INVALID_HIP_TRANSFORM_CHOSEN 17 2204 The HIP Transform crypto suite does not correspond to 2205 one offered by the Responder. 2207 AUTHENTICATION_FAILED 24 2209 Sent in response to a HIP signature failure, except when 2210 the signature verification fails in a NOTIFY message. 2212 CHECKSUM_FAILED 26 2214 Sent in response to a HIP checksum failure. 2216 HMAC_FAILED 28 2217 Sent in response to a HIP HMAC failure. 2219 ENCRYPTION_FAILED 32 2221 The Responder could not successfully decrypt the 2222 ENCRYPTED parameter. 2224 INVALID_HIT 40 2226 Sent in response to a failure to validate the peer's 2227 HIT from the corresponding HI. 2229 BLOCKED_BY_POLICY 42 2231 The Responder is unwilling to set up an association 2232 for some policy reason (e.g., received HIT is NULL 2233 and policy does not allow opportunistic mode). 2235 SERVER_BUSY_PLEASE_RETRY 44 2237 The Responder is unwilling to set up an association as it is 2238 suffering under some kind of overload and has chosen to shed load 2239 by rejecting the Initiator's request. The Initiator may retry; 2240 however, the Initiator MUST find another (different) puzzle 2241 solution for any such retries. Note that the Initiator may need 2242 to obtain a new puzzle with a new I1/R1 exchange. 2244 NOTIFY MESSAGES - STATUS TYPES Value 2245 ------------------------------ ----- 2247 I2_ACKNOWLEDGEMENT 16384 2249 The Responder has an I2 from the Initiator but had to queue the I2 2250 for processing. The puzzle was correctly solved and the Responder 2251 is willing to set up an association but currently has a number of 2252 I2s in the processing queue. R2 will be sent after the I2 has 2253 been processed. 2255 5.2.17. ECHO_REQUEST_SIGNED 2257 0 1 2 3 2258 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 2259 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2260 | Type | Length | 2261 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2262 | Opaque data (variable length) | 2263 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2265 Type 897 2266 Length variable 2267 Opaque data opaque data, supposed to be meaningful only to the 2268 node that sends ECHO_REQUEST_SIGNED and receives a 2269 corresponding ECHO_RESPONSE_SIGNED or 2270 ECHO_RESPONSE_UNSIGNED. 2272 The ECHO_REQUEST_SIGNED parameter contains an opaque blob of data 2273 that the sender wants to get echoed back in the corresponding reply 2274 packet. 2276 The ECHO_REQUEST_SIGNED and corresponding echo response parameters 2277 MAY be used for any purpose where a node wants to carry some state in 2278 a request packet and get it back in a response packet. The 2279 ECHO_REQUEST_SIGNED is covered by the HMAC and SIGNATURE. A HIP 2280 packet can contain only one ECHO_REQUEST_SIGNED or 2281 ECHO_REQUEST_UNSIGNED parameter. The ECHO_REQUEST_SIGNED parameter 2282 MUST be responded to with a corresponding echo response. 2283 ECHO_RESPONSE_SIGNED SHOULD be used, but if it is not possible, e.g., 2284 due to a middlebox-provided response, it MAY be responded to with an 2285 ECHO_RESPONSE_UNSIGNED. 2287 5.2.18. ECHO_REQUEST_UNSIGNED 2289 0 1 2 3 2290 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 2291 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2292 | Type | Length | 2293 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2294 | Opaque data (variable length) | 2295 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2297 Type 63661 2298 Length variable 2299 Opaque data opaque data, supposed to be meaningful only to the 2300 node that sends ECHO_REQUEST_UNSIGNED and receives a 2301 corresponding ECHO_RESPONSE_UNSIGNED. 2303 The ECHO_REQUEST_UNSIGNED parameter contains an opaque blob of data 2304 that the sender wants to get echoed back in the corresponding reply 2305 packet. 2307 The ECHO_REQUEST_UNSIGNED and corresponding echo response parameters 2308 MAY be used for any purpose where a node wants to carry some state in 2309 a request packet and get it back in a response packet. The 2310 ECHO_REQUEST_UNSIGNED is not covered by the HMAC and SIGNATURE. A 2311 HIP packet can contain one or more ECHO_REQUEST_UNSIGNED parameters. 2312 It is possible that middleboxes add ECHO_REQUEST_UNSIGNED parameters 2313 in HIP packets passing by. The sender has to create the Opaque field 2314 so that it can later identify and remove the corresponding 2315 ECHO_RESPONSE_UNSIGNED parameter. 2317 The ECHO_REQUEST_UNSIGNED parameter MUST be responded to with an 2318 ECHO_RESPONSE_UNSIGNED parameter. 2320 5.2.19. ECHO_RESPONSE_SIGNED 2322 0 1 2 3 2323 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 2324 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2325 | Type | Length | 2326 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2327 | Opaque data (variable length) | 2328 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2330 Type 961 2331 Length variable 2332 Opaque data opaque data, copied unmodified from the 2333 ECHO_REQUEST_SIGNED or ECHO_REQUEST_UNSIGNED 2334 parameter that triggered this response. 2336 The ECHO_RESPONSE_SIGNED parameter contains an opaque blob of data 2337 that the sender of the ECHO_REQUEST_SIGNED wants to get echoed back. 2338 The opaque data is copied unmodified from the ECHO_REQUEST_SIGNED 2339 parameter. 2341 The ECHO_REQUEST_SIGNED and ECHO_RESPONSE_SIGNED parameters MAY be 2342 used for any purpose where a node wants to carry some state in a 2343 request packet and get it back in a response packet. The 2344 ECHO_RESPONSE_SIGNED is covered by the HMAC and SIGNATURE. 2346 5.2.20. ECHO_RESPONSE_UNSIGNED 2348 0 1 2 3 2349 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 2350 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2351 | Type | Length | 2352 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2353 | Opaque data (variable length) | 2354 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2356 Type 63425 2357 Length variable 2358 Opaque data opaque data, copied unmodified from the 2359 ECHO_REQUEST_SIGNED or ECHO_REQUEST_UNSIGNED 2360 parameter that triggered this response. 2362 The ECHO_RESPONSE_UNSIGNED parameter contains an opaque blob of data 2363 that the sender of the ECHO_REQUEST_SIGNED or ECHO_REQUEST_UNSIGNED 2364 wants to get echoed back. The opaque data is copied unmodified from 2365 the corresponding echo request parameter. 2367 The echo request and ECHO_RESPONSE_UNSIGNED parameters MAY be used 2368 for any purpose where a node wants to carry some state in a request 2369 packet and get it back in a response packet. The 2370 ECHO_RESPONSE_UNSIGNED is not covered by the HMAC and SIGNATURE. 2372 5.3. HIP Packets 2374 There are eight basic HIP packets (see Table 10). Four are for the 2375 HIP base exchange, one is for updating, one is for sending 2376 notifications, and two are for closing a HIP association. 2378 +------------------+------------------------------------------------+ 2379 | Packet type | Packet name | 2380 +------------------+------------------------------------------------+ 2381 | 1 | I1 - the HIP Initiator Packet | 2382 | | | 2383 | 2 | R1 - the HIP Responder Packet | 2384 | | | 2385 | 3 | I2 - the Second HIP Initiator Packet | 2386 | | | 2387 | 4 | R2 - the Second HIP Responder Packet | 2388 | | | 2389 | 16 | UPDATE - the HIP Update Packet | 2390 | | | 2391 | 17 | NOTIFY - the HIP Notify Packet | 2392 | | | 2393 | 18 | CLOSE - the HIP Association Closing Packet | 2394 | | | 2395 | 19 | CLOSE_ACK - the HIP Closing Acknowledgment | 2396 | | Packet | 2397 +------------------+------------------------------------------------+ 2399 Table 10: HIP packets and packet type numbers 2401 Packets consist of the fixed header as described in Section 5.1, 2402 followed by the parameters. The parameter part, in turn, consists of 2403 zero or more TLV-coded parameters. 2405 In addition to the base packets, other packet types will be defined 2406 later in separate specifications. For example, support for mobility 2407 and multi-homing is not included in this specification. 2409 See Notation (Section 2.2) for used operations. 2411 In the future, an OPTIONAL upper-layer payload MAY follow the HIP 2412 header. The Next Header field in the header indicates if there is 2413 additional data following the HIP header. The HIP packet, however, 2414 MUST NOT be fragmented. This limits the size of the possible 2415 additional data in the packet. 2417 5.3.1. I1 - the HIP Initiator Packet 2419 The HIP header values for the I1 packet: 2421 Header: 2422 Packet Type = 1 2423 SRC HIT = Initiator's HIT 2424 DST HIT = Responder's HIT, or NULL 2426 IP ( HIP () ) 2428 The I1 packet contains only the fixed HIP header. 2430 Valid control bits: none 2432 The Initiator gets the Responder's HIT either from a DNS lookup of 2433 the Responder's FQDN, from some other repository, or from a local 2434 table. If the Initiator does not know the Responder's HIT, it may 2435 attempt to use opportunistic mode by using NULL (all zeros) as the 2436 Responder's HIT. See also "HIP Opportunistic Mode" (Section 4.1.6). 2438 Since this packet is so easy to spoof even if it were signed, no 2439 attempt is made to add to its generation or processing cost. 2441 Implementations MUST be able to handle a storm of received I1 2442 packets, discarding those with common content that arrive within a 2443 small time delta. 2445 5.3.2. R1 - the HIP Responder Packet 2447 The HIP header values for the R1 packet: 2449 Header: 2450 Packet Type = 2 2451 SRC HIT = Responder's HIT 2452 DST HIT = Initiator's HIT 2454 IP ( HIP ( [ R1_COUNTER, ] 2455 PUZZLE, 2456 DIFFIE_HELLMAN, 2457 HIP_TRANSFORM, 2458 HOST_ID, 2459 [ ECHO_REQUEST_SIGNED, ] 2460 HIP_SIGNATURE_2 ) 2461 <, ECHO_REQUEST_UNSIGNED >i) 2463 Valid control bits: A 2465 If the Responder's HI is an anonymous one, the A control MUST be set. 2467 The Initiator's HIT MUST match the one received in I1. If the 2468 Responder has multiple HIs, the Responder's HIT used MUST match 2469 Initiator's request. If the Initiator used opportunistic mode, the 2470 Responder may select freely among its HIs. See also "HIP 2471 Opportunistic Mode" (Section 4.1.6). 2473 The R1 generation counter is used to determine the currently valid 2474 generation of puzzles. The value is increased periodically, and it 2475 is RECOMMENDED that it is increased at least as often as solutions to 2476 old puzzles are no longer accepted. 2478 The Puzzle contains a Random #I and the difficulty K. The difficulty 2479 K indicates the number of lower-order bits, in the puzzle hash 2480 result, that must be zeros; see Section 4.1.2. The Random #I is not 2481 covered by the signature and must be zeroed during the signature 2482 calculation, allowing the sender to select and set the #I into a 2483 precomputed R1 just prior sending it to the peer. 2485 The Diffie-Hellman value is ephemeral, and one value SHOULD be used 2486 only for one connection. Once the Responder has received a valid 2487 response to an R1 packet, that Diffie-Hellman value SHOULD be 2488 deprecated. Because it is possible that the Responder has sent the 2489 same Diffie-Hellman value to different hosts simultaneously in 2490 corresponding R1 packets, those responses should also be accepted. 2491 However, as a defense against I1 storms, an implementation MAY 2492 propose, and re-use if not avoidable, the same Diffie-Hellman value 2493 for a period of time, for example, 15 minutes. By using a small 2494 number of different puzzles for a given Diffie-Hellman value, the R1 2495 packets can be precomputed and delivered as quickly as I1 packets 2496 arrive. A scavenger process should clean up unused Diffie-Hellman 2497 values and puzzles. 2499 Re-using Diffie-Hellman public keys opens up the potential security 2500 risk of more than one Initiator ending up with the same keying 2501 material (due to faulty random number generators). Also, more than 2502 one Initiator using the same Responder public key half may lead to 2503 potentially easier cryptographic attacks and to imperfect forward 2504 security. 2506 However, these risks involved in re-using the same key are 2507 statistical; that is, the authors are not aware of any mechanism that 2508 would allow manipulation of the protocol so that the risk of the re- 2509 use of any given Responder Diffie-Hellman public key would differ 2510 from the base probability. Consequently, it is RECOMMENDED that 2511 implementations avoid re-using the same D-H key with multiple 2512 Initiators, but because the risk is considered statistical and not 2513 known to be manipulable, the implementations MAY re-use a key in 2514 order to ease resource-constrained implementations and to increase 2515 the probability of successful communication with legitimate clients 2516 even under an I1 storm. In particular, when it is too expensive to 2517 generate enough precomputed R1 packets to supply each potential 2518 Initiator with a different D-H key, the Responder MAY send the same 2519 D-H key to several Initiators, thereby creating the possibility of 2520 multiple legitimate Initiators ending up using the same Responder- 2521 side public key. However, as soon as the Responder knows that it 2522 will use a particular D-H key, it SHOULD stop offering it. This 2523 design is aimed to allow resource-constrained Responders to offer 2524 services under I1 storms and to simultaneously make the probability 2525 of D-H key re-use both statistical and as low as possible. 2527 If a future version of this protocol is considered, we strongly 2528 recommend that these issues be studied again. Especially, the 2529 current design allows hosts to become potentially more vulnerable to 2530 a statistical, low-probability problem during I1 storm attacks than 2531 what they are if no attack is taking place; whether this is 2532 acceptable or not should be reconsidered in the light of any new 2533 experience gained. 2535 The HIP_TRANSFORM contains the encryption and integrity algorithms 2536 supported by the Responder to protect the HI exchange, in the order 2537 of preference. All implementations MUST support the AES [RFC3602] 2538 with HMAC-SHA-1-96 [RFC2404]. 2540 The ECHO_REQUEST_SIGNED and ECHO_REQUEST_UNSIGNED contains data that 2541 the sender wants to receive unmodified in the corresponding response 2542 packet in the ECHO_RESPONSE_SIGNED or ECHO_RESPONSE_UNSIGNED 2543 parameter. 2545 The signature is calculated over the whole HIP envelope, after 2546 setting the Initiator's HIT, header checksum, as well as the Opaque 2547 field and the Random #I in the PUZZLE parameter temporarily to zero, 2548 and excluding any parameters that follow the signature, as described 2549 in Section 5.2.12. This allows the Responder to use precomputed R1s. 2550 The Initiator SHOULD validate this signature. It SHOULD check that 2551 the Responder's HI received matches with the one expected, if any. 2553 5.3.3. I2 - the Second HIP Initiator Packet 2555 The HIP header values for the I2 packet: 2557 Header: 2558 Type = 3 2559 SRC HIT = Initiator's HIT 2560 DST HIT = Responder's HIT 2562 IP ( HIP ( [R1_COUNTER,] 2563 SOLUTION, 2564 DIFFIE_HELLMAN, 2565 HIP_TRANSFORM, 2566 ENCRYPTED { HOST_ID } or HOST_ID, 2567 [ ECHO_RESPONSE_SIGNED ,] 2568 HMAC, 2569 HIP_SIGNATURE 2570 <, ECHO_RESPONSE_UNSIGNED>i ) ) 2572 Valid control bits: A 2574 The HITs used MUST match the ones used previously. 2576 If the Initiator's HI is an anonymous one, the A control MUST be set. 2578 The Initiator MAY include an unmodified copy of the R1_COUNTER 2579 parameter received in the corresponding R1 packet into the I2 packet. 2581 The Solution contains the Random #I from R1 and the computed #J. The 2582 low-order K bits of the RHASH(I | ... | J) MUST be zero. 2584 The Diffie-Hellman value is ephemeral. If precomputed, a scavenger 2585 process should clean up unused Diffie-Hellman values. The Responder 2586 may re-use Diffie-Hellman values under some conditions as specified 2587 in Section 5.3.2. 2589 The HIP_TRANSFORM contains the single encryption and integrity 2590 transform selected by the Initiator, that will be used to protect the 2591 HI exchange. The chosen transform MUST correspond to one offered by 2592 the Responder in the R1. All implementations MUST support the AES 2593 transform [RFC3602]. 2595 The Initiator's HI MAY be encrypted using the HIP_TRANSFORM 2596 encryption algorithm. The keying material is derived from the 2597 Diffie-Hellman exchanged as defined in Section 6.5. 2599 The ECHO_RESPONSE_SIGNED and ECHO_RESPONSE_UNSIGNED contain the 2600 unmodified Opaque data copied from the corresponding echo request 2601 parameter. 2603 The HMAC is calculated over the whole HIP envelope, excluding any 2604 parameters after the HMAC, as described in Section 6.4.1. The 2605 Responder MUST validate the HMAC. 2607 The signature is calculated over the whole HIP envelope, excluding 2608 any parameters after the HIP_SIGNATURE, as described in 2609 Section 5.2.11. The Responder MUST validate this signature. It MAY 2610 use either the HI in the packet or the HI acquired by some other 2611 means. 2613 5.3.4. R2 - the Second HIP Responder Packet 2615 The HIP header values for the R2 packet: 2617 Header: 2618 Packet Type = 4 2619 SRC HIT = Responder's HIT 2620 DST HIT = Initiator's HIT 2622 IP ( HIP ( HMAC_2, HIP_SIGNATURE ) ) 2624 Valid control bits: none 2626 The HMAC_2 is calculated over the whole HIP envelope, with 2627 Responder's HOST_ID parameter concatenated with the HIP envelope. 2628 The HOST_ID parameter is removed after the HMAC calculation. The 2629 procedure is described in Section 6.4.1. 2631 The signature is calculated over the whole HIP envelope. 2633 The Initiator MUST validate both the HMAC and the signature. 2635 5.3.5. UPDATE - the HIP Update Packet 2637 Support for the UPDATE packet is MANDATORY. 2639 The HIP header values for the UPDATE packet: 2641 Header: 2642 Packet Type = 16 2643 SRC HIT = Sender's HIT 2644 DST HIT = Recipient's HIT 2646 IP ( HIP ( [SEQ, ACK, ] HMAC, HIP_SIGNATURE ) ) 2648 Valid control bits: None 2650 The UPDATE packet contains mandatory HMAC and HIP_SIGNATURE 2651 parameters, and other optional parameters. 2653 The UPDATE packet contains zero or one SEQ parameter. The presence 2654 of a SEQ parameter indicates that the receiver MUST ACK the UPDATE. 2655 An UPDATE that does not contain a SEQ parameter is simply an ACK of a 2656 previous UPDATE and itself MUST NOT be ACKed. 2658 An UPDATE packet contains zero or one ACK parameters. The ACK 2659 parameter echoes the SEQ sequence number of the UPDATE packet being 2660 ACKed. A host MAY choose to ACK more than one UPDATE packet at a 2661 time; e.g., the ACK may contain the last two SEQ values received, for 2662 robustness to ACK loss. ACK values are not cumulative; each received 2663 unique SEQ value requires at least one corresponding ACK value in 2664 reply. Received ACKs that are redundant are ignored. 2666 The UPDATE packet may contain both a SEQ and an ACK parameter. In 2667 this case, the ACK is being piggybacked on an outgoing UPDATE. In 2668 general, UPDATEs carrying SEQ SHOULD be ACKed upon completion of the 2669 processing of the UPDATE. A host MAY choose to hold the UPDATE 2670 carrying ACK for a short period of time to allow for the possibility 2671 of piggybacking the ACK parameter, in a manner similar to TCP delayed 2672 acknowledgments. 2674 A sender MAY choose to forgo reliable transmission of a particular 2675 UPDATE (e.g., it becomes overcome by events). The semantics are such 2676 that the receiver MUST acknowledge the UPDATE, but the sender MAY 2677 choose to not care about receiving the ACK. 2679 UPDATEs MAY be retransmitted without incrementing SEQ. If the same 2680 subset of parameters is included in multiple UPDATEs with different 2681 SEQs, the host MUST ensure that the receiver's processing of the 2682 parameters multiple times will not result in a protocol error. 2684 5.3.6. NOTIFY - the HIP Notify Packet 2686 The NOTIFY packet is OPTIONAL. The NOTIFY packet MAY be used to 2687 provide information to a peer. Typically, NOTIFY is used to indicate 2688 some type of protocol error or negotiation failure. NOTIFY packets 2689 are unacknowledged. The receiver can handle the packet only as 2690 informational, and SHOULD NOT change its HIP state (Section 4.4.1) 2691 based purely on a received NOTIFY packet. 2693 The HIP header values for the NOTIFY packet: 2695 Header: 2696 Packet Type = 17 2697 SRC HIT = Sender's HIT 2698 DST HIT = Recipient's HIT, or zero if unknown 2700 IP ( HIP (i, [HOST_ID, ] HIP_SIGNATURE) ) 2702 Valid control bits: None 2704 The NOTIFY packet is used to carry one or more NOTIFICATION 2705 parameters. 2707 5.3.7. CLOSE - the HIP Association Closing Packet 2709 The HIP header values for the CLOSE packet: 2711 Header: 2712 Packet Type = 18 2713 SRC HIT = Sender's HIT 2714 DST HIT = Recipient's HIT 2716 IP ( HIP ( ECHO_REQUEST_SIGNED, HMAC, HIP_SIGNATURE ) ) 2718 Valid control bits: none 2720 The sender MUST include an ECHO_REQUEST_SIGNED used to validate 2721 CLOSE_ACK received in response, and both an HMAC and a signature 2722 (calculated over the whole HIP envelope). 2724 The receiver peer MUST validate both the HMAC and the signature if it 2725 has a HIP association state, and MUST reply with a CLOSE_ACK 2726 containing an ECHO_RESPONSE_SIGNED corresponding to the received 2727 ECHO_REQUEST_SIGNED. 2729 5.3.8. CLOSE_ACK - the HIP Closing Acknowledgment Packet 2731 The HIP header values for the CLOSE_ACK packet: 2733 Header: 2734 Packet Type = 19 2735 SRC HIT = Sender's HIT 2736 DST HIT = Recipient's HIT 2738 IP ( HIP ( ECHO_RESPONSE_SIGNED, HMAC, HIP_SIGNATURE ) ) 2740 Valid control bits: none 2742 The sender MUST include both an HMAC and signature (calculated over 2743 the whole HIP envelope). 2745 The receiver peer MUST validate both the HMAC and the signature. 2747 5.4. ICMP Messages 2749 When a HIP implementation detects a problem with an incoming packet, 2750 and it either cannot determine the identity of the sender of the 2751 packet or does not have any existing HIP association with the sender 2752 of the packet, it MAY respond with an ICMP packet. Any such replies 2753 MUST be rate-limited as described in [RFC2463]. In most cases, the 2754 ICMP packet will have the Parameter Problem type (12 for ICMPv4, 4 2755 for ICMPv6), with the Pointer field pointing to the field that caused 2756 the ICMP message to be generated. 2758 5.4.1. Invalid Version 2760 If a HIP implementation receives a HIP packet that has an 2761 unrecognized HIP version number, it SHOULD respond, rate-limited, 2762 with an ICMP packet with type Parameter Problem, the Pointer pointing 2763 to the VER./RES. byte in the HIP header. 2765 5.4.2. Other Problems with the HIP Header and Packet Structure 2767 If a HIP implementation receives a HIP packet that has other 2768 unrecoverable problems in the header or packet format, it MAY 2769 respond, rate-limited, with an ICMP packet with type Parameter 2770 Problem, the Pointer pointing to the field that failed to pass the 2771 format checks. However, an implementation MUST NOT send an ICMP 2772 message if the checksum fails; instead, it MUST silently drop the 2773 packet. 2775 5.4.3. Invalid Puzzle Solution 2777 If a HIP implementation receives an I2 packet that has an invalid 2778 puzzle solution, the behavior depends on the underlying version of 2779 IP. If IPv6 is used, the implementation SHOULD respond with an ICMP 2780 packet with type Parameter Problem, the Pointer pointing to the 2781 beginning of the Puzzle solution #J field in the SOLUTION payload in 2782 the HIP message. 2784 If IPv4 is used, the implementation MAY respond with an ICMP packet 2785 with the type Parameter Problem, copying enough of bytes from the I2 2786 message so that the SOLUTION parameter fits into the ICMP message, 2787 the Pointer pointing to the beginning of the Puzzle solution #J 2788 field, as in the IPv6 case. Note, however, that the resulting ICMPv4 2789 message exceeds the typical ICMPv4 message size as defined in 2790 [RFC0792]. 2792 5.4.4. Non-Existing HIP Association 2794 If a HIP implementation receives a CLOSE or UPDATE packet, or any 2795 other packet whose handling requires an existing association, that 2796 has either a Receiver or Sender HIT that does not match with any 2797 existing HIP association, the implementation MAY respond, rate- 2798 limited, with an ICMP packet with the type Parameter Problem, and 2799 with the Pointer pointing to the beginning of the first HIT that does 2800 not match. 2802 A host MUST NOT reply with such an ICMP if it receives any of the 2803 following messages: I1, R2, I2, R2, and NOTIFY. When introducing new 2804 packet types, a specification SHOULD define the appropriate rules for 2805 sending or not sending this kind of ICMP reply. 2807 6. Packet Processing 2809 Each host is assumed to have a single HIP protocol implementation 2810 that manages the host's HIP associations and handles requests for new 2811 ones. Each HIP association is governed by a conceptual state 2812 machine, with states defined above in Section 4.4. The HIP 2813 implementation can simultaneously maintain HIP associations with more 2814 than one host. Furthermore, the HIP implementation may have more 2815 than one active HIP association with another host; in this case, HIP 2816 associations are distinguished by their respective HITs. It is not 2817 possible to have more than one HIP association between any given pair 2818 of HITs. Consequently, the only way for two hosts to have more than 2819 one parallel association is to use different HITs, at least at one 2820 end. 2822 The processing of packets depends on the state of the HIP 2823 association(s) with respect to the authenticated or apparent 2824 originator of the packet. A HIP implementation determines whether it 2825 has an active association with the originator of the packet based on 2826 the HITs. In the case of user data carried in a specific transport 2827 format, the transport format document specifies how the incoming 2828 packets are matched with the active associations. 2830 6.1. Processing Outgoing Application Data 2832 In a HIP host, an application can send application-level data using 2833 an identifier specified via the underlying API. The API can be a 2834 backwards-compatible API (see [RFC5338]), using identifiers that look 2835 similar to IP addresses, or a completely new API, providing enhanced 2836 services related to Host Identities. Depending on the HIP 2837 implementation, the identifier provided to the application may be 2838 different; for example, it can be a HIT or an IP address. 2840 The exact format and method for transferring the data from the source 2841 HIP host to the destination HIP host is defined in the corresponding 2842 transport format document. The actual data is transferred in the 2843 network using the appropriate source and destination IP addresses. 2845 In this document, conceptual processing rules are defined only for 2846 the base case where both hosts have only single usable IP addresses; 2847 the multi-address multi-homing case will be specified separately. 2849 The following conceptual algorithm describes the steps that are 2850 required for handling outgoing datagrams destined to a HIT. 2852 1. If the datagram has a specified source address, it MUST be a HIT. 2853 If it is not, the implementation MAY replace the source address 2854 with a HIT. Otherwise, it MUST drop the packet. 2856 2. If the datagram has an unspecified source address, the 2857 implementation must choose a suitable source HIT for the 2858 datagram. 2860 3. If there is no active HIP association with the given HIT pair, one must be created by running the base 2862 exchange. While waiting for the base exchange to complete, the 2863 implementation SHOULD queue at least one packet per HIP 2864 association to be formed, and it MAY queue more than one. 2866 4. Once there is an active HIP association for the given HIT pair, the outgoing datagram is passed to 2868 transport handling. The possible transport formats are defined 2869 in separate documents, of which the ESP transport format for HIP 2870 is mandatory for all HIP implementations. 2872 5. Before sending the packet, the HITs in the datagram are replaced 2873 with suitable IP addresses. For IPv6, the rules defined in 2874 [RFC3484] SHOULD be followed. Note that this HIT-to-IP-address 2875 conversion step MAY also be performed at some other point in the 2876 stack, e.g., before wrapping the packet into the output format. 2878 6.2. Processing Incoming Application Data 2880 The following conceptual algorithm describes the incoming datagram 2881 handling when HITs are used at the receiving host as application- 2882 level identifiers. More detailed steps for processing packets are 2883 defined in corresponding transport format documents. 2885 1. The incoming datagram is mapped to an existing HIP association, 2886 typically using some information from the packet. For example, 2887 such mapping may be based on the ESP Security Parameter Index 2888 (SPI). 2890 2. The specific transport format is unwrapped, in a way depending on 2891 the transport format, yielding a packet that looks like a 2892 standard (unencrypted) IP packet. If possible, this step SHOULD 2893 also verify that the packet was indeed (once) sent by the remote 2894 HIP host, as identified by the HIP association. 2896 Depending on the used transport mode, the verification method can 2897 vary. While the HI (as well as HIT) is used as the higher-layer 2898 identifier, the verification method has to verify that the data 2899 packet was sent by a node identity and that the actual identity 2900 maps to this particular HIT. When using ESP transport format 2901 [RFC5202], the verification is done using the SPI value in the 2902 data packet to find the corresponding SA with associated HIT and 2903 key, and decrypting the packet with that associated key. 2905 3. The IP addresses in the datagram are replaced with the HITs 2906 associated with the HIP association. Note that this IP-address- 2907 to-HIT conversion step MAY also be performed at some other point 2908 in the stack. 2910 4. The datagram is delivered to the upper layer. When 2911 demultiplexing the datagram, the right upper-layer socket is 2912 based on the HITs. 2914 6.3. Solving the Puzzle 2916 This subsection describes the puzzle-solving details. 2918 In R1, the values I and K are sent in network byte order. Similarly, 2919 in I2, the values I and J are sent in network byte order. The hash 2920 is created by concatenating, in network byte order, the following 2921 data, in the following order and using the RHASH algorithm: 2923 64-bit random value I, in network byte order, as appearing in R1 2924 and I2. 2926 128-bit Initiator's HIT, in network byte order, as appearing in 2927 the HIP Payload in R1 and I2. 2929 128-bit Responder's HIT, in network byte order, as appearing in 2930 the HIP Payload in R1 and I2. 2932 64-bit random value J, in network byte order, as appearing in I2. 2934 In order to be a valid response puzzle, the K low-order bits of the 2935 resulting RHASH digest must be zero. 2937 Notes: 2939 i) The length of the data to be hashed is 48 bytes. 2941 ii) All the data in the hash input MUST be in network byte order. 2943 iii) The order of the Initiator's and Responder's HITs are 2944 different in the R1 and I2 packets; see Section 5.1. Care must be 2945 taken to copy the values in the right order to the hash input. 2947 The following procedure describes the processing steps involved, 2948 assuming that the Responder chooses to precompute the R1 packets: 2950 Precomputation by the Responder: 2951 Sets up the puzzle difficulty K. 2952 Creates a signed R1 and caches it. 2954 Responder: 2955 Selects a suitable cached R1. 2956 Generates a random number I. 2957 Sends I and K in an R1. 2958 Saves I and K for a Delta time. 2960 Initiator: 2961 Generates repeated attempts to solve the puzzle until a matching J 2962 is found: 2963 Ltrunc( RHASH( I | HIT-I | HIT-R | J ), K ) == 0 2964 Sends I and J in an I2. 2966 Responder: 2967 Verifies that the received I is a saved one. 2968 Finds the right K based on I. 2969 Computes V := Ltrunc( RHASH( I | HIT-I | HIT-R | J ), K ) 2970 Rejects if V != 0 2971 Accept if V == 0 2973 6.4. HMAC and SIGNATURE Calculation and Verification 2975 The following subsections define the actions for processing HMAC, 2976 HIP_SIGNATURE and HIP_SIGNATURE_2 parameters. 2978 6.4.1. HMAC Calculation 2980 The following process applies both to the HMAC and HMAC_2 parameters. 2981 When processing HMAC_2, the difference is that the HMAC calculation 2982 includes a pseudo HOST_ID field containing the Responder's 2983 information as sent in the R1 packet earlier. 2985 Both the Initiator and the Responder should take some care when 2986 verifying or calculating the HMAC_2. Specifically, the Responder 2987 should preserve other parameters than the HOST_ID when sending the 2988 R2. Also, the Initiator has to preserve the HOST_ID exactly as it 2989 was received in the R1 packet. 2991 The scope of the calculation for HMAC and HMAC_2 is: 2993 HMAC: { HIP header | [ Parameters ] } 2995 where Parameters include all HIP parameters of the packet that is 2996 being calculated with Type values from 1 to (HMAC's Type value - 1) 2997 and exclude parameters with Type values greater or equal to HMAC's 2998 Type value. 3000 During HMAC calculation, the following applies: 3002 o In the HIP header, the Checksum field is set to zero. 3004 o In the HIP header, the Header Length field value is calculated to 3005 the beginning of the HMAC parameter. 3007 Parameter order is described in Section 5.2.1. 3009 HMAC_2: { HIP header | [ Parameters ] | HOST_ID } 3011 where Parameters include all HIP parameters for the packet that is 3012 being calculated with Type values from 1 to (HMAC_2's Type value - 1) 3013 and exclude parameters with Type values greater or equal to HMAC_2's 3014 Type value. 3016 During HMAC_2 calculation, the following applies: 3018 o In the HIP header, the Checksum field is set to zero. 3020 o In the HIP header, the Header Length field value is calculated to 3021 the beginning of the HMAC_2 parameter and added to the length of 3022 the concatenated HOST_ID parameter length. 3024 o HOST_ID parameter is exactly in the form it was received in the R1 3025 packet from the Responder. 3027 Parameter order is described in Section 5.2.1, except that the 3028 HOST_ID parameter in this calculation is added to the end. 3030 The HMAC parameter is defined in Section 5.2.9 and the HMAC_2 3031 parameter in Section 5.2.10. The HMAC calculation and verification 3032 process (the process applies both to HMAC and HMAC_2 except where 3033 HMAC_2 is mentioned separately) is as follows: 3035 Packet sender: 3037 1. Create the HIP packet, without the HMAC, HIP_SIGNATURE, 3038 HIP_SIGNATURE_2, or any other parameter with greater Type value 3039 than the HMAC parameter has. 3041 2. In case of HMAC_2 calculation, add a HOST_ID (Responder) 3042 parameter to the end of the packet. 3044 3. Calculate the Header Length field in the HIP header including the 3045 added HOST_ID parameter in case of HMAC_2. 3047 4. Compute the HMAC using either HIP-gl or HIP-lg integrity key 3048 retrieved from KEYMAT as defined in Section 6.5. 3050 5. In case of HMAC_2, remove the HOST_ID parameter from the packet. 3052 6. Add the HMAC parameter to the packet and any parameter with 3053 greater Type value than the HMAC's (HMAC_2's) that may follow, 3054 including possible HIP_SIGNATURE or HIP_SIGNATURE_2 parameters 3056 7. Recalculate the Length field in the HIP header. 3058 Packet receiver: 3060 1. Verify the HIP header Length field. 3062 2. Remove the HMAC or HMAC_2 parameter, as well as all other 3063 parameters that follow it with greater Type value including 3064 possible HIP_SIGNATURE or HIP_SIGNATURE_2 fields, saving the 3065 contents if they will be needed later. 3067 3. In case of HMAC_2, build and add a HOST_ID parameter (with 3068 Responder information) to the packet. The HOST_ID parameter 3069 should be identical to the one previously received from the 3070 Responder. 3072 4. Recalculate the HIP packet length in the HIP header and clear the 3073 Checksum field (set it to all zeros). In case of HMAC_2, the 3074 length is calculated with the added HOST_ID parameter. 3076 5. Compute the HMAC using either HIP-gl or HIP-lg integrity key as 3077 defined in Section 6.5 and verify it against the received HMAC. 3079 6. Set Checksum and Header Length field in the HIP header to 3080 original values. 3082 7. In case of HMAC_2, remove the HOST_ID parameter from the packet 3083 before further processing. 3085 6.4.2. Signature Calculation 3087 The following process applies both to the HIP_SIGNATURE and 3088 HIP_SIGNATURE_2 parameters. When processing HIP_SIGNATURE_2, the 3089 only difference is that instead of HIP_SIGNATURE parameter, the 3090 HIP_SIGNATURE_2 parameter is used, and the Initiator's HIT and PUZZLE 3091 Opaque and Random #I fields are cleared (set to all zeros) before 3092 computing the signature. The HIP_SIGNATURE parameter is defined in 3093 Section 5.2.11 and the HIP_SIGNATURE_2 parameter in Section 5.2.12. 3095 The scope of the calculation for HIP_SIGNATURE and HIP_SIGNATURE_2 3096 is: 3098 HIP_SIGNATURE: { HIP header | [ Parameters ] } 3100 where Parameters include all HIP parameters for the packet that is 3101 being calculated with Type values from 1 to (HIP_SIGNATURE's Type 3102 value - 1). 3104 During signature calculation, the following apply: 3106 o In the HIP header, the Checksum field is set to zero. 3108 o In the HIP header, the Header Length field value is calculated to 3109 the beginning of the HIP_SIGNATURE parameter. 3111 Parameter order is described in Section 5.2.1. 3113 HIP_SIGNATURE_2: { HIP header | [ Parameters ] } 3115 where Parameters include all HIP parameters for the packet that is 3116 being calculated with Type values from 1 to (HIP_SIGNATURE_2's Type 3117 value - 1). 3119 During signature calculation, the following apply: 3121 o In the HIP header, the Initiator's HIT field and Checksum fields 3122 are set to zero. 3124 o In the HIP header, the Header Length field value is calculated to 3125 the beginning of the HIP_SIGNATURE_2 parameter. 3127 o PUZZLE parameter's Opaque and Random #I fields are set to zero. 3129 Parameter order is described in Section 5.2.1. 3131 Signature calculation and verification process (the process applies 3132 both to HIP_SIGNATURE and HIP_SIGNATURE_2 except in the case where 3133 HIP_SIGNATURE_2 is separately mentioned): 3135 Packet sender: 3137 1. Create the HIP packet without the HIP_SIGNATURE parameter or any 3138 parameters that follow the HIP_SIGNATURE parameter. 3140 2. Calculate the Length field and zero the Checksum field in the HIP 3141 header. In case of HIP_SIGNATURE_2, set Initiator's HIT field in 3142 the HIP header as well as PUZZLE parameter's Opaque and Random #I 3143 fields to zero. 3145 3. Compute the signature using the private key corresponding to the 3146 Host Identifier (public key). 3148 4. Add the HIP_SIGNATURE parameter to the packet. 3150 5. Add any parameters that follow the HIP_SIGNATURE parameter. 3152 6. Recalculate the Length field in the HIP header, and calculate the 3153 Checksum field. 3155 Packet receiver: 3157 1. Verify the HIP header Length field. 3159 2. Save the contents of the HIP_SIGNATURE parameter and any 3160 parameters following the HIP_SIGNATURE parameter and remove them 3161 from the packet. 3163 3. Recalculate the HIP packet Length in the HIP header and clear the 3164 Checksum field (set it to all zeros). In case of 3165 HIP_SIGNATURE_2, set Initiator's HIT field in HIP header as well 3166 as PUZZLE parameter's Opaque and Random #I fields to zero. 3168 4. Compute the signature and verify it against the received 3169 signature using the packet sender's Host Identifier (public key). 3171 5. Restore the original packet by adding removed parameters (in step 3172 2) and resetting the values that were set to zero (in step 3). 3174 The verification can use either the HI received from a HIP packet, 3175 the HI from a DNS query, if the FQDN has been received in the HOST_ID 3176 packet, or one received by some other means. 3178 6.5. HIP KEYMAT Generation 3180 HIP keying material is derived from the Diffie-Hellman session key, 3181 Kij, produced during the HIP base exchange (Section 4.1.3). The 3182 Initiator has Kij during the creation of the I2 packet, and the 3183 Responder has Kij once it receives the I2 packet. This is why I2 can 3184 already contain encrypted information. 3186 The KEYMAT is derived by feeding Kij and the HITs into the following 3187 operation; the | operation denotes concatenation. 3189 KEYMAT = K1 | K2 | K3 | ... 3190 where 3192 K1 = RHASH( Kij | sort(HIT-I | HIT-R) | I | J | 0x01 ) 3193 K2 = RHASH( Kij | K1 | 0x02 ) 3194 K3 = RHASH( Kij | K2 | 0x03 ) 3195 ... 3196 K255 = RHASH( Kij | K254 | 0xff ) 3197 K256 = RHASH( Kij | K255 | 0x00 ) 3198 etc. 3200 Sort(HIT-I | HIT-R) is defined as the network byte order 3201 concatenation of the two HITs, with the smaller HIT preceding the 3202 larger HIT, resulting from the numeric comparison of the two HITs 3203 interpreted as positive (unsigned) 128-bit integers in network byte 3204 order. 3206 I and J values are from the puzzle and its solution that were 3207 exchanged in R1 and I2 messages when this HIP association was set up. 3208 Both hosts have to store I and J values for the HIP association for 3209 future use. 3211 The initial keys are drawn sequentially in the order that is 3212 determined by the numeric comparison of the two HITs, with comparison 3213 method described in the previous paragraph. HOST_g denotes the host 3214 with the greater HIT value, and HOST_l the host with the lower HIT 3215 value. 3217 The drawing order for initial keys: 3219 HIP-gl encryption key for HOST_g's outgoing HIP packets 3221 HIP-gl integrity (HMAC) key for HOST_g's outgoing HIP packets 3223 HIP-lg encryption key (currently unused) for HOST_l's outgoing HIP 3224 packets 3226 HIP-lg integrity (HMAC) key for HOST_l's outgoing HIP packets 3228 The number of bits drawn for a given algorithm is the "natural" size 3229 of the keys. For the mandatory algorithms, the following sizes 3230 apply: 3232 AES 128 bits 3233 SHA-1 160 bits 3235 NULL 0 bits 3237 If other key sizes are used, they must be treated as different 3238 encryption algorithms and defined separately. 3240 6.6. Initiation of a HIP Exchange 3242 An implementation may originate a HIP exchange to another host based 3243 on a local policy decision, usually triggered by an application 3244 datagram, in much the same way that an IPsec IKE key exchange can 3245 dynamically create a Security Association. Alternatively, a system 3246 may initiate a HIP exchange if it has rebooted or timed out, or 3247 otherwise lost its HIP state, as described in Section 4.5.4. 3249 The implementation prepares an I1 packet and sends it to the IP 3250 address that corresponds to the peer host. The IP address of the 3251 peer host may be obtained via conventional mechanisms, such as DNS 3252 lookup. The I1 contents are specified in Section 5.3.1. The 3253 selection of which Host Identity to use, if a host has more than one 3254 to choose from, is typically a policy decision. 3256 The following steps define the conceptual processing rules for 3257 initiating a HIP exchange: 3259 1. The Initiator gets the Responder's HIT and one or more addresses 3260 either from a DNS lookup of the Responder's FQDN, from some other 3261 repository, or from a local table. If the Initiator does not 3262 know the Responder's HIT, it may attempt opportunistic mode by 3263 using NULL (all zeros) as the Responder's HIT. See also "HIP 3264 Opportunistic Mode" (Section 4.1.6). 3266 2. The Initiator sends an I1 to one of the Responder's addresses. 3267 The selection of which address to use is a local policy decision. 3269 3. Upon sending an I1, the sender shall transition to state I1-SENT, 3270 start a timer whose timeout value should be larger than the 3271 worst-case anticipated RTT, and shall increment a timeout counter 3272 associated with the I1. 3274 4. Upon timeout, the sender SHOULD retransmit the I1 and restart the 3275 timer, up to a maximum of I1_RETRIES_MAX tries. 3277 6.6.1. Sending Multiple I1s in Parallel 3279 For the sake of minimizing the session establishment latency, an 3280 implementation MAY send the same I1 to more than one of the 3281 Responder's addresses. However, it MUST NOT send to more than three 3282 (3) addresses in parallel. Furthermore, upon timeout, the 3283 implementation MUST refrain from sending the same I1 packet to 3284 multiple addresses. That is, if it retries to initialize the 3285 connection after timeout, it MUST NOT send the I1 packet to more than 3286 one destination address. These limitations are placed in order to 3287 avoid congestion of the network, and potential DoS attacks that might 3288 happen, e.g., because someone's claim to have hundreds or thousands 3289 of addresses could generate a huge number of I1 messages from the 3290 Initiator. 3292 As the Responder is not guaranteed to distinguish the duplicate I1s 3293 it receives at several of its addresses (because it avoids storing 3294 states when it answers back an R1), the Initiator may receive several 3295 duplicate R1s. 3297 The Initiator SHOULD then select the initial preferred destination 3298 address using the source address of the selected received R1, and use 3299 the preferred address as a source address for the I2. Processing 3300 rules for received R1s are discussed in Section 6.8. 3302 6.6.2. Processing Incoming ICMP Protocol Unreachable Messages 3304 A host may receive an ICMP 'Destination Protocol Unreachable' message 3305 as a response to sending a HIP I1 packet. Such a packet may be an 3306 indication that the peer does not support HIP, or it may be an 3307 attempt to launch an attack by making the Initiator believe that the 3308 Responder does not support HIP. 3310 When a system receives an ICMP 'Destination Protocol Unreachable' 3311 message while it is waiting for an R1, it MUST NOT terminate the 3312 wait. It MAY continue as if it had not received the ICMP message, 3313 and send a few more I1s. Alternatively, it MAY take the ICMP message 3314 as a hint that the peer most probably does not support HIP, and 3315 return to state UNASSOCIATED earlier than otherwise. However, at 3316 minimum, it MUST continue waiting for an R1 for a reasonable time 3317 before returning to UNASSOCIATED. 3319 6.7. Processing Incoming I1 Packets 3321 An implementation SHOULD reply to an I1 with an R1 packet, unless the 3322 implementation is unable or unwilling to set up a HIP association. 3323 If the implementation is unable to set up a HIP association, the host 3324 SHOULD send an ICMP Destination Protocol Unreachable, 3325 Administratively Prohibited, message to the I1 source address. If 3326 the implementation is unwilling to set up a HIP association, the host 3327 MAY ignore the I1. This latter case may occur during a DoS attack 3328 such as an I1 flood. 3330 The implementation MUST be able to handle a storm of received I1 3331 packets, discarding those with common content that arrive within a 3332 small time delta. 3334 A spoofed I1 can result in an R1 attack on a system. An R1 sender 3335 MUST have a mechanism to rate-limit R1s to an address. 3337 It is RECOMMENDED that the HIP state machine does not transition upon 3338 sending an R1. 3340 The following steps define the conceptual processing rules for 3341 responding to an I1 packet: 3343 1. The Responder MUST check that the Responder's HIT in the received 3344 I1 is either one of its own HITs or NULL. 3346 2. If the Responder is in ESTABLISHED state, the Responder MAY 3347 respond to this with an R1 packet, prepare to drop existing SAs, 3348 and stay at ESTABLISHED state. 3350 3. If the Responder is in I1-SENT state, it must make a comparison 3351 between the sender's HIT and its own (i.e., the receiver's) HIT. 3352 If the sender's HIT is greater than its own HIT, it should drop 3353 the I1 and stay at I1-SENT. If the sender's HIT is smaller than 3354 its own HIT, it should send R1 and stay at I1-SENT. The HIT 3355 comparison goes similarly as in Section 6.5. 3357 4. If the implementation chooses to respond to the I1 with an R1 3358 packet, it creates a new R1 or selects a precomputed R1 according 3359 to the format described in Section 5.3.2. 3361 5. The R1 MUST contain the received Responder's HIT, unless the 3362 received HIT is NULL, in which case the Responder SHOULD select a 3363 HIT that is constructed with the MUST algorithm in Section 3, 3364 which is currently RSA. Other than that, selecting the HIT is a 3365 local policy matter. 3367 6. The Responder sends the R1 to the source IP address of the I1 3368 packet. 3370 6.7.1. R1 Management 3372 All compliant implementations MUST produce R1 packets. An R1 packet 3373 MAY be precomputed. An R1 packet MAY be reused for time Delta T, 3374 which is implementation dependent, and SHOULD be deprecated and not 3375 used once a valid response I2 packet has been received from an 3376 Initiator. During an I1 message storm, an R1 packet may be re-used 3377 beyond this limit. R1 information MUST NOT be discarded until Delta 3378 S after T. Time S is the delay needed for the last I2 to arrive back 3379 to the Responder. 3381 An implementation MAY keep state about received I1s and match the 3382 received I2s against the state, as discussed in Section 4.1.1. 3384 6.7.2. Handling Malformed Messages 3386 If an implementation receives a malformed I1 message, it SHOULD NOT 3387 respond with a NOTIFY message, as such practice could open up a 3388 potential denial-of-service danger. Instead, it MAY respond with an 3389 ICMP packet, as defined in Section 5.4. 3391 6.8. Processing Incoming R1 Packets 3393 A system receiving an R1 MUST first check to see if it has sent an I1 3394 to the originator of the R1 (i.e., it is in state I1-SENT). If so, 3395 it SHOULD process the R1 as described below, send an I2, and go to 3396 state I2-SENT, setting a timer to protect the I2. If the system is 3397 in state I2-SENT, it MAY respond to an R1 if the R1 has a larger R1 3398 generation counter; if so, it should drop its state due to processing 3399 the previous R1 and start over from state I1-SENT. If the system is 3400 in any other state with respect to that host, it SHOULD silently drop 3401 the R1. 3403 When sending multiple I1s, an Initiator SHOULD wait for a small 3404 amount of time after the first R1 reception to allow possibly 3405 multiple R1s to arrive, and it SHOULD respond to an R1 among the set 3406 with the largest R1 generation counter. 3408 The following steps define the conceptual processing rules for 3409 responding to an R1 packet: 3411 1. A system receiving an R1 MUST first check to see if it has sent 3412 an I1 to the originator of the R1 (i.e., it has a HIP 3413 association that is in state I1-SENT and that is associated with 3414 the HITs in the R1). Unless the I1 was sent in opportunistic 3415 mode (see Section 4.1.6), the IP addresses in the received R1 3416 packet SHOULD be ignored and, when looking up the right HIP 3417 association, the received R1 SHOULD be matched against the 3418 associations using only the HITs. If a match exists, the system 3419 should process the R1 as described below. 3421 2. Otherwise, if the system is in any other state than I1-SENT or 3422 I2-SENT with respect to the HITs included in the R1, it SHOULD 3423 silently drop the R1 and remain in the current state. 3425 3. If the HIP association state is I1-SENT or I2-SENT, the received 3426 Initiator's HIT MUST correspond to the HIT used in the original, 3427 and the I1 and the Responder's HIT MUST correspond to the one 3428 used, unless the I1 contained a NULL HIT. 3430 4. The system SHOULD validate the R1 signature before applying 3431 further packet processing, according to Section 5.2.12. 3433 5. If the HIP association state is I1-SENT, and multiple valid R1s 3434 are present, the system SHOULD select from among the R1s with 3435 the largest R1 generation counter. 3437 6. If the HIP association state is I2-SENT, the system MAY reenter 3438 state I1-SENT and process the received R1 if it has a larger R1 3439 generation counter than the R1 responded to previously. 3441 7. The R1 packet may have the A bit set -- in this case, the system 3442 MAY choose to refuse it by dropping the R1 and returning to 3443 state UNASSOCIATED. The system SHOULD consider dropping the R1 3444 only if it used a NULL HIT in I1. If the A bit is set, the 3445 Responder's HIT is anonymous and should not be stored. 3447 8. The system SHOULD attempt to validate the HIT against the 3448 received Host Identity by using the received Host Identity to 3449 construct a HIT and verify that it matches the Sender's HIT. 3451 9. The system MUST store the received R1 generation counter for 3452 future reference. 3454 10. The system attempts to solve the puzzle in R1. The system MUST 3455 terminate the search after exceeding the remaining lifetime of 3456 the puzzle. If the puzzle is not successfully solved, the 3457 implementation may either resend I1 within the retry bounds or 3458 abandon the HIP exchange. 3460 11. The system computes standard Diffie-Hellman keying material 3461 according to the public value and Group ID provided in the 3462 DIFFIE_HELLMAN parameter. The Diffie-Hellman keying material 3463 Kij is used for key extraction as specified in Section 6.5. If 3464 the received Diffie-Hellman Group ID is not supported, the 3465 implementation may either resend I1 within the retry bounds or 3466 abandon the HIP exchange. 3468 12. The system selects the HIP transform from the choices presented 3469 in the R1 packet and uses the selected values subsequently when 3470 generating and using encryption keys, and when sending the I2. 3471 If the proposed alternatives are not acceptable to the system, 3472 it may either resend I1 within the retry bounds or abandon the 3473 HIP exchange. 3475 13. The system initializes the remaining variables in the associated 3476 state, including Update ID counters. 3478 14. The system prepares and sends an I2, as described in 3479 Section 5.3.3. 3481 15. The system SHOULD start a timer whose timeout value should be 3482 larger than the worst-case anticipated RTT, and MUST increment a 3483 timeout counter associated with the I2. The sender SHOULD 3484 retransmit the I2 upon a timeout and restart the timer, up to a 3485 maximum of I2_RETRIES_MAX tries. 3487 16. If the system is in state I1-SENT, it shall transition to state 3488 I2-SENT. If the system is in any other state, it remains in the 3489 current state. 3491 6.8.1. Handling Malformed Messages 3493 If an implementation receives a malformed R1 message, it MUST 3494 silently drop the packet. Sending a NOTIFY or ICMP would not help, 3495 as the sender of the R1 typically doesn't have any state. An 3496 implementation SHOULD wait for some more time for a possibly good R1, 3497 after which it MAY try again by sending a new I1 packet. 3499 6.9. Processing Incoming I2 Packets 3501 Upon receipt of an I2, the system MAY perform initial checks to 3502 determine whether the I2 corresponds to a recent R1 that has been 3503 sent out, if the Responder keeps such state. For example, the sender 3504 could check whether the I2 is from an address or HIT that has 3505 recently received an R1 from it. The R1 may have had Opaque data 3506 included that was echoed back in the I2. If the I2 is considered to 3507 be suspect, it MAY be silently discarded by the system. 3509 Otherwise, the HIP implementation SHOULD process the I2. This 3510 includes validation of the puzzle solution, generating the Diffie- 3511 Hellman key, decrypting the Initiator's Host Identity, verifying the 3512 signature, creating state, and finally sending an R2. 3514 The following steps define the conceptual processing rules for 3515 responding to an I2 packet: 3517 1. The system MAY perform checks to verify that the I2 corresponds 3518 to a recently sent R1. Such checks are implementation 3519 dependent. See Appendix A for a description of an example 3520 implementation. 3522 2. The system MUST check that the Responder's HIT corresponds to 3523 one of its own HITs. 3525 3. If the system's state machine is in the R2-SENT state, the 3526 system MAY check if the newly received I2 is similar to the one 3527 that triggered moving to R2-SENT. If so, it MAY retransmit a 3528 previously sent R2, reset the R2-SENT timer, and the state 3529 machine stays in R2-SENT. 3531 4. If the system's state machine is in the I2-SENT state, the 3532 system makes a comparison between its local and sender's HITs 3533 (similarly as in Section 6.5). If the local HIT is smaller than 3534 the sender's HIT, it should drop the I2 packet, use the peer 3535 Diffie-Hellman key and nonce I from the R1 packet received 3536 earlier, and get the local Diffie-Hellman key and nonce J from 3537 the I2 packet sent to the peer earlier. Otherwise, the system 3538 should process the received I2 packet and drop any previously 3539 derived Diffie-Hellman keying material Kij it might have formed 3540 upon sending the I2 previously. The peer Diffie-Hellman key and 3541 the nonce J are taken from the just arrived I2 packet. The 3542 local Diffie-Hellman key and the nonce I are the ones that were 3543 earlier sent in the R1 packet. 3545 5. If the system's state machine is in the I1-SENT state, and the 3546 HITs in the I2 match those used in the previously sent I1, the 3547 system uses this received I2 as the basis for the HIP 3548 association it was trying to form, and stops retransmitting I1 3549 (provided that the I2 passes the below additional checks). 3551 6. If the system's state machine is in any other state than R2- 3552 SENT, the system SHOULD check that the echoed R1 generation 3553 counter in I2 is within the acceptable range. Implementations 3554 MUST accept puzzles from the current generation and MAY accept 3555 puzzles from earlier generations. If the newly received I2 is 3556 outside the accepted range, the I2 is stale (perhaps replayed) 3557 and SHOULD be dropped. 3559 7. The system MUST validate the solution to the puzzle by computing 3560 the hash described in Section 5.3.3 using the same RHASH 3561 algorithm. 3563 8. The I2 MUST have a single value in the HIP_TRANSFORM parameter, 3564 which MUST match one of the values offered to the Initiator in 3565 the R1 packet. 3567 9. The system must derive Diffie-Hellman keying material Kij based 3568 on the public value and Group ID in the DIFFIE_HELLMAN 3569 parameter. This key is used to derive the HIP association keys, 3570 as described in Section 6.5. If the Diffie-Hellman Group ID is 3571 unsupported, the I2 packet is silently dropped. 3573 10. The encrypted HOST_ID is decrypted by the Initiator encryption 3574 key defined in Section 6.5. If the decrypted data is not a 3575 HOST_ID parameter, the I2 packet is silently dropped. 3577 11. The implementation SHOULD also verify that the Initiator's HIT 3578 in the I2 corresponds to the Host Identity sent in the I2. 3579 (Note: some middleboxes may not able to make this verification.) 3581 12. The system MUST verify the HMAC according to the procedures in 3582 Section 5.2.9. 3584 13. The system MUST verify the HIP_SIGNATURE according to 3585 Section 5.2.11 and Section 5.3.3. 3587 14. If the checks above are valid, then the system proceeds with 3588 further I2 processing; otherwise, it discards the I2 and its 3589 state machine remains in the same state. 3591 15. The I2 packet may have the A bit set -- in this case, the system 3592 MAY choose to refuse it by dropping the I2 and the state machine 3593 returns to state UNASSOCIATED. If the A bit is set, the 3594 Initiator's HIT is anonymous and should not be stored. 3596 16. The system initializes the remaining variables in the associated 3597 state, including Update ID counters. 3599 17. Upon successful processing of an I2 when the system's state 3600 machine is in state UNASSOCIATED, I1-SENT, I2-SENT, or R2-SENT, 3601 an R2 is sent and the system's state machine transitions to 3602 state R2-SENT. 3604 18. Upon successful processing of an I2 when the system's state 3605 machine is in state ESTABLISHED, the old HIP association is 3606 dropped and a new one is installed, an R2 is sent, and the 3607 system's state machine transitions to R2-SENT. 3609 19. Upon the system's state machine transitioning to R2-SENT, the 3610 system starts a timer. The state machine transitions to 3611 ESTABLISHED if some data has been received on the incoming HIP 3612 association, or an UPDATE packet has been received (or some 3613 other packet that indicates that the peer system's state machine 3614 has moved to ESTABLISHED). If the timer expires (allowing for 3615 maximal retransmissions of I2s), the state machine transitions 3616 to ESTABLISHED. 3618 6.9.1. Handling Malformed Messages 3620 If an implementation receives a malformed I2 message, the behavior 3621 SHOULD depend on how many checks the message has already passed. If 3622 the puzzle solution in the message has already been checked, the 3623 implementation SHOULD report the error by responding with a NOTIFY 3624 packet. Otherwise, the implementation MAY respond with an ICMP 3625 message as defined in Section 5.4. 3627 6.10. Processing Incoming R2 Packets 3629 An R2 received in states UNASSOCIATED, I1-SENT, or ESTABLISHED 3630 results in the R2 being dropped and the state machine staying in the 3631 same state. If an R2 is received in state I2-SENT, it SHOULD be 3632 processed. 3634 The following steps define the conceptual processing rules for an 3635 incoming R2 packet: 3637 1. The system MUST verify that the HITs in use correspond to the 3638 HITs that were received in the R1. 3640 2. The system MUST verify the HMAC_2 according to the procedures in 3641 Section 5.2.10. 3643 3. The system MUST verify the HIP signature according to the 3644 procedures in Section 5.2.11. 3646 4. If any of the checks above fail, there is a high probability of 3647 an ongoing man-in-the-middle or other security attack. The 3648 system SHOULD act accordingly, based on its local policy. 3650 5. If the system is in any other state than I2-SENT, the R2 is 3651 silently dropped. 3653 6. Upon successful processing of the R2, the state machine moves to 3654 state ESTABLISHED. 3656 6.11. Sending UPDATE Packets 3658 A host sends an UPDATE packet when it wants to update some 3659 information related to a HIP association. There are a number of 3660 likely situations, e.g., mobility management and rekeying of an 3661 existing ESP Security Association. The following paragraphs define 3662 the conceptual rules for sending an UPDATE packet to the peer. 3663 Additional steps can be defined in other documents where the UPDATE 3664 packet is used. 3666 The system first determines whether there are any outstanding UPDATE 3667 messages that may conflict with the new UPDATE message under 3668 consideration. When multiple UPDATEs are outstanding (not yet 3669 acknowledged), the sender must assume that such UPDATEs may be 3670 processed in an arbitrary order. Therefore, any new UPDATEs that 3671 depend on a previous outstanding UPDATE being successfully received 3672 and acknowledged MUST be postponed until reception of the necessary 3673 ACK(s) occurs. One way to prevent any conflicts is to only allow one 3674 outstanding UPDATE at a time. However, allowing multiple UPDATEs may 3675 improve the performance of mobility and multihoming protocols. 3677 The following steps define the conceptual processing rules for 3678 sending UPDATE packets. 3680 1. The first UPDATE packet is sent with Update ID of zero. 3681 Otherwise, the system increments its own Update ID value by one 3682 before continuing the below steps. 3684 2. The system creates an UPDATE packet that contains a SEQ parameter 3685 with the current value of Update ID. The UPDATE packet may also 3686 include an ACK of the peer's Update ID found in a received UPDATE 3687 SEQ parameter, if any. 3689 3. The system sends the created UPDATE packet and starts an UPDATE 3690 timer. The default value for the timer is 2 * RTT estimate. If 3691 multiple UPDATEs are outstanding, multiple timers are in effect. 3693 4. If the UPDATE timer expires, the UPDATE is resent. The UPDATE 3694 can be resent UPDATE_RETRY_MAX times. The UPDATE timer SHOULD be 3695 exponentially backed off for subsequent retransmissions. If no 3696 acknowledgment is received from the peer after UPDATE_RETRY_MAX 3697 times, the HIP association is considered to be broken and the 3698 state machine should move from state ESTABLISHED to state CLOSING 3699 as depicted in Section 4.4.3. The UPDATE timer is cancelled upon 3700 receiving an ACK from the peer that acknowledges receipt of the 3701 UPDATE. 3703 6.12. Receiving UPDATE Packets 3705 When a system receives an UPDATE packet, its processing depends on 3706 the state of the HIP association and the presence and values of the 3707 SEQ and ACK parameters. Typically, an UPDATE message also carries 3708 optional parameters whose handling is defined in separate documents. 3710 For each association, the peer's next expected in-sequence Update ID 3711 ("peer Update ID") is stored. Initially, this value is zero. Update 3712 ID comparisons of "less than" and "greater than" are performed with 3713 respect to a circular sequence number space. 3715 The sender may send multiple outstanding UPDATE messages. These 3716 messages are processed in the order in which they are received at the 3717 receiver (i.e., no resequencing is performed). When processing 3718 UPDATEs out-of-order, the receiver MUST keep track of which UPDATEs 3719 were previously processed, so that duplicates or retransmissions are 3720 ACKed and not reprocessed. A receiver MAY choose to define a receive 3721 window of Update IDs that it is willing to process at any given time, 3722 and discard received UPDATEs falling outside of that window. 3724 The following steps define the conceptual processing rules for 3725 receiving UPDATE packets. 3727 1. If there is no corresponding HIP association, the implementation 3728 MAY reply with an ICMP Parameter Problem, as specified in 3729 Section 5.4.4. 3731 2. If the association is in the ESTABLISHED state and the SEQ (but 3732 not ACK) parameter is present, the UPDATE is processed and 3733 replied to as described in Section 6.12.1. 3735 3. If the association is in the ESTABLISHED state and the ACK (but 3736 not SEQ) parameter is present, the UPDATE is processed as 3737 described in Section 6.12.2. 3739 4. If the association is in the ESTABLISHED state and there is both 3740 an ACK and SEQ in the UPDATE, the ACK is first processed as 3741 described in Section 6.12.2, and then the rest of the UPDATE is 3742 processed as described in Section 6.12.1. 3744 6.12.1. Handling a SEQ Parameter in a Received UPDATE Message 3746 The following steps define the conceptual processing rules for 3747 handling a SEQ parameter in a received UPDATE packet. 3749 1. If the Update ID in the received SEQ is not the next in the 3750 sequence of Update IDs and is greater than the receiver's window 3751 for new UPDATEs, the packet MUST be dropped. 3753 2. If the Update ID in the received SEQ corresponds to an UPDATE 3754 that has recently been processed, the packet is treated as a 3755 retransmission. The HMAC verification (next step) MUST NOT be 3756 skipped. (A byte-by-byte comparison of the received and a stored 3757 packet would be OK, though.) It is recommended that a host cache 3758 UPDATE packets sent with ACKs to avoid the cost of generating a 3759 new ACK packet to respond to a replayed UPDATE. The system MUST 3760 acknowledge, again, such (apparent) UPDATE message 3761 retransmissions but SHOULD also consider rate-limiting such 3762 retransmission responses to guard against replay attacks. 3764 3. The system MUST verify the HMAC in the UPDATE packet. If the 3765 verification fails, the packet MUST be dropped. 3767 4. The system MAY verify the SIGNATURE in the UPDATE packet. If the 3768 verification fails, the packet SHOULD be dropped and an error 3769 message logged. 3771 5. If a new SEQ parameter is being processed, the parameters in the 3772 UPDATE are then processed. The system MUST record the Update ID 3773 in the received SEQ parameter, for replay protection. 3775 6. An UPDATE acknowledgment packet with ACK parameter is prepared 3776 and sent to the peer. This ACK parameter may be included in a 3777 separate UPDATE or piggybacked in an UPDATE with SEQ parameter, 3778 as described in Section 5.3.5. The ACK parameter MAY acknowledge 3779 more than one of the peer's Update IDs. 3781 6.12.2. Handling an ACK Parameter in a Received UPDATE Packet 3783 The following steps define the conceptual processing rules for 3784 handling an ACK parameter in a received UPDATE packet. 3786 1. The sequence number reported in the ACK must match with an 3787 earlier sent UPDATE packet that has not already been 3788 acknowledged. If no match is found or if the ACK does not 3789 acknowledge a new UPDATE, the packet MUST either be dropped if no 3790 SEQ parameter is present, or the processing steps in 3791 Section 6.12.1 are followed. 3793 2. The system MUST verify the HMAC in the UPDATE packet. If the 3794 verification fails, the packet MUST be dropped. 3796 3. The system MAY verify the SIGNATURE in the UPDATE packet. If the 3797 verification fails, the packet SHOULD be dropped and an error 3798 message logged. 3800 4. The corresponding UPDATE timer is stopped (see Section 6.11) so 3801 that the now acknowledged UPDATE is no longer retransmitted. If 3802 multiple UPDATEs are newly acknowledged, multiple timers are 3803 stopped. 3805 6.13. Processing NOTIFY Packets 3807 Processing NOTIFY packets is OPTIONAL. If processed, any errors in a 3808 received NOTIFICATION parameter SHOULD be logged. Received errors 3809 MUST be considered only as informational, and the receiver SHOULD NOT 3810 change its HIP state (Section 4.4.1) purely based on the received 3811 NOTIFY message. 3813 6.14. Processing CLOSE Packets 3815 When the host receives a CLOSE message, it responds with a CLOSE_ACK 3816 message and moves to CLOSED state. (The authenticity of the CLOSE 3817 message is verified using both HMAC and SIGNATURE). This processing 3818 applies whether or not the HIP association state is CLOSING in order 3819 to handle CLOSE messages from both ends that cross in flight. 3821 The HIP association is not discarded before the host moves from the 3822 UNASSOCIATED state. 3824 Once the closing process has started, any need to send data packets 3825 will trigger creating and establishing of a new HIP association, 3826 starting with sending an I1. 3828 If there is no corresponding HIP association, the CLOSE packet is 3829 dropped. 3831 6.15. Processing CLOSE_ACK Packets 3833 When a host receives a CLOSE_ACK message, it verifies that it is in 3834 CLOSING or CLOSED state and that the CLOSE_ACK was in response to the 3835 CLOSE (using the included ECHO_RESPONSE_SIGNED in response to the 3836 sent ECHO_REQUEST_SIGNED). 3838 The CLOSE_ACK uses HMAC and SIGNATURE for verification. The state is 3839 discarded when the state changes to UNASSOCIATED and, after that, the 3840 host MAY respond with an ICMP Parameter Problem to an incoming CLOSE 3841 message (see Section 5.4.4). 3843 6.16. Handling State Loss 3845 In the case of system crash and unanticipated state loss, the system 3846 SHOULD delete the corresponding HIP state, including the keying 3847 material. That is, the state SHOULD NOT be stored on stable storage. 3848 If the implementation does drop the state (as RECOMMENDED), it MUST 3849 also drop the peer's R1 generation counter value, unless a local 3850 policy explicitly defines that the value of that particular host is 3851 stored. An implementation MUST NOT store R1 generation counters by 3852 default, but storing R1 generation counter values, if done, MUST be 3853 configured by explicit HITs. 3855 7. HIP Policies 3857 There are a number of variables that will influence the HIP exchanges 3858 that each host must support. All HIP implementations MUST support 3859 more than one simultaneous HI, at least one of which SHOULD be 3860 reserved for anonymous usage. Although anonymous HIs will be rarely 3861 used as Responders' HIs, they will be common for Initiators. Support 3862 for more than two HIs is RECOMMENDED. 3864 Many Initiators would want to use a different HI for different 3865 Responders. The implementations SHOULD provide for an ACL of 3866 Initiator's HIT to Responder's HIT. This ACL SHOULD also include 3867 preferred transform and local lifetimes. 3869 The value of K used in the HIP R1 packet can also vary by policy. K 3870 should never be greater than 20, but for trusted partners it could be 3871 as low as 0. 3873 Responders would need a similar ACL, representing which hosts they 3874 accept HIP exchanges, and the preferred transform and local 3875 lifetimes. Wildcarding SHOULD be supported for this ACL also. 3877 8. Security Considerations 3879 HIP is designed to provide secure authentication of hosts. HIP also 3880 attempts to limit the exposure of the host to various denial-of- 3881 service and man-in-the-middle (MitM) attacks. In so doing, HIP 3882 itself is subject to its own DoS and MitM attacks that potentially 3883 could be more damaging to a host's ability to conduct business as 3884 usual. 3886 The 384-bit Diffie-Hellman Group is targeted to be used in hosts that 3887 either do not require or are not powerful enough for handling strong 3888 cryptography. Although there is a risk that with suitable equipment 3889 the encryption can be broken in real time, the 384-bit group can 3890 provide some protection for end-hosts that are not able to handle any 3891 stronger cryptography. When the security provided by the 384-bit 3892 group is not enough for applications on a host, the support for this 3893 group should be turned off in the configuration. 3895 Denial-of-service attacks often take advantage of the cost of start 3896 of state for a protocol on the Responder compared to the 'cheapness' 3897 on the Initiator. HIP makes no attempt to increase the cost of the 3898 start of state on the Initiator, but makes an effort to reduce the 3899 cost to the Responder. This is done by having the Responder start 3900 the 3-way exchange instead of the Initiator, making the HIP protocol 3901 4 packets long. In doing this, packet 2 becomes a 'stock' packet 3902 that the Responder MAY use many times, until some Initiator has 3903 provided a valid response to such an R1 packet. During an I1 storm, 3904 the host may reuse the same D-H value also even if some Initiator has 3905 provided a valid response using that particular D-H value. However, 3906 such behavior is discouraged and should be avoided. Using the same 3907 Diffie-Hellman values and random puzzle #I value has some risks. 3908 This risk needs to be balanced against a potential storm of HIP I1 3909 packets. 3911 This shifting of the start of state cost to the Initiator in creating 3912 the I2 HIP packet, presents another DoS attack. The attacker spoofs 3913 the I1 HIP packet and the Responder sends out the R1 HIP packet. 3914 This could conceivably tie up the 'Initiator' with evaluating the R1 3915 HIP packet, and creating the I2 HIP packet. The defense against this 3916 attack is to simply ignore any R1 packet where a corresponding I1 was 3917 not sent. 3919 A second form of DoS attack arrives in the I2 HIP packet. Once the 3920 attacking Initiator has solved the puzzle, it can send packets with 3921 spoofed IP source addresses with either an invalid encrypted HIP 3922 payload component or a bad HIP signature. This would take resources 3923 in the Responder's part to reach the point to discover that the I2 3924 packet cannot be completely processed. The defense against this 3925 attack is after N bad I2 packets, the Responder would discard any I2s 3926 that contain the given Initiator HIT. This will shut down the 3927 attack. The attacker would have to request another R1 and use that 3928 to launch a new attack. The Responder could up the value of K while 3929 under attack. On the downside, valid I2s might get dropped too. 3931 A third form of DoS attack is emulating the restart of state after a 3932 reboot of one of the partners. A restarting host would send an I1 to 3933 a peer, which would respond with an R1 even if it were in the 3934 ESTABLISHED state. If the I1 were spoofed, the resulting R1 would be 3935 received unexpectedly by the spoofed host and would be dropped, as in 3936 the first case above. 3938 A fourth form of DoS attack is emulating the end of state. HIP 3939 relies on timers plus a CLOSE/CLOSE_ACK handshake to explicitly 3940 signal the end of a HIP association. Because both CLOSE and 3941 CLOSE_ACK messages contain an HMAC, an outsider cannot close a 3942 connection. The presence of an additional SIGNATURE allows 3943 middleboxes to inspect these messages and discard the associated 3944 state (for e.g., firewalling, SPI-based NATing, etc.). However, the 3945 optional behavior of replying to CLOSE with an ICMP Parameter Problem 3946 packet (as described in Section 5.4.4) might allow an IP spoofer 3947 sending CLOSE messages to launch reflection attacks. 3949 A fifth form of DoS attack is replaying R1s to cause the Initiator to 3950 solve stale puzzles and become out of synchronization with the 3951 Responder. The R1 generation counter is a monotonically increasing 3952 counter designed to protect against this attack, as described in 3953 Section 4.1.4. 3955 Man-in-the-middle attacks are difficult to defend against, without 3956 third-party authentication. A skillful MitM could easily handle all 3957 parts of HIP, but HIP indirectly provides the following protection 3958 from a MitM attack. If the Responder's HI is retrieved from a signed 3959 DNS zone, a certificate, or through some other secure means, the 3960 Initiator can use this to validate the R1 HIP packet. 3962 Likewise, if the Initiator's HI is in a secure DNS zone, a trusted 3963 certificate, or otherwise securely available, the Responder can 3964 retrieve the HI (after having got the I2 HIP packet) and verify that 3965 the HI indeed can be trusted. However, since an Initiator may choose 3966 to use an anonymous HI, it knowingly risks a MitM attack. The 3967 Responder may choose not to accept a HIP exchange with an anonymous 3968 Initiator. 3970 The HIP Opportunistic Mode concept has been introduced in this 3971 document, but this document does not specify what the semantics of 3972 such a connection setup are for applications. There are certain 3973 concerns with opportunistic mode, as discussed in Section 4.1.6. 3975 NOTIFY messages are used only for informational purposes and they are 3976 unacknowledged. A HIP implementation cannot rely solely on the 3977 information received in a NOTIFY message because the packet may have 3978 been replayed. It SHOULD NOT change any state information based 3979 purely on a received NOTIFY message. 3981 Since not all hosts will ever support HIP, ICMP 'Destination Protocol 3982 Unreachable' messages are to be expected and present a DoS attack. 3983 Against an Initiator, the attack would look like the Responder does 3984 not support HIP, but shortly after receiving the ICMP message, the 3985 Initiator would receive a valid R1 HIP packet. Thus, to protect from 3986 this attack, an Initiator should not react to an ICMP message until a 3987 reasonable delta time to get the real Responder's R1 HIP packet. A 3988 similar attack against the Responder is more involved. Normally, if 3989 an I1 message received by a Responder was a bogus one sent by an 3990 attacker, the Responder may receive an ICMP message from the IP 3991 address the R1 message was sent to. However, a sophisticated 3992 attacker can try to take advantage of such a behavior and try to 3993 break up the HIP exchange by sending such an ICMP message to the 3994 Responder before the Initiator has a chance to send a valid I2 3995 message. Hence, the Responder SHOULD NOT act on such an ICMP 3996 message. Especially, it SHOULD NOT remove any minimal state created 3997 when it sent the R1 HIP packet (if it did create one), but wait for 3998 either a valid I2 HIP packet or the natural timeout (that is, if R1 3999 packets are tracked at all). Likewise, the Initiator should ignore 4000 any ICMP message while waiting for an R2 HIP packet, and should 4001 delete any pending state only after a natural timeout. 4003 9. IANA Considerations 4005 IANA has reserved protocol number 139 for the Host Identity Protocol. 4007 This document defines a new 128-bit value under the CGA Message Type 4008 namespace [RFC3972], 0xF0EF F02F BFF4 3D0F E793 0C3C 6E61 74EA, to be 4009 used for HIT generation as specified in ORCHID [RFC4843]. 4011 This document also creates a set of new namespaces. These are 4012 described below. 4014 Packet Type 4016 The 7-bit Packet Type field in a HIP protocol packet describes the 4017 type of a HIP protocol message. It is defined in Section 5.1. 4018 The current values are defined in Sections 5.3.1 through 5.3.8. 4020 New values are assigned through IETF Consensus [RFC2434]. 4022 HIP Version 4024 The four-bit Version field in a HIP protocol packet describes the 4025 version of the HIP protocol. It is defined in Section 5.1. The 4026 only currently defined value is 1. New values are assigned 4027 through IETF Consensus. 4029 Parameter Type 4031 The 16-bit Type field in a HIP parameter describes the type of the 4032 parameter. It is defined in Section 5.2.1. The current values 4033 are defined in Sections 5.2.3 through 5.2.20. 4035 With the exception of the assigned Type codes, the Type codes 0 4036 through 1023 and 61440 through 65535 are reserved for future base 4037 protocol extensions, and are assigned through IETF Consensus. 4039 The Type codes 32768 through 49141 are reserved for 4040 experimentation. Types SHOULD be selected in a random fashion 4041 from this range, thereby reducing the probability of collisions. 4042 A method employing genuine randomness (such as flipping a coin) 4043 SHOULD be used. 4045 All other Type codes are assigned through First Come First Served, 4046 with Specification Required [RFC2434]. 4048 Group ID 4050 The eight-bit Group ID values appear in the DIFFIE_HELLMAN 4051 parameter and are defined in Section 5.2.6. New values either 4052 from the reserved or unassigned space are assigned through IETF 4053 Consensus. 4055 Suite ID 4057 The 16-bit Suite ID values in a HIP_TRANSFORM parameter are 4058 defined in Section 5.2.7. New values either from the reserved or 4059 unassigned space are assigned through IETF Consensus. 4061 DI-Type 4063 The four-bit DI-Type values in a HOST_ID parameter are defined in 4064 Section 5.2.8. New values are assigned through IETF Consensus. 4066 Notify Message Type 4068 The 16-bit Notify Message Type values in a NOTIFICATION parameter 4069 are defined in Section 5.2.16. 4071 Notify Message Type values 1-10 are used for informing about 4072 errors in packet structures, values 11-20 for informing about 4073 problems in parameters containing cryptographic related material, 4074 values 21-30 for informing about problems in authentication or 4075 packet integrity verification. Parameter numbers above 30 can be 4076 used for informing about other types of errors or events. Values 4077 51-8191 are error types reserved to be allocated by IANA. Values 4078 8192-16383 are error types for experimentation. Values 16385- 4079 40959 are status types to be allocated by IANA, and values 40960- 4080 65535 are status types for experimentation. New values in ranges 4081 51-8191 and 16385-40959 are assigned through First Come First 4082 Served, with Specification Required. 4084 10. Acknowledgments 4086 The drive to create HIP came to being after attending the MALLOC 4087 meeting at the 43rd IETF meeting. Baiju Patel and Hilarie Orman 4088 really gave the original author, Bob Moskowitz, the assist to get HIP 4089 beyond 5 paragraphs of ideas. It has matured considerably since the 4090 early versions thanks to extensive input from IETFers. Most 4091 importantly, its design goals are articulated and are different from 4092 other efforts in this direction. Particular mention goes to the 4093 members of the NameSpace Research Group of the IRTF. Noel Chiappa 4094 provided valuable input at early stages of discussions about 4095 identifier handling and Keith Moore the impetus to provide 4096 resolvability. Steve Deering provided encouragement to keep working, 4097 as a solid proposal can act as a proof of ideas for a research group. 4099 Many others contributed; extensive security tips were provided by 4100 Steve Bellovin. Rob Austein kept the DNS parts on track. Paul 4101 Kocher taught Bob Moskowitz how to make the puzzle exchange expensive 4102 for the Initiator to respond, but easy for the Responder to validate. 4103 Bill Sommerfeld supplied the Birthday concept, which later evolved 4104 into the R1 generation counter, to simplify reboot management. Erik 4105 Nordmark supplied the CLOSE-mechanism for closing connections. 4106 Rodney Thayer and Hugh Daniels provided extensive feedback. In the 4107 early times of this document, John Gilmore kept Bob Moskowitz 4108 challenged to provide something of value. 4110 During the later stages of this document, when the editing baton was 4111 transferred to Pekka Nikander, the input from the early implementors 4112 was invaluable. Without having actual implementations, this document 4113 would not be on the level it is now. 4115 In the usual IETF fashion, a large number of people have contributed 4116 to the actual text or ideas. The list of these people include Jeff 4117 Ahrenholz, Francis Dupont, Derek Fawcus, George Gross, Andrew 4118 McGregor, Julien Laganier, Miika Komu, Mika Kousa, Jan Melen, Henrik 4119 Petander, Michael Richardson, Tim Shepard, Jorma Wall, and Jukka 4120 Ylitalo. Our apologies to anyone whose name is missing. 4122 Once the HIP Working Group was founded in early 2004, a number of 4123 changes were introduced through the working group process. Most 4124 notably, the original document was split in two, one containing the 4125 base exchange and the other one defining how to use ESP. Some 4126 modifications to the protocol proposed by Aura, et al., [AUR03] were 4127 added at a later stage. 4129 11. References 4130 11.1. Normative References 4132 [FIPS.95-1.1993] National Institute of Standards and 4133 Technology, "Codes for the Identification of 4134 Federal and Federally Assisted Organizations", 4135 FIPS PUB 95-1, January 1993. 4137 [RFC0768] Postel, J., "User Datagram Protocol", STD 6, 4138 RFC 768, August 1980. 4140 [RFC1035] Mockapetris, P., "Domain names - 4141 implementation and specification", STD 13, 4142 RFC 1035, November 1987. 4144 [RFC2119] Bradner, S., "Key words for use in RFCs to 4145 Indicate Requirement Levels", BCP 14, 4146 RFC 2119, March 1997. 4148 [RFC2404] Madson, C. and R. Glenn, "The Use of HMAC-SHA- 4149 1-96 within ESP and AH", RFC 2404, 4150 November 1998. 4152 [RFC2451] Pereira, R. and R. Adams, "The ESP CBC-Mode 4153 Cipher Algorithms", RFC 2451, November 1998. 4155 [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, 4156 Version 6 (IPv6) Specification", RFC 2460, 4157 December 1998. 4159 [RFC2463] Conta, A. and S. Deering, "Internet Control 4160 Message Protocol (ICMPv6) for the Internet 4161 Protocol Version 6 (IPv6) Specification", 4162 RFC 2463, December 1998. 4164 [RFC2536] Eastlake, D., "DSA KEYs and SIGs in the Domain 4165 Name System (DNS)", RFC 2536, March 1999. 4167 [RFC2898] Kaliski, B., "PKCS #5: Password-Based 4168 Cryptography Specification Version 2.0", 4169 RFC 2898, September 2000. 4171 [RFC3110] Eastlake, D., "RSA/SHA-1 SIGs and RSA KEYs in 4172 the Domain Name System (DNS)", RFC 3110, 4173 May 2001. 4175 [RFC3484] Draves, R., "Default Address Selection for 4176 Internet Protocol version 6 (IPv6)", RFC 3484, 4177 February 2003. 4179 [RFC3526] Kivinen, T. and M. Kojo, "More Modular 4180 Exponential (MODP) Diffie-Hellman groups for 4181 Internet Key Exchange (IKE)", RFC 3526, 4182 May 2003. 4184 [RFC3602] Frankel, S., Glenn, R., and S. Kelly, "The 4185 AES-CBC Cipher Algorithm and Its Use with 4186 IPsec", RFC 3602, September 2003. 4188 [RFC3972] Aura, T., "Cryptographically Generated 4189 Addresses (CGA)", RFC 3972, March 2005. 4191 [RFC4034] Arends, R., Austein, R., Larson, M., Massey, 4192 D., and S. Rose, "Resource Records for the DNS 4193 Security Extensions", RFC 4034, March 2005. 4195 [RFC4282] Aboba, B., Beadles, M., Arkko, J., and P. 4196 Eronen, "The Network Access Identifier", 4197 RFC 4282, December 2005. 4199 [RFC4307] Schiller, J., "Cryptographic Algorithms for 4200 Use in the Internet Key Exchange Version 2 4201 (IKEv2)", RFC 4307, December 2005. 4203 [RFC4843] Nikander, P., Laganier, J., and F. Dupont, "An 4204 IPv6 Prefix for Overlay Routable Cryptographic 4205 Hash Identifiers (ORCHID)", RFC 4843, 4206 April 2007. 4208 [RFC5202] Jokela, P., Moskowitz, R., and P. Nikander, 4209 "Using the Encapsulating Security Payload 4210 (ESP) Transport Format with the Host Identity 4211 Protocol (HIP)", RFC 5202, April 2008. 4213 11.2. Informative References 4215 [AUR03] Aura, T., Nagarajan, A., and A. Gurtov, 4216 "Analysis of the HIP Base Exchange Protocol", 4217 in Proceedings of 10th Australasian Conference 4218 on Information Security and Privacy, 4219 July 2003. 4221 [CRO03] Crosby, SA. and DS. Wallach, "Denial of 4222 Service via Algorithmic Complexity Attacks", 4223 in Proceedings of Usenix Security Symposium 4224 2003, Washington, DC., August 2003. 4226 [DIF76] Diffie, W. and M. Hellman, "New Directions in 4227 Cryptography", IEEE Transactions on 4228 Information Theory vol. IT-22, number 6, pages 4229 644-654, Nov 1976. 4231 [FIPS.197.2001] National Institute of Standards and 4232 Technology, "Advanced Encryption Standard 4233 (AES)", FIPS PUB 197, November 2001, . 4237 [I-D.ietf-btns-c-api] Richardson, M., Williams, N., Komu, M., and S. 4238 Tarkoma, "C-Bindings for IPsec Application 4239 Programming Interfaces", 4240 draft-ietf-btns-c-api-04 (work in progress), 4241 March 2009. 4243 [KAU03] Kaufman, C., Perlman, R., and B. Sommerfeld, 4244 "DoS protection for UDP-based protocols", ACM 4245 Conference on Computer and Communications 4246 Security , Oct 2003. 4248 [KRA03] Krawczyk, H., "SIGMA: The 'SIGn-and-MAc' 4249 Approach to Authenticated Diffie-Hellman and 4250 Its Use in the IKE-Protocols", in Proceedings 4251 of CRYPTO 2003, pages 400-425, August 2003. 4253 [RFC0792] Postel, J., "Internet Control Message 4254 Protocol", STD 5, RFC 792, September 1981. 4256 [RFC2412] Orman, H., "The OAKLEY Key Determination 4257 Protocol", RFC 2412, November 1998. 4259 [RFC2434] Narten, T. and H. Alvestrand, "Guidelines for 4260 Writing an IANA Considerations Section in 4261 RFCs", BCP 26, RFC 2434, October 1998. 4263 [RFC4306] Kaufman, C., "Internet Key Exchange (IKEv2) 4264 Protocol", RFC 4306, December 2005. 4266 [RFC5204] Laganier, J. and L. Eggert, "Host Identity 4267 Protocol (HIP) Rendezvous Extension", 4268 RFC 5204, April 2008. 4270 [RFC5205] Nikander, P. and J. Laganier, "Host Identity 4271 Protocol (HIP) Domain Name System (DNS) 4272 Extensions", RFC 5205, April 2008. 4274 [RFC5206] Nikander, P., Henderson, T., Vogt, C., and J. 4276 Arkko, "End-Host Mobility and Multihoming with 4277 the Host Identity Protocol", RFC 5206, 4278 April 2008. 4280 [RFC5338] Henderson, T., Nikander, P., and M. Komu, 4281 "Using the Host Identity Protocol with Legacy 4282 Applications", RFC 5338, September 2008. 4284 [RFC5533] Nordmark, E. and M. Bagnulo, "Shim6: Level 3 4285 Multihoming Shim Protocol for IPv6", RFC 5533, 4286 June 2009. 4288 [rfc4423-bis] Moskowitz, R., "Host Identity Protocol 4289 Architecture", draft-ietf-hip-rfc4423-bis-00 4290 (work in progress), August 2010. 4292 Appendix A. Using Responder Puzzles 4294 As mentioned in Section 4.1.1, the Responder may delay state creation 4295 and still reject most spoofed I2s by using a number of pre-calculated 4296 R1s and a local selection function. This appendix defines one 4297 possible implementation in detail. The purpose of this appendix is 4298 to give the implementors an idea on how to implement the mechanism. 4299 If the implementation is based on this appendix, it MAY contain some 4300 local modification that makes an attacker's task harder. 4302 The Responder creates a secret value S, that it regenerates 4303 periodically. The Responder needs to remember the two latest values 4304 of S. Each time the S is regenerated, the R1 generation counter 4305 value is incremented by one. 4307 The Responder generates a pre-signed R1 packet. The signature for 4308 pre-generated R1s must be recalculated when the Diffie-Hellman key is 4309 recomputed or when the R1_COUNTER value changes due to S value 4310 regeneration. 4312 When the Initiator sends the I1 packet for initializing a connection, 4313 the Responder gets the HIT and IP address from the packet, and 4314 generates an I value for the puzzle. The I value is set to the pre- 4315 signed R1 packet. 4317 I value calculation: 4318 I = Ltrunc( RHASH ( S | HIT-I | HIT-R | IP-I | IP-R ), 64) 4320 The RHASH algorithm is the same that is used to generate the 4321 Responder's HIT value. 4323 From an incoming I2 packet, the Responder gets the required 4324 information to validate the puzzle: HITs, IP addresses, and the 4325 information of the used S value from the R1_COUNTER. Using these 4326 values, the Responder can regenerate the I, and verify it against the 4327 I received in the I2 packet. If the I values match, it can verify 4328 the solution using I, J, and difficulty K. If the I values do not 4329 match, the I2 is dropped. 4331 puzzle_check: 4332 V := Ltrunc( RHASH( I2.I | I2.hit_i | I2.hit_r | I2.J ), K ) 4333 if V != 0, drop the packet 4335 If the puzzle solution is correct, the I and J values are stored for 4336 later use. They are used as input material when keying material is 4337 generated. 4339 Keeping state about failed puzzle solutions depends on the 4340 implementation. Although it is possible for the Responder not to 4341 keep any state information, it still may do so to protect itself 4342 against certain attacks (see Section 4.1.1). 4344 Appendix B. Generating a Public Key Encoding from an HI 4346 The following pseudo-code illustrates the process to generate a 4347 public key encoding from an HI for both RSA and DSA. 4349 The symbol := denotes assignment; the symbol += denotes appending. 4350 The pseudo-function encode_in_network_byte_order takes two 4351 parameters, an integer (bignum) and a length in bytes, and returns 4352 the integer encoded into a byte string of the given length. 4354 switch ( HI.algorithm ) 4355 { 4357 case RSA: 4358 buffer := encode_in_network_byte_order ( HI.RSA.e_len, 4359 ( HI.RSA.e_len > 255 ) ? 3 : 1 ) 4360 buffer += encode_in_network_byte_order ( HI.RSA.e, HI.RSA.e_len ) 4361 buffer += encode_in_network_byte_order ( HI.RSA.n, HI.RSA.n_len ) 4362 break; 4364 case DSA: 4365 buffer := encode_in_network_byte_order ( HI.DSA.T , 1 ) 4366 buffer += encode_in_network_byte_order ( HI.DSA.Q , 20 ) 4367 buffer += encode_in_network_byte_order ( HI.DSA.P , 64 + 4368 8 * HI.DSA.T ) 4369 buffer += encode_in_network_byte_order ( HI.DSA.G , 64 + 4370 8 * HI.DSA.T ) 4371 buffer += encode_in_network_byte_order ( HI.DSA.Y , 64 + 4372 8 * HI.DSA.T ) 4373 break; 4375 } 4377 Appendix C. Example Checksums for HIP Packets 4379 The HIP checksum for HIP packets is specified in Section 5.1.1. 4380 Checksums for TCP and UDP packets running over HIP-enabled security 4381 associations are specified in Section 3.5. The examples below use IP 4382 addresses of 192.168.0.1 and 192.168.0.2 (and their respective IPv4- 4383 compatible IPv6 formats), and HITs with the prefix of 2001:10 4384 followed by zeros, followed by a decimal 1 or 2, respectively. 4386 The following example is defined only for testing a checksum 4387 calculation. The address format for the IPv4-compatible IPv6 address 4388 is not a valid one, but using these IPv6 addresses when testing an 4389 IPv6 implementation gives the same checksum output as an IPv4 4390 implementation with the corresponding IPv4 addresses. 4392 C.1. IPv6 HIP Example (I1) 4394 Source Address: ::192.168.0.1 4395 Destination Address: ::192.168.0.2 4396 Upper-Layer Packet Length: 40 0x28 4397 Next Header: 139 0x8b 4398 Payload Protocol: 59 0x3b 4399 Header Length: 4 0x4 4400 Packet Type: 1 0x1 4401 Version: 1 0x1 4402 Reserved: 1 0x1 4403 Control: 0 0x0 4404 Checksum: 446 0x1be 4405 Sender's HIT : 2001:10::1 4406 Receiver's HIT: 2001:10::2 4408 C.2. IPv4 HIP Packet (I1) 4410 The IPv4 checksum value for the same example I1 packet is the same as 4411 the IPv6 checksum (since the checksums due to the IPv4 and IPv6 4412 pseudo-header components are the same). 4414 C.3. TCP Segment 4416 Regardless of whether IPv6 or IPv4 is used, the TCP and UDP sockets 4417 use the IPv6 pseudo-header format [RFC2460], with the HITs used in 4418 place of the IPv6 addresses. 4420 Sender's HIT: 2001:10::1 4421 Receiver's HIT: 2001:10::2 4422 Upper-Layer Packet Length: 20 0x14 4423 Next Header: 6 0x06 4424 Source port: 65500 0xffdc 4425 Destination port: 22 0x0016 4426 Sequence number: 1 0x00000001 4427 Acknowledgment number: 0 0x00000000 4428 Header length: 20 0x14 4429 Flags: SYN 0x02 4430 Window size: 65535 0xffff 4431 Checksum: 28618 0x6fca 4432 Urgent pointer: 0 0x0000 4434 0x0000: 6000 0000 0014 0640 2001 0010 0000 0000 4435 0x0010: 0000 0000 0000 0001 2001 0010 0000 0000 4436 0x0020: 0000 0000 0000 0002 ffdc 0016 0000 0001 4437 0x0030: 0000 0000 5002 ffff 6fca 0000 4439 Appendix D. 384-Bit Group 4441 This 384-bit group is defined only to be used with HIP. NOTE: The 4442 security level of this group is very low! The encryption may be 4443 broken in a very short time, even real-time. It should be used only 4444 when the host is not powerful enough (e.g., some PDAs) and when 4445 security requirements are low (e.g., during normal web surfing). 4447 This prime is: 2^384 - 2^320 - 1 + 2^64 * { [ 2^254 pi] + 5857 } 4449 Its hexadecimal value is: 4451 FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 4452 29024E08 8A67CC74 020BBEA6 3B13B202 FFFFFFFF FFFFFFFF 4454 The generator is: 2. 4456 Appendix E. OAKLEY Well-Known Group 1 4458 See also [RFC2412] for definition of OAKLEY well-known group 1. 4460 OAKLEY Well-Known Group 1: A 768-bit prime 4462 The prime is 2^768 - 2^704 - 1 + 2^64 * { [2^638 pi] + 149686 }. 4464 The hexadecimal value is: 4466 FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 4467 29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD 4468 EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245 4469 E485B576 625E7EC6 F44C42E9 A63A3620 FFFFFFFF FFFFFFFF 4471 This has been rigorously verified as a prime. 4473 The generator is: 22 (decimal) 4475 Authors' Addresses 4477 Robert Moskowitz 4478 ICSAlabs, An Independent Division of Verizon Business Systems 4479 1000 Bent Creek Blvd, Suite 200 4480 Mechanicsburg, PA 4481 USA 4483 EMail: robert.moskowitz@icsalabs.com 4484 Petri Jokela (editor) 4485 Ericsson Research NomadicLab 4486 JORVAS FIN-02420 4487 FINLAND 4489 Phone: +358 9 299 1 4490 EMail: petri.jokela@nomadiclab.com 4492 Thomas R. Henderson 4493 The Boeing Company 4494 P.O. Box 3707 4495 Seattle, WA 4496 USA 4498 EMail: thomas.r.henderson@boeing.com