idnits 2.17.1 draft-moskowitz-hip-rfc5201-bis-01.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** You're using the IETF Trust Provisions' Section 6.b License Notice from 12 Sep 2009 rather than the newer Notice from 28 Dec 2009. (See https://trustee.ietf.org/license-info/) 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 1799 has weird spacing: '...c Value leng...' == Line 1801 has weird spacing: '...c Value the ...' == Line 2219 has weird spacing: '...ication info...' == Line 2345 has weird spacing: '...ue data opaqu...' == Line 2377 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 (March 9, 2010) is 5154 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) -- No information found for draft-laganier-rfc4843-bis - is the name correct? -- Possible downref: Normative reference to a draft: ref. 'RFC4843-bis' ** 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 (==), 8 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group R. Moskowitz, Ed. 3 Internet-Draft ICSAlabs 4 Obsoletes: 5201 (if approved) P. Nikander 5 Intended status: Standards Track P. Jokela 6 Expires: September 10, 2010 Ericsson Research NomadicLab 7 T. Henderson 8 The Boeing Company 9 T. Heer 10 RWTH Aachen University, 11 Distributed Systems Group 12 March 9, 2010 14 Host Identity Protocol 15 draft-moskowitz-hip-rfc5201-bis-01 17 Abstract 19 This document specifies the details of the Host Identity Protocol 20 (HIP). HIP allows consenting hosts to securely establish and 21 maintain shared IP-layer state, allowing separation of the identifier 22 and locator roles of IP addresses, thereby enabling continuity of 23 communications across IP address changes. HIP is based on a Sigma- 24 compliant Diffie-Hellman key exchange, using public key identifiers 25 from a new Host Identity namespace for mutual peer authentication. 26 The protocol is designed to be resistant to denial-of-service (DoS) 27 and man-in-the-middle (MitM) attacks. When used together with 28 another suitable security protocol, such as the Encapsulated Security 29 Payload (ESP), it provides integrity protection and optional 30 encryption for upper-layer protocols, such as TCP and UDP. 32 This document obsoletes RFC 5201 and addresses the concerns raised by 33 the IESG, particularly that of crypto agility. It also incorporates 34 lessons learned from the implementations of RFC 5201. 36 Status of This Memo 38 This Internet-Draft is submitted to IETF in full conformance with the 39 provisions of BCP 78 and BCP 79. 41 Internet-Drafts are working documents of the Internet Engineering 42 Task Force (IETF), its areas, and its working groups. Note that 43 other groups may also distribute working documents as Internet- 44 Drafts. 46 Internet-Drafts are draft documents valid for a maximum of six months 47 and may be updated, replaced, or obsoleted by other documents at any 48 time. It is inappropriate to use Internet-Drafts as reference 49 material or to cite them other than as "work in progress." 51 The list of current Internet-Drafts can be accessed at 52 http://www.ietf.org/ietf/1id-abstracts.txt. 54 The list of Internet-Draft Shadow Directories can be accessed at 55 http://www.ietf.org/shadow.html. 57 This Internet-Draft will expire on September 10, 2010. 59 Copyright Notice 61 Copyright (c) 2010 IETF Trust and the persons identified as the 62 document authors. All rights reserved. 64 This document is subject to BCP 78 and the IETF Trust's Legal 65 Provisions Relating to IETF Documents 66 (http://trustee.ietf.org/license-info) in effect on the date of 67 publication of this document. Please review these documents 68 carefully, as they describe your rights and restrictions with respect 69 to this document. Code Components extracted from this document must 70 include Simplified BSD License text as described in Section 4.e of 71 the Trust Legal Provisions and are provided without warranty as 72 described in the BSD License. 74 This document may contain material from IETF Documents or IETF 75 Contributions published or made publicly available before November 76 10, 2008. The person(s) controlling the copyright in some of this 77 material may not have granted the IETF Trust the right to allow 78 modifications of such material outside the IETF Standards Process. 79 Without obtaining an adequate license from the person(s) controlling 80 the copyright in such materials, this document may not be modified 81 outside the IETF Standards Process, and derivative works of it may 82 not be created outside the IETF Standards Process, except to format 83 it for publication as an RFC or to translate it into languages other 84 than English. 86 Table of Contents 88 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 6 89 1.1. A New Namespace and Identifiers . . . . . . . . . . . . . 6 90 1.2. The HIP Base Exchange . . . . . . . . . . . . . . . . . . 7 91 1.3. Memo Structure . . . . . . . . . . . . . . . . . . . . . 8 92 2. Terms and Definitions . . . . . . . . . . . . . . . . . . . . 8 93 2.1. Requirements Terminology . . . . . . . . . . . . . . . . 8 94 2.2. Notation . . . . . . . . . . . . . . . . . . . . . . . . 8 95 2.3. Definitions . . . . . . . . . . . . . . . . . . . . . . . 8 96 3. Host Identifier (HI) and Its Representations . . . . . . . . 9 97 3.1. Host Identity Tag (HIT) . . . . . . . . . . . . . . . . . 10 98 3.2. Generating a HIT from an HI . . . . . . . . . . . . . . . 10 99 4. Protocol Overview . . . . . . . . . . . . . . . . . . . . . . 11 100 4.1. Creating a HIP Association . . . . . . . . . . . . . . . 12 101 4.1.1. HIP Puzzle Mechanism . . . . . . . . . . . . . . . . 13 102 4.1.2. Puzzle Exchange . . . . . . . . . . . . . . . . . . . 14 103 4.1.3. Authenticated Diffie-Hellman Protocol . . . . . . . . 15 104 4.1.4. HIP Replay Protection . . . . . . . . . . . . . . . . 16 105 4.1.5. Refusing a HIP Exchange . . . . . . . . . . . . . . . 17 106 4.1.6. HIP Opportunistic Mode . . . . . . . . . . . . . . . 17 107 4.2. Updating a HIP Association . . . . . . . . . . . . . . . 19 108 4.3. Error Processing . . . . . . . . . . . . . . . . . . . . 20 109 4.4. HIP State Machine . . . . . . . . . . . . . . . . . . . . 21 110 4.4.1. HIP States . . . . . . . . . . . . . . . . . . . . . 21 111 4.4.2. HIP State Processes . . . . . . . . . . . . . . . . . 22 112 4.4.3. Simplified HIP State Diagram . . . . . . . . . . . . 29 113 4.5. User Data Considerations . . . . . . . . . . . . . . . . 31 114 4.5.1. TCP and UDP Pseudo-Header Computation for User Data . 31 115 4.5.2. Sending Data on HIP Packets . . . . . . . . . . . . . 31 116 4.5.3. Transport Formats . . . . . . . . . . . . . . . . . . 31 117 4.5.4. Reboot and SA Timeout Restart of HIP . . . . . . . . 31 118 4.6. Certificate Distribution . . . . . . . . . . . . . . . . 32 119 5. Packet Formats . . . . . . . . . . . . . . . . . . . . . . . 32 120 5.1. Payload Format . . . . . . . . . . . . . . . . . . . . . 32 121 5.1.1. Checksum . . . . . . . . . . . . . . . . . . . . . . 33 122 5.1.2. HIP Controls . . . . . . . . . . . . . . . . . . . . 34 123 5.1.3. HIP Fragmentation Support . . . . . . . . . . . . . . 34 124 5.2. HIP Parameters . . . . . . . . . . . . . . . . . . . . . 35 125 5.2.1. TLV Format . . . . . . . . . . . . . . . . . . . . . 38 126 5.2.2. Defining New Parameters . . . . . . . . . . . . . . . 39 127 5.2.3. R1_COUNTER . . . . . . . . . . . . . . . . . . . . . 40 128 5.2.4. PUZZLE . . . . . . . . . . . . . . . . . . . . . . . 41 129 5.2.5. SOLUTION . . . . . . . . . . . . . . . . . . . . . . 42 130 5.2.6. DIFFIE_HELLMAN . . . . . . . . . . . . . . . . . . . 43 131 5.2.7. HIP_TRANSFORM . . . . . . . . . . . . . . . . . . . . 44 132 5.2.8. HOST_ID . . . . . . . . . . . . . . . . . . . . . . . 45 133 5.2.9. OGA_LIST . . . . . . . . . . . . . . . . . . . . . . 46 134 5.2.10. HMAC . . . . . . . . . . . . . . . . . . . . . . . . 47 135 5.2.11. HMAC_2 . . . . . . . . . . . . . . . . . . . . . . . 47 136 5.2.12. HIP_SIGNATURE . . . . . . . . . . . . . . . . . . . . 48 137 5.2.13. HIP_SIGNATURE_2 . . . . . . . . . . . . . . . . . . . 49 138 5.2.14. SEQ . . . . . . . . . . . . . . . . . . . . . . . . . 49 139 5.2.15. ACK . . . . . . . . . . . . . . . . . . . . . . . . . 50 140 5.2.16. ENCRYPTED . . . . . . . . . . . . . . . . . . . . . . 51 141 5.2.17. NOTIFICATION . . . . . . . . . . . . . . . . . . . . 52 142 5.2.18. ECHO_REQUEST_SIGNED . . . . . . . . . . . . . . . . . 56 143 5.2.19. ECHO_REQUEST_UNSIGNED . . . . . . . . . . . . . . . . 56 144 5.2.20. ECHO_RESPONSE_SIGNED . . . . . . . . . . . . . . . . 57 145 5.2.21. ECHO_RESPONSE_UNSIGNED . . . . . . . . . . . . . . . 58 146 5.3. HIP Packets . . . . . . . . . . . . . . . . . . . . . . . 58 147 5.3.1. I1 - the HIP Initiator Packet . . . . . . . . . . . . 59 148 5.3.2. R1 - the HIP Responder Packet . . . . . . . . . . . . 60 149 5.3.3. I2 - the Second HIP Initiator Packet . . . . . . . . 62 150 5.3.4. R2 - the Second HIP Responder Packet . . . . . . . . 63 151 5.3.5. UPDATE - the HIP Update Packet . . . . . . . . . . . 64 152 5.3.6. NOTIFY - the HIP Notify Packet . . . . . . . . . . . 65 153 5.3.7. CLOSE - the HIP Association Closing Packet . . . . . 65 154 5.3.8. CLOSE_ACK - the HIP Closing Acknowledgment Packet . . 66 155 5.4. ICMP Messages . . . . . . . . . . . . . . . . . . . . . . 66 156 5.4.1. Invalid Version . . . . . . . . . . . . . . . . . . . 67 157 5.4.2. Other Problems with the HIP Header and Packet 158 Structure . . . . . . . . . . . . . . . . . . . . . . 67 159 5.4.3. Invalid Puzzle Solution . . . . . . . . . . . . . . . 67 160 5.4.4. Non-Existing HIP Association . . . . . . . . . . . . 67 161 6. Packet Processing . . . . . . . . . . . . . . . . . . . . . . 68 162 6.1. Processing Outgoing Application Data . . . . . . . . . . 68 163 6.2. Processing Incoming Application Data . . . . . . . . . . 69 164 6.3. Solving the Puzzle . . . . . . . . . . . . . . . . . . . 70 165 6.4. HMAC and SIGNATURE Calculation and Verification . . . . . 71 166 6.4.1. HMAC Calculation . . . . . . . . . . . . . . . . . . 71 167 6.4.2. Signature Calculation . . . . . . . . . . . . . . . . 73 168 6.5. HIP KEYMAT Generation . . . . . . . . . . . . . . . . . . 75 169 6.6. Initiation of a HIP Exchange . . . . . . . . . . . . . . 77 170 6.6.1. Sending Multiple I1s in Parallel . . . . . . . . . . 78 171 6.6.2. Processing Incoming ICMP Protocol Unreachable 172 Messages . . . . . . . . . . . . . . . . . . . . . . 78 173 6.7. Processing Incoming I1 Packets . . . . . . . . . . . . . 78 174 6.7.1. R1 Management . . . . . . . . . . . . . . . . . . . . 80 175 6.7.2. Handling Malformed Messages . . . . . . . . . . . . . 80 176 6.8. Processing Incoming R1 Packets . . . . . . . . . . . . . 80 177 6.8.1. Handling Malformed Messages . . . . . . . . . . . . . 82 178 6.9. Processing Incoming I2 Packets . . . . . . . . . . . . . 82 179 6.9.1. Handling Malformed Messages . . . . . . . . . . . . . 85 180 6.10. Processing Incoming R2 Packets . . . . . . . . . . . . . 85 181 6.11. Sending UPDATE Packets . . . . . . . . . . . . . . . . . 86 182 6.12. Receiving UPDATE Packets . . . . . . . . . . . . . . . . 87 183 6.12.1. Handling a SEQ Parameter in a Received UPDATE 184 Message . . . . . . . . . . . . . . . . . . . . . . . 87 185 6.12.2. Handling an ACK Parameter in a Received UPDATE 186 Packet . . . . . . . . . . . . . . . . . . . . . . . 88 187 6.13. Processing NOTIFY Packets . . . . . . . . . . . . . . . . 89 188 6.14. Processing CLOSE Packets . . . . . . . . . . . . . . . . 89 189 6.15. Processing CLOSE_ACK Packets . . . . . . . . . . . . . . 89 190 6.16. Handling State Loss . . . . . . . . . . . . . . . . . . . 90 191 7. HIP Policies . . . . . . . . . . . . . . . . . . . . . . . . 90 192 8. Security Considerations . . . . . . . . . . . . . . . . . . . 90 193 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 93 194 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 95 195 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 96 196 11.1. Normative References . . . . . . . . . . . . . . . . . . 96 197 11.2. Informative References . . . . . . . . . . . . . . . . . 97 198 Appendix A. Using Responder Puzzles . . . . . . . . . . . . . . 99 199 Appendix B. Generating a Public Key Encoding from an HI . . . . 100 200 Appendix C. Example Checksums for HIP Packets . . . . . . . . . 101 201 C.1. IPv6 HIP Example (I1) . . . . . . . . . . . . . . . . . . 102 202 C.2. IPv4 HIP Packet (I1) . . . . . . . . . . . . . . . . . . 102 203 C.3. TCP Segment . . . . . . . . . . . . . . . . . . . . . . . 102 204 Appendix D. 384-Bit Group . . . . . . . . . . . . . . . . . . . 103 205 Appendix E. OAKLEY Well-Known Group 1 . . . . . . . . . . . . . 103 206 Appendix F. ORCHID Generation Algorithms for HITs . . . . . . . 103 207 F.1. SHA-1 Truncated to 96 Bits . . . . . . . . . . . . . . . 104 208 F.2. SHA-256 Truncated to 96 Bits . . . . . . . . . . . . . . 104 210 1. Introduction 212 This memo specifies the details of the Host Identity Protocol (HIP). 213 A high-level description of the protocol and the underlying 214 architectural thinking is available in the separate HIP architecture 215 description [rfc4423-bis]. Briefly, the HIP architecture proposes an 216 alternative to the dual use of IP addresses as "locators" (routing 217 labels) and "identifiers" (endpoint, or host, identifiers). In HIP, 218 public cryptographic keys, of a public/private key pair, are used as 219 Host Identifiers, to which higher layer protocols are bound instead 220 of an IP address. By using public keys (and their representations) 221 as host identifiers, dynamic changes to IP address sets can be 222 directly authenticated between hosts, and if desired, strong 223 authentication between hosts at the TCP/IP stack level can be 224 obtained. 226 This memo specifies the base HIP protocol ("base exchange") used 227 between hosts to establish an IP-layer communications context, called 228 HIP association, prior to communications. It also defines a packet 229 format and procedures for updating an active HIP association. Other 230 elements of the HIP architecture are specified in other documents, 231 such as. 233 o "Using the Encapsulating Security Payload (ESP) Transport Format 234 with the Host Identity Protocol (HIP)" [RFC5202]: how to use the 235 Encapsulating Security Payload (ESP) for integrity protection and 236 optional encryption 238 o "End-Host Mobility and Multihoming with the Host Identity 239 Protocol" [RFC5206]: how to support mobility and multihoming in 240 HIP 242 o "Host Identity Protocol (HIP) Domain Name System (DNS) Extensions" 243 [RFC5205]: how to extend DNS to contain Host Identity information 245 o "Host Identity Protocol (HIP) Rendezvous Extension" [RFC5204]: 246 using a rendezvous mechanism to contact mobile HIP hosts 248 1.1. A New Namespace and Identifiers 250 The Host Identity Protocol introduces a new namespace, the Host 251 Identity namespace. Some ramifications of this new namespace are 252 explained in the HIP architecture description [rfc4423-bis]. 254 There are two main representations of the Host Identity, the full 255 Host Identifier (HI) and the Host Identity Tag (HIT). The HI is a 256 public key and directly represents the Identity. Since there are 257 different public key algorithms that can be used with different key 258 lengths, the HI is not good for use as a packet identifier, or as an 259 index into the various operational tables needed to support HIP. 260 Consequently, a hash of the HI, the Host Identity Tag (HIT), becomes 261 the operational representation. It is 128 bits long and is used in 262 the HIP payloads and to index the corresponding state in the end 263 hosts. The HIT has an important security property in that it is 264 self-certifying (see Section 3). 266 1.2. The HIP Base Exchange 268 The HIP base exchange is a two-party cryptographic protocol used to 269 establish communications context between hosts. The base exchange is 270 a Sigma-compliant [KRA03] four-packet exchange. The first party is 271 called the Initiator and the second party the Responder. The four- 272 packet design helps to make HIP DoS resilient. The protocol 273 exchanges Diffie-Hellman keys in the 2nd and 3rd packets, and 274 authenticates the parties in the 3rd and 4th packets. Additionally, 275 the Responder starts a puzzle exchange in the 2nd packet, with the 276 Initiator completing it in the 3rd packet before the Responder stores 277 any state from the exchange. 279 The exchange can use the Diffie-Hellman output to encrypt the Host 280 Identity of the Initiator in the 3rd packet (although Aura, et al., 281 [AUR03] notes that such operation may interfere with packet- 282 inspecting middleboxes), or the Host Identity may instead be sent 283 unencrypted. The Responder's Host Identity is not protected. It 284 should be noted, however, that both the Initiator's and the 285 Responder's HITs are transported as such (in cleartext) in the 286 packets, allowing an eavesdropper with a priori knowledge about the 287 parties to verify their identities. 289 Data packets start to flow after the 4th packet. The 3rd and 4th HIP 290 packets may carry a data payload in the future. However, the details 291 of this are to be defined later as more implementation experience is 292 gained. 294 An existing HIP association can be updated using the update mechanism 295 defined in this document, and when the association is no longer 296 needed, it can be closed using the defined closing mechanism. 298 Finally, HIP is designed as an end-to-end authentication and key 299 establishment protocol, to be used with Encapsulated Security Payload 300 (ESP) [RFC5202] and other end-to-end security protocols. The base 301 protocol does not cover all the fine-grained policy control found in 302 Internet Key Exchange (IKE) [RFC4306] that allows IKE to support 303 complex gateway policies. Thus, HIP is not a replacement for IKE. 305 1.3. Memo Structure 307 The rest of this memo is structured as follows. Section 2 defines 308 the central keywords, notation, and terms used throughout the rest of 309 the document. Section 3 defines the structure of the Host Identity 310 and its various representations. Section 4 gives an overview of the 311 HIP base exchange protocol. Sections 5 and 6 define the detail 312 packet formats and rules for packet processing. Finally, Sections 7, 313 8, and 9 discuss policy, security, and IANA considerations, 314 respectively. 316 2. Terms and Definitions 318 2.1. Requirements Terminology 320 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 321 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 322 document are to be interpreted as described in RFC 2119 [RFC2119]. 324 2.2. Notation 326 [x] indicates that x is optional. 328 {x} indicates that x is encrypted. 330 X(y) indicates that y is a parameter of X. 332 i indicates that x exists i times. 334 --> signifies "Initiator to Responder" communication (requests). 336 <-- signifies "Responder to Initiator" communication (replies). 338 | signifies concatenation of information-- e.g., X | Y is the 339 concatenation of X with Y. 341 Ltrunc (H(x), K) denotes the lowest order K bits of the result of 342 the hash function H on the input x. 344 2.3. Definitions 346 Unused Association Lifetime (UAL): Implementation-specific time for 347 which, if no packet is sent or received for this time interval, a 348 host MAY begin to tear down an active association. 350 Maximum Segment Lifetime (MSL): Maximum time that a TCP segment is 351 expected to spend in the network. 353 Exchange Complete (EC): Time that the host spends at the R2-SENT 354 before it moves to ESTABLISHED state. The time is n * I2 355 retransmission timeout, where n is about I2_RETRIES_MAX. 357 ORCHID Generation Algorithm (OGA): Hash algorithm used to generate 358 a Host Identity Tag (HIT) from the Host Identity public key based 359 on the ORCHID specifications [RFC4843-bis]. Currently truncated 360 SHA-1 [FIPS.95-1.1993] and truncated SHA-256 [FIPS.180-2.2002] are 361 defined. 363 Responder's HIT Hash Algorithm (RHASH): Hash algorithm used for 364 various hash calculations in this document. The algorithm is the 365 same as is used to generate the Responder's HIT. The RHASH is 366 defined by the ORCHID Generation Algorithm represented by the 367 respective index bits in the Responder's HIT. 369 Opportunistic mode: HIP base exchange where the Responder's HIT is 370 not known a priori to the Initiator. 372 3. Host Identifier (HI) and Its Representations 374 In this section, the properties of the Host Identifier and Host 375 Identifier Tag are discussed, and the exact format for them is 376 defined. In HIP, the public key of an asymmetric key pair is used as 377 the Host Identifier (HI). Correspondingly, the host itself is 378 defined as the entity that holds the private key from the key pair. 379 See the HIP architecture specification [rfc4423-bis] for more details 380 about the difference between an identity and the corresponding 381 identifier. 383 HIP implementations MUST support the Rivest Shamir Adelman (RSA/ 384 SHA-2) [RFC5702] public key algorithm, and SHOULD support the RSA/ 385 SHA-1 [RFC3110] and the Digital Signature Algorithm (DSA) [RFC2536] 386 algorithms; other algorithms MAY be supported. 388 A hashed encoding of the HI, the Host Identity Tag (HIT), is used in 389 protocols to represent the Host Identity. The HIT is 128 bits long 390 and has the following three key properties: i) it is the same length 391 as an IPv6 address and can be used in address-sized fields in APIs 392 and protocols, ii) it is self-certifying (i.e., given a HIT, it is 393 computationally hard to find a Host Identity key that matches the 394 HIT), and iii) the probability of HIT collision between two hosts is 395 very low. 397 The structure of the HIT is defined in [RFC4843-bis] The HIT consists 398 of three parts: first, an IANA assigned prefix to distinguish it from 399 other IPv6 addresses. Second, a four-bit encoding of the algorithm 400 that was used for generating the hashed representation of the public 401 key. Third, a 96-bit hashed representation of the Host Identity. 402 The encoding of the ORCHID generation algorithm and the exact 403 algorithm for generating the hashed representation is specified in 404 Appendix F. 406 Carrying HIs and HITs in the header of user data packets would 407 increase the overhead of packets. Thus, it is not expected that they 408 are carried in every packet, but other methods are used to map the 409 data packets to the corresponding HIs. In some cases, this makes it 410 possible to use HIP without any additional headers in the user data 411 packets. For example, if ESP is used to protect data traffic, the 412 Security Parameter Index (SPI) carried in the ESP header can be used 413 to map the encrypted data packet to the correct HIP association. 415 3.1. Host Identity Tag (HIT) 417 The Host Identity Tag is a 128-bit value -- a hashed encoding of the 418 Host Identifier. There are two advantages of using a hashed encoding 419 over the actual Host Identity public key in protocols. Firstly, its 420 fixed length makes for easier protocol coding and also better manages 421 the packet size cost of this technology. Secondly, it presents a 422 consistent format to the protocol whatever underlying identity 423 technology is used. 425 RFC 4843-bis [RFC4843-bis] specifies 128-bit hash-based identifiers, 426 called Overlay Routable Cryptographic Hash Identifiers (ORCHIDs). 427 Their prefix, allocated from the IPv6 address block, is defined in 428 [RFC4843-bis]. The Host Identity Tag is a type of ORCHID. 430 3.2. Generating a HIT from an HI 432 The HIT MUST be generated according to the ORCHID generation method 433 described in [RFC4843-bis] using a context ID value of 0xF0EF F02F 434 BFF4 3D0F E793 0C3C 6E61 74EA (this tag value has been generated 435 randomly by the editor of this specification), and an input that 436 encodes the Host Identity field (see Section 5.2.8) present in a HIP 437 payload packet. The hash function and the algorithm used for 438 generating the HIT from the HI depends on the ORCHID Generation 439 Algorithm (OGA) and is indicated by the four bits of the OGA field in 440 the ORCHID. Currently, truncated SHA-1 and SHA-256, as defined 441 below, are the only available OGAs. If a new OGA is needed in the 442 future for HIT generation, a new OGA identifier has to be specified 443 in supplementary documents. 445 For Identities that are either RSA or Digital Signature Algorithm 446 (DSA) public keys, this input consists of the public key encoding as 447 specified in the corresponding DNSSEC document, taking the algorithm- 448 specific portion of the RDATA part of the KEY RR. There are 449 currently only two defined public key algorithms: RSA/SHA-1 and DSA. 450 Hence, either of the following applies: 452 The RSA public key is encoded as defined in [RFC3110] Section 2, 453 taking the exponent length (e_len), exponent (e), and modulus (n) 454 fields concatenated. The length (n_len) of the modulus (n) can be 455 determined from the total HI Length and the preceding HI fields 456 including the exponent (e). Thus, the data taht serves as input 457 for the OGA has the same length as the HI. The fields MUST be 458 encoded in network byte order, as defined in [RFC3110]. 460 The DSA public key is encoded as defined in [RFC2536] Section 2, 461 taking the fields T, Q, P, G, and Y, concatenated. Thus, the data 462 to be hashed is 1 + 20 + 3 * 64 + 3 * 8 * T octets long, where T 463 is the size parameter as defined in [RFC2536]. The size parameter 464 T, affecting the field lengths, MUST be selected as the minimum 465 value that is long enough to accommodate P, G, and Y. The fields 466 MUST be encoded in network byte order, as defined in [RFC2536]. 468 In Appendix B, the public key encoding process is illustrated using 469 pseudo-code. 471 4. Protocol Overview 473 The following material is an overview of the HIP protocol operation, 474 and does not contain all details of the packet formats or the packet 475 processing steps. Sections 5 and 6 describe in more detail the 476 packet formats and packet processing steps, respectively, and are 477 normative in case of any conflicts with this section. 479 The protocol number 139 has been assigned by IANA to the Host 480 Identity Protocol. 482 The HIP payload (Section 5.1) header could be carried in every IP 483 datagram. However, since HIP headers are relatively large (40 484 bytes), it is desirable to 'compress' the HIP header so that the HIP 485 header only occurs in control packets used to establish or change HIP 486 association state. The actual method for header 'compression' and 487 for matching data packets with existing HIP associations (if any) is 488 defined in separate documents, describing transport formats and 489 methods. All HIP implementations MUST implement, at minimum, the ESP 490 transport format for HIP [RFC5202]. 492 4.1. Creating a HIP Association 494 By definition, the system initiating a HIP exchange is the Initiator, 495 and the peer is the Responder. This distinction is forgotten once 496 the base exchange completes, and either party can become the 497 Initiator in future communications. 499 The HIP base exchange serves to manage the establishment of state 500 between an Initiator and a Responder. The first packet, I1, 501 initiates the exchange, and the last three packets, R1, I2, and R2, 502 constitute an authenticated Diffie-Hellman [DIF76] key exchange for 503 session key generation. During the Diffie-Hellman key exchange, a 504 piece of keying material is generated. The HIP association keys are 505 drawn from this keying material. If other cryptographic keys are 506 needed, e.g., to be used with ESP, they are expected to be drawn from 507 the same keying material. 509 The Initiator first sends a trigger packet, I1, to the Responder. 510 The packet contains only the HIT of the Initiator and possibly the 511 HIT of the Responder, if it is known. Note that in some cases it may 512 be possible to replace this trigger packet by some other form of a 513 trigger, in which case the protocol starts with the Responder sending 514 the R1 packet. 516 The second packet, R1, starts the actual exchange. It contains a 517 puzzle -- a cryptographic challenge that the Initiator must solve 518 before continuing the exchange. The level of difficulty of the 519 puzzle can be adjusted based on level of trust with the Initiator, 520 current load, or other factors. In addition, the R1 contains the 521 initial Diffie-Hellman parameters and a signature, covering part of 522 the message. Some fields are left outside the signature to support 523 pre-created R1s. The R1 also contains lists of cryptographic 524 algorithms supported by the Responder. Based on these lists, the 525 Initiator can continue, abort, or restart the base exchange with a 526 different selection of cryptographic algorithms. 528 In the I2 packet, the Initiator must display the solution to the 529 received puzzle. Without a correct solution, the I2 message is 530 discarded. The I2 also contains a Diffie-Hellman parameter that 531 carries needed information for the Responder. The packet is signed 532 by the sender. 534 The R2 packet finalizes the base exchange. The packet is signed. 536 The base exchange is illustrated below. The term "key" refers to the 537 Host Identity public key, and "sig" represents a signature using such 538 a key. The packets contain other parameters not shown in this 539 figure. 541 Initiator Responder 543 I1: trigger exchange 544 --------------------------> 545 select precomputed R1 546 R1: puzzle, D-H, key, sig 547 <------------------------- 548 check sig remain stateless 549 solve puzzle 550 I2: solution, D-H, {key}, sig 551 --------------------------> 552 compute D-H check puzzle 553 check sig 554 R2: sig 555 <-------------------------- 556 check sig compute D-H 558 4.1.1. HIP Puzzle Mechanism 560 The purpose of the HIP puzzle mechanism is to protect the Responder 561 from a number of denial-of-service threats. It allows the Responder 562 to delay state creation until receiving I2. Furthermore, the puzzle 563 allows the Responder to use a fairly cheap calculation to check that 564 the Initiator is "sincere" in the sense that it has churned CPU 565 cycles in solving the puzzle. 567 The puzzle mechanism has been explicitly designed to give space for 568 various implementation options. It allows a Responder implementation 569 to completely delay session-specific state creation until a valid I2 570 is received. In such a case, a correctly formatted I2 can be 571 rejected only once the Responder has checked its validity by 572 computing one hash function. On the other hand, the design also 573 allows a Responder implementation to keep state about received I1s, 574 and match the received I2s against the state, thereby allowing the 575 implementation to avoid the computational cost of the hash function. 576 The drawback of this latter approach is the requirement of creating 577 state. Finally, it also allows an implementation to use other 578 combinations of the space-saving and computation-saving mechanisms. 580 The Responder can remain stateless and drop most spoofed I2s because 581 puzzle calculation is based on the Initiator's Host Identity Tag. The 582 idea is that the Responder has a (perhaps varying) number of pre- 583 calculated R1 packets, and it selects one of these based on the 584 information carried in I1. When the Responder then later receives 585 I2, it can verify that the puzzle has been solved using the 586 Initiator's HIT. This makes it impractical for the attacker to first 587 exchange one I1/R1, and then generate a large number of spoofed I2s 588 that seemingly come from different HITs. The method does not protect 589 from an attacker that uses fixed HITs, though. Against such an 590 attacker a viable approach may be to create a piece of local state, 591 and remember that the puzzle check has previously failed. See 592 Appendix A for one possible implementation. Implementations SHOULD 593 include sufficient randomness to the algorithm so that algorithmic 594 complexity attacks become impossible [CRO03]. 596 The Responder can set the puzzle difficulty for Initiator, based on 597 its level of trust of the Initiator. Because the puzzle is not 598 included in the signature calculation, the Responder can use pre- 599 calculated R1 packets and include the puzzle just before sending the 600 R1 to the Initiator. The Responder SHOULD use heuristics to 601 determine when it is under a denial-of-service attack, and set the 602 puzzle difficulty value K appropriately; see below. 604 4.1.2. Puzzle Exchange 606 The Responder starts the puzzle exchange when it receives an I1. The 607 Responder supplies a random number I, and requires the Initiator to 608 find a number J. To select a proper J, the Initiator must create the 609 concatenation of I, the HITs of the parties, and J, and take a hash 610 over this concatenation using the RHASH algorithm. The lowest order 611 K bits of the result MUST be zeros. The value K sets the difficulty 612 of the puzzle. 614 To generate a proper number J, the Initiator will have to generate a 615 number of Js until one produces the hash target of zeros. The 616 Initiator SHOULD give up after exceeding the puzzle lifetime in the 617 PUZZLE parameter (Section 5.2.4). The Responder needs to re-create 618 the concatenation of I, the HITs, and the provided J, and compute the 619 hash once to prove that the Initiator did its assigned task. 621 To prevent precomputation attacks, the Responder MUST select the 622 number I in such a way that the Initiator cannot guess it. 623 Furthermore, the construction MUST allow the Responder to verify that 624 the value was indeed selected by it and not by the Initiator. See 625 Appendix A for an example on how to implement this. 627 Using the Opaque data field in an ECHO_REQUEST_SIGNED 628 (Section 5.2.18) or in an ECHO_REQUEST_UNSIGNED parameter 629 (Section 5.2.19), the Responder can include some data in R1 that the 630 Initiator must copy unmodified in the corresponding I2 packet. The 631 Responder can generate the Opaque data in various ways; e.g., using 632 some secret, the sent I, and possibly other related data. Using the 633 same secret, the received I (from the I2), and the other related data 634 (if any), the Receiver can verify that it has itself sent the I to 635 the Initiator. The Responder MUST periodically change such a used 636 secret. 638 It is RECOMMENDED that the Responder generates a new puzzle and a new 639 R1 once every few minutes. Furthermore, it is RECOMMENDED that the 640 Responder remembers an old puzzle at least 2*Lifetime seconds after 641 the puzzle has been deprecated. These time values allow a slower 642 Initiator to solve the puzzle while limiting the usability that an 643 old, solved puzzle has to an attacker. 645 NOTE: The protocol developers explicitly considered whether R1 should 646 include a timestamp in order to protect the Initiator from replay 647 attacks. The decision was to NOT include a timestamp. 649 NOTE: The protocol developers explicitly considered whether a memory 650 bound function should be used for the puzzle instead of a CPU-bound 651 function. The decision was not to use memory-bound functions. At 652 the time of the decision, the idea of memory-bound functions was 653 relatively new and their IPR status were unknown. Once there is more 654 experience about memory-bound functions and once their IPR status is 655 better known, it may be reasonable to reconsider this decision. 657 4.1.3. Authenticated Diffie-Hellman Protocol 659 The packets R1, I2, and R2 implement a standard authenticated Diffie- 660 Hellman exchange. The Responder sends one or two public Diffie- 661 Hellman keys and its public authentication key, i.e., its Host 662 Identity, in R1. The signature in R1 allows the Initiator to verify 663 that the R1 has been once generated by the Responder. However, since 664 it is precomputed and therefore does not cover all of the packet, it 665 does not protect from replay attacks. 667 When the Initiator receives an R1, it gets one or two public Diffie- 668 Hellman values from the Responder. If there are two values, it 669 selects the value corresponding to the strongest supported Group ID 670 and computes the Diffie-Hellman session key (Kij). It creates a HIP 671 association using keying material from the session key (see 672 Section 6.5), and may use the association to encrypt its public 673 authentication key, i.e., Host Identity. The resulting I2 contains 674 the Initiator's Diffie-Hellman key and its (optionally encrypted) 675 public authentication key. The signature in I2 covers all of the 676 packet. 678 The Responder extracts the Initiator Diffie-Hellman public key from 679 the I2, computes the Diffie-Hellman session key, creates a 680 corresponding HIP association, and decrypts the Initiator's public 681 authentication key. It can then verify the signature using the 682 authentication key. 684 The final message, R2, is needed to protect the Initiator from replay 685 attacks. 687 4.1.4. HIP Replay Protection 689 The HIP protocol includes the following mechanisms to protect against 690 malicious replays. Responders are protected against replays of I1 691 packets by virtue of the stateless response to I1s with presigned R1 692 messages. Initiators are protected against R1 replays by a 693 monotonically increasing "R1 generation counter" included in the R1. 694 Responders are protected against replays or false I2s by the puzzle 695 mechanism (Section 4.1.1 above), and optional use of opaque data. 696 Hosts are protected against replays to R2s and UPDATEs by use of a 697 less expensive HMAC verification preceding HIP signature 698 verification. 700 The R1 generation counter is a monotonically increasing 64-bit 701 counter that may be initialized to any value. The scope of the 702 counter MAY be system-wide but SHOULD be per Host Identity, if there 703 is more than one local host identity. The value of this counter 704 SHOULD be kept across system reboots and invocations of the HIP base 705 exchange. This counter indicates the current generation of puzzles. 706 Implementations MUST accept puzzles from the current generation and 707 MAY accept puzzles from earlier generations. A system's local 708 counter MUST be incremented at least as often as every time old R1s 709 cease to be valid, and SHOULD never be decremented, lest the host 710 expose its peers to the replay of previously generated, higher 711 numbered R1s. The R1 counter SHOULD NOT roll over. 713 A host may receive more than one R1, either due to sending multiple 714 I1s (Section 6.6.1) or due to a replay of an old R1. When sending 715 multiple I1s, an Initiator SHOULD wait for a small amount of time (a 716 reasonable time may be 2 * expected RTT) after the first R1 reception 717 to allow possibly multiple R1s to arrive, and it SHOULD respond to an 718 R1 among the set with the largest R1 generation counter. If an 719 Initiator is processing an R1 or has already sent an I2 (still 720 waiting for R2) and it receives another R1 with a larger R1 721 generation counter, it MAY elect to restart R1 processing with the 722 fresher R1, as if it were the first R1 to arrive. 724 Upon conclusion of an active HIP association with another host, the 725 R1 generation counter associated with the peer host SHOULD be 726 flushed. A local policy MAY override the default flushing of R1 727 counters on a per-HIT basis. The reason for recommending the 728 flushing of this counter is that there may be hosts where the R1 729 generation counter (occasionally) decreases; e.g., due to hardware 730 failure. 732 4.1.5. Refusing a HIP Exchange 734 A HIP-aware host may choose not to accept a HIP exchange. If the 735 host's policy is to only be an Initiator, it should begin its own HIP 736 exchange. A host MAY choose to have such a policy since only the 737 Initiator's HI is protected in the exchange. There is a risk of a 738 race condition if each host's policy is to only be an Initiator, at 739 which point the HIP exchange will fail. 741 If the host's policy does not permit it to enter into a HIP exchange 742 with the Initiator, it should send an ICMP 'Destination Unreachable, 743 Administratively Prohibited' message. A more complex HIP packet is 744 not used here as it actually opens up more potential DoS attacks than 745 a simple ICMP message. 747 After receiving the R1 packet, the Initiator can determine whether 748 the Responder supports the required cryptographic operations to 749 successfully establish a HIP association. The choice of which kind 750 of source HIT (determined by the ORCHID generation algorithm) is used 751 by the Initiator is made by the Initiator before sending the I1 752 packet. If the Initiator determines that the Responder does not 753 support the chosen HIT type, the Initiator MAY restart the base 754 exchange with a source HIT that is supported by the Responder. The 755 Initator MAY abort the base exchange without noticing the Responder 756 if the Responder does not support a suitable HIT type. 758 4.1.6. HIP Opportunistic Mode 760 It is possible to initiate a HIP negotiation even if the Responder's 761 HI (and HIT) is unknown. In this case, the connection initializing 762 I1 packet contains NULL (all zeros) as the destination HIT. This 763 kind of connection setup is called opportunistic mode. 765 There are both security and API issues involved with the 766 opportunistic mode. 768 Given that the Responder's HI is not known by the Initiator, there 769 must be suitable API calls that allow the Initiator to request, 770 directly or indirectly, that the underlying kernel initiate the HIP 771 base exchange solely based on locators. The Responder's HI will be 772 tentatively available in the R1 packet, and in an authenticated form 773 once the R2 packet has been received and verified. Hence, it could 774 be communicated to the application via new API mechanisms. However, 775 with a backwards-compatible API the application sees only the 776 locators used for the initial contact. Depending on the desired 777 semantics of the API, this can raise the following issues: 779 o The actual locators may later change if an UPDATE message is used, 780 even if from the API perspective the session still appears to be 781 between specific locators. The locator update is still secure, 782 however, and the session is still between the same nodes. 784 o Different sessions between the same locators may result in 785 connections to different nodes, if the implementation no longer 786 remembers which identifier the peer had in another session. This 787 is possible when the peer's locator has changed for legitimate 788 reasons or when an attacker pretends to be a node that has the 789 peer's locator. Therefore, when using opportunistic mode, HIP 790 MUST NOT place any expectation that the peer's HI returned in the 791 R1 message matches any HI previously seen from that address. 793 If the HIP implementation and application do not have the same 794 understanding of what constitutes a session, this may even happen 795 within the same session. For instance, an implementation may not 796 know when HIP state can be purged for UDP-based applications. 798 o As with all HIP exchanges, the handling of locator-based or 799 interface-based policy is unclear for opportunistic mode HIP. An 800 application may make a connection to a specific locator because 801 the application has knowledge of the security properties along the 802 network to that locator. If one of the nodes moves and the 803 locators are updated, these security properties may not be 804 maintained. Depending on the security policy of the application, 805 this may be a problem. This is an area of ongoing study. As an 806 example, there is work to create an API that applications can use 807 to specify their security requirements in a similar context 808 [btns-c-api]. 810 In addition, the following security considerations apply. The 811 generation counter mechanism will be less efficient in protecting 812 against replays of the R1 packet, given that the Responder can choose 813 a replay that uses any HI, not just the one given in the I1 packet . 815 More importantly, the opportunistic exchange is vulnerable to man-in- 816 the-middle attacks, because the Initiator does not have any public 817 key information about the peer. To assess the impacts of this 818 vulnerability, we compare it to vulnerabilities in current, non-HIP- 819 capable communications. 821 An attacker on the path between the two peers can insert itself as a 822 man-in-the-middle by providing its own identifier to the Initiator 823 and then initiating another HIP session towards the Responder. For 824 this to be possible, the Initiator must employ opportunistic mode, 825 and the Responder must be configured to accept a connection from any 826 HIP-enabled node. 828 An attacker outside the path will be unable to do so, given that it 829 cannot respond to the messages in the base exchange. 831 These properties are characteristic also of communications in the 832 current Internet. A client contacting a server without employing 833 end-to-end security may find itself talking to the server via a man- 834 in-the-middle, assuming again that the server is willing to talk to 835 anyone. 837 If end-to-end security is in place, then the worst that can happen in 838 both the opportunistic HIP and normal IP cases is denial-of-service; 839 an entity on the path can disrupt communications, but will be unable 840 to insert itself as a man-in-the-middle. 842 However, once the opportunistic exchange has successfully completed, 843 HIP provides integrity protection and confidentiality for the 844 communications, and can securely change the locators of the 845 endpoints. 847 As a result, it is believed that the HIP opportunistic mode is at 848 least as secure as current IP. 850 4.2. Updating a HIP Association 852 A HIP association between two hosts may need to be updated over time. 853 Examples include the need to rekey expiring user data security 854 associations, add new security associations, or change IP addresses 855 associated with hosts. The UPDATE packet is used for those and other 856 similar purposes. This document only specifies the UPDATE packet 857 format and basic processing rules, with mandatory parameters. The 858 actual usage is defined in separate specifications. 860 HIP provides a general purpose UPDATE packet, which can carry 861 multiple HIP parameters, for updating the HIP state between two 862 peers. The UPDATE mechanism has the following properties: 864 UPDATE messages carry a monotonically increasing sequence number 865 and are explicitly acknowledged by the peer. Lost UPDATEs or 866 acknowledgments may be recovered via retransmission. Multiple 867 UPDATE messages may be outstanding under certain circumstances. 869 UPDATE is protected by both HMAC and HIP_SIGNATURE parameters, 870 since processing UPDATE signatures alone is a potential DoS attack 871 against intermediate systems. 873 UPDATE packets are explicitly acknowledged by the use of an 874 acknowledgment parameter that echoes an individual sequence number 875 received from the peer. A single UPDATE packet may contain both a 876 sequence number and one or more acknowledgment numbers (i.e., 877 piggybacked acknowledgment(s) for the peer's UPDATE). 879 The UPDATE packet is defined in Section 5.3.5. 881 4.3. Error Processing 883 HIP error processing behavior depends on whether or not there exists 884 an active HIP association. In general, if a HIP association exists 885 between the sender and receiver of a packet causing an error 886 condition, the receiver SHOULD respond with a NOTIFY packet. On the 887 other hand, if there are no existing HIP associations between the 888 sender and receiver, or the receiver cannot reasonably determine the 889 identity of the sender, the receiver MAY respond with a suitable ICMP 890 message; see Section 5.4 for more details. 892 The HIP protocol and state machine is designed to recover from one of 893 the parties crashing and losing its state. The following scenarios 894 describe the main use cases covered by the design. 896 No prior state between the two systems. 898 The system with data to send is the Initiator. The process 899 follows the standard four-packet base exchange, establishing 900 the HIP association. 902 The system with data to send has no state with the receiver, but 903 the receiver has a residual HIP association. 905 The system with data to send is the Initiator. The Initiator 906 acts as in no prior state, sending I1 and getting R1. When the 907 Responder receives a valid I2, the old association is 908 'discovered' and deleted, and the new association is 909 established. 911 The system with data to send has a HIP association, but the 912 receiver does not. 914 The system sends data on the outbound user data security 915 association. The receiver 'detects' the situation when it 916 receives a user data packet that it cannot match to any HIP 917 association. The receiving host MUST discard this packet. 919 Optionally, the receiving host MAY send an ICMP packet, with 920 the type Parameter Problem, to inform the sender that the HIP 921 association does not exist (see Section 5.4), and it MAY 922 initiate a new HIP negotiation. However, responding with these 923 optional mechanisms is implementation or policy dependent. 925 4.4. HIP State Machine 927 The HIP protocol itself has little state. In the HIP base exchange, 928 there is an Initiator and a Responder. Once the security 929 associations (SAs) are established, this distinction is lost. If the 930 HIP state needs to be re-established, the controlling parameters are 931 which peer still has state and which has a datagram to send to its 932 peer. The following state machine attempts to capture these 933 processes. 935 The state machine is presented in a single system view, representing 936 either an Initiator or a Responder. There is not a complete overlap 937 of processing logic here and in the packet definitions. Both are 938 needed to completely implement HIP. 940 Implementors must understand that the state machine, as described 941 here, is informational. Specific implementations are free to 942 implement the actual functions differently. Section 6 describes the 943 packet processing rules in more detail. This state machine focuses 944 on the HIP I1, R1, I2, and R2 packets only. Other states may be 945 introduced by mechanisms in other specifications (such as mobility 946 and multihoming). 948 4.4.1. HIP States 950 +---------------------+---------------------------------------------+ 951 | State | Explanation | 952 +---------------------+---------------------------------------------+ 953 | UNASSOCIATED | State machine start | 954 | | | 955 | I1-SENT | Initiating base exchange | 956 | | | 957 | I2-SENT | Waiting to complete base exchange | 958 | | | 959 | R2-SENT | Waiting to complete base exchange | 960 | | | 961 | ESTABLISHED | HIP association established | 962 | | | 963 | CLOSING | HIP association closing, no data can be | 964 | | sent | 965 | | | 966 | CLOSED | HIP association closed, no data can be sent | 967 | | | 968 | E-FAILED | HIP exchange failed | 969 +---------------------+---------------------------------------------+ 971 Table 1: HIP States 973 4.4.2. HIP State Processes 975 System behavior in state UNASSOCIATED, Table 2. 977 +---------------------+---------------------------------------------+ 978 | Trigger | Action | 979 +---------------------+---------------------------------------------+ 980 | User data to send, | Send I1 and go to I1-SENT | 981 | requiring a new HIP | | 982 | association | | 983 | | | 984 | Receive I1 | Send R1 and stay at UNASSOCIATED | 985 | | | 986 | Receive I2, process | If successful, send R2 and go to R2-SENT | 987 | | | 988 | | If fail, stay at UNASSOCIATED | 989 | | | 990 | Receive user data | Optionally send ICMP as defined in | 991 | for unknown HIP | Section 5.4 and stay at UNASSOCIATED | 992 | association | | 993 | | | 994 | Receive CLOSE | Optionally send ICMP Parameter Problem and | 995 | | stay at UNASSOCIATED | 996 | | | 997 | Receive ANYOTHER | Drop and stay at UNASSOCIATED | 998 +---------------------+---------------------------------------------+ 1000 Table 2: UNASSOCIATED - Start state 1002 System behavior in state I1-SENT, Table 3. 1004 +---------------------+---------------------------------------------+ 1005 | Trigger | Action | 1006 +---------------------+---------------------------------------------+ 1007 | Receive I1 | If the local HIT is smaller than the peer | 1008 | | HIT, drop I1 and stay at I1-SENT | 1009 | | | 1010 | | If the local HIT is greater than the peer | 1011 | | HIT, send R1 and stay at I1_SENT | 1012 | | | 1013 | Receive I2, process | If successful, send R2 and go to R2-SENT | 1014 | | | 1015 | | If fail, stay at I1-SENT | 1016 | | | 1017 | Receive R1, process | If OGA of own HIT is not supported by peer, | 1018 | | select supported own HIT, send I1 stay at | 1019 | | I1-SENT | 1020 | | | 1021 | | If successful, send I2 and go to I2-SENT | 1022 | | | 1023 | | If fail, stay at I1-SENT | 1024 | | | 1025 | Receive ANYOTHER | Drop and stay at I1-SENT | 1026 | | | 1027 | Timeout, increment | If counter is less than I1_RETRIES_MAX, | 1028 | timeout counter | send I1 and stay at I1-SENT | 1029 | | | 1030 | | If counter is greater than I1_RETRIES_MAX, | 1031 | | go to E-FAILED | 1032 +---------------------+---------------------------------------------+ 1034 Table 3: I1-SENT - Initiating HIP 1036 System behavior in state I2-SENT, Table 4. 1038 +---------------------+---------------------------------------------+ 1039 | Trigger | Action | 1040 +---------------------+---------------------------------------------+ 1041 | Receive I1 | Send R1 and stay at I2-SENT | 1042 | | | 1043 | Receive R1, process | If successful, send I2 and cycle at I2-SENT | 1044 | | | 1045 | | If fail, stay at I2-SENT | 1046 | | | 1047 | Receive I2, process | If successful and local HIT is smaller than | 1048 | | the peer HIT, drop I2 and stay at I2-SENT | 1049 | | | 1050 | | If successful and local HIT is greater than | 1051 | | the peer HIT, send R2 and go to R2-SENT | 1052 | | | 1053 | | If fail, stay at I2-SENT | 1054 | | | 1055 | Receive R2, process | If successful, go to ESTABLISHED | 1056 | | | 1057 | | If fail, stay at I2-SENT | 1058 | | | 1059 | Receive ANYOTHER | Drop and stay at I2-SENT | 1060 | | | 1061 | Timeout, increment | If counter is less than I2_RETRIES_MAX, | 1062 | timeout counter | send I2 and stay at I2-SENT | 1063 | | | 1064 | | If counter is greater than I2_RETRIES_MAX, | 1065 | | go to E-FAILED | 1066 +---------------------+---------------------------------------------+ 1068 Table 4: I2-SENT - Waiting to finish HIP 1070 System behavior in state R2-SENT, Table 5. 1072 +---------------------+---------------------------------------------+ 1073 | Trigger | Action | 1074 +---------------------+---------------------------------------------+ 1075 | Receive I1 | Send R1 and stay at R2-SENT | 1076 | | | 1077 | Receive I2, process | If successful, send R2 and cycle at R2-SENT | 1078 | | | 1079 | | If fail, stay at R2-SENT | 1080 | | | 1081 | Receive R1 | Drop and stay at R2-SENT | 1082 | | | 1083 | Receive R2 | Drop and stay at R2-SENT | 1084 | | | 1085 | Receive data or | Move to ESTABLISHED | 1086 | UPDATE | | 1087 | | | 1088 | Exchange Complete | Move to ESTABLISHED | 1089 | Timeout | | 1090 +---------------------+---------------------------------------------+ 1092 Table 5: R2-SENT - Waiting to finish HIP 1094 System behavior in state ESTABLISHED, Table 6. 1096 +---------------------+---------------------------------------------+ 1097 | Trigger | Action | 1098 +---------------------+---------------------------------------------+ 1099 | Receive I1 | Send R1 and stay at ESTABLISHED | 1100 | | | 1101 | Receive I2, process | If successful, send R2, drop old HIP | 1102 | with puzzle and | association, establish a new HIP | 1103 | possible Opaque | association, go to R2-SENT | 1104 | data verification | | 1105 | | | 1106 | | If fail, stay at ESTABLISHED | 1107 | | | 1108 | Receive R1 | Drop and stay at ESTABLISHED | 1109 | | | 1110 | Receive R2 | Drop and stay at ESTABLISHED | 1111 | | | 1112 | Receive user data | Process and stay at ESTABLISHED | 1113 | for HIP association | | 1114 | | | 1115 | No packet | Send CLOSE and go to CLOSING | 1116 | sent/received | | 1117 | during UAL minutes | | 1118 | | | 1119 | Receive CLOSE, | If successful, send CLOSE_ACK and go to | 1120 | process | CLOSED | 1121 | | | 1122 | | If fail, stay at ESTABLISHED | 1123 +---------------------+---------------------------------------------+ 1125 Table 6: ESTABLISHED - HIP association established 1127 System behavior in state CLOSING, Table 7. 1129 +---------------------+---------------------------------------------+ 1130 | Trigger | Action | 1131 +---------------------+---------------------------------------------+ 1132 | User data to send, | Send I1 and stay at CLOSING | 1133 | requires the | | 1134 | creation of another | | 1135 | incarnation of the | | 1136 | HIP association | | 1137 | | | 1138 | Receive I1 | Send R1 and stay at CLOSING | 1139 | | | 1140 | Receive I2, process | If successful, send R2 and go to R2-SENT | 1141 | | | 1142 | | If fail, stay at CLOSING | 1143 | | | 1144 | Receive R1, process | If successful, send I2 and go to I2-SENT | 1145 | | | 1146 | | If fail, stay at CLOSING | 1147 | | | 1148 | Receive CLOSE, | If successful, send CLOSE_ACK, discard | 1149 | process | state and go to CLOSED | 1150 | | | 1151 | | If fail, stay at CLOSING | 1152 | | | 1153 | Receive CLOSE_ACK, | If successful, discard state and go to | 1154 | process | UNASSOCIATED | 1155 | | | 1156 | | If fail, stay at CLOSING | 1157 | | | 1158 | Receive ANYOTHER | Drop and stay at CLOSING | 1159 | | | 1160 | Timeout, increment | If timeout sum is less than UAL+MSL | 1161 | timeout sum, reset | minutes, retransmit CLOSE and stay at | 1162 | timer | CLOSING | 1163 | | | 1164 | | If timeout sum is greater than UAL+MSL | 1165 | | minutes, go to UNASSOCIATED | 1166 +---------------------+---------------------------------------------+ 1168 Table 7: CLOSING - HIP association has not been used for UAL minutes 1169 System behavior in state CLOSED, Table 8. 1171 +---------------------+---------------------------------------------+ 1172 | Trigger | Action | 1173 +---------------------+---------------------------------------------+ 1174 | Datagram to send, | Send I1, and stay at CLOSED | 1175 | requires the | | 1176 | creation of another | | 1177 | incarnation of the | | 1178 | HIP association | | 1179 | | | 1180 | Receive I1 | Send R1 and stay at CLOSED | 1181 | | | 1182 | Receive I2, process | If successful, send R2 and go to R2-SENT | 1183 | | | 1184 | | If fail, stay at CLOSED | 1185 | | | 1186 | Receive R1, process | If successful, send I2 and go to I2-SENT | 1187 | | | 1188 | | If fail, stay at CLOSED | 1189 | | | 1190 | Receive CLOSE, | If successful, send CLOSE_ACK, stay at | 1191 | process | CLOSED | 1192 | | | 1193 | | If fail, stay at CLOSED | 1194 | | | 1195 | Receive CLOSE_ACK, | If successful, discard state and go to | 1196 | process | UNASSOCIATED | 1197 | | | 1198 | | If fail, stay at CLOSED | 1199 | | | 1200 | Receive ANYOTHER | Drop and stay at CLOSED | 1201 | | | 1202 | Timeout (UAL+2MSL) | Discard state, and go to UNASSOCIATED | 1203 +---------------------+---------------------------------------------+ 1205 Table 8: CLOSED - CLOSE_ACK sent, resending CLOSE_ACK if necessary 1207 System behavior in state E-FAILED, Table 9. 1209 +-------------------------+-----------------------------------------+ 1210 | Trigger | Action | 1211 +-------------------------+-----------------------------------------+ 1212 | Wait for | Go to UNASSOCIATED. Re-negotiation is | 1213 | implementation-specific | possible after moving to UNASSOCIATED | 1214 | time | state. | 1215 +-------------------------+-----------------------------------------+ 1216 Table 9: E-FAILED - HIP failed to establish association with peer 1218 4.4.3. Simplified HIP State Diagram 1220 The following diagram shows the major state transitions. Transitions 1221 based on received packets implicitly assume that the packets are 1222 successfully authenticated or processed. 1224 +-+ +----------------------------+ 1225 I1 received, send R1 | | | | 1226 | v v | 1227 Datagram to send +--------------+ I2 received, send R2 | 1228 +---------------| UNASSOCIATED |----------------+ | 1229 | +-+ +--------------+ | | 1230 Send I1 | | | Alg. not supported, send I1 | | 1231 v | v | | 1232 +---------+ I2 received, send R2 | | 1233 +---->| I1-SENT |---------------------------------------+ | | 1234 | +---------+ | | | 1235 | | +------------------------+ | | | 1236 | | R1 received, | I2 received, send R2 | | | | 1237 | v send I2 | v v v | 1238 | +---------+ | +---------+ | 1239 | +->| I2-SENT |------------+ | R2-SENT |<----+ | 1240 | | +---------+ +---------+ | | 1241 | | | | | | 1242 | | | data| | | 1243 | |receive | or| | | 1244 | |R1, send | EC timeout| receive I2,| | 1245 | |I2 |R2 received +--------------+ | send R2| | 1246 | | +----------->| ESTABLISHED |<--------+ | | 1247 | | +--------------+ | | 1248 | | | | | receive I2, send R2 | | 1249 | | recv+------------+ | +------------------------+ | 1250 | | CLOSE,| | | | 1251 | | send| No packet sent| | | 1252 | | CLOSE_ACK| /received for | timeout | | 1253 | | | UAL min, send | +---------+<-+ (UAL+MSL) | | 1254 | | | CLOSE +--->| CLOSING |--+ retransmit | | 1255 | | | +---------+ CLOSE | | 1256 +--|------------|----------------------+| | | | | | 1257 +------------|-----------------------+ | | +-----------------+ | 1258 | | +-----------+ +-------------------|--+ 1259 | +-----------+ | receive CLOSE, CLOSE_ACK | | 1260 | | | send CLOSE_ACK received or | | 1261 | | | timeout | | 1262 | | | (UAL+MSL) | | 1263 | v v | | 1264 | +--------+ receive I2, send R2 | | 1265 +-----------------------| CLOSED |----------------------------+ | 1266 +--------+ /-----------------------+ 1267 ^ | \-------/ timeout (UAL+2MSL), 1268 | | move to UNASSOCIATED 1269 +-+ 1270 CLOSE received, send CLOSE_ACK 1272 4.5. User Data Considerations 1274 4.5.1. TCP and UDP Pseudo-Header Computation for User Data 1276 When computing TCP and UDP checksums on user data packets that flow 1277 through sockets bound to HITs, the IPv6 pseudo-header format 1278 [RFC2460] MUST be used, even if the actual addresses on the packet 1279 are IPv4 addresses. Additionally, the HITs MUST be used in the place 1280 of the IPv6 addresses in the IPv6 pseudo-header. Note that the 1281 pseudo-header for actual HIP payloads is computed differently; see 1282 Section 5.1.1. 1284 4.5.2. Sending Data on HIP Packets 1286 A future version of this document may define how to include user data 1287 on various HIP packets. However, currently the HIP header is a 1288 terminal header, and not followed by any other headers. 1290 4.5.3. Transport Formats 1292 The actual data transmission format, used for user data after the HIP 1293 base exchange, is not defined in this document. Such transport 1294 formats and methods are described in separate specifications. All 1295 HIP implementations MUST implement, at minimum, the ESP transport 1296 format for HIP [RFC5202]. 1298 When new transport formats are defined, they get the type value from 1299 the HIP Transform type value space 2048-4095. The order in which the 1300 transport formats are presented in the R1 packet, is the preferred 1301 order. The last of the transport formats MUST be ESP transport 1302 format, represented by the ESP_TRANSFORM parameter. 1304 4.5.4. Reboot and SA Timeout Restart of HIP 1306 Simulating a loss of state is a potential DoS attack. The following 1307 process has been crafted to manage state recovery without presenting 1308 a DoS opportunity. 1310 If a host reboots or the HIP association times out, it has lost its 1311 HIP state. If the host that lost state has a datagram to send to the 1312 peer, it simply restarts the HIP base exchange. After the base 1313 exchange has completed, the Initiator can create a new SA and start 1314 sending data. The peer does not reset its state until it receives a 1315 valid I2 HIP packet. 1317 If a system receives a user data packet that cannot be matched to any 1318 existing HIP association, it is possible that it has lost the state 1319 and its peer has not. It MAY send an ICMP packet with the Parameter 1320 Problem type, and with the pointer pointing to the referred HIP- 1321 related association information. Reacting to such traffic depends on 1322 the implementation and the environment where the implementation is 1323 used. 1325 If the host, that apparently has lost its state, decides to restart 1326 the HIP base exchange, it sends an I1 packet to the peer. After the 1327 base exchange has been completed successfully, the Initiator can 1328 create a new HIP association and the peer drops its old SA and 1329 creates a new one. 1331 4.6. Certificate Distribution 1333 This document does not define how to use certificates or how to 1334 transfer them between hosts. These functions are expected to be 1335 defined in a future specification. A parameter type value, meant to 1336 be used for carrying certificates, is reserved, though: CERT, Type 1337 768; see Section 5.2. 1339 5. Packet Formats 1341 5.1. Payload Format 1343 All HIP packets start with a fixed header. 1345 0 1 2 3 1346 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 1347 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1348 | Next Header | Header Length |0| Packet Type | VER. | RES.|1| 1349 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1350 | Checksum | Controls | 1351 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1352 | Sender's Host Identity Tag (HIT) | 1353 | | 1354 | | 1355 | | 1356 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1357 | Receiver's Host Identity Tag (HIT) | 1358 | | 1359 | | 1360 | | 1361 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1362 | | 1363 / HIP Parameters / 1364 / / 1365 | | 1366 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1367 The HIP header is logically an IPv6 extension header. However, this 1368 document does not describe processing for Next Header values other 1369 than decimal 59, IPPROTO_NONE, the IPv6 'no next header' value. 1370 Future documents MAY do so. However, current implementations MUST 1371 ignore trailing data if an unimplemented Next Header value is 1372 received. 1374 The Header Length field contains the length of the HIP Header and HIP 1375 parameters in 8-byte units, excluding the first 8 bytes. Since all 1376 HIP headers MUST contain the sender's and receiver's HIT fields, the 1377 minimum value for this field is 4, and conversely, the maximum length 1378 of the HIP Parameters field is (255*8)-32 = 2008 bytes. Note: this 1379 sets an additional limit for sizes of parameters included in the 1380 Parameters field, independent of the individual parameter maximum 1381 lengths. 1383 The Packet Type indicates the HIP packet type. The individual packet 1384 types are defined in the relevant sections. If a HIP host receives a 1385 HIP packet that contains an unknown packet type, it MUST drop the 1386 packet. 1388 The HIP Version is four bits. The current version is 1. The version 1389 number is expected to be incremented only if there are incompatible 1390 changes to the protocol. Most extensions can be handled by defining 1391 new packet types, new parameter types, or new controls. 1393 The following three bits are reserved for future use. They MUST be 1394 zero when sent, and they SHOULD be ignored when handling a received 1395 packet. 1397 The two fixed bits in the header are reserved for potential SHIM6 1398 compatibility [RFC5533]. For implementations adhering (only) to this 1399 specification, they MUST be set as shown when sending and MUST be 1400 ignored when receiving. This is to ensure optimal forward 1401 compatibility. Note that for implementations that implement other 1402 compatible specifications in addition to this specification, the 1403 corresponding rules may well be different. For example, in the case 1404 that the forthcoming SHIM6 protocol happens to be compatible with 1405 this specification, an implementation that implements both this 1406 specification and the SHIM6 protocol may need to check these bits in 1407 order to determine how to handle the packet. 1409 The HIT fields are always 128 bits (16 bytes) long. 1411 5.1.1. Checksum 1413 Since the checksum covers the source and destination addresses in the 1414 IP header, it must be recomputed on HIP-aware NAT devices. 1416 If IPv6 is used to carry the HIP packet, the pseudo-header [RFC2460] 1417 contains the source and destination IPv6 addresses, HIP packet length 1418 in the pseudo-header length field, a zero field, and the HIP protocol 1419 number (see Section 4) in the Next Header field. The length field is 1420 in bytes and can be calculated from the HIP header length field: (HIP 1421 Header Length + 1) * 8. 1423 In case of using IPv4, the IPv4 UDP pseudo-header format [RFC0768] is 1424 used. In the pseudo-header, the source and destination addresses are 1425 those used in the IP header, the zero field is obviously zero, the 1426 protocol is the HIP protocol number (see Section 4), and the length 1427 is calculated as in the IPv6 case. 1429 5.1.2. HIP Controls 1431 The HIP Controls section conveys information about the structure of 1432 the packet and capabilities of the host. 1434 The following fields have been defined: 1436 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1437 | | | | | | | | | | | | | | | |A| 1438 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1440 A - Anonymous: If this is set, the sender's HI in this packet is 1441 anonymous, i.e., one not listed in a directory. Anonymous HIs 1442 SHOULD NOT be stored. This control is set in packets R1 and/or 1443 I2. The peer receiving an anonymous HI may choose to refuse it. 1445 The rest of the fields are reserved for future use and MUST be set to 1446 zero on sent packets and ignored on received packets. 1448 5.1.3. HIP Fragmentation Support 1450 A HIP implementation must support IP fragmentation/reassembly. 1451 Fragment reassembly MUST be implemented in both IPv4 and IPv6, but 1452 fragment generation is REQUIRED to be implemented in IPv4 (IPv4 1453 stacks and networks will usually do this by default) and RECOMMENDED 1454 to be implemented in IPv6. In IPv6 networks, the minimum MTU is 1455 larger, 1280 bytes, than in IPv4 networks. The larger MTU size is 1456 usually sufficient for most HIP packets, and therefore fragment 1457 generation may not be needed. If a host expects to send HIP packets 1458 that are larger than the minimum IPv6 MTU, it MUST implement fragment 1459 generation even for IPv6. 1461 In IPv4 networks, HIP packets may encounter low MTUs along their 1462 routed path. Since HIP does not provide a mechanism to use multiple 1463 IP datagrams for a single HIP packet, support for path MTU discovery 1464 does not bring any value to HIP in IPv4 networks. HIP-aware NAT 1465 devices MUST perform any IPv4 reassembly/fragmentation. 1467 All HIP implementations have to be careful while employing a 1468 reassembly algorithm so that the algorithm is sufficiently resistant 1469 to DoS attacks. 1471 Because certificate chains can cause the packet to be fragmented and 1472 fragmentation can open implementation to denial-of-service attacks 1473 [KAU03], it is strongly recommended that the separate document 1474 specifying the certificate usage in the HIP Base Exchange defines the 1475 usage of "Hash and URL" formats rather than including certificates in 1476 exchanges. With this, most problems related to DoS attacks with 1477 fragmentation can be avoided. 1479 5.2. HIP Parameters 1481 The HIP Parameters are used to carry the public key associated with 1482 the sender's HIT, together with related security and other 1483 information. They consist of ordered parameters, encoded in TLV 1484 format. 1486 The following parameter types are currently defined. 1488 +------------------------+-------+----------+-----------------------+ 1489 | TLV | Type | Length | Data | 1490 +------------------------+-------+----------+-----------------------+ 1491 | R1_COUNTER | 128 | 12 | System Boot Counter | 1492 | | | | | 1493 | PUZZLE | 257 | 12 | K and Random #I | 1494 | | | | | 1495 | SOLUTION | 321 | 20 | K, Random #I and | 1496 | | | | puzzle solution J | 1497 | | | | | 1498 | SEQ | 385 | 4 | Update packet ID | 1499 | | | | number | 1500 | | | | | 1501 | ACK | 449 | variable | Update packet ID | 1502 | | | | number | 1503 | | | | | 1504 | DIFFIE_HELLMAN | 513 | variable | public key | 1505 | | | | | 1506 | HIP_TRANSFORM | 577 | variable | HIP Encryption and | 1507 | | | | Integrity Transform | 1508 | | | | | 1509 | ENCRYPTED | 641 | variable | Encrypted part of I2 | 1510 | | | | packet | 1511 | | | | | 1512 | HOST_ID | 705 | variable | Host Identity with | 1513 | | | | Fully-Qualified | 1514 | | | | Domain FQDN (Name) or | 1515 | | | | Network Access | 1516 | | | | Identifier (NAI) | 1517 | | | | | 1518 | OGA_LIST | 715 | variable | List of the OGAs | 1519 | | | | supported by the | 1520 | | | | Responder | 1521 | | | | | 1522 | CERT | 768 | variable | HI Certificate; used | 1523 | | | | to transfer | 1524 | | | | certificates. Usage | 1525 | | | | is not currently | 1526 | | | | defined, but it will | 1527 | | | | be specified in a | 1528 | | | | separate document | 1529 | | | | once needed. | 1530 | | | | | 1531 | NOTIFICATION | 832 | variable | Informational data | 1532 | | | | | 1533 | ECHO_REQUEST_SIGNED | 897 | variable | Opaque data to be | 1534 | | | | echoed back; under | 1535 | | | | signature | 1536 | ECHO_RESPONSE_SIGNED | 961 | variable | Opaque data echoed | 1537 | | | | back; under signature | 1538 | | | | | 1539 | HMAC | 61505 | variable | HMAC-based message | 1540 | | | | authentication code, | 1541 | | | | with key material | 1542 | | | | from HIP_TRANSFORM | 1543 | | | | | 1544 | HMAC_2 | 61569 | variable | HMAC based message | 1545 | | | | authentication code, | 1546 | | | | with key material | 1547 | | | | from HIP_TRANSFORM. | 1548 | | | | Compared to HMAC, the | 1549 | | | | HOST_ID parameter is | 1550 | | | | included in HMAC_2 | 1551 | | | | calculation. | 1552 | | | | | 1553 | HIP_SIGNATURE_2 | 61633 | variable | Signature of the R1 | 1554 | | | | packet | 1555 | | | | | 1556 | HIP_SIGNATURE | 61697 | variable | Signature of the | 1557 | | | | packet | 1558 | | | | | 1559 | ECHO_REQUEST_UNSIGNED | 63661 | variable | Opaque data to be | 1560 | | | | echoed back; after | 1561 | | | | signature | 1562 | | | | | 1563 | ECHO_RESPONSE_UNSIGNED | 63425 | variable | Opaque data echoed | 1564 | | | | back; after signature | 1565 +------------------------+-------+----------+-----------------------+ 1567 Because the ordering (from lowest to highest) of HIP parameters is 1568 strictly enforced (see Section 5.2.1), the parameter type values for 1569 existing parameters have been spaced to allow for future protocol 1570 extensions. Parameters numbered between 0-1023 are used in HIP 1571 handshake and update procedures and are covered by signatures. 1572 Parameters numbered between 1024-2047 are reserved. Parameters 1573 numbered between 2048-4095 are used for parameters related to HIP 1574 transform types. Parameters numbered between 4096 and (2^16 - 2^12) 1575 61439 are reserved. Parameters numbered between 61440-62463 are used 1576 for signatures and signed MACs. Parameters numbered between 62464- 1577 63487 are used for parameters that fall outside of the signed area of 1578 the packet. Parameters numbered between 63488-64511 are used for 1579 rendezvous and other relaying services. Parameters numbered between 1580 64512-65535 are reserved. 1582 5.2.1. TLV Format 1584 The TLV-encoded parameters are described in the following 1585 subsections. The type-field value also describes the order of these 1586 fields in the packet, except for type values from 2048 to 4095 which 1587 are reserved for new transport forms. The parameters MUST be 1588 included in the packet such that their types form an increasing 1589 order. If the parameter can exist multiple times in the packet, the 1590 type value may be the same in consecutive parameters. If the order 1591 does not follow this rule, the packet is considered to be malformed 1592 and it MUST be discarded. 1594 Parameters using type values from 2048 up to 4095 are transport 1595 formats. Currently, one transport format is defined: the ESP 1596 transport format [RFC5202]. The order of these parameters does not 1597 follow the order of their type value, but they are put in the packet 1598 in order of preference. The first of the transport formats it the 1599 most preferred, and so on. 1601 All of the TLV parameters have a length (including Type and Length 1602 fields), which is a multiple of 8 bytes. When needed, padding MUST 1603 be added to the end of the parameter so that the total length becomes 1604 a multiple of 8 bytes. This rule ensures proper alignment of data. 1605 Any added padding bytes MUST be zeroed by the sender, and their 1606 values SHOULD NOT be checked by the receiver. 1608 Consequently, the Length field indicates the length of the Contents 1609 field (in bytes). The total length of the TLV parameter (including 1610 Type, Length, Contents, and Padding) is related to the Length field 1611 according to the following formula: 1613 Total Length = 11 + Length - (Length + 3) % 8; 1615 where % is the modulo operator 1616 0 1 2 3 1617 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 1618 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1619 | Type |C| Length | 1620 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1621 | | 1622 / Contents / 1623 / +-+-+-+-+-+-+-+-+ 1624 | | Padding | 1625 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1627 Type Type code for the parameter. 16 bits long, C-bit 1628 being part of the Type code. 1629 C Critical. One if this parameter is critical, and 1630 MUST be recognized by the recipient, zero otherwise. 1631 The C bit is considered to be a part of the Type 1632 field. Consequently, critical parameters are always 1633 odd and non-critical ones have an even value. 1634 Length Length of the Contents, in bytes. 1635 Contents Parameter specific, defined by Type 1636 Padding Padding, 0-7 bytes, added if needed 1638 Critical parameters MUST be recognized by the recipient. If a 1639 recipient encounters a critical parameter that it does not recognize, 1640 it MUST NOT process the packet any further. It MAY send an ICMP or 1641 NOTIFY, as defined in Section 4.3. 1643 Non-critical parameters MAY be safely ignored. If a recipient 1644 encounters a non-critical parameter that it does not recognize, it 1645 SHOULD proceed as if the parameter was not present in the received 1646 packet. 1648 5.2.2. Defining New Parameters 1650 Future specifications may define new parameters as needed. When 1651 defining new parameters, care must be taken to ensure that the 1652 parameter type values are appropriate and leave suitable space for 1653 other future extensions. One must remember that the parameters MUST 1654 always be arranged in increasing order by Type code, thereby limiting 1655 the order of parameters (see Section 5.2.1). 1657 The following rules must be followed when defining new parameters. 1659 1. The low-order bit C of the Type code is used to distinguish 1660 between critical and non-critical parameters. 1662 2. A new parameter may be critical only if an old recipient ignoring 1663 it would cause security problems. In general, new parameters 1664 SHOULD be defined as non-critical, and expect a reply from the 1665 recipient. 1667 3. If a system implements a new critical parameter, it MUST provide 1668 the ability to set the associated feature off, such that the 1669 critical parameter is not sent at all. The configuration option 1670 must be well documented. Implementations operating in a mode 1671 adhering to this specification MUST disable the sending of new 1672 critical parameters. In other words, the management interface 1673 MUST allow vanilla standards-only mode as a default configuration 1674 setting, and MAY allow new critical payloads to be configured on 1675 (and off). 1677 4. See Section 9 for allocation rules regarding Type codes. 1679 5.2.3. R1_COUNTER 1681 0 1 2 3 1682 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 1683 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1684 | Type | Length | 1685 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1686 | Reserved, 4 bytes | 1687 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1688 | R1 generation counter, 8 bytes | 1689 | | 1690 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1692 Type 128 1693 Length 12 1694 R1 generation 1695 counter The current generation of valid puzzles 1697 The R1_COUNTER parameter contains a 64-bit unsigned integer in 1698 network-byte order, indicating the current generation of valid 1699 puzzles. The sender is supposed to increment this counter 1700 periodically. It is RECOMMENDED that the counter value is 1701 incremented at least as often as old PUZZLE values are deprecated so 1702 that SOLUTIONs to them are no longer accepted. 1704 The R1_COUNTER parameter is optional. It SHOULD be included in the 1705 R1 (in which case, it is covered by the signature), and if present in 1706 the R1, it MAY be echoed (including the Reserved field verbatim) by 1707 the Initiator in the I2. 1709 5.2.4. PUZZLE 1711 0 1 2 3 1712 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 1713 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1714 | Type | Length | 1715 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1716 | K, 1 byte | Lifetime | Opaque, 2 bytes | 1717 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1718 | Random #I, 8 bytes | 1719 | | 1720 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1722 Type 257 1723 Length 12 1724 K K is the number of verified bits 1725 Lifetime puzzle lifetime 2^(value-32) seconds 1726 Opaque data set by the Responder, indexing the puzzle 1727 Random #I random number 1729 Random #I is represented as a 64-bit integer, K and Lifetime as 8-bit 1730 integers, all in network byte order. 1732 The PUZZLE parameter contains the puzzle difficulty K and a 64-bit 1733 puzzle random integer #I. The Puzzle Lifetime indicates the time 1734 during which the puzzle solution is valid, and sets a time limit that 1735 should not be exceeded by the Initiator while it attempts to solve 1736 the puzzle. The lifetime is indicated as a power of 2 using the 1737 formula 2^(Lifetime-32) seconds. A puzzle MAY be augmented with an 1738 ECHO_REQUEST_SIGNED or an ECHO_REQUEST_UNSIGNED parameter included in 1739 the R1; the contents of the echo request are then echoed back in the 1740 ECHO_RESPONSE_SIGNED or in the ECHO_RESPONSE_UNSIGNED, allowing the 1741 Responder to use the included information as a part of its puzzle 1742 processing. 1744 The Opaque and Random #I field are not covered by the HIP_SIGNATURE_2 1745 parameter. 1747 5.2.5. SOLUTION 1749 0 1 2 3 1750 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 1751 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1752 | Type | Length | 1753 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1754 | K, 1 byte | Reserved | Opaque, 2 bytes | 1755 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1756 | Random #I, 8 bytes | 1757 | | 1758 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1759 | Puzzle solution #J, 8 bytes | 1760 | | 1761 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1763 Type 321 1764 Length 20 1765 K K is the number of verified bits 1766 Reserved zero when sent, ignored when received 1767 Opaque copied unmodified from the received PUZZLE 1768 parameter 1769 Random #I random number 1770 Puzzle solution #J random number 1772 Random #I and Random #J are represented as 64-bit integers, K as an 1773 8-bit integer, all in network byte order. 1775 The SOLUTION parameter contains a solution to a puzzle. It also 1776 echoes back the random difficulty K, the Opaque field, and the puzzle 1777 integer #I. 1779 5.2.6. DIFFIE_HELLMAN 1781 0 1 2 3 1782 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 1783 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1784 | Type | Length | 1785 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1786 | Group ID | Public Value Length | Public Value / 1787 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1788 / | 1789 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1790 | Group ID | Public Value Length | Public Value / 1791 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1792 / | padding | 1793 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1795 Type 513 1796 Length length in octets, excluding Type, Length, and 1797 padding 1798 Group ID defines values for p and g 1799 Public Value length of the following Public Value in octets 1800 Length 1801 Public Value the sender's public Diffie-Hellman key 1803 The following Group IDs have been defined: 1805 Group Value 1806 Reserved 0 1807 384-bit group 1 1808 OAKLEY well-known group 1 2 1809 1536-bit MODP group 3 1810 3072-bit MODP group 4 1811 6144-bit MODP group 5 1812 8192-bit MODP group 6 1814 The MODP Diffie-Hellman groups are defined in [RFC3526]. The OAKLEY 1815 well-known group 1 is defined in Appendix E. 1817 The sender can include at most two different Diffie-Hellman public 1818 values in the DIFFIE_HELLMAN parameter. This gives the possibility, 1819 e.g., for a server to provide a weaker encryption possibility for a 1820 PDA host that is not powerful enough. It is RECOMMENDED that the 1821 Initiator, receiving more than one public value, selects the stronger 1822 one, if it supports it. 1824 A HIP implementation MUST implement Group IDs 1 and 3. The 384-bit 1825 group can be used when lower security is enough (e.g., web surfing) 1826 and when the equipment is not powerful enough (e.g., some PDAs). It 1827 is REQUIRED that the default configuration allows Group ID 1 usage, 1828 but it is RECOMMENDED that applications that need stronger security 1829 turn Group ID 1 support off. Equipment powerful enough SHOULD 1830 implement also Group ID 5. The 384-bit group is defined in 1831 Appendix D. 1833 To avoid unnecessary failures during the base exchange, the rest of 1834 the groups SHOULD be implemented in hosts where resources are 1835 adequate. 1837 5.2.7. HIP_TRANSFORM 1839 0 1 2 3 1840 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 1841 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1842 | Type | Length | 1843 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1844 | Suite ID #1 | Suite ID #2 | 1845 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1846 | Suite ID #n | Padding | 1847 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1849 Type 577 1850 Length length in octets, excluding Type, Length, and 1851 padding 1852 Suite ID defines the HIP Suite to be used 1854 The following Suite IDs are defined ([RFC4307],[RFC2451]): 1856 Suite ID Value 1858 RESERVED 0 1859 AES-CBC with HMAC-SHA-1 1 1860 3DES-CBC with HMAC-SHA-1 2 1861 3DES-CBC with HMAC-MD5 3 1862 BLOWFISH-CBC with HMAC-SHA-1 4 1863 NULL-ENCRYPT with HMAC-SHA-1 5 1864 NULL-ENCRYPT with HMAC-MD5 6 1866 The sender of a HIP_TRANSFORM parameter MUST make sure that there are 1867 no more than six (6) HIP Suite IDs in one HIP_TRANSFORM parameter. 1868 Conversely, a recipient MUST be prepared to handle received transport 1869 parameters that contain more than six Suite IDs by accepting the 1870 first six Suite IDs and dropping the rest. The limited number of 1871 transforms sets the maximum size of HIP_TRANSFORM parameter. As the 1872 default configuration, the HIP_TRANSFORM parameter MUST contain at 1873 least one of the mandatory Suite IDs. There MAY be a configuration 1874 option that allows the administrator to override this default. 1876 The Responder lists supported and desired Suite IDs in order of 1877 preference in the R1, up to the maximum of six Suite IDs. The 1878 Initiator MUST choose only one of the corresponding Suite IDs. That 1879 Suite ID will be used for generating the I2. 1881 Mandatory implementations: AES-CBC with HMAC-SHA1 and NULL-ENCRYPTION 1882 with HMAC-SHA1. 1884 5.2.8. HOST_ID 1886 0 1 2 3 1887 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 1888 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1889 | Type | Length | 1890 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1891 | HI Length |DI-type| DI Length | 1892 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1893 | Host Identity / 1894 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1895 / | Domain Identifier / 1896 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1897 / | Padding | 1898 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1900 Type 705 1901 Length length in octets, excluding Type, Length, and 1902 Padding 1903 HI Length length of the Host Identity in octets 1904 DI-type type of the following Domain Identifier field 1905 DI Length length of the FQDN or NAI in octets 1906 Host Identity actual Host Identity 1907 Domain Identifier the identifier of the sender 1909 The Host Identity is represented in RFC 4034 [RFC4034] format. The 1910 algorithms used in RDATA format are the following: 1912 Algorithms Values 1914 RESERVED 0 1915 DSA 3 [RFC2536] (RECOMMENDED) 1916 RSA/SHA-1 5 [RFC3110] (RECOMMENDED) 1917 RSA/SHA-2 7 [RFC5702] (REQUIRED) 1919 The following DI-types have been defined: 1921 Type Value 1922 none included 0 1923 FQDN 1 1924 NAI 2 1926 FQDN Fully Qualified Domain Name, in binary format. 1927 NAI Network Access Identifier 1929 The format for the FQDN is defined in RFC 1035 [RFC1035] Section 3.1. 1930 The format for NAI is defined in [RFC4282] 1932 If there is no Domain Identifier, i.e., the DI-type field is zero, 1933 the DI Length field is set to zero as well. 1935 5.2.9. OGA_LIST 1937 0 1 2 3 1938 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 1939 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1940 | Type | Length | 1941 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1942 | OGA #1 | OGA #2 | 1943 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1944 | OGA #n | Padding | 1945 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1947 Type 715 1948 Length length in octets, excluding Type, Length, and 1949 padding 1950 OGA defines the ORCHID generation algorithm available 1951 to the host 1953 The following OGAs are defined: 1955 Host Identity Hash Value 1957 RESERVED 0 1958 SHA-1 1 1959 SHA-256 2 1961 The OGA_LIST parameter contains a list of the supported OGAs of the 1962 Responder. The Responder sends the OGA list in the signed part of 1963 the R1 packet. Based on the OGA list, the Initiator can determine 1964 which OGAs of its HITs are supported by the Responder. 1966 5.2.10. HMAC 1968 0 1 2 3 1969 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 1970 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1971 | Type | Length | 1972 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1973 | | 1974 | HMAC | 1975 / / 1976 / +-------------------------------+ 1977 | | Padding | 1978 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1980 Type 61505 1981 Length length in octets, excluding Type, Length, and 1982 Padding 1983 HMAC HMAC computed over the HIP packet, excluding the 1984 HMAC parameter and any following parameters, such 1985 as HIP_SIGNATURE, HIP_SIGNATURE_2, 1986 ECHO_REQUEST_UNSIGNED, or ECHO_RESPONSE_UNSIGNED. 1987 The checksum field MUST be set to zero and the HIP 1988 header length in the HIP common header MUST be 1989 calculated not to cover any excluded parameters 1990 when the HMAC is calculated. The size of the 1991 HMAC is the natural size of the hash computation 1992 output depending on the used hash function. 1994 The HMAC calculation and verification process is presented in 1995 Section 6.4.1. 1997 5.2.11. HMAC_2 1999 The parameter structure is the same as in Section 5.2.10. The fields 2000 are: 2002 Type 61569 2003 Length length in octets, excluding Type, Length, and 2004 Padding 2005 HMAC HMAC computed over the HIP packet, excluding the 2006 HMAC parameter and any following parameters such 2007 as HIP_SIGNATURE, HIP_SIGNATURE_2, 2008 ECHO_REQUEST_UNSIGNED, or ECHO_RESPONSE_UNSIGNED, 2009 and including an additional sender's HOST_ID 2010 parameter during the HMAC calculation. The 2011 checksum field MUST be set to zero and the HIP 2012 header length in the HIP common header MUST be 2013 calculated not to cover any excluded parameters 2014 when the HMAC is calculated. The size of the 2015 HMAC is the natural size of the hash computation 2016 output depending on the used hash function. 2018 The HMAC calculation and verification process is presented in 2019 Section 6.4.1. 2021 5.2.12. HIP_SIGNATURE 2023 0 1 2 3 2024 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 2025 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2026 | Type | Length | 2027 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2028 | SIG alg | Signature / 2029 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2030 / | Padding | 2031 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2033 Type 61697 2034 Length length in octets, excluding Type, Length, and 2035 Padding 2036 SIG alg signature algorithm 2037 Signature the signature is calculated over the HIP packet, 2038 excluding the HIP_SIGNATURE parameter and any 2039 parameters that follow the HIP_SIGNATURE parameter. 2040 The checksum field MUST be set to zero, and the HIP 2041 header length in the HIP common header MUST be 2042 calculated only to the beginning of the 2043 HIP_SIGNATURE parameter when the signature is 2044 calculated. 2046 The signature algorithms are defined in Section 5.2.8. The signature 2047 in the Signature field is encoded using the proper method depending 2048 on the signature algorithm (e.g., according to [RFC3110] in case of 2049 RSA/SHA-1, according to [RFC5702] in case of RSA/SHA-256, or 2050 according to [RFC2536] in case of DSA). 2052 The HIP_SIGNATURE calculation and verification process is presented 2053 in Section 6.4.2. 2055 5.2.13. HIP_SIGNATURE_2 2057 The parameter structure is the same as in Section 5.2.12. The fields 2058 are: 2060 Type 61633 2061 Length length in octets, excluding Type, Length, and 2062 Padding 2063 SIG alg signature algorithm 2064 Signature Within the R1 packet that contains the HIP_SIGNATURE_2 2065 parameter, the Initiator's HIT, the checksum 2066 field, and the Opaque and Random #I fields in the 2067 PUZZLE parameter MUST be set to zero while 2068 computing the HIP_SIGNATURE_2 signature. Further, 2069 the HIP packet length in the HIP header MUST be 2070 adjusted as if the HIP_SIGNATURE_2 was not in the 2071 packet during the signature calculation, i.e., the 2072 HIP packet length points to the beginning of 2073 the HIP_SIGNATURE_2 parameter during signing and 2074 verification. 2076 Zeroing the Initiator's HIT makes it possible to create R1 packets 2077 beforehand, to minimize the effects of possible DoS attacks. Zeroing 2078 the Random #I and Opaque fields within the PUZZLE parameter allows 2079 these fields to be populated dynamically on precomputed R1s. 2081 Signature calculation and verification follows the process in 2082 Section 6.4.2. 2084 5.2.14. SEQ 2086 0 1 2 3 2087 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 2088 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2089 | Type | Length | 2090 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2091 | Update ID | 2092 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2094 Type 385 2095 Length 4 2096 Update ID 32-bit sequence number 2098 The Update ID is an unsigned quantity, initialized by a host to zero 2099 upon moving to ESTABLISHED state. The Update ID has scope within a 2100 single HIP association, and not across multiple associations or 2101 multiple hosts. The Update ID is incremented by one before each new 2102 UPDATE that is sent by the host; the first UPDATE packet originated 2103 by a host has an Update ID of 0. 2105 5.2.15. ACK 2107 0 1 2 3 2108 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 2109 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2110 | Type | Length | 2111 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2112 | peer Update ID | 2113 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2115 Type 449 2116 Length variable (multiple of 4) 2117 peer Update ID 32-bit sequence number corresponding to the 2118 Update ID being ACKed. 2120 The ACK parameter includes one or more Update IDs that have been 2121 received from the peer. The Length field identifies the number of 2122 peer Update IDs that are present in the parameter. 2124 5.2.16. ENCRYPTED 2126 0 1 2 3 2127 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 2128 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2129 | Type | Length | 2130 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2131 | Reserved | 2132 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2133 | IV / 2134 / / 2135 / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2136 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / 2137 / Encrypted data / 2138 / / 2139 / +-------------------------------+ 2140 / | Padding | 2141 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2143 Type 641 2144 Length length in octets, excluding Type, Length, and 2145 Padding 2146 Reserved zero when sent, ignored when received 2147 IV Initialization vector, if needed, otherwise 2148 nonexistent. The length of the IV is inferred from 2149 the HIP transform. 2150 Encrypted The data is encrypted using an encryption algorithm 2151 data as defined in HIP transform. 2153 The ENCRYPTED parameter encapsulates another parameter, the encrypted 2154 data, which holds one or more HIP parameters in block encrypted form. 2156 Consequently, the first fields in the encapsulated parameter(s) are 2157 Type and Length of the first such parameter, allowing the contents to 2158 be easily parsed after decryption. 2160 The field labelled "Encrypted data" consists of the output of one or 2161 more HIP parameters concatenated together that have been passed 2162 through an encryption algorithm. Each of these inner parameters is 2163 padded according to the rules of Section 5.2.1 for padding individual 2164 parameters. As a result, the concatenated parameters will be a block 2165 of data that is 8-byte aligned. 2167 Some encryption algorithms require that the data to be encrypted must 2168 be a multiple of the cipher algorithm block size. In this case, the 2169 above block of data MUST include additional padding, as specified by 2170 the encryption algorithm. The size of the extra padding is selected 2171 so that the length of the unencrypted data block is a multiple of the 2172 cipher block size. The encryption algorithm may specify padding 2173 bytes other than zero; for example, AES [FIPS.197.2001] uses the 2174 PKCS5 padding scheme (see section 6.1.1 of [RFC2898]) where the 2175 remaining n bytes to fill the block each have the value n. This 2176 yields an "unencrypted data" block that is transformed to an 2177 "encrypted data" block by the cipher suite. This extra padding added 2178 to the set of parameters to satisfy the cipher block alignment rules 2179 is not counted in HIP TLV length fields, and this extra padding 2180 should be removed by the cipher suite upon decryption. 2182 Note that the length of the cipher suite output may be smaller or 2183 larger than the length of the set of parameters to be encrypted, 2184 since the encryption process may compress the data or add additional 2185 padding to the data. 2187 Once this encryption process is completed, the Encrypted data field 2188 is ready for inclusion in the Parameter. If necessary, additional 2189 Padding for 8-byte alignment is then added according to the rules of 2190 Section 5.2.1. 2192 5.2.17. NOTIFICATION 2194 The NOTIFICATION parameter is used to transmit informational data, 2195 such as error conditions and state transitions, to a HIP peer. A 2196 NOTIFICATION parameter may appear in the NOTIFY packet type. The use 2197 of the NOTIFICATION parameter in other packet types is for further 2198 study. 2200 0 1 2 3 2201 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 2202 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2203 | Type | Length | 2204 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2205 | Reserved | Notify Message Type | 2206 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2207 | / 2208 / Notification Data / 2209 / +---------------+ 2210 / | Padding | 2211 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2213 Type 832 2214 Length length in octets, excluding Type, Length, and 2215 Padding 2216 Reserved zero when sent, ignored when received 2217 Notify Message specifies the type of notification 2218 Type 2219 Notification informational or error data transmitted in addition 2220 Data to the Notify Message Type. Values for this field 2221 are type specific (see below). 2222 Padding any Padding, if necessary, to make the parameter a 2223 multiple of 8 bytes. 2225 Notification information can be error messages specifying why an SA 2226 could not be established. It can also be status data that a process 2227 managing an SA database wishes to communicate with a peer process. 2228 The table below lists the Notification messages and their 2229 corresponding values. 2231 To avoid certain types of attacks, a Responder SHOULD avoid sending a 2232 NOTIFICATION to any host with which it has not successfully verified 2233 a puzzle solution. 2235 Types in the range 0-16383 are intended for reporting errors and in 2236 the range 16384-65535 for other status information. An 2237 implementation that receives a NOTIFY packet with a NOTIFICATION 2238 error parameter in response to a request packet (e.g., I1, I2, 2239 UPDATE) SHOULD assume that the corresponding request has failed 2240 entirely. Unrecognized error types MUST be ignored except that they 2241 SHOULD be logged. 2243 Notify payloads with status types MUST be ignored if not recognized. 2245 NOTIFICATION PARAMETER - ERROR TYPES Value 2246 ------------------------------------ ----- 2247 UNSUPPORTED_CRITICAL_PARAMETER_TYPE 1 2249 Sent if the parameter type has the "critical" bit set and the 2250 parameter type is not recognized. Notification Data contains 2251 the two-octet parameter type. 2253 INVALID_SYNTAX 7 2255 Indicates that the HIP message received was invalid because 2256 some type, length, or value was out of range or because the 2257 request was rejected for policy reasons. To avoid a denial- 2258 of-service attack using forged messages, this status may only be 2259 returned for packets whose HMAC (if present) and SIGNATURE have 2260 been verified. This status MUST be sent in response to any 2261 error not covered by one of the other status types, and should 2262 not contain details to avoid leaking information to someone 2263 probing a node. To aid debugging, more detailed error 2264 information SHOULD be written to a console or log. 2266 NO_DH_PROPOSAL_CHOSEN 14 2268 None of the proposed group IDs was acceptable. 2270 INVALID_DH_CHOSEN 15 2272 The D-H Group ID field does not correspond to one offered 2273 by the Responder. 2275 NO_HIP_PROPOSAL_CHOSEN 16 2277 None of the proposed HIP Transform crypto suites was 2278 acceptable. 2280 INVALID_HIP_TRANSFORM_CHOSEN 17 2282 The HIP Transform crypto suite does not correspond to 2283 one offered by the Responder. 2285 AUTHENTICATION_FAILED 24 2287 Sent in response to a HIP signature failure, except when 2288 the signature verification fails in a NOTIFY message. 2290 CHECKSUM_FAILED 26 2292 Sent in response to a HIP checksum failure. 2294 HMAC_FAILED 28 2295 Sent in response to a HIP HMAC failure. 2297 ENCRYPTION_FAILED 32 2299 The Responder could not successfully decrypt the 2300 ENCRYPTED parameter. 2302 INVALID_HIT 40 2304 Sent in response to a failure to validate the peer's 2305 HIT from the corresponding HI. 2307 BLOCKED_BY_POLICY 42 2309 The Responder is unwilling to set up an association 2310 for some policy reason (e.g., received HIT is NULL 2311 and policy does not allow opportunistic mode). 2313 SERVER_BUSY_PLEASE_RETRY 44 2315 The Responder is unwilling to set up an association as it is 2316 suffering under some kind of overload and has chosen to shed load 2317 by rejecting the Initiator's request. The Initiator may retry; 2318 however, the Initiator MUST find another (different) puzzle 2319 solution for any such retries. Note that the Initiator may need 2320 to obtain a new puzzle with a new I1/R1 exchange. 2322 NOTIFY MESSAGES - STATUS TYPES Value 2323 ------------------------------ ----- 2325 I2_ACKNOWLEDGEMENT 16384 2327 The Responder has an I2 from the Initiator but had to queue the I2 2328 for processing. The puzzle was correctly solved and the Responder 2329 is willing to set up an association but currently has a number of 2330 I2s in the processing queue. R2 will be sent after the I2 has 2331 been processed. 2333 5.2.18. ECHO_REQUEST_SIGNED 2335 0 1 2 3 2336 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 2337 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2338 | Type | Length | 2339 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2340 | Opaque data (variable length) | 2341 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2343 Type 897 2344 Length variable 2345 Opaque data opaque data, supposed to be meaningful only to the 2346 node that sends ECHO_REQUEST_SIGNED and receives a 2347 corresponding ECHO_RESPONSE_SIGNED or 2348 ECHO_RESPONSE_UNSIGNED. 2350 The ECHO_REQUEST_SIGNED parameter contains an opaque blob of data 2351 that the sender wants to get echoed back in the corresponding reply 2352 packet. 2354 The ECHO_REQUEST_SIGNED and corresponding echo response parameters 2355 MAY be used for any purpose where a node wants to carry some state in 2356 a request packet and get it back in a response packet. The 2357 ECHO_REQUEST_SIGNED is covered by the HMAC and SIGNATURE. A HIP 2358 packet can contain only one ECHO_REQUEST_SIGNED or 2359 ECHO_REQUEST_UNSIGNED parameter. The ECHO_REQUEST_SIGNED parameter 2360 MUST be responded to with a corresponding echo response. 2361 ECHO_RESPONSE_SIGNED SHOULD be used, but if it is not possible, e.g., 2362 due to a middlebox-provided response, it MAY be responded to with an 2363 ECHO_RESPONSE_UNSIGNED. 2365 5.2.19. ECHO_REQUEST_UNSIGNED 2367 0 1 2 3 2368 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 2369 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2370 | Type | Length | 2371 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2372 | Opaque data (variable length) | 2373 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2375 Type 63661 2376 Length variable 2377 Opaque data opaque data, supposed to be meaningful only to the 2378 node that sends ECHO_REQUEST_UNSIGNED and receives a 2379 corresponding ECHO_RESPONSE_UNSIGNED. 2381 The ECHO_REQUEST_UNSIGNED parameter contains an opaque blob of data 2382 that the sender wants to get echoed back in the corresponding reply 2383 packet. 2385 The ECHO_REQUEST_UNSIGNED and corresponding echo response parameters 2386 MAY be used for any purpose where a node wants to carry some state in 2387 a request packet and get it back in a response packet. The 2388 ECHO_REQUEST_UNSIGNED is not covered by the HMAC and SIGNATURE. A 2389 HIP packet can contain one or more ECHO_REQUEST_UNSIGNED parameters. 2390 It is possible that middleboxes add ECHO_REQUEST_UNSIGNED parameters 2391 in HIP packets passing by. The sender has to create the Opaque field 2392 so that it can later identify and remove the corresponding 2393 ECHO_RESPONSE_UNSIGNED parameter. 2395 The ECHO_REQUEST_UNSIGNED parameter MUST be responded to with an 2396 ECHO_RESPONSE_UNSIGNED parameter. 2398 5.2.20. ECHO_RESPONSE_SIGNED 2400 0 1 2 3 2401 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 2402 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2403 | Type | Length | 2404 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2405 | Opaque data (variable length) | 2406 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2408 Type 961 2409 Length variable 2410 Opaque data opaque data, copied unmodified from the 2411 ECHO_REQUEST_SIGNED or ECHO_REQUEST_UNSIGNED 2412 parameter that triggered this response. 2414 The ECHO_RESPONSE_SIGNED parameter contains an opaque blob of data 2415 that the sender of the ECHO_REQUEST_SIGNED wants to get echoed back. 2416 The opaque data is copied unmodified from the ECHO_REQUEST_SIGNED 2417 parameter. 2419 The ECHO_REQUEST_SIGNED and ECHO_RESPONSE_SIGNED parameters MAY be 2420 used for any purpose where a node wants to carry some state in a 2421 request packet and get it back in a response packet. The 2422 ECHO_RESPONSE_SIGNED is covered by the HMAC and SIGNATURE. 2424 5.2.21. ECHO_RESPONSE_UNSIGNED 2426 0 1 2 3 2427 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 2428 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2429 | Type | Length | 2430 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2431 | Opaque data (variable length) | 2432 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2434 Type 63425 2435 Length variable 2436 Opaque data opaque data, copied unmodified from the 2437 ECHO_REQUEST_SIGNED or ECHO_REQUEST_UNSIGNED 2438 parameter that triggered this response. 2440 The ECHO_RESPONSE_UNSIGNED parameter contains an opaque blob of data 2441 that the sender of the ECHO_REQUEST_SIGNED or ECHO_REQUEST_UNSIGNED 2442 wants to get echoed back. The opaque data is copied unmodified from 2443 the corresponding echo request parameter. 2445 The echo request and ECHO_RESPONSE_UNSIGNED parameters MAY be used 2446 for any purpose where a node wants to carry some state in a request 2447 packet and get it back in a response packet. The 2448 ECHO_RESPONSE_UNSIGNED is not covered by the HMAC and SIGNATURE. 2450 5.3. HIP Packets 2452 There are eight basic HIP packets (see Table 10). Four are for the 2453 HIP base exchange, one is for updating, one is for sending 2454 notifications, and two are for closing a HIP association. 2456 +------------------+------------------------------------------------+ 2457 | Packet type | Packet name | 2458 +------------------+------------------------------------------------+ 2459 | 1 | I1 - the HIP Initiator Packet | 2460 | | | 2461 | 2 | R1 - the HIP Responder Packet | 2462 | | | 2463 | 3 | I2 - the Second HIP Initiator Packet | 2464 | | | 2465 | 4 | R2 - the Second HIP Responder Packet | 2466 | | | 2467 | 16 | UPDATE - the HIP Update Packet | 2468 | | | 2469 | 17 | NOTIFY - the HIP Notify Packet | 2470 | | | 2471 | 18 | CLOSE - the HIP Association Closing Packet | 2472 | | | 2473 | 19 | CLOSE_ACK - the HIP Closing Acknowledgment | 2474 | | Packet | 2475 +------------------+------------------------------------------------+ 2477 Table 10: HIP packets and packet type numbers 2479 Packets consist of the fixed header as described in Section 5.1, 2480 followed by the parameters. The parameter part, in turn, consists of 2481 zero or more TLV-coded parameters. 2483 In addition to the base packets, other packet types will be defined 2484 later in separate specifications. For example, support for mobility 2485 and multi-homing is not included in this specification. 2487 See Notation (Section 2.2) for used operations. 2489 In the future, an OPTIONAL upper-layer payload MAY follow the HIP 2490 header. The Next Header field in the header indicates if there is 2491 additional data following the HIP header. The HIP packet, however, 2492 MUST NOT be fragmented. This limits the size of the possible 2493 additional data in the packet. 2495 5.3.1. I1 - the HIP Initiator Packet 2497 The HIP header values for the I1 packet: 2499 Header: 2500 Packet Type = 1 2501 SRC HIT = Initiator's HIT 2502 DST HIT = Responder's HIT, or NULL 2504 IP ( HIP () ) 2506 The I1 packet contains only the fixed HIP header. 2508 Valid control bits: none 2510 The Initiator gets the Responder's HIT either from a DNS lookup of 2511 the Responder's FQDN, from some other repository, or from a local 2512 table. If the Initiator does not know the Responder's HIT, it may 2513 attempt to use opportunistic mode by using NULL (all zeros) as the 2514 Responder's HIT. See also "HIP Opportunistic Mode" (Section 4.1.6). 2516 Since this packet is so easy to spoof even if it were signed, no 2517 attempt is made to add to its generation or processing cost. 2519 Implementations MUST be able to handle a storm of received I1 2520 packets, discarding those with common content that arrive within a 2521 small time delta. 2523 5.3.2. R1 - the HIP Responder Packet 2525 The HIP header values for the R1 packet: 2527 Header: 2528 Packet Type = 2 2529 SRC HIT = Responder's HIT 2530 DST HIT = Initiator's HIT 2532 IP ( HIP ( [ R1_COUNTER, ] 2533 PUZZLE, 2534 DIFFIE_HELLMAN, 2535 HIP_TRANSFORM, 2536 HOST_ID, 2537 [ ECHO_REQUEST_SIGNED, ] 2538 HIP_SIGNATURE_2 ) 2539 <, ECHO_REQUEST_UNSIGNED >i) 2541 Valid control bits: A 2543 If the Responder's HI is an anonymous one, the A control MUST be set. 2545 The Initiator's HIT MUST match the one received in I1. If the 2546 Responder has multiple HIs, the Responder's HIT used MUST match 2547 Initiator's request. If the Initiator used opportunistic mode, the 2548 Responder may select freely among its HIs. See also "HIP 2549 Opportunistic Mode" (Section 4.1.6). 2551 The R1 generation counter is used to determine the currently valid 2552 generation of puzzles. The value is increased periodically, and it 2553 is RECOMMENDED that it is increased at least as often as solutions to 2554 old puzzles are no longer accepted. 2556 The Puzzle contains a Random #I and the difficulty K. The difficulty 2557 K indicates the number of lower-order bits, in the puzzle hash 2558 result, that must be zeros; see Section 4.1.2. The Random #I is not 2559 covered by the signature and must be zeroed during the signature 2560 calculation, allowing the sender to select and set the #I into a 2561 precomputed R1 just prior sending it to the peer. 2563 The Diffie-Hellman value is ephemeral, and one value SHOULD be used 2564 only for one connection. Once the Responder has received a valid 2565 response to an R1 packet, that Diffie-Hellman value SHOULD be 2566 deprecated. Because it is possible that the Responder has sent the 2567 same Diffie-Hellman value to different hosts simultaneously in 2568 corresponding R1 packets, those responses should also be accepted. 2569 However, as a defense against I1 storms, an implementation MAY 2570 propose, and re-use if not avoidable, the same Diffie-Hellman value 2571 for a period of time, for example, 15 minutes. By using a small 2572 number of different puzzles for a given Diffie-Hellman value, the R1 2573 packets can be precomputed and delivered as quickly as I1 packets 2574 arrive. A scavenger process should clean up unused Diffie-Hellman 2575 values and puzzles. 2577 Re-using Diffie-Hellman public keys opens up the potential security 2578 risk of more than one Initiator ending up with the same keying 2579 material (due to faulty random number generators). Also, more than 2580 one Initiator using the same Responder public key half may lead to 2581 potentially easier cryptographic attacks and to imperfect forward 2582 security. 2584 However, these risks involved in re-using the same key are 2585 statistical; that is, the authors are not aware of any mechanism that 2586 would allow manipulation of the protocol so that the risk of the re- 2587 use of any given Responder Diffie-Hellman public key would differ 2588 from the base probability. Consequently, it is RECOMMENDED that 2589 implementations avoid re-using the same D-H key with multiple 2590 Initiators, but because the risk is considered statistical and not 2591 known to be manipulable, the implementations MAY re-use a key in 2592 order to ease resource-constrained implementations and to increase 2593 the probability of successful communication with legitimate clients 2594 even under an I1 storm. In particular, when it is too expensive to 2595 generate enough precomputed R1 packets to supply each potential 2596 Initiator with a different D-H key, the Responder MAY send the same 2597 D-H key to several Initiators, thereby creating the possibility of 2598 multiple legitimate Initiators ending up using the same Responder- 2599 side public key. However, as soon as the Responder knows that it 2600 will use a particular D-H key, it SHOULD stop offering it. This 2601 design is aimed to allow resource-constrained Responders to offer 2602 services under I1 storms and to simultaneously make the probability 2603 of D-H key re-use both statistical and as low as possible. 2605 If a future version of this protocol is considered, we strongly 2606 recommend that these issues be studied again. Especially, the 2607 current design allows hosts to become potentially more vulnerable to 2608 a statistical, low-probability problem during I1 storm attacks than 2609 what they are if no attack is taking place; whether this is 2610 acceptable or not should be reconsidered in the light of any new 2611 experience gained. 2613 The HIP_TRANSFORM contains the encryption and integrity algorithms 2614 supported by the Responder to protect the HI exchange, in the order 2615 of preference. All implementations MUST support the AES [RFC3602] 2616 with HMAC-SHA-1-96 [RFC2404]. 2618 The ECHO_REQUEST_SIGNED and ECHO_REQUEST_UNSIGNED contains data that 2619 the sender wants to receive unmodified in the corresponding response 2620 packet in the ECHO_RESPONSE_SIGNED or ECHO_RESPONSE_UNSIGNED 2621 parameter. 2623 The signature is calculated over the whole HIP envelope, after 2624 setting the Initiator's HIT, header checksum, as well as the Opaque 2625 field and the Random #I in the PUZZLE parameter temporarily to zero, 2626 and excluding any parameters that follow the signature, as described 2627 in Section 5.2.13. This allows the Responder to use precomputed R1s. 2628 The Initiator SHOULD validate this signature. It SHOULD check that 2629 the Responder's HI received matches with the one expected, if any. 2631 5.3.3. I2 - the Second HIP Initiator Packet 2633 The HIP header values for the I2 packet: 2635 Header: 2636 Type = 3 2637 SRC HIT = Initiator's HIT 2638 DST HIT = Responder's HIT 2640 IP ( HIP ( [R1_COUNTER,] 2641 SOLUTION, 2642 DIFFIE_HELLMAN, 2643 HIP_TRANSFORM, 2644 ENCRYPTED { HOST_ID } or HOST_ID, 2645 [ ECHO_RESPONSE_SIGNED ,] 2646 HMAC, 2647 HIP_SIGNATURE 2648 <, ECHO_RESPONSE_UNSIGNED>i ) ) 2650 Valid control bits: A 2652 The HITs used MUST match the ones used previously. 2654 If the Initiator's HI is an anonymous one, the A control MUST be set. 2656 The Initiator MAY include an unmodified copy of the R1_COUNTER 2657 parameter received in the corresponding R1 packet into the I2 packet. 2659 The Solution contains the Random #I from R1 and the computed #J. The 2660 low-order K bits of the RHASH(I | ... | J) MUST be zero. 2662 The Diffie-Hellman value is ephemeral. If precomputed, a scavenger 2663 process should clean up unused Diffie-Hellman values. The Responder 2664 may re-use Diffie-Hellman values under some conditions as specified 2665 in Section 5.3.2. 2667 The HIP_TRANSFORM contains the single encryption and integrity 2668 transform selected by the Initiator, that will be used to protect the 2669 HI exchange. The chosen transform MUST correspond to one offered by 2670 the Responder in the R1. All implementations MUST support the AES 2671 transform [RFC3602]. 2673 The Initiator's HI MAY be encrypted using the HIP_TRANSFORM 2674 encryption algorithm. The keying material is derived from the 2675 Diffie-Hellman exchanged as defined in Section 6.5. 2677 The ECHO_RESPONSE_SIGNED and ECHO_RESPONSE_UNSIGNED contain the 2678 unmodified Opaque data copied from the corresponding echo request 2679 parameter. 2681 The HMAC is calculated over the whole HIP envelope, excluding any 2682 parameters after the HMAC, as described in Section 6.4.1. The 2683 Responder MUST validate the HMAC. 2685 The signature is calculated over the whole HIP envelope, excluding 2686 any parameters after the HIP_SIGNATURE, as described in 2687 Section 5.2.12. The Responder MUST validate this signature. It MAY 2688 use either the HI in the packet or the HI acquired by some other 2689 means. 2691 5.3.4. R2 - the Second HIP Responder Packet 2693 The HIP header values for the R2 packet: 2695 Header: 2696 Packet Type = 4 2697 SRC HIT = Responder's HIT 2698 DST HIT = Initiator's HIT 2700 IP ( HIP ( HMAC_2, HIP_SIGNATURE ) ) 2702 Valid control bits: none 2704 The HMAC_2 is calculated over the whole HIP envelope, with 2705 Responder's HOST_ID parameter concatenated with the HIP envelope. 2706 The HOST_ID parameter is removed after the HMAC calculation. The 2707 procedure is described in Section 6.4.1. 2709 The signature is calculated over the whole HIP envelope. 2711 The Initiator MUST validate both the HMAC and the signature. 2713 5.3.5. UPDATE - the HIP Update Packet 2715 Support for the UPDATE packet is MANDATORY. 2717 The HIP header values for the UPDATE packet: 2719 Header: 2720 Packet Type = 16 2721 SRC HIT = Sender's HIT 2722 DST HIT = Recipient's HIT 2724 IP ( HIP ( [SEQ, ACK, ] HMAC, HIP_SIGNATURE ) ) 2726 Valid control bits: None 2728 The UPDATE packet contains mandatory HMAC and HIP_SIGNATURE 2729 parameters, and other optional parameters. 2731 The UPDATE packet contains zero or one SEQ parameter. The presence 2732 of a SEQ parameter indicates that the receiver MUST ACK the UPDATE. 2733 An UPDATE that does not contain a SEQ parameter is simply an ACK of a 2734 previous UPDATE and itself MUST NOT be ACKed. 2736 An UPDATE packet contains zero or one ACK parameters. The ACK 2737 parameter echoes the SEQ sequence number of the UPDATE packet being 2738 ACKed. A host MAY choose to ACK more than one UPDATE packet at a 2739 time; e.g., the ACK may contain the last two SEQ values received, for 2740 robustness to ACK loss. ACK values are not cumulative; each received 2741 unique SEQ value requires at least one corresponding ACK value in 2742 reply. Received ACKs that are redundant are ignored. 2744 The UPDATE packet may contain both a SEQ and an ACK parameter. In 2745 this case, the ACK is being piggybacked on an outgoing UPDATE. In 2746 general, UPDATEs carrying SEQ SHOULD be ACKed upon completion of the 2747 processing of the UPDATE. A host MAY choose to hold the UPDATE 2748 carrying ACK for a short period of time to allow for the possibility 2749 of piggybacking the ACK parameter, in a manner similar to TCP delayed 2750 acknowledgments. 2752 A sender MAY choose to forgo reliable transmission of a particular 2753 UPDATE (e.g., it becomes overcome by events). The semantics are such 2754 that the receiver MUST acknowledge the UPDATE, but the sender MAY 2755 choose to not care about receiving the ACK. 2757 UPDATEs MAY be retransmitted without incrementing SEQ. If the same 2758 subset of parameters is included in multiple UPDATEs with different 2759 SEQs, the host MUST ensure that the receiver's processing of the 2760 parameters multiple times will not result in a protocol error. 2762 5.3.6. NOTIFY - the HIP Notify Packet 2764 The NOTIFY packet is OPTIONAL. The NOTIFY packet MAY be used to 2765 provide information to a peer. Typically, NOTIFY is used to indicate 2766 some type of protocol error or negotiation failure. NOTIFY packets 2767 are unacknowledged. The receiver can handle the packet only as 2768 informational, and SHOULD NOT change its HIP state (Section 4.4.1) 2769 based purely on a received NOTIFY packet. 2771 The HIP header values for the NOTIFY packet: 2773 Header: 2774 Packet Type = 17 2775 SRC HIT = Sender's HIT 2776 DST HIT = Recipient's HIT, or zero if unknown 2778 IP ( HIP (i, [HOST_ID, ] HIP_SIGNATURE) ) 2780 Valid control bits: None 2782 The NOTIFY packet is used to carry one or more NOTIFICATION 2783 parameters. 2785 5.3.7. CLOSE - the HIP Association Closing Packet 2787 The HIP header values for the CLOSE packet: 2789 Header: 2790 Packet Type = 18 2791 SRC HIT = Sender's HIT 2792 DST HIT = Recipient's HIT 2794 IP ( HIP ( ECHO_REQUEST_SIGNED, HMAC, HIP_SIGNATURE ) ) 2796 Valid control bits: none 2798 The sender MUST include an ECHO_REQUEST_SIGNED used to validate 2799 CLOSE_ACK received in response, and both an HMAC and a signature 2800 (calculated over the whole HIP envelope). 2802 The receiver peer MUST validate both the HMAC and the signature if it 2803 has a HIP association state, and MUST reply with a CLOSE_ACK 2804 containing an ECHO_RESPONSE_SIGNED corresponding to the received 2805 ECHO_REQUEST_SIGNED. 2807 5.3.8. CLOSE_ACK - the HIP Closing Acknowledgment Packet 2809 The HIP header values for the CLOSE_ACK packet: 2811 Header: 2812 Packet Type = 19 2813 SRC HIT = Sender's HIT 2814 DST HIT = Recipient's HIT 2816 IP ( HIP ( ECHO_RESPONSE_SIGNED, HMAC, HIP_SIGNATURE ) ) 2818 Valid control bits: none 2820 The sender MUST include both an HMAC and signature (calculated over 2821 the whole HIP envelope). 2823 The receiver peer MUST validate both the HMAC and the signature. 2825 5.4. ICMP Messages 2827 When a HIP implementation detects a problem with an incoming packet, 2828 and it either cannot determine the identity of the sender of the 2829 packet or does not have any existing HIP association with the sender 2830 of the packet, it MAY respond with an ICMP packet. Any such replies 2831 MUST be rate-limited as described in [RFC2463]. In most cases, the 2832 ICMP packet will have the Parameter Problem type (12 for ICMPv4, 4 2833 for ICMPv6), with the Pointer field pointing to the field that caused 2834 the ICMP message to be generated. 2836 5.4.1. Invalid Version 2838 If a HIP implementation receives a HIP packet that has an 2839 unrecognized HIP version number, it SHOULD respond, rate-limited, 2840 with an ICMP packet with type Parameter Problem, the Pointer pointing 2841 to the VER./RES. byte in the HIP header. 2843 5.4.2. Other Problems with the HIP Header and Packet Structure 2845 If a HIP implementation receives a HIP packet that has other 2846 unrecoverable problems in the header or packet format, it MAY 2847 respond, rate-limited, with an ICMP packet with type Parameter 2848 Problem, the Pointer pointing to the field that failed to pass the 2849 format checks. However, an implementation MUST NOT send an ICMP 2850 message if the checksum fails; instead, it MUST silently drop the 2851 packet. 2853 5.4.3. Invalid Puzzle Solution 2855 If a HIP implementation receives an I2 packet that has an invalid 2856 puzzle solution, the behavior depends on the underlying version of 2857 IP. If IPv6 is used, the implementation SHOULD respond with an ICMP 2858 packet with type Parameter Problem, the Pointer pointing to the 2859 beginning of the Puzzle solution #J field in the SOLUTION payload in 2860 the HIP message. 2862 If IPv4 is used, the implementation MAY respond with an ICMP packet 2863 with the type Parameter Problem, copying enough of bytes from the I2 2864 message so that the SOLUTION parameter fits into the ICMP message, 2865 the Pointer pointing to the beginning of the Puzzle solution #J 2866 field, as in the IPv6 case. Note, however, that the resulting ICMPv4 2867 message exceeds the typical ICMPv4 message size as defined in 2868 [RFC0792]. 2870 5.4.4. Non-Existing HIP Association 2872 If a HIP implementation receives a CLOSE or UPDATE packet, or any 2873 other packet whose handling requires an existing association, that 2874 has either a Receiver or Sender HIT that does not match with any 2875 existing HIP association, the implementation MAY respond, rate- 2876 limited, with an ICMP packet with the type Parameter Problem, and 2877 with the Pointer pointing to the beginning of the first HIT that does 2878 not match. 2880 A host MUST NOT reply with such an ICMP if it receives any of the 2881 following messages: I1, R2, I2, R2, and NOTIFY. When introducing new 2882 packet types, a specification SHOULD define the appropriate rules for 2883 sending or not sending this kind of ICMP reply. 2885 6. Packet Processing 2887 Each host is assumed to have a single HIP protocol implementation 2888 that manages the host's HIP associations and handles requests for new 2889 ones. Each HIP association is governed by a conceptual state 2890 machine, with states defined above in Section 4.4. The HIP 2891 implementation can simultaneously maintain HIP associations with more 2892 than one host. Furthermore, the HIP implementation may have more 2893 than one active HIP association with another host; in this case, HIP 2894 associations are distinguished by their respective HITs. It is not 2895 possible to have more than one HIP association between any given pair 2896 of HITs. Consequently, the only way for two hosts to have more than 2897 one parallel association is to use different HITs, at least at one 2898 end. 2900 The processing of packets depends on the state of the HIP 2901 association(s) with respect to the authenticated or apparent 2902 originator of the packet. A HIP implementation determines whether it 2903 has an active association with the originator of the packet based on 2904 the HITs. In the case of user data carried in a specific transport 2905 format, the transport format document specifies how the incoming 2906 packets are matched with the active associations. 2908 6.1. Processing Outgoing Application Data 2910 In a HIP host, an application can send application-level data using 2911 an identifier specified via the underlying API. The API can be a 2912 backwards-compatible API (see [RFC5338]), using identifiers that look 2913 similar to IP addresses, or a completely new API, providing enhanced 2914 services related to Host Identities. Depending on the HIP 2915 implementation, the identifier provided to the application may be 2916 different; for example, it can be a HIT or an IP address. 2918 The exact format and method for transferring the data from the source 2919 HIP host to the destination HIP host is defined in the corresponding 2920 transport format document. The actual data is transferred in the 2921 network using the appropriate source and destination IP addresses. 2923 In this document, conceptual processing rules are defined only for 2924 the base case where both hosts have only single usable IP addresses; 2925 the multi-address multi-homing case will be specified separately. 2927 The following conceptual algorithm describes the steps that are 2928 required for handling outgoing datagrams destined to a HIT. 2930 1. If the datagram has a specified source address, it MUST be a HIT. 2931 If it is not, the implementation MAY replace the source address 2932 with a HIT. Otherwise, it MUST drop the packet. 2934 2. If the datagram has an unspecified source address, the 2935 implementation must choose a suitable source HIT for the 2936 datagram. 2938 3. If there is no active HIP association with the given HIT pair, one must be created by running the base 2940 exchange. While waiting for the base exchange to complete, the 2941 implementation SHOULD queue at least one packet per HIP 2942 association to be formed, and it MAY queue more than one. 2944 4. Once there is an active HIP association for the given HIT pair, the outgoing datagram is passed to 2946 transport handling. The possible transport formats are defined 2947 in separate documents, of which the ESP transport format for HIP 2948 is mandatory for all HIP implementations. 2950 5. Before sending the packet, the HITs in the datagram are replaced 2951 with suitable IP addresses. For IPv6, the rules defined in 2952 [RFC3484] SHOULD be followed. Note that this HIT-to-IP-address 2953 conversion step MAY also be performed at some other point in the 2954 stack, e.g., before wrapping the packet into the output format. 2956 6.2. Processing Incoming Application Data 2958 The following conceptual algorithm describes the incoming datagram 2959 handling when HITs are used at the receiving host as application- 2960 level identifiers. More detailed steps for processing packets are 2961 defined in corresponding transport format documents. 2963 1. The incoming datagram is mapped to an existing HIP association, 2964 typically using some information from the packet. For example, 2965 such mapping may be based on the ESP Security Parameter Index 2966 (SPI). 2968 2. The specific transport format is unwrapped, in a way depending on 2969 the transport format, yielding a packet that looks like a 2970 standard (unencrypted) IP packet. If possible, this step SHOULD 2971 also verify that the packet was indeed (once) sent by the remote 2972 HIP host, as identified by the HIP association. 2974 Depending on the used transport mode, the verification method can 2975 vary. While the HI (as well as HIT) is used as the higher-layer 2976 identifier, the verification method has to verify that the data 2977 packet was sent by a node identity and that the actual identity 2978 maps to this particular HIT. When using ESP transport format 2979 [RFC5202], the verification is done using the SPI value in the 2980 data packet to find the corresponding SA with associated HIT and 2981 key, and decrypting the packet with that associated key. 2983 3. The IP addresses in the datagram are replaced with the HITs 2984 associated with the HIP association. Note that this IP-address- 2985 to-HIT conversion step MAY also be performed at some other point 2986 in the stack. 2988 4. The datagram is delivered to the upper layer. When 2989 demultiplexing the datagram, the right upper-layer socket is 2990 based on the HITs. 2992 6.3. Solving the Puzzle 2994 This subsection describes the puzzle-solving details. 2996 In R1, the values I and K are sent in network byte order. Similarly, 2997 in I2, the values I and J are sent in network byte order. The hash 2998 is created by concatenating, in network byte order, the following 2999 data, in the following order and using the RHASH algorithm: 3001 64-bit random value I, in network byte order, as appearing in R1 3002 and I2. 3004 128-bit Initiator's HIT, in network byte order, as appearing in 3005 the HIP Payload in R1 and I2. 3007 128-bit Responder's HIT, in network byte order, as appearing in 3008 the HIP Payload in R1 and I2. 3010 64-bit random value J, in network byte order, as appearing in I2. 3012 In order to be a valid response puzzle, the K low-order bits of the 3013 resulting RHASH digest must be zero. 3015 Notes: 3017 i) The length of the data to be hashed is 48 bytes. 3019 ii) All the data in the hash input MUST be in network byte order. 3021 iii) The order of the Initiator's and Responder's HITs are 3022 different in the R1 and I2 packets; see Section 5.1. Care must be 3023 taken to copy the values in the right order to the hash input. 3025 The following procedure describes the processing steps involved, 3026 assuming that the Responder chooses to precompute the R1 packets: 3028 Precomputation by the Responder: 3029 Sets up the puzzle difficulty K. 3030 Creates a signed R1 and caches it. 3032 Responder: 3033 Selects a suitable cached R1. 3034 Generates a random number I. 3035 Sends I and K in an R1. 3036 Saves I and K for a Delta time. 3038 Initiator: 3039 Generates repeated attempts to solve the puzzle until a matching J 3040 is found: 3041 Ltrunc( RHASH( I | HIT-I | HIT-R | J ), K ) == 0 3042 Sends I and J in an I2. 3044 Responder: 3045 Verifies that the received I is a saved one. 3046 Finds the right K based on I. 3047 Computes V := Ltrunc( RHASH( I | HIT-I | HIT-R | J ), K ) 3048 Rejects if V != 0 3049 Accept if V == 0 3051 6.4. HMAC and SIGNATURE Calculation and Verification 3053 The following subsections define the actions for processing HMAC, 3054 HIP_SIGNATURE and HIP_SIGNATURE_2 parameters. 3056 6.4.1. HMAC Calculation 3058 The following process applies both to the HMAC and HMAC_2 parameters. 3059 When processing HMAC_2, the difference is that the HMAC calculation 3060 includes a pseudo HOST_ID field containing the Responder's 3061 information as sent in the R1 packet earlier. 3063 Both the Initiator and the Responder should take some care when 3064 verifying or calculating the HMAC_2. Specifically, the Responder 3065 should preserve other parameters than the HOST_ID when sending the 3066 R2. Also, the Initiator has to preserve the HOST_ID exactly as it 3067 was received in the R1 packet. 3069 The scope of the calculation for HMAC and HMAC_2 is: 3071 HMAC: { HIP header | [ Parameters ] } 3073 where Parameters include all HIP parameters of the packet that is 3074 being calculated with Type values from 1 to (HMAC's Type value - 1) 3075 and exclude parameters with Type values greater or equal to HMAC's 3076 Type value. 3078 During HMAC calculation, the following applies: 3080 o In the HIP header, the Checksum field is set to zero. 3082 o In the HIP header, the Header Length field value is calculated to 3083 the beginning of the HMAC parameter. 3085 Parameter order is described in Section 5.2.1. 3087 HMAC_2: { HIP header | [ Parameters ] | HOST_ID } 3089 where Parameters include all HIP parameters for the packet that is 3090 being calculated with Type values from 1 to (HMAC_2's Type value - 1) 3091 and exclude parameters with Type values greater or equal to HMAC_2's 3092 Type value. 3094 During HMAC_2 calculation, the following applies: 3096 o In the HIP header, the Checksum field is set to zero. 3098 o In the HIP header, the Header Length field value is calculated to 3099 the beginning of the HMAC_2 parameter and added to the length of 3100 the concatenated HOST_ID parameter length. 3102 o HOST_ID parameter is exactly in the form it was received in the R1 3103 packet from the Responder. 3105 Parameter order is described in Section 5.2.1, except that the 3106 HOST_ID parameter in this calculation is added to the end. 3108 The HMAC parameter is defined in Section 5.2.10 and the HMAC_2 3109 parameter in Section 5.2.11. The HMAC calculation and verification 3110 process (the process applies both to HMAC and HMAC_2 except where 3111 HMAC_2 is mentioned separately) is as follows: 3113 Packet sender: 3115 1. Create the HIP packet, without the HMAC, HIP_SIGNATURE, 3116 HIP_SIGNATURE_2, or any other parameter with greater Type value 3117 than the HMAC parameter has. 3119 2. In case of HMAC_2 calculation, add a HOST_ID (Responder) 3120 parameter to the end of the packet. 3122 3. Calculate the Header Length field in the HIP header including the 3123 added HOST_ID parameter in case of HMAC_2. 3125 4. Compute the HMAC using either HIP-gl or HIP-lg integrity key 3126 retrieved from KEYMAT as defined in Section 6.5. 3128 5. In case of HMAC_2, remove the HOST_ID parameter from the packet. 3130 6. Add the HMAC parameter to the packet and any parameter with 3131 greater Type value than the HMAC's (HMAC_2's) that may follow, 3132 including possible HIP_SIGNATURE or HIP_SIGNATURE_2 parameters 3134 7. Recalculate the Length field in the HIP header. 3136 Packet receiver: 3138 1. Verify the HIP header Length field. 3140 2. Remove the HMAC or HMAC_2 parameter, as well as all other 3141 parameters that follow it with greater Type value including 3142 possible HIP_SIGNATURE or HIP_SIGNATURE_2 fields, saving the 3143 contents if they will be needed later. 3145 3. In case of HMAC_2, build and add a HOST_ID parameter (with 3146 Responder information) to the packet. The HOST_ID parameter 3147 should be identical to the one previously received from the 3148 Responder. 3150 4. Recalculate the HIP packet length in the HIP header and clear the 3151 Checksum field (set it to all zeros). In case of HMAC_2, the 3152 length is calculated with the added HOST_ID parameter. 3154 5. Compute the HMAC using either HIP-gl or HIP-lg integrity key as 3155 defined in Section 6.5 and verify it against the received HMAC. 3157 6. Set Checksum and Header Length field in the HIP header to 3158 original values. 3160 7. In case of HMAC_2, remove the HOST_ID parameter from the packet 3161 before further processing. 3163 6.4.2. Signature Calculation 3165 The following process applies both to the HIP_SIGNATURE and 3166 HIP_SIGNATURE_2 parameters. When processing HIP_SIGNATURE_2, the 3167 only difference is that instead of HIP_SIGNATURE parameter, the 3168 HIP_SIGNATURE_2 parameter is used, and the Initiator's HIT and PUZZLE 3169 Opaque and Random #I fields are cleared (set to all zeros) before 3170 computing the signature. The HIP_SIGNATURE parameter is defined in 3171 Section 5.2.12 and the HIP_SIGNATURE_2 parameter in Section 5.2.13. 3173 The scope of the calculation for HIP_SIGNATURE and HIP_SIGNATURE_2 3174 is: 3176 HIP_SIGNATURE: { HIP header | [ Parameters ] } 3178 where Parameters include all HIP parameters for the packet that is 3179 being calculated with Type values from 1 to (HIP_SIGNATURE's Type 3180 value - 1). 3182 During signature calculation, the following apply: 3184 o In the HIP header, the Checksum field is set to zero. 3186 o In the HIP header, the Header Length field value is calculated to 3187 the beginning of the HIP_SIGNATURE parameter. 3189 Parameter order is described in Section 5.2.1. 3191 HIP_SIGNATURE_2: { HIP header | [ Parameters ] } 3193 where Parameters include all HIP parameters for the packet that is 3194 being calculated with Type values from 1 to (HIP_SIGNATURE_2's Type 3195 value - 1). 3197 During signature calculation, the following apply: 3199 o In the HIP header, the Initiator's HIT field and Checksum fields 3200 are set to zero. 3202 o In the HIP header, the Header Length field value is calculated to 3203 the beginning of the HIP_SIGNATURE_2 parameter. 3205 o PUZZLE parameter's Opaque and Random #I fields are set to zero. 3207 Parameter order is described in Section 5.2.1. 3209 Signature calculation and verification process (the process applies 3210 both to HIP_SIGNATURE and HIP_SIGNATURE_2 except in the case where 3211 HIP_SIGNATURE_2 is separately mentioned): 3213 Packet sender: 3215 1. Create the HIP packet without the HIP_SIGNATURE parameter or any 3216 parameters that follow the HIP_SIGNATURE parameter. 3218 2. Calculate the Length field and zero the Checksum field in the HIP 3219 header. In case of HIP_SIGNATURE_2, set Initiator's HIT field in 3220 the HIP header as well as PUZZLE parameter's Opaque and Random #I 3221 fields to zero. 3223 3. Compute the signature using the private key corresponding to the 3224 Host Identifier (public key). 3226 4. Add the HIP_SIGNATURE parameter to the packet. 3228 5. Add any parameters that follow the HIP_SIGNATURE parameter. 3230 6. Recalculate the Length field in the HIP header, and calculate the 3231 Checksum field. 3233 Packet receiver: 3235 1. Verify the HIP header Length field. 3237 2. Save the contents of the HIP_SIGNATURE parameter and any 3238 parameters following the HIP_SIGNATURE parameter and remove them 3239 from the packet. 3241 3. Recalculate the HIP packet Length in the HIP header and clear the 3242 Checksum field (set it to all zeros). In case of 3243 HIP_SIGNATURE_2, set Initiator's HIT field in HIP header as well 3244 as PUZZLE parameter's Opaque and Random #I fields to zero. 3246 4. Compute the signature and verify it against the received 3247 signature using the packet sender's Host Identifier (public key). 3249 5. Restore the original packet by adding removed parameters (in step 3250 2) and resetting the values that were set to zero (in step 3). 3252 The verification can use either the HI received from a HIP packet, 3253 the HI from a DNS query, if the FQDN has been received in the HOST_ID 3254 packet, or one received by some other means. 3256 6.5. HIP KEYMAT Generation 3258 HIP keying material is derived from the Diffie-Hellman session key, 3259 Kij, produced during the HIP base exchange (Section 4.1.3). The 3260 Initiator has Kij during the creation of the I2 packet, and the 3261 Responder has Kij once it receives the I2 packet. This is why I2 can 3262 already contain encrypted information. 3264 The KEYMAT is derived by feeding Kij and the HITs into the following 3265 operation; the | operation denotes concatenation. 3267 KEYMAT = K1 | K2 | K3 | ... 3268 where 3270 K1 = RHASH( Kij | sort(HIT-I | HIT-R) | I | J | 0x01 ) 3271 K2 = RHASH( Kij | K1 | 0x02 ) 3272 K3 = RHASH( Kij | K2 | 0x03 ) 3273 ... 3274 K255 = RHASH( Kij | K254 | 0xff ) 3275 K256 = RHASH( Kij | K255 | 0x00 ) 3276 etc. 3278 Sort(HIT-I | HIT-R) is defined as the network byte order 3279 concatenation of the two HITs, with the smaller HIT preceding the 3280 larger HIT, resulting from the numeric comparison of the two HITs 3281 interpreted as positive (unsigned) 128-bit integers in network byte 3282 order. 3284 I and J values are from the puzzle and its solution that were 3285 exchanged in R1 and I2 messages when this HIP association was set up. 3286 Both hosts have to store I and J values for the HIP association for 3287 future use. 3289 The initial keys are drawn sequentially in the order that is 3290 determined by the numeric comparison of the two HITs, with comparison 3291 method described in the previous paragraph. HOST_g denotes the host 3292 with the greater HIT value, and HOST_l the host with the lower HIT 3293 value. 3295 The drawing order for initial keys: 3297 HIP-gl encryption key for HOST_g's outgoing HIP packets 3299 HIP-gl integrity (HMAC) key for HOST_g's outgoing HIP packets 3301 HIP-lg encryption key (currently unused) for HOST_l's outgoing HIP 3302 packets 3304 HIP-lg integrity (HMAC) key for HOST_l's outgoing HIP packets 3306 The number of bits drawn for a given algorithm is the "natural" size 3307 of the keys. For the mandatory algorithms, the following sizes 3308 apply: 3310 AES 128 bits 3311 SHA-1 160 bits 3313 SHA-256 256 bits 3315 NULL 0 bits 3317 If other key sizes are used, they must be treated as different 3318 encryption algorithms and defined separately. 3320 6.6. Initiation of a HIP Exchange 3322 An implementation may originate a HIP exchange to another host based 3323 on a local policy decision, usually triggered by an application 3324 datagram, in much the same way that an IPsec IKE key exchange can 3325 dynamically create a Security Association. Alternatively, a system 3326 may initiate a HIP exchange if it has rebooted or timed out, or 3327 otherwise lost its HIP state, as described in Section 4.5.4. 3329 The implementation prepares an I1 packet and sends it to the IP 3330 address that corresponds to the peer host. The IP address of the 3331 peer host may be obtained via conventional mechanisms, such as DNS 3332 lookup. The I1 contents are specified in Section 5.3.1. The 3333 selection of which Host Identity to use, if a host has more than one 3334 to choose from, is typically a policy decision. 3336 The following steps define the conceptual processing rules for 3337 initiating a HIP exchange: 3339 1. The Initiator gets the Responder's HIT and one or more addresses 3340 either from a DNS lookup of the Responder's FQDN, from some other 3341 repository, or from a local table. If the Initiator does not 3342 know the Responder's HIT, it may attempt opportunistic mode by 3343 using NULL (all zeros) as the Responder's HIT. See also "HIP 3344 Opportunistic Mode" (Section 4.1.6). 3346 2. The Initiator sends an I1 to one of the Responder's addresses. 3347 The selection of which address to use is a local policy decision. 3349 3. Upon sending an I1, the sender shall transition to state I1-SENT, 3350 start a timer whose timeout value should be larger than the 3351 worst-case anticipated RTT, and shall increment a timeout counter 3352 associated with the I1. 3354 4. Upon timeout, the sender SHOULD retransmit the I1 and restart the 3355 timer, up to a maximum of I1_RETRIES_MAX tries. 3357 6.6.1. Sending Multiple I1s in Parallel 3359 For the sake of minimizing the session establishment latency, an 3360 implementation MAY send the same I1 to more than one of the 3361 Responder's addresses. However, it MUST NOT send to more than three 3362 (3) addresses in parallel. Furthermore, upon timeout, the 3363 implementation MUST refrain from sending the same I1 packet to 3364 multiple addresses. That is, if it retries to initialize the 3365 connection after timeout, it MUST NOT send the I1 packet to more than 3366 one destination address. These limitations are placed in order to 3367 avoid congestion of the network, and potential DoS attacks that might 3368 happen, e.g., because someone's claim to have hundreds or thousands 3369 of addresses could generate a huge number of I1 messages from the 3370 Initiator. 3372 As the Responder is not guaranteed to distinguish the duplicate I1s 3373 it receives at several of its addresses (because it avoids storing 3374 states when it answers back an R1), the Initiator may receive several 3375 duplicate R1s. 3377 The Initiator SHOULD then select the initial preferred destination 3378 address using the source address of the selected received R1, and use 3379 the preferred address as a source address for the I2. Processing 3380 rules for received R1s are discussed in Section 6.8. 3382 6.6.2. Processing Incoming ICMP Protocol Unreachable Messages 3384 A host may receive an ICMP 'Destination Protocol Unreachable' message 3385 as a response to sending a HIP I1 packet. Such a packet may be an 3386 indication that the peer does not support HIP, or it may be an 3387 attempt to launch an attack by making the Initiator believe that the 3388 Responder does not support HIP. 3390 When a system receives an ICMP 'Destination Protocol Unreachable' 3391 message while it is waiting for an R1, it MUST NOT terminate the 3392 wait. It MAY continue as if it had not received the ICMP message, 3393 and send a few more I1s. Alternatively, it MAY take the ICMP message 3394 as a hint that the peer most probably does not support HIP, and 3395 return to state UNASSOCIATED earlier than otherwise. However, at 3396 minimum, it MUST continue waiting for an R1 for a reasonable time 3397 before returning to UNASSOCIATED. 3399 6.7. Processing Incoming I1 Packets 3401 An implementation SHOULD reply to an I1 with an R1 packet, unless the 3402 implementation is unable or unwilling to set up a HIP association. 3403 If the implementation is unable to set up a HIP association, the host 3404 SHOULD send an ICMP Destination Protocol Unreachable, 3405 Administratively Prohibited, message to the I1 source address. If 3406 the implementation is unwilling to set up a HIP association, the host 3407 MAY ignore the I1. This latter case may occur during a DoS attack 3408 such as an I1 flood. 3410 The implementation MUST be able to handle a storm of received I1 3411 packets, discarding those with common content that arrive within a 3412 small time delta. 3414 A spoofed I1 can result in an R1 attack on a system. An R1 sender 3415 MUST have a mechanism to rate-limit R1s to an address. 3417 It is RECOMMENDED that the HIP state machine does not transition upon 3418 sending an R1. 3420 The following steps define the conceptual processing rules for 3421 responding to an I1 packet: 3423 1. The Responder MUST check that the Responder's HIT in the received 3424 I1 is either one of its own HITs or NULL. 3426 2. If the Responder is in ESTABLISHED state, the Responder MAY 3427 respond to this with an R1 packet, prepare to drop existing SAs, 3428 and stay at ESTABLISHED state. 3430 3. If the Responder is in I1-SENT state, it must make a comparison 3431 between the sender's HIT and its own (i.e., the receiver's) HIT. 3432 If the sender's HIT is greater than its own HIT, it should drop 3433 the I1 and stay at I1-SENT. If the sender's HIT is smaller than 3434 its own HIT, it should send R1 and stay at I1-SENT. The HIT 3435 comparison goes similarly as in Section 6.5. 3437 4. If the implementation chooses to respond to the I1 with an R1 3438 packet, it creates a new R1 or selects a precomputed R1 according 3439 to the format described in Section 5.3.2. 3441 5. The R1 MUST contain the received Responder's HIT, unless the 3442 received HIT is NULL, in which case the Responder SHOULD select a 3443 HIT that is constructed with the MUST algorithm in Section 3, 3444 which is currently RSA. Other than that, selecting the HIT is a 3445 local policy matter. 3447 6. The Responder sends the R1 to the source IP address of the I1 3448 packet. 3450 6.7.1. R1 Management 3452 All compliant implementations MUST produce R1 packets. An R1 packet 3453 MAY be precomputed. An R1 packet MAY be reused for time Delta T, 3454 which is implementation dependent, and SHOULD be deprecated and not 3455 used once a valid response I2 packet has been received from an 3456 Initiator. During an I1 message storm, an R1 packet may be re-used 3457 beyond this limit. R1 information MUST NOT be discarded until Delta 3458 S after T. Time S is the delay needed for the last I2 to arrive back 3459 to the Responder. 3461 An implementation MAY keep state about received I1s and match the 3462 received I2s against the state, as discussed in Section 4.1.1. 3464 6.7.2. Handling Malformed Messages 3466 If an implementation receives a malformed I1 message, it SHOULD NOT 3467 respond with a NOTIFY message, as such practice could open up a 3468 potential denial-of-service danger. Instead, it MAY respond with an 3469 ICMP packet, as defined in Section 5.4. 3471 6.8. Processing Incoming R1 Packets 3473 A system receiving an R1 MUST first check to see if it has sent an I1 3474 to the originator of the R1 (i.e., it is in state I1-SENT). If so, 3475 it SHOULD process the R1 as described below, send an I2, and go to 3476 state I2-SENT, setting a timer to protect the I2. If the system is 3477 in state I2-SENT, it MAY respond to an R1 if the R1 has a larger R1 3478 generation counter; if so, it should drop its state due to processing 3479 the previous R1 and start over from state I1-SENT. If the system is 3480 in any other state with respect to that host, it SHOULD silently drop 3481 the R1. 3483 When sending multiple I1s, an Initiator SHOULD wait for a small 3484 amount of time after the first R1 reception to allow possibly 3485 multiple R1s to arrive, and it SHOULD respond to an R1 among the set 3486 with the largest R1 generation counter. 3488 The following steps define the conceptual processing rules for 3489 responding to an R1 packet: 3491 1. A system receiving an R1 MUST first check to see if it has sent 3492 an I1 to the originator of the R1 (i.e., it has a HIP 3493 association that is in state I1-SENT and that is associated with 3494 the HITs in the R1). Unless the I1 was sent in opportunistic 3495 mode (see Section 4.1.6), the IP addresses in the received R1 3496 packet SHOULD be ignored and, when looking up the right HIP 3497 association, the received R1 SHOULD be matched against the 3498 associations using only the HITs. If a match exists, the system 3499 should process the R1 as described below. 3501 2. Otherwise, if the system is in any other state than I1-SENT or 3502 I2-SENT with respect to the HITs included in the R1, it SHOULD 3503 silently drop the R1 and remain in the current state. 3505 3. If the HIP association state is I1-SENT or I2-SENT, the received 3506 Initiator's HIT MUST correspond to the HIT used in the original, 3507 and the I1 and the Responder's HIT MUST correspond to the one 3508 used, unless the I1 contained a NULL HIT. 3510 4. The system SHOULD validate the R1 signature before applying 3511 further packet processing, according to Section 5.2.13. 3513 5. If the HIP association state is I1-SENT, and multiple valid R1s 3514 are present, the system SHOULD select from among the R1s with 3515 the largest R1 generation counter. 3517 6. If the HIP association state is I2-SENT, the system MAY reenter 3518 state I1-SENT and process the received R1 if it has a larger R1 3519 generation counter than the R1 responded to previously. 3521 7. The R1 packet may have the A bit set -- in this case, the system 3522 MAY choose to refuse it by dropping the R1 and returning to 3523 state UNASSOCIATED. The system SHOULD consider dropping the R1 3524 only if it used a NULL HIT in I1. If the A bit is set, the 3525 Responder's HIT is anonymous and should not be stored. 3527 8. The system SHOULD attempt to validate the HIT against the 3528 received Host Identity by using the received Host Identity to 3529 construct a HIT and verify that it matches the Sender's HIT. 3531 9. The system MUST store the received R1 generation counter for 3532 future reference. 3534 10. The system attempts to solve the puzzle in R1. The system MUST 3535 terminate the search after exceeding the remaining lifetime of 3536 the puzzle. If the puzzle is not successfully solved, the 3537 implementation may either resend I1 within the retry bounds or 3538 abandon the HIP exchange. 3540 11. The system computes standard Diffie-Hellman keying material 3541 according to the public value and Group ID provided in the 3542 DIFFIE_HELLMAN parameter. The Diffie-Hellman keying material 3543 Kij is used for key extraction as specified in Section 6.5. If 3544 the received Diffie-Hellman Group ID is not supported, the 3545 implementation may either resend I1 within the retry bounds or 3546 abandon the HIP exchange. 3548 12. The system selects the HIP transform from the choices presented 3549 in the R1 packet and uses the selected values subsequently when 3550 generating and using encryption keys, and when sending the I2. 3551 If the proposed alternatives are not acceptable to the system, 3552 it may either resend I1 within the retry bounds or abandon the 3553 HIP exchange. 3555 13. The system initializes the remaining variables in the associated 3556 state, including Update ID counters. 3558 14. The system prepares and sends an I2, as described in 3559 Section 5.3.3. 3561 15. The system SHOULD start a timer whose timeout value should be 3562 larger than the worst-case anticipated RTT, and MUST increment a 3563 timeout counter associated with the I2. The sender SHOULD 3564 retransmit the I2 upon a timeout and restart the timer, up to a 3565 maximum of I2_RETRIES_MAX tries. 3567 16. If the system is in state I1-SENT, it shall transition to state 3568 I2-SENT. If the system is in any other state, it remains in the 3569 current state. 3571 6.8.1. Handling Malformed Messages 3573 If an implementation receives a malformed R1 message, it MUST 3574 silently drop the packet. Sending a NOTIFY or ICMP would not help, 3575 as the sender of the R1 typically doesn't have any state. An 3576 implementation SHOULD wait for some more time for a possibly good R1, 3577 after which it MAY try again by sending a new I1 packet. 3579 6.9. Processing Incoming I2 Packets 3581 Upon receipt of an I2, the system MAY perform initial checks to 3582 determine whether the I2 corresponds to a recent R1 that has been 3583 sent out, if the Responder keeps such state. For example, the sender 3584 could check whether the I2 is from an address or HIT that has 3585 recently received an R1 from it. The R1 may have had Opaque data 3586 included that was echoed back in the I2. If the I2 is considered to 3587 be suspect, it MAY be silently discarded by the system. 3589 Otherwise, the HIP implementation SHOULD process the I2. This 3590 includes validation of the puzzle solution, generating the Diffie- 3591 Hellman key, decrypting the Initiator's Host Identity, verifying the 3592 signature, creating state, and finally sending an R2. 3594 The following steps define the conceptual processing rules for 3595 responding to an I2 packet: 3597 1. The system MAY perform checks to verify that the I2 corresponds 3598 to a recently sent R1. Such checks are implementation 3599 dependent. See Appendix A for a description of an example 3600 implementation. 3602 2. The system MUST check that the Responder's HIT corresponds to 3603 one of its own HITs. 3605 3. If the system's state machine is in the R2-SENT state, the 3606 system MAY check if the newly received I2 is similar to the one 3607 that triggered moving to R2-SENT. If so, it MAY retransmit a 3608 previously sent R2, reset the R2-SENT timer, and the state 3609 machine stays in R2-SENT. 3611 4. If the system's state machine is in the I2-SENT state, the 3612 system makes a comparison between its local and sender's HITs 3613 (similarly as in Section 6.5). If the local HIT is smaller than 3614 the sender's HIT, it should drop the I2 packet, use the peer 3615 Diffie-Hellman key and nonce I from the R1 packet received 3616 earlier, and get the local Diffie-Hellman key and nonce J from 3617 the I2 packet sent to the peer earlier. Otherwise, the system 3618 should process the received I2 packet and drop any previously 3619 derived Diffie-Hellman keying material Kij it might have formed 3620 upon sending the I2 previously. The peer Diffie-Hellman key and 3621 the nonce J are taken from the just arrived I2 packet. The 3622 local Diffie-Hellman key and the nonce I are the ones that were 3623 earlier sent in the R1 packet. 3625 5. If the system's state machine is in the I1-SENT state, and the 3626 HITs in the I2 match those used in the previously sent I1, the 3627 system uses this received I2 as the basis for the HIP 3628 association it was trying to form, and stops retransmitting I1 3629 (provided that the I2 passes the below additional checks). 3631 6. If the system's state machine is in any other state than R2- 3632 SENT, the system SHOULD check that the echoed R1 generation 3633 counter in I2 is within the acceptable range. Implementations 3634 MUST accept puzzles from the current generation and MAY accept 3635 puzzles from earlier generations. If the newly received I2 is 3636 outside the accepted range, the I2 is stale (perhaps replayed) 3637 and SHOULD be dropped. 3639 7. The system MUST validate the solution to the puzzle by computing 3640 the hash described in Section 5.3.3 using the same RHASH 3641 algorithm. 3643 8. The I2 MUST have a single value in the HIP_TRANSFORM parameter, 3644 which MUST match one of the values offered to the Initiator in 3645 the R1 packet. 3647 9. The system must derive Diffie-Hellman keying material Kij based 3648 on the public value and Group ID in the DIFFIE_HELLMAN 3649 parameter. This key is used to derive the HIP association keys, 3650 as described in Section 6.5. If the Diffie-Hellman Group ID is 3651 unsupported, the I2 packet is silently dropped. 3653 10. The encrypted HOST_ID is decrypted by the Initiator encryption 3654 key defined in Section 6.5. If the decrypted data is not a 3655 HOST_ID parameter, the I2 packet is silently dropped. 3657 11. The implementation SHOULD also verify that the Initiator's HIT 3658 in the I2 corresponds to the Host Identity sent in the I2. 3659 (Note: some middleboxes may not able to make this verification.) 3661 12. The system MUST verify the HMAC according to the procedures in 3662 Section 5.2.10. 3664 13. The system MUST verify the HIP_SIGNATURE according to 3665 Section 5.2.12 and Section 5.3.3. 3667 14. If the checks above are valid, then the system proceeds with 3668 further I2 processing; otherwise, it discards the I2 and its 3669 state machine remains in the same state. 3671 15. The I2 packet may have the A bit set -- in this case, the system 3672 MAY choose to refuse it by dropping the I2 and the state machine 3673 returns to state UNASSOCIATED. If the A bit is set, the 3674 Initiator's HIT is anonymous and should not be stored. 3676 16. The system initializes the remaining variables in the associated 3677 state, including Update ID counters. 3679 17. Upon successful processing of an I2 when the system's state 3680 machine is in state UNASSOCIATED, I1-SENT, I2-SENT, or R2-SENT, 3681 an R2 is sent and the system's state machine transitions to 3682 state R2-SENT. 3684 18. Upon successful processing of an I2 when the system's state 3685 machine is in state ESTABLISHED, the old HIP association is 3686 dropped and a new one is installed, an R2 is sent, and the 3687 system's state machine transitions to R2-SENT. 3689 19. Upon the system's state machine transitioning to R2-SENT, the 3690 system starts a timer. The state machine transitions to 3691 ESTABLISHED if some data has been received on the incoming HIP 3692 association, or an UPDATE packet has been received (or some 3693 other packet that indicates that the peer system's state machine 3694 has moved to ESTABLISHED). If the timer expires (allowing for 3695 maximal retransmissions of I2s), the state machine transitions 3696 to ESTABLISHED. 3698 6.9.1. Handling Malformed Messages 3700 If an implementation receives a malformed I2 message, the behavior 3701 SHOULD depend on how many checks the message has already passed. If 3702 the puzzle solution in the message has already been checked, the 3703 implementation SHOULD report the error by responding with a NOTIFY 3704 packet. Otherwise, the implementation MAY respond with an ICMP 3705 message as defined in Section 5.4. 3707 6.10. Processing Incoming R2 Packets 3709 An R2 received in states UNASSOCIATED, I1-SENT, or ESTABLISHED 3710 results in the R2 being dropped and the state machine staying in the 3711 same state. If an R2 is received in state I2-SENT, it SHOULD be 3712 processed. 3714 The following steps define the conceptual processing rules for an 3715 incoming R2 packet: 3717 1. The system MUST verify that the HITs in use correspond to the 3718 HITs that were received in the R1. 3720 2. The system MUST verify the HMAC_2 according to the procedures in 3721 Section 5.2.11. 3723 3. The system MUST verify the HIP signature according to the 3724 procedures in Section 5.2.12. 3726 4. If any of the checks above fail, there is a high probability of 3727 an ongoing man-in-the-middle or other security attack. The 3728 system SHOULD act accordingly, based on its local policy. 3730 5. If the system is in any other state than I2-SENT, the R2 is 3731 silently dropped. 3733 6. Upon successful processing of the R2, the state machine moves to 3734 state ESTABLISHED. 3736 6.11. Sending UPDATE Packets 3738 A host sends an UPDATE packet when it wants to update some 3739 information related to a HIP association. There are a number of 3740 likely situations, e.g., mobility management and rekeying of an 3741 existing ESP Security Association. The following paragraphs define 3742 the conceptual rules for sending an UPDATE packet to the peer. 3743 Additional steps can be defined in other documents where the UPDATE 3744 packet is used. 3746 The system first determines whether there are any outstanding UPDATE 3747 messages that may conflict with the new UPDATE message under 3748 consideration. When multiple UPDATEs are outstanding (not yet 3749 acknowledged), the sender must assume that such UPDATEs may be 3750 processed in an arbitrary order. Therefore, any new UPDATEs that 3751 depend on a previous outstanding UPDATE being successfully received 3752 and acknowledged MUST be postponed until reception of the necessary 3753 ACK(s) occurs. One way to prevent any conflicts is to only allow one 3754 outstanding UPDATE at a time. However, allowing multiple UPDATEs may 3755 improve the performance of mobility and multihoming protocols. 3757 The following steps define the conceptual processing rules for 3758 sending UPDATE packets. 3760 1. The first UPDATE packet is sent with Update ID of zero. 3761 Otherwise, the system increments its own Update ID value by one 3762 before continuing the below steps. 3764 2. The system creates an UPDATE packet that contains a SEQ parameter 3765 with the current value of Update ID. The UPDATE packet may also 3766 include an ACK of the peer's Update ID found in a received UPDATE 3767 SEQ parameter, if any. 3769 3. The system sends the created UPDATE packet and starts an UPDATE 3770 timer. The default value for the timer is 2 * RTT estimate. If 3771 multiple UPDATEs are outstanding, multiple timers are in effect. 3773 4. If the UPDATE timer expires, the UPDATE is resent. The UPDATE 3774 can be resent UPDATE_RETRY_MAX times. The UPDATE timer SHOULD be 3775 exponentially backed off for subsequent retransmissions. If no 3776 acknowledgment is received from the peer after UPDATE_RETRY_MAX 3777 times, the HIP association is considered to be broken and the 3778 state machine should move from state ESTABLISHED to state CLOSING 3779 as depicted in Section 4.4.3. The UPDATE timer is cancelled upon 3780 receiving an ACK from the peer that acknowledges receipt of the 3781 UPDATE. 3783 6.12. Receiving UPDATE Packets 3785 When a system receives an UPDATE packet, its processing depends on 3786 the state of the HIP association and the presence and values of the 3787 SEQ and ACK parameters. Typically, an UPDATE message also carries 3788 optional parameters whose handling is defined in separate documents. 3790 For each association, the peer's next expected in-sequence Update ID 3791 ("peer Update ID") is stored. Initially, this value is zero. Update 3792 ID comparisons of "less than" and "greater than" are performed with 3793 respect to a circular sequence number space. 3795 The sender may send multiple outstanding UPDATE messages. These 3796 messages are processed in the order in which they are received at the 3797 receiver (i.e., no resequencing is performed). When processing 3798 UPDATEs out-of-order, the receiver MUST keep track of which UPDATEs 3799 were previously processed, so that duplicates or retransmissions are 3800 ACKed and not reprocessed. A receiver MAY choose to define a receive 3801 window of Update IDs that it is willing to process at any given time, 3802 and discard received UPDATEs falling outside of that window. 3804 The following steps define the conceptual processing rules for 3805 receiving UPDATE packets. 3807 1. If there is no corresponding HIP association, the implementation 3808 MAY reply with an ICMP Parameter Problem, as specified in 3809 Section 5.4.4. 3811 2. If the association is in the ESTABLISHED state and the SEQ (but 3812 not ACK) parameter is present, the UPDATE is processed and 3813 replied to as described in Section 6.12.1. 3815 3. If the association is in the ESTABLISHED state and the ACK (but 3816 not SEQ) parameter is present, the UPDATE is processed as 3817 described in Section 6.12.2. 3819 4. If the association is in the ESTABLISHED state and there is both 3820 an ACK and SEQ in the UPDATE, the ACK is first processed as 3821 described in Section 6.12.2, and then the rest of the UPDATE is 3822 processed as described in Section 6.12.1. 3824 6.12.1. Handling a SEQ Parameter in a Received UPDATE Message 3826 The following steps define the conceptual processing rules for 3827 handling a SEQ parameter in a received UPDATE packet. 3829 1. If the Update ID in the received SEQ is not the next in the 3830 sequence of Update IDs and is greater than the receiver's window 3831 for new UPDATEs, the packet MUST be dropped. 3833 2. If the Update ID in the received SEQ corresponds to an UPDATE 3834 that has recently been processed, the packet is treated as a 3835 retransmission. The HMAC verification (next step) MUST NOT be 3836 skipped. (A byte-by-byte comparison of the received and a stored 3837 packet would be OK, though.) It is recommended that a host cache 3838 UPDATE packets sent with ACKs to avoid the cost of generating a 3839 new ACK packet to respond to a replayed UPDATE. The system MUST 3840 acknowledge, again, such (apparent) UPDATE message 3841 retransmissions but SHOULD also consider rate-limiting such 3842 retransmission responses to guard against replay attacks. 3844 3. The system MUST verify the HMAC in the UPDATE packet. If the 3845 verification fails, the packet MUST be dropped. 3847 4. The system MAY verify the SIGNATURE in the UPDATE packet. If the 3848 verification fails, the packet SHOULD be dropped and an error 3849 message logged. 3851 5. If a new SEQ parameter is being processed, the parameters in the 3852 UPDATE are then processed. The system MUST record the Update ID 3853 in the received SEQ parameter, for replay protection. 3855 6. An UPDATE acknowledgment packet with ACK parameter is prepared 3856 and sent to the peer. This ACK parameter may be included in a 3857 separate UPDATE or piggybacked in an UPDATE with SEQ parameter, 3858 as described in Section 5.3.5. The ACK parameter MAY acknowledge 3859 more than one of the peer's Update IDs. 3861 6.12.2. Handling an ACK Parameter in a Received UPDATE Packet 3863 The following steps define the conceptual processing rules for 3864 handling an ACK parameter in a received UPDATE packet. 3866 1. The sequence number reported in the ACK must match with an 3867 earlier sent UPDATE packet that has not already been 3868 acknowledged. If no match is found or if the ACK does not 3869 acknowledge a new UPDATE, the packet MUST either be dropped if no 3870 SEQ parameter is present, or the processing steps in 3871 Section 6.12.1 are followed. 3873 2. The system MUST verify the HMAC in the UPDATE packet. If the 3874 verification fails, the packet MUST be dropped. 3876 3. The system MAY verify the SIGNATURE in the UPDATE packet. If the 3877 verification fails, the packet SHOULD be dropped and an error 3878 message logged. 3880 4. The corresponding UPDATE timer is stopped (see Section 6.11) so 3881 that the now acknowledged UPDATE is no longer retransmitted. If 3882 multiple UPDATEs are newly acknowledged, multiple timers are 3883 stopped. 3885 6.13. Processing NOTIFY Packets 3887 Processing NOTIFY packets is OPTIONAL. If processed, any errors in a 3888 received NOTIFICATION parameter SHOULD be logged. Received errors 3889 MUST be considered only as informational, and the receiver SHOULD NOT 3890 change its HIP state (Section 4.4.1) purely based on the received 3891 NOTIFY message. 3893 6.14. Processing CLOSE Packets 3895 When the host receives a CLOSE message, it responds with a CLOSE_ACK 3896 message and moves to CLOSED state. (The authenticity of the CLOSE 3897 message is verified using both HMAC and SIGNATURE). This processing 3898 applies whether or not the HIP association state is CLOSING in order 3899 to handle CLOSE messages from both ends that cross in flight. 3901 The HIP association is not discarded before the host moves from the 3902 UNASSOCIATED state. 3904 Once the closing process has started, any need to send data packets 3905 will trigger creating and establishing of a new HIP association, 3906 starting with sending an I1. 3908 If there is no corresponding HIP association, the CLOSE packet is 3909 dropped. 3911 6.15. Processing CLOSE_ACK Packets 3913 When a host receives a CLOSE_ACK message, it verifies that it is in 3914 CLOSING or CLOSED state and that the CLOSE_ACK was in response to the 3915 CLOSE (using the included ECHO_RESPONSE_SIGNED in response to the 3916 sent ECHO_REQUEST_SIGNED). 3918 The CLOSE_ACK uses HMAC and SIGNATURE for verification. The state is 3919 discarded when the state changes to UNASSOCIATED and, after that, the 3920 host MAY respond with an ICMP Parameter Problem to an incoming CLOSE 3921 message (see Section 5.4.4). 3923 6.16. Handling State Loss 3925 In the case of system crash and unanticipated state loss, the system 3926 SHOULD delete the corresponding HIP state, including the keying 3927 material. That is, the state SHOULD NOT be stored on stable storage. 3928 If the implementation does drop the state (as RECOMMENDED), it MUST 3929 also drop the peer's R1 generation counter value, unless a local 3930 policy explicitly defines that the value of that particular host is 3931 stored. An implementation MUST NOT store R1 generation counters by 3932 default, but storing R1 generation counter values, if done, MUST be 3933 configured by explicit HITs. 3935 7. HIP Policies 3937 There are a number of variables that will influence the HIP exchanges 3938 that each host must support. All HIP implementations MUST support 3939 more than one simultaneous HI, at least one of which SHOULD be 3940 reserved for anonymous usage. Although anonymous HIs will be rarely 3941 used as Responders' HIs, they will be common for Initiators. Support 3942 for more than two HIs is RECOMMENDED. 3944 Many Initiators would want to use a different HI for different 3945 Responders. The implementations SHOULD provide for an ACL of 3946 Initiator's HIT to Responder's HIT. This ACL SHOULD also include 3947 preferred transform and local lifetimes. 3949 The value of K used in the HIP R1 packet can also vary by policy. K 3950 should never be greater than 20, but for trusted partners it could be 3951 as low as 0. 3953 Responders would need a similar ACL, representing which hosts they 3954 accept HIP exchanges, and the preferred transform and local 3955 lifetimes. Wildcarding SHOULD be supported for this ACL also. 3957 8. Security Considerations 3959 HIP is designed to provide secure authentication of hosts. HIP also 3960 attempts to limit the exposure of the host to various denial-of- 3961 service and man-in-the-middle (MitM) attacks. In so doing, HIP 3962 itself is subject to its own DoS and MitM attacks that potentially 3963 could be more damaging to a host's ability to conduct business as 3964 usual. 3966 The 384-bit Diffie-Hellman Group is targeted to be used in hosts that 3967 either do not require or are not powerful enough for handling strong 3968 cryptography. Although there is a risk that with suitable equipment 3969 the encryption can be broken in real time, the 384-bit group can 3970 provide some protection for end-hosts that are not able to handle any 3971 stronger cryptography. When the security provided by the 384-bit 3972 group is not enough for applications on a host, the support for this 3973 group should be turned off in the configuration. 3975 Denial-of-service attacks often take advantage of the cost of start 3976 of state for a protocol on the Responder compared to the 'cheapness' 3977 on the Initiator. HIP makes no attempt to increase the cost of the 3978 start of state on the Initiator, but makes an effort to reduce the 3979 cost to the Responder. This is done by having the Responder start 3980 the 3-way exchange instead of the Initiator, making the HIP protocol 3981 4 packets long. In doing this, packet 2 becomes a 'stock' packet 3982 that the Responder MAY use many times, until some Initiator has 3983 provided a valid response to such an R1 packet. During an I1 storm, 3984 the host may reuse the same D-H value also even if some Initiator has 3985 provided a valid response using that particular D-H value. However, 3986 such behavior is discouraged and should be avoided. Using the same 3987 Diffie-Hellman values and random puzzle #I value has some risks. 3988 This risk needs to be balanced against a potential storm of HIP I1 3989 packets. 3991 This shifting of the start of state cost to the Initiator in creating 3992 the I2 HIP packet, presents another DoS attack. The attacker spoofs 3993 the I1 HIP packet and the Responder sends out the R1 HIP packet. 3994 This could conceivably tie up the 'Initiator' with evaluating the R1 3995 HIP packet, and creating the I2 HIP packet. The defense against this 3996 attack is to simply ignore any R1 packet where a corresponding I1 was 3997 not sent. 3999 A second form of DoS attack arrives in the I2 HIP packet. Once the 4000 attacking Initiator has solved the puzzle, it can send packets with 4001 spoofed IP source addresses with either an invalid encrypted HIP 4002 payload component or a bad HIP signature. This would take resources 4003 in the Responder's part to reach the point to discover that the I2 4004 packet cannot be completely processed. The defense against this 4005 attack is after N bad I2 packets, the Responder would discard any I2s 4006 that contain the given Initiator HIT. This will shut down the 4007 attack. The attacker would have to request another R1 and use that 4008 to launch a new attack. The Responder could up the value of K while 4009 under attack. On the downside, valid I2s might get dropped too. 4011 A third form of DoS attack is emulating the restart of state after a 4012 reboot of one of the partners. A restarting host would send an I1 to 4013 a peer, which would respond with an R1 even if it were in the 4014 ESTABLISHED state. If the I1 were spoofed, the resulting R1 would be 4015 received unexpectedly by the spoofed host and would be dropped, as in 4016 the first case above. 4018 A fourth form of DoS attack is emulating the end of state. HIP 4019 relies on timers plus a CLOSE/CLOSE_ACK handshake to explicitly 4020 signal the end of a HIP association. Because both CLOSE and 4021 CLOSE_ACK messages contain an HMAC, an outsider cannot close a 4022 connection. The presence of an additional SIGNATURE allows 4023 middleboxes to inspect these messages and discard the associated 4024 state (for e.g., firewalling, SPI-based NATing, etc.). However, the 4025 optional behavior of replying to CLOSE with an ICMP Parameter Problem 4026 packet (as described in Section 5.4.4) might allow an IP spoofer 4027 sending CLOSE messages to launch reflection attacks. 4029 A fifth form of DoS attack is replaying R1s to cause the Initiator to 4030 solve stale puzzles and become out of synchronization with the 4031 Responder. The R1 generation counter is a monotonically increasing 4032 counter designed to protect against this attack, as described in 4033 Section 4.1.4. 4035 Man-in-the-middle attacks are difficult to defend against, without 4036 third-party authentication. A skillful MitM could easily handle all 4037 parts of HIP, but HIP indirectly provides the following protection 4038 from a MitM attack. If the Responder's HI is retrieved from a signed 4039 DNS zone, a certificate, or through some other secure means, the 4040 Initiator can use this to validate the R1 HIP packet. 4042 Likewise, if the Initiator's HI is in a secure DNS zone, a trusted 4043 certificate, or otherwise securely available, the Responder can 4044 retrieve the HI (after having got the I2 HIP packet) and verify that 4045 the HI indeed can be trusted. However, since an Initiator may choose 4046 to use an anonymous HI, it knowingly risks a MitM attack. The 4047 Responder may choose not to accept a HIP exchange with an anonymous 4048 Initiator. 4050 The HIP Opportunistic Mode concept has been introduced in this 4051 document, but this document does not specify what the semantics of 4052 such a connection setup are for applications. There are certain 4053 concerns with opportunistic mode, as discussed in Section 4.1.6. 4055 NOTIFY messages are used only for informational purposes and they are 4056 unacknowledged. A HIP implementation cannot rely solely on the 4057 information received in a NOTIFY message because the packet may have 4058 been replayed. It SHOULD NOT change any state information based 4059 purely on a received NOTIFY message. 4061 Since not all hosts will ever support HIP, ICMP 'Destination Protocol 4062 Unreachable' messages are to be expected and present a DoS attack. 4063 Against an Initiator, the attack would look like the Responder does 4064 not support HIP, but shortly after receiving the ICMP message, the 4065 Initiator would receive a valid R1 HIP packet. Thus, to protect from 4066 this attack, an Initiator should not react to an ICMP message until a 4067 reasonable delta time to get the real Responder's R1 HIP packet. A 4068 similar attack against the Responder is more involved. Normally, if 4069 an I1 message received by a Responder was a bogus one sent by an 4070 attacker, the Responder may receive an ICMP message from the IP 4071 address the R1 message was sent to. However, a sophisticated 4072 attacker can try to take advantage of such a behavior and try to 4073 break up the HIP exchange by sending such an ICMP message to the 4074 Responder before the Initiator has a chance to send a valid I2 4075 message. Hence, the Responder SHOULD NOT act on such an ICMP 4076 message. Especially, it SHOULD NOT remove any minimal state created 4077 when it sent the R1 HIP packet (if it did create one), but wait for 4078 either a valid I2 HIP packet or the natural timeout (that is, if R1 4079 packets are tracked at all). Likewise, the Initiator should ignore 4080 any ICMP message while waiting for an R2 HIP packet, and should 4081 delete any pending state only after a natural timeout. 4083 9. IANA Considerations 4085 IANA has reserved protocol number 139 for the Host Identity Protocol. 4087 This document defines a new 128-bit value under the CGA Message Type 4088 namespace [RFC3972], 0xF0EF F02F BFF4 3D0F E793 0C3C 6E61 74EA, to be 4089 used for HIT generation as specified in ORCHID [RFC4843-bis]. 4091 This document also creates a set of new namespaces. These are 4092 described below. 4094 Packet Type 4096 The 7-bit Packet Type field in a HIP protocol packet describes the 4097 type of a HIP protocol message. It is defined in Section 5.1. 4098 The current values are defined in Sections 5.3.1 through 5.3.8. 4100 New values are assigned through IETF Consensus [RFC2434]. 4102 HIP Version 4104 The four-bit Version field in a HIP protocol packet describes the 4105 version of the HIP protocol. It is defined in Section 5.1. The 4106 only currently defined value is 1. New values are assigned 4107 through IETF Consensus. 4109 Parameter Type 4111 The 16-bit Type field in a HIP parameter describes the type of the 4112 parameter. It is defined in Section 5.2.1. The current values 4113 are defined in Sections 5.2.3 through 5.2.21. 4115 With the exception of the assigned Type codes, the Type codes 0 4116 through 1023 and 61440 through 65535 are reserved for future base 4117 protocol extensions, and are assigned through IETF Consensus. 4119 The Type codes 32768 through 49141 are reserved for 4120 experimentation. Types SHOULD be selected in a random fashion 4121 from this range, thereby reducing the probability of collisions. 4122 A method employing genuine randomness (such as flipping a coin) 4123 SHOULD be used. 4125 All other Type codes are assigned through First Come First Served, 4126 with Specification Required [RFC2434]. 4128 Group ID 4130 The eight-bit Group ID values appear in the DIFFIE_HELLMAN 4131 parameter and are defined in Section 5.2.6. New values either 4132 from the reserved or unassigned space are assigned through IETF 4133 Consensus. 4135 Suite ID 4137 The 16-bit Suite ID values in a HIP_TRANSFORM parameter are 4138 defined in Section 5.2.7. New values either from the reserved or 4139 unassigned space are assigned through IETF Consensus. 4141 DI-Type 4143 The four-bit DI-Type values in a HOST_ID parameter are defined in 4144 Section 5.2.8. New values are assigned through IETF Consensus. 4146 Notify Message Type 4148 The 16-bit Notify Message Type values in a NOTIFICATION parameter 4149 are defined in Section 5.2.17. 4151 Notify Message Type values 1-10 are used for informing about 4152 errors in packet structures, values 11-20 for informing about 4153 problems in parameters containing cryptographic related material, 4154 values 21-30 for informing about problems in authentication or 4155 packet integrity verification. Parameter numbers above 30 can be 4156 used for informing about other types of errors or events. Values 4157 51-8191 are error types reserved to be allocated by IANA. Values 4158 8192-16383 are error types for experimentation. Values 16385- 4159 40959 are status types to be allocated by IANA, and values 40960- 4160 65535 are status types for experimentation. New values in ranges 4161 51-8191 and 16385-40959 are assigned through First Come First 4162 Served, with Specification Required. 4164 10. Acknowledgments 4166 The drive to create HIP came to being after attending the MALLOC 4167 meeting at the 43rd IETF meeting. Baiju Patel and Hilarie Orman 4168 really gave the original author, Bob Moskowitz, the assist to get HIP 4169 beyond 5 paragraphs of ideas. It has matured considerably since the 4170 early versions thanks to extensive input from IETFers. Most 4171 importantly, its design goals are articulated and are different from 4172 other efforts in this direction. Particular mention goes to the 4173 members of the NameSpace Research Group of the IRTF. Noel Chiappa 4174 provided valuable input at early stages of discussions about 4175 identifier handling and Keith Moore the impetus to provide 4176 resolvability. Steve Deering provided encouragement to keep working, 4177 as a solid proposal can act as a proof of ideas for a research group. 4179 Many others contributed; extensive security tips were provided by 4180 Steve Bellovin. Rob Austein kept the DNS parts on track. Paul 4181 Kocher taught Bob Moskowitz how to make the puzzle exchange expensive 4182 for the Initiator to respond, but easy for the Responder to validate. 4183 Bill Sommerfeld supplied the Birthday concept, which later evolved 4184 into the R1 generation counter, to simplify reboot management. Erik 4185 Nordmark supplied the CLOSE-mechanism for closing connections. 4186 Rodney Thayer and Hugh Daniels provided extensive feedback. In the 4187 early times of this document, John Gilmore kept Bob Moskowitz 4188 challenged to provide something of value. 4190 During the later stages of this document, when the editing baton was 4191 transferred to Pekka Nikander, the input from the early implementors 4192 was invaluable. Without having actual implementations, this document 4193 would not be on the level it is now. 4195 In the usual IETF fashion, a large number of people have contributed 4196 to the actual text or ideas. The list of these people include Jeff 4197 Ahrenholz, Francis Dupont, Derek Fawcus, George Gross, Andrew 4198 McGregor, Julien Laganier, Miika Komu, Mika Kousa, Jan Melen, Henrik 4199 Petander, Michael Richardson, Tim Shepard, Jorma Wall, and Jukka 4200 Ylitalo. Our apologies to anyone whose name is missing. 4202 Once the HIP Working Group was founded in early 2004, a number of 4203 changes were introduced through the working group process. Most 4204 notably, the original document was split in two, one containing the 4205 base exchange and the other one defining how to use ESP. Some 4206 modifications to the protocol proposed by Aura, et al., [AUR03] were 4207 added at a later stage. 4209 11. References 4210 11.1. Normative References 4212 [FIPS.180-2.2002] National Institute of Standards and Technology, 4213 "Secure Hash Standard", FIPS PUB 180-2, 4214 August 2002, . 4217 [FIPS.95-1.1993] National Institute of Standards and Technology, 4218 "Codes for the Identification of Federal and 4219 Federally Assisted Organizations", FIPS PUB 95-1, 4220 January 1993. 4222 [RFC0768] Postel, J., "User Datagram Protocol", STD 6, 4223 RFC 768, August 1980. 4225 [RFC1035] Mockapetris, P., "Domain names - implementation 4226 and specification", STD 13, RFC 1035, 4227 November 1987. 4229 [RFC2119] Bradner, S., "Key words for use in RFCs to 4230 Indicate Requirement Levels", BCP 14, RFC 2119, 4231 March 1997. 4233 [RFC2404] Madson, C. and R. Glenn, "The Use of HMAC-SHA-1-96 4234 within ESP and AH", RFC 2404, November 1998. 4236 [RFC2451] Pereira, R. and R. Adams, "The ESP CBC-Mode Cipher 4237 Algorithms", RFC 2451, November 1998. 4239 [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, 4240 Version 6 (IPv6) Specification", RFC 2460, 4241 December 1998. 4243 [RFC2463] Conta, A. and S. Deering, "Internet Control 4244 Message Protocol (ICMPv6) for the Internet 4245 Protocol Version 6 (IPv6) Specification", 4246 RFC 2463, December 1998. 4248 [RFC2536] Eastlake, D., "DSA KEYs and SIGs in the Domain 4249 Name System (DNS)", RFC 2536, March 1999. 4251 [RFC2898] Kaliski, B., "PKCS #5: Password-Based Cryptography 4252 Specification Version 2.0", RFC 2898, 4253 September 2000. 4255 [RFC3110] Eastlake, D., "RSA/SHA-1 SIGs and RSA KEYs in the 4256 Domain Name System (DNS)", RFC 3110, May 2001. 4258 [RFC3484] Draves, R., "Default Address Selection for 4259 Internet Protocol version 6 (IPv6)", RFC 3484, 4260 February 2003. 4262 [RFC3526] Kivinen, T. and M. Kojo, "More Modular Exponential 4263 (MODP) Diffie-Hellman groups for Internet Key 4264 Exchange (IKE)", RFC 3526, May 2003. 4266 [RFC3602] Frankel, S., Glenn, R., and S. Kelly, "The AES-CBC 4267 Cipher Algorithm and Its Use with IPsec", 4268 RFC 3602, September 2003. 4270 [RFC3972] Aura, T., "Cryptographically Generated Addresses 4271 (CGA)", RFC 3972, March 2005. 4273 [RFC4034] Arends, R., Austein, R., Larson, M., Massey, D., 4274 and S. Rose, "Resource Records for the DNS 4275 Security Extensions", RFC 4034, March 2005. 4277 [RFC4282] Aboba, B., Beadles, M., Arkko, J., and P. Eronen, 4278 "The Network Access Identifier", RFC 4282, 4279 December 2005. 4281 [RFC4307] Schiller, J., "Cryptographic Algorithms for Use in 4282 the Internet Key Exchange Version 2 (IKEv2)", 4283 RFC 4307, December 2005. 4285 [RFC4843-bis] Nikander, P., Laganier, J., and F. Dupont, "STUB: 4286 An IPv6 Prefix for Overlay Routable Cryptographic 4287 Hash Identifiers (ORCHID)", 4288 draft-laganier-rfc4843-bis-00 (work in progress), 4289 February 2010. 4291 [RFC5202] Jokela, P., Moskowitz, R., and P. Nikander, "Using 4292 the Encapsulating Security Payload (ESP) Transport 4293 Format with the Host Identity Protocol (HIP)", 4294 RFC 5202, April 2008. 4296 [RFC5702] Jansen, J., "Use of SHA-2 Algorithms with RSA in 4297 DNSKEY and RRSIG Resource Records for DNSSEC", 4298 RFC 5702, October 2009. 4300 11.2. Informative References 4302 [AUR03] Aura, T., Nagarajan, A., and A. Gurtov, "Analysis 4303 of the HIP Base Exchange Protocol", in Proceedings 4304 of 10th Australasian Conference on Information 4305 Security and Privacy, July 2003. 4307 [CRO03] Crosby, SA. and DS. Wallach, "Denial of Service 4308 via Algorithmic Complexity Attacks", in 4309 Proceedings of Usenix Security Symposium 2003, 4310 Washington, DC., August 2003. 4312 [DIF76] Diffie, W. and M. Hellman, "New Directions in 4313 Cryptography", IEEE Transactions on Information 4314 Theory vol. IT-22, number 6, pages 644-654, 4315 Nov 1976. 4317 [FIPS.197.2001] National Institute of Standards and Technology, 4318 "Advanced Encryption Standard (AES)", FIPS PUB 4319 197, November 2001, . 4322 [KAU03] Kaufman, C., Perlman, R., and B. Sommerfeld, "DoS 4323 protection for UDP-based protocols", ACM 4324 Conference on Computer and Communications 4325 Security , Oct 2003. 4327 [KRA03] Krawczyk, H., "SIGMA: The 'SIGn-and-MAc' Approach 4328 to Authenticated Diffie-Hellman and Its Use in the 4329 IKE-Protocols", in Proceedings of CRYPTO 2003, 4330 pages 400-425, August 2003. 4332 [RFC0792] Postel, J., "Internet Control Message Protocol", 4333 STD 5, RFC 792, September 1981. 4335 [RFC2412] Orman, H., "The OAKLEY Key Determination 4336 Protocol", RFC 2412, November 1998. 4338 [RFC2434] Narten, T. and H. Alvestrand, "Guidelines for 4339 Writing an IANA Considerations Section in RFCs", 4340 BCP 26, RFC 2434, October 1998. 4342 [RFC4306] Kaufman, C., "Internet Key Exchange (IKEv2) 4343 Protocol", RFC 4306, December 2005. 4345 [RFC5204] Laganier, J. and L. Eggert, "Host Identity 4346 Protocol (HIP) Rendezvous Extension", RFC 5204, 4347 April 2008. 4349 [RFC5205] Nikander, P. and J. Laganier, "Host Identity 4350 Protocol (HIP) Domain Name System (DNS) 4351 Extensions", RFC 5205, April 2008. 4353 [RFC5206] Nikander, P., Henderson, T., Vogt, C., and J. 4354 Arkko, "End-Host Mobility and Multihoming with the 4355 Host Identity Protocol", RFC 5206, April 2008. 4357 [RFC5338] Henderson, T., Nikander, P., and M. Komu, "Using 4358 the Host Identity Protocol with Legacy 4359 Applications", RFC 5338, September 2008. 4361 [RFC5533] Nordmark, E. and M. Bagnulo, "Shim6: Level 3 4362 Multihoming Shim Protocol for IPv6", RFC 5533, 4363 June 2009. 4365 [btns-c-api] Richardson, M., Williams, N., Komu, M., and S. 4366 Tarkoma, "C-Bindings for IPsec Application 4367 Programming Interfaces", draft-ietf-btns-c-api-04 4368 (work in progress), March 2009. 4370 [rfc4423-bis] Moskowitz, R. and P. Nikander, "Host Identity 4371 Protocol Architecture", 4372 draft-moskowitz-hip-rfc4423-bis-00 (work in 4373 progress), December 2009. 4375 Appendix A. Using Responder Puzzles 4377 As mentioned in Section 4.1.1, the Responder may delay state creation 4378 and still reject most spoofed I2s by using a number of pre-calculated 4379 R1s and a local selection function. This appendix defines one 4380 possible implementation in detail. The purpose of this appendix is 4381 to give the implementors an idea on how to implement the mechanism. 4382 If the implementation is based on this appendix, it MAY contain some 4383 local modification that makes an attacker's task harder. 4385 The Responder creates a secret value S, that it regenerates 4386 periodically. The Responder needs to remember the two latest values 4387 of S. Each time the S is regenerated, the R1 generation counter 4388 value is incremented by one. 4390 The Responder generates a pre-signed R1 packet. The signature for 4391 pre-generated R1s must be recalculated when the Diffie-Hellman key is 4392 recomputed or when the R1_COUNTER value changes due to S value 4393 regeneration. 4395 When the Initiator sends the I1 packet for initializing a connection, 4396 the Responder gets the HIT and IP address from the packet, and 4397 generates an I value for the puzzle. The I value is set to the pre- 4398 signed R1 packet. 4400 I value calculation: 4401 I = Ltrunc( RHASH ( S | HIT-I | HIT-R | IP-I | IP-R ), 64) 4403 The RHASH algorithm is the same that is used to generate the 4404 Responder's HIT value. 4406 From an incoming I2 packet, the Responder gets the required 4407 information to validate the puzzle: HITs, IP addresses, and the 4408 information of the used S value from the R1_COUNTER. Using these 4409 values, the Responder can regenerate the I, and verify it against the 4410 I received in the I2 packet. If the I values match, it can verify 4411 the solution using I, J, and difficulty K. If the I values do not 4412 match, the I2 is dropped. 4414 puzzle_check: 4415 V := Ltrunc( RHASH( I2.I | I2.hit_i | I2.hit_r | I2.J ), K ) 4416 if V != 0, drop the packet 4418 If the puzzle solution is correct, the I and J values are stored for 4419 later use. They are used as input material when keying material is 4420 generated. 4422 Keeping state about failed puzzle solutions depends on the 4423 implementation. Although it is possible for the Responder not to 4424 keep any state information, it still may do so to protect itself 4425 against certain attacks (see Section 4.1.1). 4427 Appendix B. Generating a Public Key Encoding from an HI 4429 The following pseudo-code illustrates the process to generate a 4430 public key encoding from an HI for both RSA and DSA. 4432 The symbol := denotes assignment; the symbol += denotes appending. 4433 The pseudo-function encode_in_network_byte_order takes two 4434 parameters, an integer (bignum) and a length in bytes, and returns 4435 the integer encoded into a byte string of the given length. 4437 switch ( HI.algorithm ) 4438 { 4440 case RSA: 4441 buffer := encode_in_network_byte_order ( HI.RSA.e_len, 4442 ( HI.RSA.e_len > 255 ) ? 3 : 1 ) 4443 buffer += encode_in_network_byte_order ( HI.RSA.e, HI.RSA.e_len ) 4444 buffer += encode_in_network_byte_order ( HI.RSA.n, HI.RSA.n_len ) 4445 break; 4447 case DSA: 4448 buffer := encode_in_network_byte_order ( HI.DSA.T , 1 ) 4449 buffer += encode_in_network_byte_order ( HI.DSA.Q , 20 ) 4450 buffer += encode_in_network_byte_order ( HI.DSA.P , 64 + 4451 8 * HI.DSA.T ) 4452 buffer += encode_in_network_byte_order ( HI.DSA.G , 64 + 4453 8 * HI.DSA.T ) 4454 buffer += encode_in_network_byte_order ( HI.DSA.Y , 64 + 4455 8 * HI.DSA.T ) 4456 break; 4458 } 4460 Appendix C. Example Checksums for HIP Packets 4462 The HIP checksum for HIP packets is specified in Section 5.1.1. 4463 Checksums for TCP and UDP packets running over HIP-enabled security 4464 associations are specified in Section 3.5. The examples below use IP 4465 addresses of 192.168.0.1 and 192.168.0.2 (and their respective IPv4- 4466 compatible IPv6 formats), and HITs with the prefix of 2001:10 4467 followed by zeros, followed by a decimal 1 or 2, respectively. 4469 The following example is defined only for testing a checksum 4470 calculation. The address format for the IPv4-compatible IPv6 address 4471 is not a valid one, but using these IPv6 addresses when testing an 4472 IPv6 implementation gives the same checksum output as an IPv4 4473 implementation with the corresponding IPv4 addresses. 4475 C.1. IPv6 HIP Example (I1) 4477 Source Address: ::192.168.0.1 4478 Destination Address: ::192.168.0.2 4479 Upper-Layer Packet Length: 40 0x28 4480 Next Header: 139 0x8b 4481 Payload Protocol: 59 0x3b 4482 Header Length: 4 0x4 4483 Packet Type: 1 0x1 4484 Version: 1 0x1 4485 Reserved: 1 0x1 4486 Control: 0 0x0 4487 Checksum: 446 0x1be 4488 Sender's HIT : 2001:10::1 4489 Receiver's HIT: 2001:10::2 4491 C.2. IPv4 HIP Packet (I1) 4493 The IPv4 checksum value for the same example I1 packet is the same as 4494 the IPv6 checksum (since the checksums due to the IPv4 and IPv6 4495 pseudo-header components are the same). 4497 C.3. TCP Segment 4499 Regardless of whether IPv6 or IPv4 is used, the TCP and UDP sockets 4500 use the IPv6 pseudo-header format [RFC2460], with the HITs used in 4501 place of the IPv6 addresses. 4503 Sender's HIT: 2001:10::1 4504 Receiver's HIT: 2001:10::2 4505 Upper-Layer Packet Length: 20 0x14 4506 Next Header: 6 0x06 4507 Source port: 65500 0xffdc 4508 Destination port: 22 0x0016 4509 Sequence number: 1 0x00000001 4510 Acknowledgment number: 0 0x00000000 4511 Header length: 20 0x14 4512 Flags: SYN 0x02 4513 Window size: 65535 0xffff 4514 Checksum: 28618 0x6fca 4515 Urgent pointer: 0 0x0000 4517 0x0000: 6000 0000 0014 0640 2001 0010 0000 0000 4518 0x0010: 0000 0000 0000 0001 2001 0010 0000 0000 4519 0x0020: 0000 0000 0000 0002 ffdc 0016 0000 0001 4520 0x0030: 0000 0000 5002 ffff 6fca 0000 4522 Appendix D. 384-Bit Group 4524 This 384-bit group is defined only to be used with HIP. NOTE: The 4525 security level of this group is very low! The encryption may be 4526 broken in a very short time, even real-time. It should be used only 4527 when the host is not powerful enough (e.g., some PDAs) and when 4528 security requirements are low (e.g., during normal web surfing). 4530 This prime is: 2^384 - 2^320 - 1 + 2^64 * { [ 2^254 pi] + 5857 } 4532 Its hexadecimal value is: 4534 FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 4535 29024E08 8A67CC74 020BBEA6 3B13B202 FFFFFFFF FFFFFFFF 4537 The generator is: 2. 4539 Appendix E. OAKLEY Well-Known Group 1 4541 See also [RFC2412] for definition of OAKLEY well-known group 1. 4543 OAKLEY Well-Known Group 1: A 768-bit prime 4545 The prime is 2^768 - 2^704 - 1 + 2^64 * { [2^638 pi] + 149686 }. 4547 The hexadecimal value is: 4549 FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 4550 29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD 4551 EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245 4552 E485B576 625E7EC6 F44C42E9 A63A3620 FFFFFFFF FFFFFFFF 4554 This has been rigorously verified as a prime. 4556 The generator is: 22 (decimal) 4558 Appendix F. ORCHID Generation Algorithms for HITs 4560 The HIT as an ORCHID [RFC4843-bis] consists of three parts: A 28-bit 4561 prefix, a 4-bit encoding of the ORCHID generation algorithm (OGA) and 4562 the representation of the public key. The OGA is an index pointing 4563 to the specific aglorithm by which the 96-bit hashed encoding is 4564 generated. The OGA is protocol specific and is to be interpreted as 4565 defined below for all protocols that use the same context ID as HIP. 4567 The set of used OGAs will be extended to counter the progress in 4568 computation capabilities and vulnerabilities in the employed 4569 algorithms. The intended use of the OGA is to introduce a new OGA 4570 and phase out an old OGA before it becomes insecure. Since the 4-bit 4571 OGA field only permits 16 OGAs to be used in parallel, phased-out 4572 OGAs must be reused at some point. In such a case, there will be a 4573 rollover of the OGA index and the next newly introduced OGA will 4574 start with a lower OGA index than the previoulsy introduced one. The 4575 rollover effectively deprecates the reused OGA. For a smooth 4576 transition, the OGA should be deprecated a considerable time before 4577 the OGA index is reused. 4579 The OGA of the Responder's HIT determines the RHASH and the hash 4580 function to be used for the HMAC in HIP control packets. For OGAs 4581 that employ a hash function, this hash function is used. For OGAs 4582 that do not need a hash function, a hash function is defined in 4583 Table 11. 4585 The following OGAs are defined for HIT generation. The input for 4586 each generation algorithm is the encoding of the HI as defined in 4587 Section 3.2. The output is 96 bits long and is directly used in the 4588 ORCHID. 4590 +-------+---------------+------------------------------+ 4591 | Index | Hash function | Description | 4592 +-------+---------------+------------------------------+ 4593 | 0 | | Reserved | 4594 | 1 | SHA-1 | SHA-1 truncated to 96 bits | 4595 | 2 | SHA-256 | SHA-256 truncated to 96 bits | 4596 +-------+---------------+------------------------------+ 4598 Table 11: Orchid Generation Algorithms 4600 F.1. SHA-1 Truncated to 96 Bits 4602 For generating a HIT with OGA index 1, the input is hashed with SHA-1 4603 [FIPS.95-1.1993] and the left-most 96 bits are used as output: 4604 LTRUNC(SHA-1(HI), 96). 4606 F.2. SHA-256 Truncated to 96 Bits 4608 For generating a HIT with OGA index 2, the input is hashed with SHA- 4609 256 [FIPS.180-2.2002] and the left-most 96 bits are used as output: 4610 LTRUNC(SHA-256(HI), 96). 4612 Authors' Addresses 4614 Robert Moskowitz (editor) 4615 ICSAlabs, An Independent Division of Verizon Business Systems 4616 1000 Bent Creek Blvd, Suite 200 4617 Mechanicsburg, PA 4618 USA 4620 EMail: robert.moskowitz@icsalabs.com 4622 Pekka Nikander 4623 Ericsson Research NomadicLab 4624 JORVAS FIN-02420 4625 FINLAND 4627 Phone: +358 9 299 1 4628 EMail: pekka.nikander@nomadiclab.com 4630 Petri Jokela 4631 Ericsson Research NomadicLab 4632 JORVAS FIN-02420 4633 FINLAND 4635 Phone: +358 9 299 1 4636 EMail: petri.jokela@nomadiclab.com 4638 Thomas R. Henderson 4639 The Boeing Company 4640 P.O. Box 3707 4641 Seattle, WA 4642 USA 4644 EMail: thomas.r.henderson@boeing.com 4646 Tobias Heer 4647 RWTH Aachen University, Distributed Systems Group 4648 Ahornstrasse 55 4649 Aachen 52062 4650 Germany 4652 EMail: heer@cs.rwth-aachen.de 4653 URI: http://ds.cs.rwth-aachen.de/members/heer