idnits 2.17.1 draft-ietf-hip-rfc5201-bis-02.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There are 5 instances of too long lines in the document, the longest one being 11 characters in excess of 72. == 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 1973 has weird spacing: '...c Value leng...' == Line 1975 has weird spacing: '...c Value the ...' == Line 2464 has weird spacing: '...ication info...' == Line 2590 has weird spacing: '...ue data opaqu...' == Line 2622 has weird spacing: '...ue data opaqu...' == (2 more instances...) == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'SHOULD not' in this paragraph: 7. The system MUST check that the DH Group ID in the DH parameter in the R1 matches the first DH Suite ID in the Responder's DH_GROUP_LIST in the R1 that was also contained in the Initiator's DH_GROUP_LIST in the I1. If the two DH Group ID of the DH parameter does not express the Responder's best choice, the Initiator can conclude that the DH_GROUP_LIST in the I1 was adversely modified. In such case, the Initiator MAY send a new I1 packet, however, it SHOULD not change its preference in the DH_GROUP_LIST in the new I1. Alternatively, the Initiator MAY abort the HIP exchange. == 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 (September 3, 2010) is 4978 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) == Missing Reference: 'RFC2410' is mentioned on line 2028, but not defined == Missing Reference: 'RFC4754' is mentioned on line 2107, but not defined == Missing Reference: 'RFC5639' is mentioned on line 2108, but not defined == Unused Reference: 'RFC2404' is defined on line 4657, but no explicit reference was found in the text == Unused Reference: 'RFC4307' is defined on line 4705, but no explicit reference was found in the text == Unused Reference: 'RFC4868' is defined on line 4718, but no explicit reference was found in the text ** Obsolete normative reference: RFC 2460 (Obsoleted by RFC 8200) ** Obsolete normative reference: RFC 2463 (Obsoleted by RFC 4443) ** Obsolete normative reference: RFC 2898 (Obsoleted by RFC 8018) ** Obsolete normative reference: RFC 3484 (Obsoleted by RFC 6724) ** Obsolete normative reference: RFC 4282 (Obsoleted by RFC 7542) ** Obsolete normative reference: RFC 4307 (Obsoleted by RFC 8247) ** Obsolete normative reference: RFC 4753 (Obsoleted by RFC 5903) -- 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 5201 (Obsoleted by RFC 7401) ** Obsolete normative reference: RFC 5202 (Obsoleted by RFC 7402) ** Downref: Normative reference to an Informational RFC: RFC 5869 -- 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: 11 errors (**), 0 flaws (~~), 17 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 ICSA labs 4 Obsoletes: 5201 (if approved) P. Jokela 5 Intended status: Standards Track Ericsson Research NomadicLab 6 Expires: March 7, 2011 T. Henderson 7 The Boeing Company 8 T. Heer 9 RWTH Aachen University, 10 Distributed Systems Group 11 September 3, 2010 13 Host Identity Protocol 14 draft-ietf-hip-rfc5201-bis-02 16 Abstract 18 This document specifies the details of the Host Identity Protocol 19 (HIP). HIP allows consenting hosts to securely establish and 20 maintain shared IP-layer state, allowing separation of the identifier 21 and locator roles of IP addresses, thereby enabling continuity of 22 communications across IP address changes. HIP is based on a SIGMA- 23 compliant Diffie-Hellman key exchange, using public key identifiers 24 from a new Host Identity namespace for mutual peer authentication. 25 The protocol is designed to be resistant to denial-of-service (DoS) 26 and man-in-the-middle (MitM) attacks. When used together with 27 another suitable security protocol, such as the Encapsulated Security 28 Payload (ESP), it provides integrity protection and optional 29 encryption for upper-layer protocols, such as TCP and UDP. 31 This document obsoletes RFC 5201 and addresses the concerns raised by 32 the IESG, particularly that of crypto agility. It also incorporates 33 lessons learned from the implementations of RFC 5201. 35 Status of This Memo 37 This Internet-Draft is submitted in full conformance with the 38 provisions of BCP 78 and BCP 79. 40 Internet-Drafts are working documents of the Internet Engineering 41 Task Force (IETF). Note that other groups may also distribute 42 working documents as Internet-Drafts. The list of current Internet- 43 Drafts is at http://datatracker.ietf.org/drafts/current/. 45 Internet-Drafts are draft documents valid for a maximum of six months 46 and may be updated, replaced, or obsoleted by other documents at any 47 time. It is inappropriate to use Internet-Drafts as reference 48 material or to cite them other than as "work in progress." 49 This Internet-Draft will expire on March 7, 2011. 51 Copyright Notice 53 Copyright (c) 2010 IETF Trust and the persons identified as the 54 document authors. All rights reserved. 56 This document is subject to BCP 78 and the IETF Trust's Legal 57 Provisions Relating to IETF Documents 58 (http://trustee.ietf.org/license-info) in effect on the date of 59 publication of this document. Please review these documents 60 carefully, as they describe your rights and restrictions with respect 61 to this document. Code Components extracted from this document must 62 include Simplified BSD License text as described in Section 4.e of 63 the Trust Legal Provisions and are provided without warranty as 64 described in the Simplified BSD License. 66 This document may contain material from IETF Documents or IETF 67 Contributions published or made publicly available before November 68 10, 2008. The person(s) controlling the copyright in some of this 69 material may not have granted the IETF Trust the right to allow 70 modifications of such material outside the IETF Standards Process. 71 Without obtaining an adequate license from the person(s) controlling 72 the copyright in such materials, this document may not be modified 73 outside the IETF Standards Process, and derivative works of it may 74 not be created outside the IETF Standards Process, except to format 75 it for publication as an RFC or to translate it into languages other 76 than English. 78 Table of Contents 80 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 6 81 1.1. A New Namespace and Identifiers . . . . . . . . . . . . . 7 82 1.2. The HIP Base Exchange (BEX) . . . . . . . . . . . . . . . 7 83 1.3. Memo Structure . . . . . . . . . . . . . . . . . . . . . 8 84 2. Terms and Definitions . . . . . . . . . . . . . . . . . . . . 8 85 2.1. Requirements Terminology . . . . . . . . . . . . . . . . 8 86 2.2. Notation . . . . . . . . . . . . . . . . . . . . . . . . 8 87 2.3. Definitions . . . . . . . . . . . . . . . . . . . . . . . 9 88 3. Host Identifier (HI) and Its Structure . . . . . . . . . . . 9 89 3.1. Host Identity Tag (HIT) . . . . . . . . . . . . . . . . . 10 90 3.2. Generating a HIT from an HI . . . . . . . . . . . . . . . 11 91 4. Protocol Overview . . . . . . . . . . . . . . . . . . . . . . 11 92 4.1. Creating a HIP Association . . . . . . . . . . . . . . . 12 93 4.1.1. HIP Puzzle Mechanism . . . . . . . . . . . . . . . . 14 94 4.1.2. Puzzle Exchange . . . . . . . . . . . . . . . . . . . 15 95 4.1.3. Authenticated Diffie-Hellman Protocol with DH 96 Group Negotiation . . . . . . . . . . . . . . . . . . 16 98 4.1.4. HIP Replay Protection . . . . . . . . . . . . . . . . 17 99 4.1.5. Refusing a HIP Exchange . . . . . . . . . . . . . . . 18 100 4.1.6. Aborting a HIP Exchange . . . . . . . . . . . . . . . 18 101 4.1.7. HIP Downgrade Protection . . . . . . . . . . . . . . 19 102 4.1.8. HIP Opportunistic Mode . . . . . . . . . . . . . . . 20 103 4.2. Updating a HIP Association . . . . . . . . . . . . . . . 22 104 4.3. Error Processing . . . . . . . . . . . . . . . . . . . . 23 105 4.4. HIP State Machine . . . . . . . . . . . . . . . . . . . . 24 106 4.4.1. Timespan Definitions . . . . . . . . . . . . . . . . 24 107 4.4.2. HIP States . . . . . . . . . . . . . . . . . . . . . 25 108 4.4.3. HIP State Processes . . . . . . . . . . . . . . . . . 26 109 4.4.4. Simplified HIP State Diagram . . . . . . . . . . . . 33 110 4.5. User Data Considerations . . . . . . . . . . . . . . . . 35 111 4.5.1. TCP and UDP Pseudo-Header Computation for User Data . 35 112 4.5.2. Sending Data on HIP Packets . . . . . . . . . . . . . 35 113 4.5.3. Transport Formats . . . . . . . . . . . . . . . . . . 35 114 4.5.4. Reboot, Timeout, and Restart of HIP . . . . . . . . . 35 115 4.6. Certificate Distribution . . . . . . . . . . . . . . . . 36 116 5. Packet Formats . . . . . . . . . . . . . . . . . . . . . . . 36 117 5.1. Payload Format . . . . . . . . . . . . . . . . . . . . . 36 118 5.1.1. Checksum . . . . . . . . . . . . . . . . . . . . . . 37 119 5.1.2. HIP Controls . . . . . . . . . . . . . . . . . . . . 38 120 5.1.3. HIP Fragmentation Support . . . . . . . . . . . . . . 38 121 5.2. HIP Parameters . . . . . . . . . . . . . . . . . . . . . 39 122 5.2.1. TLV Format . . . . . . . . . . . . . . . . . . . . . 42 123 5.2.2. Defining New Parameters . . . . . . . . . . . . . . . 43 124 5.2.3. R1_COUNTER . . . . . . . . . . . . . . . . . . . . . 44 125 5.2.4. PUZZLE . . . . . . . . . . . . . . . . . . . . . . . 45 126 5.2.5. SOLUTION . . . . . . . . . . . . . . . . . . . . . . 46 127 5.2.6. DIFFIE_HELLMAN . . . . . . . . . . . . . . . . . . . 47 128 5.2.7. HIP_CIPHER . . . . . . . . . . . . . . . . . . . . . 48 129 5.2.8. HOST_ID . . . . . . . . . . . . . . . . . . . . . . . 49 130 5.2.9. HIT_SUITE_LIST . . . . . . . . . . . . . . . . . . . 51 131 5.2.10. DH_GROUP_LIST . . . . . . . . . . . . . . . . . . . . 52 132 5.2.11. HIP_MAC . . . . . . . . . . . . . . . . . . . . . . . 53 133 5.2.12. HIP_MAC_2 . . . . . . . . . . . . . . . . . . . . . . 53 134 5.2.13. HIP_SIGNATURE . . . . . . . . . . . . . . . . . . . . 54 135 5.2.14. HIP_SIGNATURE_2 . . . . . . . . . . . . . . . . . . . 55 136 5.2.15. SEQ . . . . . . . . . . . . . . . . . . . . . . . . . 55 137 5.2.16. ACK . . . . . . . . . . . . . . . . . . . . . . . . . 56 138 5.2.17. ENCRYPTED . . . . . . . . . . . . . . . . . . . . . . 57 139 5.2.18. NOTIFICATION . . . . . . . . . . . . . . . . . . . . 58 140 5.2.19. ECHO_REQUEST_SIGNED . . . . . . . . . . . . . . . . . 62 141 5.2.20. ECHO_REQUEST_UNSIGNED . . . . . . . . . . . . . . . . 62 142 5.2.21. ECHO_RESPONSE_SIGNED . . . . . . . . . . . . . . . . 63 143 5.2.22. ECHO_RESPONSE_UNSIGNED . . . . . . . . . . . . . . . 64 144 5.3. HIP Packets . . . . . . . . . . . . . . . . . . . . . . . 64 145 5.3.1. I1 - the HIP Initiator Packet . . . . . . . . . . . . 65 146 5.3.2. R1 - the HIP Responder Packet . . . . . . . . . . . . 66 147 5.3.3. I2 - the Second HIP Initiator Packet . . . . . . . . 69 148 5.3.4. R2 - the Second HIP Responder Packet . . . . . . . . 70 149 5.3.5. UPDATE - the HIP Update Packet . . . . . . . . . . . 70 150 5.3.6. NOTIFY - the HIP Notify Packet . . . . . . . . . . . 71 151 5.3.7. CLOSE - the HIP Association Closing Packet . . . . . 72 152 5.3.8. CLOSE_ACK - the HIP Closing Acknowledgment Packet . . 72 153 5.4. ICMP Messages . . . . . . . . . . . . . . . . . . . . . . 73 154 5.4.1. Invalid Version . . . . . . . . . . . . . . . . . . . 73 155 5.4.2. Other Problems with the HIP Header and Packet 156 Structure . . . . . . . . . . . . . . . . . . . . . . 73 157 5.4.3. Invalid Puzzle Solution . . . . . . . . . . . . . . . 73 158 5.4.4. Non-Existing HIP Association . . . . . . . . . . . . 74 159 6. Packet Processing . . . . . . . . . . . . . . . . . . . . . . 74 160 6.1. Processing Outgoing Application Data . . . . . . . . . . 74 161 6.2. Processing Incoming Application Data . . . . . . . . . . 75 162 6.3. Solving the Puzzle . . . . . . . . . . . . . . . . . . . 76 163 6.4. HIP_MAC and SIGNATURE Calculation and Verification . . . 78 164 6.4.1. HMAC Calculation . . . . . . . . . . . . . . . . . . 78 165 6.4.2. Signature Calculation . . . . . . . . . . . . . . . . 80 166 6.5. HIP KEYMAT Generation . . . . . . . . . . . . . . . . . . 82 167 6.6. Initiation of a HIP Exchange . . . . . . . . . . . . . . 83 168 6.6.1. Sending Multiple I1s in Parallel . . . . . . . . . . 84 169 6.6.2. Processing Incoming ICMP Protocol Unreachable 170 Messages . . . . . . . . . . . . . . . . . . . . . . 85 171 6.7. Processing Incoming I1 Packets . . . . . . . . . . . . . 85 172 6.7.1. R1 Management . . . . . . . . . . . . . . . . . . . . 86 173 6.7.2. Handling Malformed Messages . . . . . . . . . . . . . 87 174 6.8. Processing Incoming R1 Packets . . . . . . . . . . . . . 87 175 6.8.1. Handling Malformed Messages . . . . . . . . . . . . . 89 176 6.9. Processing Incoming I2 Packets . . . . . . . . . . . . . 89 177 6.9.1. Handling Malformed Messages . . . . . . . . . . . . . 92 178 6.10. Processing Incoming R2 Packets . . . . . . . . . . . . . 92 179 6.11. Sending UPDATE Packets . . . . . . . . . . . . . . . . . 93 180 6.12. Receiving UPDATE Packets . . . . . . . . . . . . . . . . 94 181 6.12.1. Handling a SEQ Parameter in a Received UPDATE 182 Message . . . . . . . . . . . . . . . . . . . . . . . 95 183 6.12.2. Handling an ACK Parameter in a Received UPDATE 184 Packet . . . . . . . . . . . . . . . . . . . . . . . 95 185 6.13. Processing NOTIFY Packets . . . . . . . . . . . . . . . . 96 186 6.14. Processing CLOSE Packets . . . . . . . . . . . . . . . . 96 187 6.15. Processing CLOSE_ACK Packets . . . . . . . . . . . . . . 97 188 6.16. Handling State Loss . . . . . . . . . . . . . . . . . . . 97 189 7. HIP Policies . . . . . . . . . . . . . . . . . . . . . . . . 97 190 8. Changes from RFC 5201 . . . . . . . . . . . . . . . . . . . . 98 191 8.1. Changes from draft-ietf-hip-rfc5201-bis-01 . . . . . . . 98 192 8.2. Changes from draft-ietf-hip-rfc5201-bis-00 . . . . . . . 100 193 8.3. Contents of draft-ietf-hip-rfc5201-bis-00 . . . . . . . . 100 195 9. Security Considerations . . . . . . . . . . . . . . . . . . . 100 196 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 102 197 11. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 104 198 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 105 199 12.1. Normative References . . . . . . . . . . . . . . . . . . 105 200 12.2. Informative References . . . . . . . . . . . . . . . . . 108 201 Appendix A. Using Responder Puzzles . . . . . . . . . . . . . . 109 202 Appendix B. Generating a Public Key Encoding from an HI . . . . 110 203 Appendix C. Example Checksums for HIP Packets . . . . . . . . . 111 204 C.1. IPv6 HIP Example (I1) . . . . . . . . . . . . . . . . . . 112 205 C.2. IPv4 HIP Packet (I1) . . . . . . . . . . . . . . . . . . 112 206 C.3. TCP Segment . . . . . . . . . . . . . . . . . . . . . . . 112 207 Appendix D. ECDH-160 Group . . . . . . . . . . . . . . . . . . . 113 208 Appendix E. HIT Suites and HIT Generation . . . . . . . . . . . 113 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 Since the HIP Base Exchange was first developed, there have been a 249 few advances in cryptography and attacks against cryptographic 250 systems. As a result, all cryptographic protocols need to be agile. 251 That is it should be a part of the protocol to switch from one 252 cryptograhic primative to another, and reasonable effort should be 253 done to support a reasonable set of mainstream algorithms. This 254 update to the Base Exchange adds this needed cryptographic agility 255 while addressing the downgrade attacks that such flexibility enables. 256 In particular, Elliptic Curve support (ECDSA and ECDH) and 257 alternative hash functions have been added. 259 1.1. A New Namespace and Identifiers 261 The Host Identity Protocol introduces a new namespace, the Host 262 Identity namespace. Some ramifications of this new namespace are 263 explained in the HIP architecture description [rfc4423-bis]. 265 There are two main representations of the Host Identity, the full 266 Host Identifier (HI) and the Host Identity Tag (HIT). The HI is a 267 public key and directly represents the Identity. Since there are 268 different public key algorithms that can be used with different key 269 lengths, the HI is not good for use as a packet identifier, or as an 270 index into the various operational tables needed to support HIP. 271 Consequently, a hash of the HI, the Host Identity Tag (HIT), becomes 272 the operational representation. It is 128 bits long and is used in 273 the HIP payloads and to index the corresponding state in the end 274 hosts. The HIT has an important security property in that it is 275 self-certifying (see Section 3). 277 1.2. The HIP Base Exchange (BEX) 279 The HIP base exchange is a two-party cryptographic protocol used to 280 establish communications context between hosts. The base exchange is 281 a SIGMA-compliant [KRA03] four-packet exchange. The first party is 282 called the Initiator and the second party the Responder. The four- 283 packet design helps to make HIP DoS resilient. The protocol 284 exchanges Diffie-Hellman keys in the 2nd and 3rd packets, and 285 authenticates the parties in the 3rd and 4th packets. Additionally, 286 the Responder starts a puzzle exchange in the 2nd packet, with the 287 Initiator completing it in the 3rd packet before the Responder stores 288 any state from the exchange. 290 The exchange can use the Diffie-Hellman output to encrypt the Host 291 Identity of the Initiator in the 3rd packet (although Aura, et al., 292 [AUR03] notes that such operation may interfere with packet- 293 inspecting middleboxes), or the Host Identity may instead be sent 294 unencrypted. The Responder's Host Identity is not protected. It 295 should be noted, however, that both the Initiator's and the 296 Responder's HITs are transported as such (in cleartext) in the 297 packets, allowing an eavesdropper with a priori knowledge about the 298 parties to verify their identities. 300 Data packets start to flow after the 4th packet. The 3rd and 4th HIP 301 packets may carry a data payload in the future. However, the details 302 of this may be defined later. 304 An existing HIP association can be updated using the update mechanism 305 defined in this document, and when the association is no longer 306 needed, it can be closed using the defined closing mechanism. 308 Finally, HIP is designed as an end-to-end authentication and key 309 establishment protocol, to be used with Encapsulated Security Payload 310 (ESP) [RFC5202] and other end-to-end security protocols. The base 311 protocol does not cover all the fine-grained policy control found in 312 Internet Key Exchange (IKE) [RFC4306] that allows IKE to support 313 complex gateway policies. Thus, HIP is not a replacement for IKE. 315 1.3. Memo Structure 317 The rest of this memo is structured as follows. Section 2 defines 318 the central keywords, notation, and terms used throughout the rest of 319 the document. Section 3 defines the structure of the Host Identity 320 and its various representations. Section 4 gives an overview of the 321 HIP base exchange protocol. Sections 5 and 6 define the detail 322 packet formats and rules for packet processing. Finally, Sections 7, 323 9, and 10 discuss policy, security, and IANA considerations, 324 respectively. 326 2. Terms and Definitions 328 2.1. Requirements Terminology 330 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 331 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 332 document are to be interpreted as described in RFC 2119 [RFC2119]. 334 2.2. Notation 336 [x] indicates that x is optional. 338 {x} indicates that x is encrypted. 340 X(y) indicates that y is a parameter of X. ` 342 i indicates that x exists i times. 344 --> signifies "Initiator to Responder" communication (requests). 346 <-- signifies "Responder to Initiator" communication (replies). 348 | signifies concatenation of information-- e.g., X | Y is the 349 concatenation of X with Y. 351 Ltrunc (H(x), K) denotes the lowest order K bits of the result of 352 the hash function H on the input x. 354 2.3. Definitions 356 Host Identity (HI) The Host Identity is the public key of a 357 signature algorithm and represents the identity of the host. In 358 HIP, a host proves its identity by creating a signature with the 359 private key belonging to its HI (c.f. Section 3). 361 Host Identity Tag (HIT) The Host Identity Tag is a shorthand for the 362 HI in IPv6 format. It is generated by hashing the HI (c.f. 363 Section 3.1). 365 HIT Suite: A HIT Suite groups all cryptographic algorithms that are 366 required to generate and use an HI and its HIT. In particular, 367 these algorithms are: 1) the public key signature algorithm and 2) 368 the hash function, 3) the truncation (c.f. Appendix E). 370 Responder's HIT Hash Algorithm (RHASH): The Hash algorithm used for 371 various hash calculations in this document. The algorithm is the 372 same as is used to generate the Responder's HIT. The RHASH is the 373 hash function defined by the HIT Suite of the Responder's HIT 374 (c.f. Appendix E). 376 Length of the Responder's HIT Hash Algorithm (RHASH_len): RHASH_len 377 is the natural output length of RHASH in bits. 379 3. Host Identifier (HI) and Its Structure 381 In this section, the properties of the Host Identifier and Host 382 Identifier Tag are discussed, and the exact format for them is 383 defined. In HIP, the public key of an asymmetric key pair is used as 384 the Host Identifier (HI). Correspondingly, the host itself is 385 defined as the entity that holds the private key from the key pair. 386 See the HIP architecture specification [rfc4423-bis] for more details 387 about the difference between an identity and the corresponding 388 identifier. 390 HIP implementations MUST support the Rivest Shamir Adelman (RSA) 391 [RFC3110] public key algorithm, and SHOULD support the Digital 392 Signature Algorithm (DSA) [RFC2536] algorithms, and Elliptic Curve 393 Digital Signature Algorithm (ECDSA) Section 5.2.8, ECDSA description; 394 other algorithms MAY be supported. 396 A hashed encoding of the HI, the Host Identity Tag (HIT), is used in 397 protocols to represent the Host Identity. The HIT is 128 bits long 398 and has the following three key properties: i) it is the same length 399 as an IPv6 address and can be used in address-sized fields in APIs 400 and protocols, ii) it is self-certifying (i.e., given a HIT, it is 401 computationally hard to find a Host Identity key that matches the 402 HIT), and iii) the probability of HIT collision between two hosts is 403 very low, hence, it is infeasible for an attacker to find a collision 404 with a HIT that is in use. For details on the security properties of 405 the HIT see [rfc4423-bis]. 407 The structure of the HIT is defined in [RFC4843-bis]. The HIT 408 consists of three parts: first, an IANA assigned prefix to 409 distinguish it from other IPv6 addresses. Second, a four-bit 410 encoding of the algorithms that were used for generating the HI and 411 the hashed representation of HI. Third, a 96-bit hashed 412 representation of the Host Identity. The encoding of the ORCHID 413 generation algorithm and the exact algorithm for generating the 414 hashed representation is specified in Appendix E. 416 Carrying HIs and HITs in the header of user data packets would 417 increase the overhead of packets. Thus, it is not expected that they 418 are carried in every packet, but other methods are used to map the 419 data packets to the corresponding HIs. In some cases, this makes it 420 possible to use HIP without any additional headers in the user data 421 packets. For example, if ESP is used to protect data traffic, the 422 Security Parameter Index (SPI) carried in the ESP header can be used 423 to map the encrypted data packet to the correct HIP association. 425 3.1. Host Identity Tag (HIT) 427 The Host Identity Tag is a 128-bit value -- a hashed encoding of the 428 Host Identifier. There are two advantages of using a hashed encoding 429 over the actual Host Identity public key in protocols. Firstly, its 430 fixed length makes for easier protocol coding and also better manages 431 the packet size cost of this technology. Secondly, it presents a 432 consistent format to the protocol whatever underlying identity 433 technology is used. 435 RFC 4843-bis [RFC4843-bis] specifies 128-bit hash-based identifiers, 436 called Overlay Routable Cryptographic Hash Identifiers (ORCHIDs). 437 Their prefix, allocated from the IPv6 address block, is defined in 438 [RFC4843-bis]. The Host Identity Tag is a type of ORCHID. 440 This document extends [RFC5201] with measures to support crypto 441 agility. One of these measures is to allow for different hash 442 functions for creating a HIT. HIT Suites group sets of algorithms 443 that are required to generate and use a particular HIT. The Suites 444 are encoded in HIT Suite IDs. These HIT Suite IDs are transmitted in 445 the ORCHID Generation Algorithm field in the ORCHID. The HIT Suite 446 ID in the OGA field enables a hosts tell from another host's HIT, 447 whether it can successfully establish a HIP association with that 448 host. 450 3.2. Generating a HIT from an HI 452 The HIT MUST be generated according to the ORCHID generation method 453 described in [RFC4843-bis] using a context ID value of 0xF0EF F02F 454 BFF4 3D0F E793 0C3C 6E61 74EA (this tag value has been generated 455 randomly by the editor of this specification), and an input that 456 encodes the Host Identity field (see Section 5.2.8) present in a HIP 457 payload packet. The class of hash function, signature algorithm, and 458 the algorithm used for generating the HIT from the HI depends on the 459 HIT Suite (see Appendix E) and is indicated by the four bits of the 460 Orchid Generation Algorithm (OGA) field in the ORCHID. Currently, 461 truncated SHA-1 [FIPS.95-1.1993] and truncated SHA-256 462 [FIPS.180-2.2002] are defined as hashes for generating a HIT. 464 For Identities that are either RSA, Digital Signature Algorithm 465 (DSA), or Elliptic Curve DSA (ECDSA) public keys, the ORCHID input 466 consists of the public key encoding as specified in the corresponding 467 DNSSEC documents, taking the algorithm-specific portion of the RDATA 468 part of the KEY RR. There are currently only two defined public key 469 algorithms: RSA/SHA-1 and DSA. Hence, either of the following 470 applies: 472 The RSA public key is encoded as defined in [RFC3110] Section 2, 473 taking the exponent length (e_len), exponent (e), and modulus (n) 474 fields concatenated. The length (n_len) of the modulus (n) can be 475 determined from the total HI Length and the preceding HI fields 476 including the exponent (e). Thus, the data that serves as input 477 for the HIT generation has the same length as the HI. The fields 478 MUST be encoded in network byte order, as defined in [RFC3110]. 480 The DSA public key is encoded as defined in [RFC2536] Section 2, 481 taking the fields T, Q, P, G, and Y, concatenated. Thus, the data 482 to be hashed is 1 + 20 + 3 * 64 + 3 * 8 * T octets long, where T 483 is the size parameter as defined in [RFC2536]. The size parameter 484 T, affecting the field lengths, MUST be selected as the minimum 485 value that is long enough to accommodate P, G, and Y. The fields 486 MUST be encoded in network byte order, as defined in [RFC2536]. 488 The ECDSA public key is encoded as defined in [fundamental-ecc] 489 Section 4.2 and 6. 491 In Appendix B, the public key encoding process is illustrated using 492 pseudo-code. 494 4. Protocol Overview 496 The following material is an overview of the HIP protocol operation, 497 and does not contain all details of the packet formats or the packet 498 processing steps. Sections 5 and 6 describe in more detail the 499 packet formats and packet processing steps, respectively, and are 500 normative in case of any conflicts with this section. 502 The protocol number 139 has been assigned by IANA to the Host 503 Identity Protocol. 505 The HIP payload (Section 5.1) header could be carried in every IP 506 datagram. However, since HIP headers are relatively large (40 507 bytes), it is desirable to 'compress' the HIP header so that the HIP 508 header only occurs in control packets used to establish or change HIP 509 association state. The actual method for header 'compression' and 510 for matching data packets with existing HIP associations (if any) is 511 defined in separate documents, describing transport formats and 512 methods. All HIP implementations MUST implement, at minimum, the ESP 513 transport format for HIP [RFC5202]. 515 4.1. Creating a HIP Association 517 By definition, the system initiating a HIP exchange is the Initiator, 518 and the peer is the Responder. This distinction is forgotten once 519 the base exchange completes, and either party can become the 520 Initiator in future communications. 522 The HIP base exchange serves to manage the establishment of state 523 between an Initiator and a Responder. The first packet, I1, 524 initiates the exchange, and the last three packets, R1, I2, and R2, 525 constitute an authenticated Diffie-Hellman [DIF76] key exchange for 526 session key generation. In the first two packets, the hosts agree on 527 a set of cryptographic identifiers and algorithms that then are used 528 in and after the exchange. During the Diffie-Hellman key exchange, a 529 piece of keying material is generated. The HIP association keys are 530 drawn from this keying material. If other cryptographic keys are 531 needed, e.g., to be used with ESP, they are expected to be drawn from 532 the same keying material. 534 The Initiator first sends a trigger packet, I1, to the Responder. 535 The packet contains the HIT of the Initiator and possibly the HIT of 536 the Responder, if it is known. Moreover, the I1 packet initializes 537 the negotiation of the Diffie-Hellman group that is used for 538 generating the keying material. Therefore, the I1 contains a list of 539 Diffie Hellman Group IDs supported by the Initiator. Note that in 540 some cases it may be possible to replace this trigger packet by some 541 other form of a trigger, in which case the protocol starts with the 542 Responder sending the R1 packet. In such cases, another mechanism to 543 convey the Initiator's supported DH Groups (e.g., by using a default 544 group) must be specified. 546 The second packet, R1, starts the actual authenticated Diffie-Hellman 547 exchange. It contains a puzzle -- a cryptographic challenge that the 548 Initiator must solve before continuing the exchange. The level of 549 difficulty of the puzzle can be adjusted based on level of trust with 550 the Initiator, current load, or other factors. In addition, the R1 551 contains the Responder's Diffie-Hellman parameter and lists of 552 cryptographic algorithms supported by the Responder. Based on these 553 lists, the Initiator can continue, abort, or restart the base 554 exchange with a different selection of cryptographic algorithms. The 555 R1 packet contains a signature that covers selected parts of the 556 message. Some fields are left outside the signature to support pre- 557 created R1s. 559 In the I2 packet, the Initiator must display the solution to the 560 received puzzle. Without a correct solution, the I2 message is 561 discarded. The I2 also contains a Diffie-Hellman parameter that 562 carries needed information for the Responder. The packet is signed 563 by the sender. 565 The R2 packet acknowledges the receipt of the I2 and finalizes the 566 base exchange. The packet is signed. 568 The base exchange is illustrated below. The term "key" refers to the 569 Host Identity public key, and "sig" represents a signature using such 570 a key. The packets contain other parameters not shown in this 571 figure. 573 Initiator Responder 575 I1: DH list 576 --------------------------> 577 select precomputed R1 578 R1: puzzle, DH, key, sig 579 <------------------------- 580 check sig remain stateless 581 solve puzzle 582 I2: solution, DH, {key}, sig 583 --------------------------> 584 compute DH check puzzle 585 check sig 586 R2: sig 587 <-------------------------- 588 check sig compute DH 590 4.1.1. HIP Puzzle Mechanism 592 The purpose of the HIP puzzle mechanism is to protect the Responder 593 from a number of denial-of-service threats. It allows the Responder 594 to delay state creation until receiving I2. Furthermore, the puzzle 595 allows the Responder to use a fairly cheap calculation to check that 596 the Initiator is "sincere" in the sense that it has churned CPU 597 cycles in solving the puzzle. 599 The puzzle mechanism has been explicitly designed to give space for 600 various implementation options. It allows a Responder implementation 601 to completely delay session-specific state creation until a valid I2 602 is received. In such a case, a correctly formatted I2 can be 603 rejected only once the Responder has checked its validity by 604 computing one hash function. On the other hand, the design also 605 allows a Responder implementation to keep state about received I1s, 606 and match the received I2s against the state, thereby allowing the 607 implementation to avoid the computational cost of the hash function. 608 The drawback of this latter approach is the requirement of creating 609 state. Finally, it also allows an implementation to use other 610 combinations of the space-saving and computation-saving mechanisms. 612 The Responder can remain stateless and drop most spoofed I2s because 613 puzzle calculation is based on the Initiator's Host Identity Tag. The 614 idea is that the Responder has a (perhaps varying) number of pre- 615 calculated R1 packets, and it selects one of these based on the 616 information carried in I1. When the Responder then later receives 617 I2, it can verify that the puzzle has been solved using the 618 Initiator's HIT. This makes it impractical for the attacker to first 619 exchange one I1/R1, and then generate a large number of spoofed I2s 620 that seemingly come from different HITs. The method does not protect 621 from an attacker that uses fixed HITs, though. Against such an 622 attacker a viable approach may be to create a piece of local state, 623 and remember that the puzzle check has previously failed. See 624 Appendix A for one possible implementation. Implementations SHOULD 625 include sufficient randomness to the algorithm so that algorithmic 626 complexity attacks become impossible [CRO03]. 628 The Responder can set the puzzle difficulty for Initiator, based on 629 its level of trust of the Initiator. Because the puzzle is not 630 included in the signature calculation, the Responder can use pre- 631 calculated R1 packets and include the puzzle just before sending the 632 R1 to the Initiator. The Responder SHOULD use heuristics to 633 determine when it is under a denial-of-service attack, and set the 634 puzzle difficulty value K appropriately; see below. 636 4.1.2. Puzzle Exchange 638 The Responder starts the puzzle exchange when it receives an I1. The 639 Responder supplies a random number I, and requires the Initiator to 640 find a number J. To select a proper J, the Initiator must create the 641 concatenation of I, the HITs of the parties, and J, and take a hash 642 over this concatenation using the RHASH algorithm. The lowest order 643 K bits of the result MUST be zeros. The value K sets the difficulty 644 of the puzzle. 646 To generate a proper number J, the Initiator will have to generate a 647 number of Js until one produces the hash target of zeros. The 648 Initiator SHOULD give up after exceeding the puzzle lifetime in the 649 PUZZLE parameter (Section 5.2.4). The Responder needs to re-create 650 the concatenation of I, the HITs, and the provided J, and compute the 651 hash once to prove that the Initiator did its assigned task. 653 To prevent precomputation attacks, the Responder MUST select the 654 number I in such a way that the Initiator cannot guess it. 655 Furthermore, the construction MUST allow the Responder to verify that 656 the value I was indeed selected by it and not by the Initiator. See 657 Appendix A for an example on how to implement this. 659 Using the Opaque data field in an ECHO_REQUEST_SIGNED 660 (Section 5.2.19) or in an ECHO_REQUEST_UNSIGNED parameter 661 (Section 5.2.20), the Responder can include some data in R1 that the 662 Initiator must copy unmodified in the corresponding I2 packet. The 663 Responder can generate the Opaque data in various ways; e.g., using 664 encryption or hashing with some secret, the sent I, and possibly 665 other related data. Using the same secret, the received I (from the 666 I2), and the other related data (if any), the Receiver can verify 667 that it has itself sent the I to the Initiator. The Responder MUST 668 periodically change such a used secret. 670 It is RECOMMENDED that the Responder generates a new puzzle and new 671 R1s once every few minutes. Furthermore, it is RECOMMENDED that the 672 Responder remembers an old puzzle at least Lifetime seconds after the 673 puzzle has been deprecated. These time values guarantee that the 674 puzzle is valid for at least Lifetime and at most 2*Lifetime seconds. 675 This limits the usability that an old, solved puzzle has to an 676 attacker. 678 NOTE: The protocol developers explicitly considered whether R1 should 679 include a timestamp in order to protect the Initiator from replay 680 attacks. The decision was to NOT include a timestamp. 682 NOTE: The protocol developers explicitly considered whether a memory 683 bound function should be used for the puzzle instead of a CPU-bound 684 function. The decision was not to use memory-bound functions. At 685 the time of the decision, the idea of memory-bound functions was 686 relatively new and their IPR status were unknown. Once there is more 687 experience about memory-bound functions and once their IPR status is 688 better known, it may be reasonable to reconsider this decision. 690 4.1.3. Authenticated Diffie-Hellman Protocol with DH Group Negotiation 692 The packets R1, I2, and R2 implement a standard authenticated Diffie- 693 Hellman exchange. The Responder sends one of its public Diffie- 694 Hellman keys and its public authentication key, i.e., its Host 695 Identity, in R1. The signature in R1 allows the Initiator to verify 696 that the R1 has been once generated by the Responder. However, since 697 it is precomputed and therefore does not cover association-specific 698 information in the I1 packet, it does not protect from replay 699 attacks. 701 Before the actual authenticated Diffie-Hellman exchange, the 702 Initiator expresses its preference regarding its choice of the DH 703 groups in the I1 packet. The preference is expressed as a sorted 704 list of DH Group IDs. The I1 packet is not protected by a signature. 705 Therefore, this list is sent in an unauthenticated way to avoid 706 costly computations for processing the I1 packet on the Responder's 707 side. Based on the preferences of the Initiator, the Responder sends 708 an R1 packet containing its most suitable public DH value. It also 709 attaches a list of its own preferences to the R1 to convey the basis 710 for the DH group selection to the Initiator. 712 If none of the DH Group IDs in the I1 is supported by the Responder, 713 the Responder selects the DH Group most suitable for it regardless of 714 the Initiator's preference. It then sends the R1 containing this DH 715 Group and its list of supported DH Group IDs to the Initiator. 717 When the Initiator receives an R1, it gets one of the Responder's 718 public Diffie-Hellman values and the list of DH Group IDs supported 719 by the Responder. This list is covered by the signature in the R1 720 packet to avoid forgery. The Initiator compares the Group ID of the 721 public DH value in the R1 packet to the list of supported DH Group 722 IDs in the R1 packets and to its own preferences expressed in the 723 list of supported DH Group IDs. The Initiator continues the BEX only 724 if the Group ID of the public DH value of the Responder matches the 725 preferences of both Initiator and Responder. Otherwise, the 726 communication is subject of a downgrade attack and the Initiator must 727 restart the key exchange with a new I1 packet or must abort the key 728 exchange. If the Responder's choice of the DH Group is not supported 729 by the Initiator, the Initiator may abort the handshake or send a new 730 I1 with a different list of supported DH Groups. However, the 731 Initiator MUST verify the signature of the R1 packet before 732 restarting or aborting the handshake. It MUST silently ignore the R1 733 packet if the signature is not valid. 735 If the preferences regarding the DH Group ID match, the Initiator 736 computes the Diffie-Hellman session key (Kij). It creates a HIP 737 association using keying material from the session key (see 738 Section 6.5), and may use the association to encrypt its public 739 authentication key, i.e., Host Identity. The resulting I2 contains 740 the Initiator's Diffie-Hellman key and its (optionally encrypted) 741 public authentication key. The signature in I2 covers all of the 742 packet. 744 The Responder extracts the Initiator Diffie-Hellman public key from 745 the I2, computes the Diffie-Hellman session key, creates a 746 corresponding HIP association, and decrypts the Initiator's public 747 authentication key. It can then verify the signature using the 748 authentication key. 750 The final message, R2, is needed to protect the Initiator from replay 751 attacks. 753 4.1.4. HIP Replay Protection 755 The HIP protocol includes the following mechanisms to protect against 756 malicious replays. Responders are protected against replays of I1 757 packets by virtue of the stateless response to I1s with presigned R1 758 messages. Initiators are protected against R1 replays by a 759 monotonically increasing "R1 generation counter" included in the R1. 760 Responders are protected against replays or false I2s by the puzzle 761 mechanism (Section 4.1.1 above), and optional use of opaque data. 762 Hosts are protected against replays to R2s and UPDATEs by use of a 763 less expensive HMAC verification preceding HIP signature 764 verification. 766 The R1 generation counter is a monotonically increasing 64-bit 767 counter that may be initialized to any value. The scope of the 768 counter MAY be system-wide but SHOULD be per Host Identity, if there 769 is more than one local host identity. The value of this counter 770 SHOULD be kept across system reboots and invocations of the HIP base 771 exchange. This counter indicates the current generation of puzzles. 772 Implementations MUST accept puzzles from the current generation and 773 MAY accept puzzles from earlier generations. A system's local 774 counter MUST be incremented at least as often as every time old R1s 775 cease to be valid, and SHOULD never be decremented, lest the host 776 expose its peers to the replay of previously generated, higher 777 numbered R1s. The R1 counter SHOULD NOT roll over. 779 A host may receive more than one R1, either due to sending multiple 780 I1s (Section 6.6.1) or due to a replay of an old R1. When sending 781 multiple I1s, an Initiator SHOULD wait for a small amount of time (a 782 reasonable time may be 2 * expected RTT) after the first R1 reception 783 to allow possibly multiple R1s to arrive, and it SHOULD respond to an 784 R1 among the set with the largest R1 generation counter. If an 785 Initiator is processing an R1 or has already sent an I2 (still 786 waiting for R2) and it receives another R1 with a larger R1 787 generation counter, it MAY elect to restart R1 processing with the 788 fresher R1, as if it were the first R1 to arrive. 790 Upon conclusion of an active HIP association with another host, the 791 R1 generation counter associated with the peer host SHOULD be 792 flushed. A local policy MAY override the default flushing of R1 793 counters on a per-HIT basis. The reason for recommending the 794 flushing of this counter is that there may be hosts where the R1 795 generation counter (occasionally) decreases; e.g., due to hardware 796 failure. 798 4.1.5. Refusing a HIP Exchange 800 A HIP-aware host may choose not to accept a HIP exchange. If the 801 host's policy is to only be an Initiator, it should begin its own HIP 802 exchange. A host MAY choose to have such a policy since only the 803 Initiator's HI is protected in the exchange. There is a risk of a 804 race condition if each host's policy is to only be an Initiator, at 805 which point the HIP exchange will fail. 807 If the host's policy does not permit it to enter into a HIP exchange 808 with the Initiator, it should send an ICMP 'Destination Unreachable, 809 Administratively Prohibited' message. A more complex HIP packet is 810 not used here as it actually opens up more potential DoS attacks than 811 a simple ICMP message. 813 4.1.6. Aborting a HIP Exchange 815 Two HIP hosts may encounter situations in which they cannot complete 816 a HIP exchange because of insufficient suport for cryptographic 817 algorithms, in particular the HIT Suites and DH Groups. After 818 receiving the R1 packet, the Initiator can determine whether the 819 Responder supports the required cryptographic operations to 820 successfully establish a HIP association. The Initiator can abort 821 the BEX silently after receiving an R1 packet that indicates an 822 unsupported set of algorithms. The specific conditions are described 823 below. 825 The R1 packet contains a signed list of HIT Suite IDs supported by 826 the Responder. Therefore, the Initiator can determine whether its 827 source HIT is supported by the Responder. If the HIT Suite ID of the 828 Initiator's HIT is not contained in the list of HIT Suites, the 829 Initiator MAY abort the handshake silently or MAY restart the 830 handshake with a new I1 packet that contains a source HIT supported 831 by the Responder. 833 During the Handshake, the Initiator and the Responder agree on a DH 834 Group. The Responder selects the DH Group and its DH public value in 835 the R1 based on the list of DH Suite IDs in the I1 packet. If the 836 responder supports none of the DH Groups selected by the Initiator, 837 the Responder selects an arbitrary DH and replies an R1 containing 838 its list of supported DH Group IDs. In this case, the Initiator will 839 receive an R1 packet containing the DH public value for an 840 unsupported DH Group and the Responder's DH Group list in the signed 841 part of the R1 packet. At this point, the Initiator MAY abort the 842 handshake or MAY restart the handshake by sending a new I1 containing 843 a selection of DH Group IDs that is supported by the Responder. 845 4.1.7. HIP Downgrade Protection 847 In a downgrade attack, an attacker manipulates the packets of an 848 Initiator and/or a Responder to unnoticeably influence the result of 849 the cryptographic negotiations in the BEX to its favor. As a result, 850 the victims select weaker cryptographic algorithms than they would 851 have without the attacker's interference. Downgrade attacks can only 852 be successful if these are not detected by the victims and the 853 victims assume a secure communication channel. 855 In HIP, almost all packet parameters related to cryptographic 856 negotiations are covered by signatures. These parameters cannot be 857 directly manipulated in a downgrade attack without invalidating the 858 signature. However, signed packets can be subject to replay attacks. 859 In such a replay attack, the attacker could use an old BEX packet 860 with an outdated selection of cryptographic algorithms and replay it 861 instead of a more recent packet with a collection of stronger 862 cryptographic algorithms. Signed packets that could be subject to 863 this replay attack are the R1 and I2 packet. However, replayed R1 864 and I2 packets cannot be used to successfully establish a HIP BEX 865 because these packets also contain the public DH values of the 866 Initiator and the Responder. Old DH values from replayed packet will 867 lead to invalid keying material and mismatching shared secrets. 869 In contrast to the first version of HIP [RFC5201], this version 870 begins the negotiation of the DH Groups already in the first BEX 871 packet, the I1. The I1 is, by intention, not protected by a 872 signature to avoid CPU-intensive cryptographic operations for 873 processing floods of I1s. Hence, the list of DH Group IDs in the I1 874 is vulnerable to forgery and manipulation. To thwart an unnoticed 875 manipulation of the I1 packet, the Responder chooses the DH Group 876 deterministically and includes its own list of DH Group IDs in the 877 signed part of the R1 packet. The Initiator can detect an attempted 878 downgrade attack by comparing the list of DH Group IDs in the R1 879 packet to its own preferences in the I1. If the choice of the DH 880 Group in the R1 packet does not equal the best match of the two 881 lists, the Initiator can conclude that its list in the I1 was altered 882 by an attacker. In this case, the Initiator can restart or abort the 883 BEX. As mentioned before, the detection of the downgrade attack is 884 sufficient to prevent it. 886 4.1.8. HIP Opportunistic Mode 888 It is possible to initiate a HIP negotiation even if the Responder's 889 HI (and HIT) is unknown. In this case, the connection initializing 890 I1 packet contains NULL (all zeros) as the destination HIT. This 891 kind of connection setup is called opportunistic mode. 893 The Responder may have multiple HITs due to multiple supported HIT 894 Suites. Since the Responder's HIT Suite is not determined by the 895 destination HIT of the I1 packet, the Responder can freely select a 896 HIT of any HIT Suite. The complete set of HIT Suites supported by 897 the Initiator is not known to the Responder. Therefore, the 898 Responder SHOULD use a Responder HIT of the same HIT Suite as the 899 Initiator's HIT because this HIT Suite is obviously supported by the 900 Initiator. If the Responder selects a different HIT that is not 901 supported by the Initiator, the Initiator MAY restart the BEX with an 902 I1 packet with a source HIT that is contained in the list of the 903 Responder's HIT Suites in the R1 packet. 905 Note that the Initiator cannot verify the signature of the R1 packet 906 if the Responder's HIT Suite is not supported. Therefore, the 907 Initiator MUST treat R1 packets with unsupported Responder HITs as 908 potentially forged and MUST NOT use any parameters from the 909 unverified R1 besides the HIT Suite List. Moreover, an Initiator 910 that uses a unverified HIT Suite List to determine a possible source 911 HIT from an R1 packet MUST verify that the HIT_SUITE_LIST in the 912 first unverified R1 packet matches the HIT_SUITE_LIST in the second 913 R1 packet for which the Initiator supports the signature algorithm. 914 The Initiator MUST restart the BEX with a new I1 packet with a source 915 HIT mentioned in the verifiable R1 if the two lists do not match to 916 mitigate downgrade attacks. 918 There are both security and API issues involved with the 919 opportunistic mode. 921 Given that the Responder's HI is not known by the Initiator, there 922 must be suitable API calls that allow the Initiator to request, 923 directly or indirectly, that the underlying kernel initiate the HIP 924 base exchange solely based on locators. The Responder's HI will be 925 tentatively available in the R1 packet, and in an authenticated form 926 once the R2 packet has been received and verified. Hence, it could 927 be communicated to the application via new API mechanisms. However, 928 with a backwards-compatible API the application sees only the 929 locators used for the initial contact. Depending on the desired 930 semantics of the API, this can raise the following issues: 932 o The actual locators may later change if an UPDATE message is used, 933 even if from the API perspective the session still appears to be 934 between specific locators. The locator update is still secure, 935 however, and the session is still between the same nodes. 937 o Different sessions between the same locators may result in 938 connections to different nodes, if the implementation no longer 939 remembers which identifier the peer had in another session. This 940 is possible when the peer's locator has changed for legitimate 941 reasons or when an attacker pretends to be a node that has the 942 peer's locator. Therefore, when using opportunistic mode, HIP 943 MUST NOT place any expectation that the peer's HI returned in the 944 R1 message matches any HI previously seen from that address. 946 If the HIP implementation and application do not have the same 947 understanding of what constitutes a session, this may even happen 948 within the same session. For instance, an implementation may not 949 know when HIP state can be purged for UDP-based applications. 951 o As with all HIP exchanges, the handling of locator-based or 952 interface-based policy is unclear for opportunistic mode HIP. An 953 application may make a connection to a specific locator because 954 the application has knowledge of the security properties along the 955 network to that locator. If one of the nodes moves and the 956 locators are updated, these security properties may not be 957 maintained. Depending on the security policy of the application, 958 this may be a problem. This is an area of ongoing study. As an 959 example, there is work to create an API that applications can use 960 to specify their security requirements in a similar context 961 [btns-c-api]. 963 In addition, the following security considerations apply. The 964 generation counter mechanism will be less efficient in protecting 965 against replays of the R1 packet, given that the Responder can choose 966 a replay that uses any HI, not just the one given in the I1 packet. 968 More importantly, the opportunistic exchange is vulnerable to man-in- 969 the-middle attacks, because the Initiator does not have any public 970 key information about the peer. To assess the impacts of this 971 vulnerability, we compare it to vulnerabilities in current, non-HIP- 972 capable communications. 974 An attacker on the path between the two peers can insert itself as a 975 man-in-the-middle by providing its own identifier to the Initiator 976 and then initiating another HIP session towards the Responder. For 977 this to be possible, the Initiator must employ opportunistic mode, 978 and the Responder must be configured to accept a connection from any 979 HIP-enabled node. 981 An attacker outside the path will be unable to do so, given that it 982 cannot respond to the messages in the base exchange. 984 These properties are characteristic also of communications in the 985 current Internet. A client contacting a server without employing 986 end-to-end security may find itself talking to the server via a man- 987 in-the-middle, assuming again that the server is willing to talk to 988 anyone. 990 If end-to-end security is in place, then the worst that can happen in 991 both the opportunistic HIP and normal IP cases is denial-of-service; 992 an entity on the path can disrupt communications, but will be unable 993 to insert itself as a man-in-the-middle. 995 However, once the opportunistic exchange has successfully completed, 996 HIP provides integrity protection and confidentiality for the 997 communications, and can securely change the locators of the 998 endpoints. 1000 As a result, it is believed that the HIP opportunistic mode is at 1001 least as secure as current IP. 1003 4.2. Updating a HIP Association 1005 A HIP association between two hosts may need to be updated over time. 1006 Examples include the need to rekey expiring user data security 1007 associations, add new security associations, or change IP addresses 1008 associated with hosts. The UPDATE packet is used for those and other 1009 similar purposes. This document only specifies the UPDATE packet 1010 format and basic processing rules, with mandatory parameters. The 1011 actual usage is defined in separate specifications. 1013 HIP provides a general purpose UPDATE packet, which can carry 1014 multiple HIP parameters, for updating the HIP state between two 1015 peers. The UPDATE mechanism has the following properties: 1017 UPDATE messages carry a monotonically increasing sequence number 1018 and are explicitly acknowledged by the peer. Lost UPDATEs or 1019 acknowledgments may be recovered via retransmission. Multiple 1020 UPDATE messages may be outstanding under certain circumstances. 1022 UPDATE is protected by both HIP_MAC and HIP_SIGNATURE parameters, 1023 since processing UPDATE signatures alone is a potential DoS attack 1024 against intermediate systems. 1026 UPDATE packets are explicitly acknowledged by the use of an 1027 acknowledgment parameter that echoes an individual sequence number 1028 received from the peer. A single UPDATE packet may contain both a 1029 sequence number and one or more acknowledgment numbers (i.e., 1030 piggybacked acknowledgment(s) for the peer's UPDATE). 1032 The UPDATE packet is defined in Section 5.3.5. 1034 4.3. Error Processing 1036 HIP error processing behavior depends on whether or not there exists 1037 an active HIP association. In general, if a HIP association exists 1038 between the sender and receiver of a packet causing an error 1039 condition, the receiver SHOULD respond with a NOTIFY packet. On the 1040 other hand, if there are no existing HIP associations between the 1041 sender and receiver, or the receiver cannot reasonably determine the 1042 identity of the sender, the receiver MAY respond with a suitable ICMP 1043 message; see Section 5.4 for more details. 1045 The HIP protocol and state machine is designed to recover from one of 1046 the parties crashing and losing its state. The following scenarios 1047 describe the main use cases covered by the design. 1049 No prior state between the two systems. 1051 The system with data to send is the Initiator. The process 1052 follows the standard four-packet base exchange, establishing 1053 the HIP association. 1055 The system with data to send has no state with the receiver, but 1056 the receiver has a residual HIP association. 1058 The system with data to send is the Initiator. The Initiator 1059 acts as in no prior state, sending I1 and getting R1. When the 1060 Responder receives a valid I2, the old association is 1061 'discovered' and deleted, and the new association is 1062 established. 1064 The system with data to send has a HIP association, but the 1065 receiver does not. 1067 The system sends data on the outbound user data security 1068 association. The receiver 'detects' the situation when it 1069 receives a user data packet that it cannot match to any HIP 1070 association. The receiving host MUST discard this packet. 1072 Optionally, the receiving host MAY send an ICMP packet, with 1073 the type Parameter Problem, to inform the sender that the HIP 1074 association does not exist (see Section 5.4), and it MAY 1075 initiate a new HIP negotiation. However, responding with these 1076 optional mechanisms is implementation or policy dependent. 1078 4.4. HIP State Machine 1080 The HIP protocol itself has little state. In the HIP base exchange, 1081 there is an Initiator and a Responder. Once the security 1082 associations (SAs) are established, this distinction is lost. If the 1083 HIP state needs to be re-established, the controlling parameters are 1084 which peer still has state and which has a datagram to send to its 1085 peer. The following state machine attempts to capture these 1086 processes. 1088 The state machine is presented in a single system view, representing 1089 either an Initiator or a Responder. There is not a complete overlap 1090 of processing logic here and in the packet definitions. Both are 1091 needed to completely implement HIP. 1093 This document extends the state machine defined in [RFC5201] and 1094 introduces a restart option to allow for the negotiation of 1095 cryptographic algorithms. The only change to the previous state 1096 machine is a transition from state I1-SENT to I1-SENT - the restart 1097 option. An Initiator is required to restart the HIP exchange if the 1098 Responder does not support the HIT Suite of the Initiator. In this 1099 case, the Initiator restarts the HIP exchange by sending a new I1 1100 packet with a source HIT supported by the Responder. 1102 Implementors must understand that the state machine, as described 1103 here, is informational. Specific implementations are free to 1104 implement the actual functions differently. Section 6 describes the 1105 packet processing rules in more detail. This state machine focuses 1106 on the HIP I1, R1, I2, and R2 packets only. Other states may be 1107 introduced by mechanisms in other specifications (such as mobility 1108 and multihoming). 1110 4.4.1. Timespan Definitions 1111 Unused Association Lifetime (UAL): Implementation-specific time for 1112 which, if no packet is sent or received for this time interval, a 1113 host MAY begin to tear down an active association. 1115 Maximum Segment Lifetime (MSL): Maximum time that a TCP segment is 1116 expected to spend in the network. 1118 Exchange Complete (EC): Time that the host spends at the R2-SENT 1119 before it moves to ESTABLISHED state. The time is n * I2 1120 retransmission timeout, where n is about I2_RETRIES_MAX. 1122 4.4.2. HIP States 1124 +---------------------+---------------------------------------------+ 1125 | State | Explanation | 1126 +---------------------+---------------------------------------------+ 1127 | UNASSOCIATED | State machine start | 1128 | | | 1129 | I1-SENT | Initiating base exchange | 1130 | | | 1131 | I2-SENT | Waiting to complete base exchange | 1132 | | | 1133 | R2-SENT | Waiting to complete base exchange | 1134 | | | 1135 | ESTABLISHED | HIP association established | 1136 | | | 1137 | CLOSING | HIP association closing, no data can be | 1138 | | sent | 1139 | | | 1140 | CLOSED | HIP association closed, no data can be sent | 1141 | | | 1142 | E-FAILED | HIP exchange failed | 1143 +---------------------+---------------------------------------------+ 1145 Table 1: HIP States 1147 4.4.3. HIP State Processes 1149 System behavior in state UNASSOCIATED, Table 2. 1151 +---------------------+---------------------------------------------+ 1152 | Trigger | Action | 1153 +---------------------+---------------------------------------------+ 1154 | User data to send, | Send I1 and go to I1-SENT | 1155 | requiring a new HIP | | 1156 | association | | 1157 | | | 1158 | Receive I1 | Send R1 and stay at UNASSOCIATED | 1159 | | | 1160 | Receive I2, process | If successful, send R2 and go to R2-SENT | 1161 | | | 1162 | | If fail, stay at UNASSOCIATED | 1163 | | | 1164 | Receive user data | Optionally send ICMP as defined in | 1165 | for unknown HIP | Section 5.4 and stay at UNASSOCIATED | 1166 | association | | 1167 | | | 1168 | Receive CLOSE | Optionally send ICMP Parameter Problem and | 1169 | | stay at UNASSOCIATED | 1170 | | | 1171 | Receive ANYOTHER | Drop and stay at UNASSOCIATED | 1172 +---------------------+---------------------------------------------+ 1174 Table 2: UNASSOCIATED - Start state 1176 System behavior in state I1-SENT, Table 3. 1178 +---------------------+---------------------------------------------+ 1179 | Trigger | Action | 1180 +---------------------+---------------------------------------------+ 1181 | Receive I1 | If the local HIT is smaller than the peer | 1182 | | HIT, drop I1 and stay at I1-SENT | 1183 | | | 1184 | | If the local HIT is greater than the peer | 1185 | | HIT, send R1 and stay at I1_SENT | 1186 | | | 1187 | Receive I2, process | If successful, send R2 and go to R2-SENT | 1188 | | | 1189 | | If fail, stay at I1-SENT | 1190 | | | 1191 | Receive R1, process | If HIT Suite of own HIT is not supported by | 1192 | | the peer, select supported own HIT, send I1 | 1193 | | and stay at I1-SENT | 1194 | | | 1195 | | If successful, send I2 and go to I2-SENT | 1196 | | | 1197 | | If fail, stay at I1-SENT | 1198 | | | 1199 | Receive ANYOTHER | Drop and stay at I1-SENT | 1200 | | | 1201 | Timeout, increment | If counter is less than I1_RETRIES_MAX, | 1202 | timeout counter | send I1 and stay at I1-SENT | 1203 | | | 1204 | | If counter is greater than I1_RETRIES_MAX, | 1205 | | go to E-FAILED | 1206 +---------------------+---------------------------------------------+ 1208 Table 3: I1-SENT - Initiating HIP 1210 System behavior in state I2-SENT, Table 4. 1212 +---------------------+---------------------------------------------+ 1213 | Trigger | Action | 1214 +---------------------+---------------------------------------------+ 1215 | Receive I1 | Send R1 and stay at I2-SENT | 1216 | | | 1217 | Receive R1, process | If successful, send I2 and cycle at I2-SENT | 1218 | | | 1219 | | If fail, stay at I2-SENT | 1220 | | | 1221 | Receive I2, process | If successful and local HIT is smaller than | 1222 | | the peer HIT, drop I2 and stay at I2-SENT | 1223 | | | 1224 | | If successful and local HIT is greater than | 1225 | | the peer HIT, send R2 and go to R2-SENT | 1226 | | | 1227 | | If fail, stay at I2-SENT | 1228 | | | 1229 | Receive R2, process | If successful, go to ESTABLISHED | 1230 | | | 1231 | | If fail, stay at I2-SENT | 1232 | | | 1233 | Receive ANYOTHER | Drop and stay at I2-SENT | 1234 | | | 1235 | Timeout, increment | If counter is less than I2_RETRIES_MAX, | 1236 | timeout counter | send I2 and stay at I2-SENT | 1237 | | | 1238 | | If counter is greater than I2_RETRIES_MAX, | 1239 | | go to E-FAILED | 1240 +---------------------+---------------------------------------------+ 1242 Table 4: I2-SENT - Waiting to finish HIP 1244 System behavior in state R2-SENT, Table 5. 1246 +---------------------+---------------------------------------------+ 1247 | Trigger | Action | 1248 +---------------------+---------------------------------------------+ 1249 | Receive I1 | Send R1 and stay at R2-SENT | 1250 | | | 1251 | Receive I2, process | If successful, send R2 and cycle at R2-SENT | 1252 | | | 1253 | | If fail, stay at R2-SENT | 1254 | | | 1255 | Receive R1 | Drop and stay at R2-SENT | 1256 | | | 1257 | Receive R2 | Drop and stay at R2-SENT | 1258 | | | 1259 | Receive data or | Move to ESTABLISHED | 1260 | UPDATE | | 1261 | | | 1262 | Exchange Complete | Move to ESTABLISHED | 1263 | Timeout | | 1264 +---------------------+---------------------------------------------+ 1266 Table 5: R2-SENT - Waiting to finish HIP 1268 System behavior in state ESTABLISHED, Table 6. 1270 +---------------------+---------------------------------------------+ 1271 | Trigger | Action | 1272 +---------------------+---------------------------------------------+ 1273 | Receive I1 | Send R1 and stay at ESTABLISHED | 1274 | | | 1275 | Receive I2, process | If successful, send R2, drop old HIP | 1276 | with puzzle and | association, establish a new HIP | 1277 | possible Opaque | association, go to R2-SENT | 1278 | data verification | | 1279 | | | 1280 | | If fail, stay at ESTABLISHED | 1281 | | | 1282 | Receive R1 | Drop and stay at ESTABLISHED | 1283 | | | 1284 | Receive R2 | Drop and stay at ESTABLISHED | 1285 | | | 1286 | Receive user data | Process and stay at ESTABLISHED | 1287 | for HIP association | | 1288 | | | 1289 | No packet | Send CLOSE and go to CLOSING | 1290 | sent/received | | 1291 | during UAL minutes | | 1292 | | | 1293 | Receive CLOSE, | If successful, send CLOSE_ACK and go to | 1294 | process | CLOSED | 1295 | | | 1296 | | If fail, stay at ESTABLISHED | 1297 +---------------------+---------------------------------------------+ 1299 Table 6: ESTABLISHED - HIP association established 1301 System behavior in state CLOSING, Table 7. 1303 +---------------------+---------------------------------------------+ 1304 | Trigger | Action | 1305 +---------------------+---------------------------------------------+ 1306 | User data to send, | Send I1 and stay at CLOSING | 1307 | requires the | | 1308 | creation of another | | 1309 | incarnation of the | | 1310 | HIP association | | 1311 | | | 1312 | Receive I1 | Send R1 and stay at CLOSING | 1313 | | | 1314 | Receive I2, process | If successful, send R2 and go to R2-SENT | 1315 | | | 1316 | | If fail, stay at CLOSING | 1317 | | | 1318 | Receive R1, process | If successful, send I2 and go to I2-SENT | 1319 | | | 1320 | | If fail, stay at CLOSING | 1321 | | | 1322 | Receive CLOSE, | If successful, send CLOSE_ACK, discard | 1323 | process | state and go to CLOSED | 1324 | | | 1325 | | If fail, stay at CLOSING | 1326 | | | 1327 | Receive CLOSE_ACK, | If successful, discard state and go to | 1328 | process | UNASSOCIATED | 1329 | | | 1330 | | If fail, stay at CLOSING | 1331 | | | 1332 | Receive ANYOTHER | Drop and stay at CLOSING | 1333 | | | 1334 | Timeout, increment | If timeout sum is less than UAL+MSL | 1335 | timeout sum, reset | minutes, retransmit CLOSE and stay at | 1336 | timer | CLOSING | 1337 | | | 1338 | | If timeout sum is greater than UAL+MSL | 1339 | | minutes, go to UNASSOCIATED | 1340 +---------------------+---------------------------------------------+ 1342 Table 7: CLOSING - HIP association has not been used for UAL minutes 1343 System behavior in state CLOSED, Table 8. 1345 +---------------------+---------------------------------------------+ 1346 | Trigger | Action | 1347 +---------------------+---------------------------------------------+ 1348 | Datagram to send, | Send I1, and stay at CLOSED | 1349 | requires the | | 1350 | creation of another | | 1351 | incarnation of the | | 1352 | HIP association | | 1353 | | | 1354 | Receive I1 | Send R1 and stay at CLOSED | 1355 | | | 1356 | Receive I2, process | If successful, send R2 and go to R2-SENT | 1357 | | | 1358 | | If fail, stay at CLOSED | 1359 | | | 1360 | Receive R1, process | If successful, send I2 and go to I2-SENT | 1361 | | | 1362 | | If fail, stay at CLOSED | 1363 | | | 1364 | Receive CLOSE, | If successful, send CLOSE_ACK, stay at | 1365 | process | CLOSED | 1366 | | | 1367 | | If fail, stay at CLOSED | 1368 | | | 1369 | Receive CLOSE_ACK, | If successful, discard state and go to | 1370 | process | UNASSOCIATED | 1371 | | | 1372 | | If fail, stay at CLOSED | 1373 | | | 1374 | Receive ANYOTHER | Drop and stay at CLOSED | 1375 | | | 1376 | Timeout (UAL+2MSL) | Discard state, and go to UNASSOCIATED | 1377 +---------------------+---------------------------------------------+ 1379 Table 8: CLOSED - CLOSE_ACK sent, resending CLOSE_ACK if necessary 1381 System behavior in state E-FAILED, Table 9. 1383 +-------------------------+-----------------------------------------+ 1384 | Trigger | Action | 1385 +-------------------------+-----------------------------------------+ 1386 | Wait for | Go to UNASSOCIATED. Re-negotiation is | 1387 | implementation-specific | possible after moving to UNASSOCIATED | 1388 | time | state. | 1389 +-------------------------+-----------------------------------------+ 1390 Table 9: E-FAILED - HIP failed to establish association with peer 1392 4.4.4. Simplified HIP State Diagram 1394 The following diagram shows the major state transitions. Transitions 1395 based on received packets implicitly assume that the packets are 1396 successfully authenticated or processed. 1398 +-+ +----------------------------+ 1399 I1 received, send R1 | | | | 1400 | v v | 1401 Datagram to send +--------------+ I2 received, send R2 | 1402 +---------------| UNASSOCIATED |----------------+ | 1403 | +-+ +--------------+ | | 1404 Send I1 | | | Alg. not supported, send I1 | | 1405 v | v | | 1406 +---------+ I2 received, send R2 | | 1407 +---->| I1-SENT |---------------------------------------+ | | 1408 | +---------+ | | | 1409 | | +------------------------+ | | | 1410 | | R1 received, | I2 received, send R2 | | | | 1411 | v send I2 | v v v | 1412 | +---------+ | +---------+ | 1413 | +->| I2-SENT |------------+ | R2-SENT |<----+ | 1414 | | +---------+ +---------+ | | 1415 | | | | | | 1416 | | | data| | | 1417 | |receive | or| | | 1418 | |R1, send | EC timeout| receive I2,| | 1419 | |I2 |R2 received +--------------+ | send R2| | 1420 | | +----------->| ESTABLISHED |<--------+ | | 1421 | | +--------------+ | | 1422 | | | | | receive I2, send R2 | | 1423 | | recv+------------+ | +------------------------+ | 1424 | | CLOSE,| | | | 1425 | | send| No packet sent| | | 1426 | | CLOSE_ACK| /received for | timeout | | 1427 | | | UAL min, send | +---------+<-+ (UAL+MSL) | | 1428 | | | CLOSE +--->| CLOSING |--+ retransmit | | 1429 | | | +---------+ CLOSE | | 1430 +--|------------|----------------------+| | | | | | 1431 +------------|-----------------------+ | | +-----------------+ | 1432 | | +-----------+ +-------------------|--+ 1433 | +-----------+ | receive CLOSE, CLOSE_ACK | | 1434 | | | send CLOSE_ACK received or | | 1435 | | | timeout | | 1436 | | | (UAL+MSL) | | 1437 | v v | | 1438 | +--------+ receive I2, send R2 | | 1439 +-----------------------| CLOSED |----------------------------+ | 1440 +--------+ /-----------------------+ 1441 ^ | \-------/ timeout (UAL+2MSL), 1442 | | move to UNASSOCIATED 1443 +-+ 1444 CLOSE received, send CLOSE_ACK 1446 4.5. User Data Considerations 1448 4.5.1. TCP and UDP Pseudo-Header Computation for User Data 1450 When computing TCP and UDP checksums on user data packets that flow 1451 through sockets bound to HITs, the IPv6 pseudo-header format 1452 [RFC2460] MUST be used, even if the actual addresses on the packet 1453 are IPv4 addresses. Additionally, the HITs MUST be used in the place 1454 of the IPv6 addresses in the IPv6 pseudo-header. Note that the 1455 pseudo-header for actual HIP payloads is computed differently; see 1456 Section 5.1.1. 1458 4.5.2. Sending Data on HIP Packets 1460 A future version of this document may define how to include user data 1461 on various HIP packets. However, currently the HIP header is a 1462 terminal header, and not followed by any other headers. 1464 4.5.3. Transport Formats 1466 The actual data transmission format, used for user data after the HIP 1467 base exchange, is not defined in this document. Such transport 1468 formats and methods are described in separate specifications. All 1469 HIP implementations MUST implement, at minimum, the ESP transport 1470 format for HIP [RFC5202]. 1472 4.5.4. Reboot, Timeout, and Restart of HIP 1474 Simulating a loss of state is a potential DoS attack. The following 1475 process has been crafted to manage state recovery without presenting 1476 a DoS opportunity. 1478 If a host reboots or the HIP association times out, it has lost its 1479 HIP state. If the host that lost state has a datagram to send to the 1480 peer, it simply restarts the HIP base exchange. After the base 1481 exchange has completed, the Initiator can create a new payload 1482 association and start sending data. The peer does not reset its 1483 state until it receives a valid I2 HIP packet. 1485 If a system receives a user data packet that cannot be matched to any 1486 existing HIP association, it is possible that it has lost the state 1487 and its peer has not. It MAY send an ICMP packet with the Parameter 1488 Problem type, and with the pointer pointing to the referred HIP- 1489 related association information. Reacting to such traffic depends on 1490 the implementation and the environment where the implementation is 1491 used. 1493 If the host, that apparently has lost its state, decides to restart 1494 the HIP base exchange, it sends an I1 packet to the peer. After the 1495 base exchange has been completed successfully, the Initiator can 1496 create a new HIP association and the peer drops its old payload 1497 associations and creates a new one. 1499 4.6. Certificate Distribution 1501 This document does not define how to use certificates or how to 1502 transfer them between hosts. These functions are expected to be 1503 defined in a future specification. A parameter type value, meant to 1504 be used for carrying certificates, is reserved, though: CERT, Type 1505 768; see Section 5.2. 1507 5. Packet Formats 1509 5.1. Payload Format 1511 All HIP packets start with a fixed header. 1513 0 1 2 3 1514 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 1515 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1516 | Next Header | Header Length |0| Packet Type | VER. | RES.|1| 1517 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1518 | Checksum | Controls | 1519 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1520 | Sender's Host Identity Tag (HIT) | 1521 | | 1522 | | 1523 | | 1524 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1525 | Receiver's Host Identity Tag (HIT) | 1526 | | 1527 | | 1528 | | 1529 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1530 | | 1531 / HIP Parameters / 1532 / / 1533 | | 1534 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1536 The HIP header is logically an IPv6 extension header. However, this 1537 document does not describe processing for Next Header values other 1538 than decimal 59, IPPROTO_NONE, the IPv6 'no next header' value. 1539 Future documents MAY do so. However, current implementations MUST 1540 ignore trailing data if an unimplemented Next Header value is 1541 received. 1543 The Header Length field contains the length of the HIP Header and HIP 1544 parameters in 8-byte units, excluding the first 8 bytes. Since all 1545 HIP headers MUST contain the sender's and receiver's HIT fields, the 1546 minimum value for this field is 4, and conversely, the maximum length 1547 of the HIP Parameters field is (255*8)-32 = 2008 bytes. Note: this 1548 sets an additional limit for sizes of parameters included in the 1549 Parameters field, independent of the individual parameter maximum 1550 lengths. 1552 The Packet Type indicates the HIP packet type. The individual packet 1553 types are defined in the relevant sections. If a HIP host receives a 1554 HIP packet that contains an unknown packet type, it MUST drop the 1555 packet. 1557 The HIP Version is four bits. The current version is 2. The version 1558 number is expected to be incremented only if there are incompatible 1559 changes to the protocol. Most extensions can be handled by defining 1560 new packet types, new parameter types, or new controls. 1562 The following three bits are reserved for future use. They MUST be 1563 zero when sent, and they SHOULD be ignored when handling a received 1564 packet. 1566 The two fixed bits in the header are reserved for potential SHIM6 1567 compatibility [RFC5533]. For implementations adhering (only) to this 1568 specification, they MUST be set as shown when sending and MUST be 1569 ignored when receiving. This is to ensure optimal forward 1570 compatibility. Note that for implementations that implement other 1571 compatible specifications in addition to this specification, the 1572 corresponding rules may well be different. For example, in the case 1573 that the forthcoming SHIM6 protocol happens to be compatible with 1574 this specification, an implementation that implements both this 1575 specification and the SHIM6 protocol may need to check these bits in 1576 order to determine how to handle the packet. 1578 The HIT fields are always 128 bits (16 bytes) long. 1580 5.1.1. Checksum 1582 Since the checksum covers the source and destination addresses in the 1583 IP header, it must be recomputed on HIP-aware NAT devices. 1585 If IPv6 is used to carry the HIP packet, the pseudo-header [RFC2460] 1586 contains the source and destination IPv6 addresses, HIP packet length 1587 in the pseudo-header length field, a zero field, and the HIP protocol 1588 number (see Section 4) in the Next Header field. The length field is 1589 in bytes and can be calculated from the HIP header length field: (HIP 1590 Header Length + 1) * 8. 1592 In case of using IPv4, the IPv4 UDP pseudo-header format [RFC0768] is 1593 used. In the pseudo-header, the source and destination addresses are 1594 those used in the IP header, the zero field is obviously zero, the 1595 protocol is the HIP protocol number (see Section 4), and the length 1596 is calculated as in the IPv6 case. 1598 5.1.2. HIP Controls 1600 The HIP Controls section conveys information about the structure of 1601 the packet and capabilities of the host. 1603 The following fields have been defined: 1605 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1606 | | | | | | | | | | | | | | | |A| 1607 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1609 A - Anonymous: If this is set, the sender's HI in this packet is 1610 anonymous, i.e., one not listed in a directory. Anonymous HIs 1611 SHOULD NOT be stored. This control is set in packets R1 and/or 1612 I2. The peer receiving an anonymous HI may choose to refuse it. 1614 The rest of the fields are reserved for future use and MUST be set to 1615 zero on sent packets and ignored on received packets. 1617 5.1.3. HIP Fragmentation Support 1619 A HIP implementation must support IP fragmentation/reassembly. 1620 Fragment reassembly MUST be implemented in both IPv4 and IPv6, but 1621 fragment generation is REQUIRED to be implemented in IPv4 (IPv4 1622 stacks and networks will usually do this by default) and RECOMMENDED 1623 to be implemented in IPv6. In IPv6 networks, the minimum MTU is 1624 larger, 1280 bytes, than in IPv4 networks. The larger MTU size is 1625 usually sufficient for most HIP packets, and therefore fragment 1626 generation may not be needed. If a host expects to send HIP packets 1627 that are larger than the minimum IPv6 MTU, it MUST implement fragment 1628 generation even for IPv6. 1630 In IPv4 networks, HIP packets may encounter low MTUs along their 1631 routed path. Since HIP does not provide a mechanism to use multiple 1632 IP datagrams for a single HIP packet, support for path MTU discovery 1633 does not bring any value to HIP in IPv4 networks. HIP-aware NAT 1634 devices MUST perform any IPv4 reassembly/fragmentation. 1636 All HIP implementations have to be careful while employing a 1637 reassembly algorithm so that the algorithm is sufficiently resistant 1638 to DoS attacks. 1640 Because certificate chains can cause the packet to be fragmented and 1641 fragmentation can open implementation to denial-of-service attacks 1642 [KAU03], it is strongly recommended that the separate document 1643 specifying the certificate usage in the HIP Base Exchange defines the 1644 usage of "Hash and URL" formats rather than including certificates in 1645 exchanges. With this, most problems related to DoS attacks with 1646 fragmentation can be avoided. 1648 5.2. HIP Parameters 1650 The HIP Parameters are used to carry the public key associated with 1651 the sender's HIT, together with related security and other 1652 information. They consist of ordered parameters, encoded in TLV 1653 format. 1655 The following parameter types are currently defined. 1657 +------------------------+-------+----------+-----------------------+ 1658 | TLV | Type | Length | Data | 1659 +------------------------+-------+----------+-----------------------+ 1660 | R1_COUNTER | 128 | 12 | System Boot Counter | 1661 | | | | | 1662 | PUZZLE | 257 | 12 | K and Random #I | 1663 | | | | | 1664 | SOLUTION | 321 | 20 | K, Random #I and | 1665 | | | | puzzle solution J | 1666 | | | | | 1667 | SEQ | 385 | 4 | Update packet ID | 1668 | | | | number | 1669 | | | | | 1670 | ACK | 449 | variable | Update packet ID | 1671 | | | | number | 1672 | | | | | 1673 | DIFFIE_HELLMAN | 513 | variable | public key | 1674 | | | | | 1675 | HIP_CIPHER | 579 | variable | HIP encryption | 1676 | | | | algorithm | 1677 | | | | | 1678 | ENCRYPTED | 641 | variable | Encrypted part of I2 | 1679 | | | | packet | 1680 | | | | | 1681 | HOST_ID | 705 | variable | Host Identity with | 1682 | | | | Fully-Qualified | 1683 | | | | Domain FQDN (Name) or | 1684 | | | | Network Access | 1685 | | | | Identifier (NAI) | 1686 | | | | | 1687 | HIT_SUITE_LIST | 715 | variable | Ordered list of the | 1688 | | | | HIT suites supported | 1689 | | | | by the Responder | 1690 | | | | | 1691 | CERT | 768 | variable | HI Certificate; used | 1692 | | | | to transfer | 1693 | | | | certificates. Usage | 1694 | | | | is currently not | 1695 | | | | defined, but it will | 1696 | | | | be specified in a | 1697 | | | | separate document | 1698 | | | | once needed. | 1699 | | | | | 1700 | NOTIFICATION | 832 | variable | Informational data | 1701 | | | | | 1702 | ECHO_REQUEST_SIGNED | 897 | variable | Opaque data to be | 1703 | | | | echoed back; under | 1704 | | | | signature | 1705 | ECHO_RESPONSE_SIGNED | 961 | variable | Opaque data echoed | 1706 | | | | back; under signature | 1707 | | | | | 1708 | DH_GROUP_LIST | 2151 | variable | Ordered list of DH | 1709 | | | | Group IDs supported | 1710 | | | | by a host | 1711 | | | | | 1712 | HIP_MAC | 61505 | variable | HMAC-based message | 1713 | | | | authentication code, | 1714 | | | | with key material | 1715 | | | | from KEYMAT | 1716 | | | | | 1717 | HIP_MAC_2 | 61569 | variable | HMAC based message | 1718 | | | | authentication code, | 1719 | | | | with key material | 1720 | | | | from KEYMAT. | 1721 | | | | Compared to HIP_MAC, | 1722 | | | | the HOST_ID parameter | 1723 | | | | is included in | 1724 | | | | HIP_MAC_2 | 1725 | | | | calculation. | 1726 | | | | | 1727 | HIP_SIGNATURE_2 | 61633 | variable | Signature of the R1 | 1728 | | | | packet | 1729 | | | | | 1730 | HIP_SIGNATURE | 61697 | variable | Signature of the | 1731 | | | | packet | 1732 | | | | | 1733 | ECHO_REQUEST_UNSIGNED | 63661 | variable | Opaque data to be | 1734 | | | | echoed back; after | 1735 | | | | signature | 1736 | | | | | 1737 | ECHO_RESPONSE_UNSIGNED | 63425 | variable | Opaque data echoed | 1738 | | | | back; after signature | 1739 +------------------------+-------+----------+-----------------------+ 1741 Because the ordering (from lowest to highest) of HIP parameters is 1742 strictly enforced (see Section 5.2.1), the parameter type values for 1743 existing parameters have been spaced to allow for future protocol 1744 extensions. Parameters numbered between 0-1023 are used in HIP 1745 handshake and update procedures and are covered by signatures. 1746 Parameters numbered between 1024-2047 are reserved. Parameters 1747 numbered between 2048-4095 are used for parameters that are covered 1748 by a signature but may also be present in packets without signatures. 1749 Parameters numbered between 4096 and (2^16 - 2^12) 61439 are 1750 reserved. Parameters numbered between 61440-62463 are used for 1751 signatures and signed MACs. Parameters numbered between 62464-63487 1752 are used for parameters that fall outside of the signed area of the 1753 packet. Parameters numbered between 63488-64511 are used for 1754 rendezvous and other relaying services. Parameters numbered between 1755 64512-65535 are reserved. 1757 5.2.1. TLV Format 1759 The TLV-encoded parameters are described in the following 1760 subsections. The type-field value also describes the order of these 1761 fields in the packet, except for type values from 2048 to 4095 which 1762 are reserved for new transport forms. The parameters MUST be 1763 included in the packet such that their types form an increasing 1764 order. If the parameter can exist multiple times in the packet, the 1765 type value may be the same in consecutive parameters. If the order 1766 does not follow this rule, the packet is considered to be malformed 1767 and it MUST be discarded. 1769 Parameters using type values from 2048 up to 4095 are transport 1770 formats. Currently, one transport format is defined: the ESP 1771 transport format [RFC5202]. The order of these parameters does not 1772 follow the order of their type value, but they are put in the packet 1773 in order of preference. The first of the transport formats it the 1774 most preferred, and so on. 1776 All of the TLV parameters have a length (including Type and Length 1777 fields), which is a multiple of 8 bytes. When needed, padding MUST 1778 be added to the end of the parameter so that the total length becomes 1779 a multiple of 8 bytes. This rule ensures proper alignment of data. 1780 Any added padding bytes MUST be zeroed by the sender, and their 1781 values SHOULD NOT be checked by the receiver. 1783 Consequently, the Length field indicates the length of the Contents 1784 field (in bytes). The total length of the TLV parameter (including 1785 Type, Length, Contents, and Padding) is related to the Length field 1786 according to the following formula: 1788 Total Length = 11 + Length - (Length + 3) % 8; 1790 where % is the modulo operator 1791 0 1 2 3 1792 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 1793 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1794 | Type |C| Length | 1795 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1796 | | 1797 / Contents / 1798 / +-+-+-+-+-+-+-+-+ 1799 | | Padding | 1800 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1802 Type Type code for the parameter. 16 bits long, C-bit 1803 being part of the Type code. 1804 C Critical. One if this parameter is critical, and 1805 MUST be recognized by the recipient, zero otherwise. 1806 The C bit is considered to be a part of the Type 1807 field. Consequently, critical parameters are always 1808 odd and non-critical ones have an even value. 1809 Length Length of the Contents, in bytes excluding Type, 1810 Length, and Padding. 1811 Contents Parameter specific, defined by Type 1812 Padding Padding, 0-7 bytes, added if needed 1814 Critical parameters MUST be recognized by the recipient. If a 1815 recipient encounters a critical parameter that it does not recognize, 1816 it MUST NOT process the packet any further. It MAY send an ICMP or 1817 NOTIFY, as defined in Section 4.3. 1819 Non-critical parameters MAY be safely ignored. If a recipient 1820 encounters a non-critical parameter that it does not recognize, it 1821 SHOULD proceed as if the parameter was not present in the received 1822 packet. 1824 5.2.2. Defining New Parameters 1826 Future specifications may define new parameters as needed. When 1827 defining new parameters, care must be taken to ensure that the 1828 parameter type values are appropriate and leave suitable space for 1829 other future extensions. One must remember that the parameters MUST 1830 always be arranged in increasing order by Type code, thereby limiting 1831 the order of parameters (see Section 5.2.1). 1833 The following rules must be followed when defining new parameters. 1835 1. The low-order bit C of the Type code is used to distinguish 1836 between critical and non-critical parameters. 1838 2. A new parameter may be critical only if an old recipient ignoring 1839 it would cause security problems. In general, new parameters 1840 SHOULD be defined as non-critical, and expect a reply from the 1841 recipient. 1843 3. If a system implements a new critical parameter, it MUST provide 1844 the ability to set the associated feature off, such that the 1845 critical parameter is not sent at all. The configuration option 1846 must be well documented. Implementations operating in a mode 1847 adhering to this specification MUST disable the sending of new 1848 critical parameters. In other words, the management interface 1849 MUST allow vanilla standards-only mode as a default configuration 1850 setting, and MAY allow new critical payloads to be configured on 1851 (and off). 1853 4. See Section 10 for allocation rules regarding Type codes. 1855 5.2.3. R1_COUNTER 1857 0 1 2 3 1858 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 1859 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1860 | Type | Length | 1861 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1862 | Reserved, 4 bytes | 1863 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1864 | R1 generation counter, 8 bytes | 1865 | | 1866 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1868 Type 128 1869 Length 12 1870 R1 generation 1871 counter The current generation of valid puzzles 1873 The R1_COUNTER parameter contains a 64-bit unsigned integer in 1874 network-byte order, indicating the current generation of valid 1875 puzzles. The sender is supposed to increment this counter 1876 periodically. It is RECOMMENDED that the counter value is 1877 incremented at least as often as old PUZZLE values are deprecated so 1878 that SOLUTIONs to them are no longer accepted. 1880 The R1_COUNTER parameter is optional. It SHOULD be included in the 1881 R1 (in which case, it is covered by the signature), and if present in 1882 the R1, it MAY be echoed (including the Reserved field verbatim) by 1883 the Initiator in the I2. 1885 5.2.4. PUZZLE 1887 0 1 2 3 1888 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 1889 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1890 | Type | Length | 1891 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1892 | K, 1 byte | Lifetime | Opaque, 2 bytes | 1893 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1894 | Random #I, n bytes | 1895 / / 1896 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1898 Type 257 1899 Length 4+RHASH_len/8 1900 K K is the number of verified bits 1901 Lifetime puzzle lifetime 2^(value-32) seconds 1902 Opaque data set by the Responder, indexing the puzzle 1903 Random #I random number of size RHASH_len bits 1905 Random #I is represented as a n-bit integer (where n is RHASH_len), K 1906 and Lifetime as 8-bit integers, all in network byte order. 1908 The PUZZLE parameter contains the puzzle difficulty K and a n-bit 1909 puzzle random integer #I. The Puzzle Lifetime indicates the time 1910 during which the puzzle solution is valid, and sets a time limit that 1911 should not be exceeded by the Initiator while it attempts to solve 1912 the puzzle. The lifetime is indicated as a power of 2 using the 1913 formula 2^(Lifetime-32) seconds. A puzzle MAY be augmented with an 1914 ECHO_REQUEST_SIGNED or an ECHO_REQUEST_UNSIGNED parameter included in 1915 the R1; the contents of the echo request are then echoed back in the 1916 ECHO_RESPONSE_SIGNED or in the ECHO_RESPONSE_UNSIGNED, allowing the 1917 Responder to use the included information as a part of its puzzle 1918 processing. 1920 The Opaque and Random #I field are not covered by the HIP_SIGNATURE_2 1921 parameter. 1923 5.2.5. SOLUTION 1925 0 1 2 3 1926 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 1927 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1928 | Type | Length | 1929 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1930 | K, 1 byte | Reserved | Opaque, 2 bytes | 1931 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1932 | Random #I, n bytes | 1933 / / 1934 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1935 | Puzzle solution #J, n bytes | 1936 / / 1937 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1939 Type 321 1940 Length 4 + RHASH_len/4 1941 K K is the number of verified bits 1942 Reserved zero when sent, ignored when received 1943 Opaque copied unmodified from the received PUZZLE 1944 parameter 1945 Random #I random number of size RHASH_len bits 1946 Puzzle solution #J random number of size RHASH_len bits 1948 Random #I and Random #J are represented as n-bit integers (where n is 1949 RHASH_len), K as an 8-bit integer, all in network byte order. 1951 The SOLUTION parameter contains a solution to a puzzle. It also 1952 echoes back the random difficulty K, the Opaque field, and the puzzle 1953 integer #I. 1955 5.2.6. DIFFIE_HELLMAN 1957 0 1 2 3 1958 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 1959 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1960 | Type | Length | 1961 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1962 | Group ID | Public Value Length | Public Value / 1963 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1964 / | 1965 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1966 / | Padding | 1967 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1969 Type 513 1970 Length length in octets, excluding Type, Length, and 1971 Padding 1972 Group ID defines values for p and g 1973 Public Value length of the following Public Value in octets 1974 Length 1975 Public Value the sender's public Diffie-Hellman key 1977 The following Group IDs have been defined: 1979 Group Value 1980 Reserved 0 1981 DEPRECATED 1 1982 DEPRECATED 2 1983 1536-bit MODP group 3 [RFC3526] 1984 3072-bit MODP group 4 [RFC3526] 1985 DEPRECATED 5 1986 DEPRECATED 6 1987 160-bit random ECP group 7 [Appendix D, draft-mcgrew-fundamental-ecc-02.txt] 1988 256-bit random ECP group 8 [RFC4753, draft-mcgrew-fundamental-ecc-02.txt] 1989 384-bit random ECP group 9 [RFC4753, draft-mcgrew-fundamental-ecc-02.txt] 1990 521-bit random ECP group 10 [RFC4753, draft-mcgrew-fundamental-ecc-02.txt] 1992 The MODP Diffie-Hellman groups are defined in [RFC3526]. The ECDH 1993 groups 8 - 10 are defined in [RFC4753] and [fundamental-ecc]. ECDH 1994 group 7 is covered in Appendix D. 1996 A HIP implementation MUST implement Group ID 3. The 160-bit ECP 1997 group can be used when lower security is enough (e.g., web surfing) 1998 and when the equipment is not powerful enough (e.g., some PDAs). 1999 Implementations SHOULD implement Group IDs 4 and 8. 2001 To avoid unnecessary failures during the base exchange, the rest of 2002 the groups SHOULD be implemented in hosts where resources are 2003 adequate. 2005 5.2.7. HIP_CIPHER 2007 0 1 2 3 2008 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 2009 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2010 | Type | Length | 2011 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2012 | Cipher ID #1 | Cipher ID #2 | 2013 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2014 | Cipher ID #n | Padding | 2015 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2017 Type 579 2018 Length length in octets, excluding Type, Length, and 2019 Padding 2020 Cipher ID defines the cipher algorithm to be used for 2021 encrypting parts of the HIP packet 2023 The following Cipher IDs are defined: 2025 Suite ID Value 2027 RESERVED 0 2028 NULL-ENCRYPT 1 ([RFC2410]) 2029 AES-128-CBC 2 ([RFC3602]) 2030 3DES-CBC 3 ([RFC2451]) 2031 AES-256-CBC 4 ([RFC3602]) 2033 The sender of a HIP_CIPHER parameter MUST make sure that there are no 2034 more than six (6) Cipher IDs in one HIP_CIPHER parameter. 2035 Conversely, a recipient MUST be prepared to handle received transport 2036 parameters that contain more than six Cipher IDs by accepting the 2037 first six Cipher IDs and dropping the rest. The limited number of 2038 transforms sets the maximum size of the HIP_CIPHER parameter. As the 2039 default configuration, the HIP_CIPHER parameter MUST contain at least 2040 one of the mandatory Cipher IDs. There MAY be a configuration option 2041 that allows the administrator to override this default. 2043 The Responder lists supported and desired Cipher IDs in order of 2044 preference in the R1, up to the maximum of six Cipher IDs. The 2045 Initiator MUST choose only one of the corresponding Cipher IDs. That 2046 Cipher ID will be used for generating the ENCRYPTED parameter. 2048 Mandatory implementation: AES-128-CBC. NULL-ENCRYPTION is included 2049 for testing purposes. NULL-ENCRYPTION SHOULD NOT be configurable via 2050 the UI. 2052 5.2.8. HOST_ID 2054 0 1 2 3 2055 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 2056 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2057 | Type | Length | 2058 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2059 | HI Length |DI-type| DI Length | 2060 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2061 | Host Identity / 2062 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2063 / | Domain Identifier / 2064 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2065 / | Padding | 2066 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2068 Type 705 2069 Length length in octets, excluding Type, Length, and 2070 Padding 2071 HI Length length of the Host Identity in octets 2072 DI-type type of the following Domain Identifier field 2073 DI Length length of the FQDN or NAI in octets 2074 Host Identity actual Host Identity 2075 Domain Identifier the identifier of the sender 2077 The Host Identity is represented in the DNSKEY format for RSA and 2078 DSA. For these, the Public Key field from RFC 4034 [RFC4034] is 2079 used. For ECC Host Identities this field is defined here directly. 2081 Algorithms Values 2083 RESERVED 0 2084 DSA 3 [RFC2536] (RECOMMENDED) 2085 RSA 5 [RFC3110] (REQUIRED) 2086 ECDSA 7 [fundamental-ecc] (RECOMMENDED) 2088 For ECDSA the Host Identity is represented by the following fields: 2090 0 1 2 3 2091 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 2092 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2093 | ECC Curve | | 2094 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2095 | Public Key / 2096 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2098 ECC Curve Curve label 2099 Public Key Represented in Octect-string format [fundamental-ecc] 2101 Required ECC Curve values are: 2103 Curve Values 2105 RESERVED 0 2106 NIST-ECDSA-256 1 [RFC4754] 2107 NIST-ECDSA-384 2 [RFC4754] 2108 brainpoolP160r1 3 [RFC5639] 2110 The following DI-types have been defined: 2112 Type Value 2113 none included 0 2114 FQDN 1 2115 NAI 2 2117 FQDN Fully Qualified Domain Name, in binary format. 2118 NAI Network Access Identifier 2120 The format for the FQDN is defined in RFC 1035 [RFC1035] Section 3.1. 2121 The format for NAI is defined in [RFC4282] 2123 If there is no Domain Identifier, i.e., the DI-type field is zero, 2124 the DI Length field is set to zero as well. 2126 5.2.9. HIT_SUITE_LIST 2128 0 1 2 3 2129 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 2130 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2131 | Type | Length | 2132 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2133 | ID #1 | ID #2 | ID #3 | ID #4 | 2134 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2135 | ID #n | Padding | 2136 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2138 Type 715 2139 Length number of HIT Suite IDs 2140 ID defines a HIT Suite ID supported by the host. 2141 The list of IDs is ordered by preference of the 2142 host. Each HIT Suite ID is one octet long. The four 2143 higher-order bits correspond to the HIT Suite ID in 2144 the ORCHID OGA field. The four lower-order bits are 2145 set to 0. 2147 The ID field in the HIT_SUITE_LIST is defined as eight-bit field 2148 opposed to the four-bit HIT Suite ID and OGA field in the ORCHID. 2149 This difference is a measure to accommodate larger HIT Suite IDs if 2150 the 16 available values prove insufficient. In that case, one of the 2151 16 values (0) will be used to indicate that four additional bits of 2152 the ORCHID will be used to encode the HIT Suite ID. Hence, the 2153 current four-bit HIT Suite-IDs only use the four higher order bits in 2154 the ID field. Future documents may define the use of the four lower- 2155 order bits in the ID field. ^ 2157 The following HIT Suites ID are defined: 2159 HIT Suite ID 2160 RESERVED 0 2161 RSA/DSA/SHA-1 1 (REQUIRED) 2162 ECDSA/SHA-256 2 (RECOMMENDED) 2163 ECDSA/SHA-384 3 (RECOMMENDED) 2165 The HIT_SUITE_LIST parameter contains a list of the supported HIT 2166 suite IDs of the Responder. The Responder sends the HIT_SUITE_LIST 2167 in the signed part of the R1 packet. Based on the HIT_SUITE_LIST, 2168 the Initiator can determine which source HITs are supported by the 2169 Responder. 2171 5.2.10. DH_GROUP_LIST 2173 0 1 2 3 2174 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 2175 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2176 | Type | Length | 2177 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2178 | DH GROUP ID #1| DH GROUP ID #2| DH GROUP ID #3| DH GROUP ID #4| 2179 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2180 | DH GROUP ID #n| Padding | 2181 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2183 Type 2151 2184 Length number of DH Group IDs 2185 DH GROUP ID defines a DH GROUP ID supported by the host. 2186 The list of IDs is ordered by preference of the 2187 host. The list of define DH Group IDs in the 2188 DIFFIE_HELLMAN parameter. Each DH Group ID is one 2189 octet long. 2191 The DH_GROUP_LIST parameter contains the list of supported DH Group 2192 IDs of a host. The Initiator sends the DH_GROUP_LIST in the I1 2193 packet, the Responder sends it in the signed part of the R1 packet. 2194 The DH Group IDs in the DH_GROUP_LIST are listed in the order of 2195 their preference of the host. DH Group IDs that are listed first are 2196 preferred compared to the DH Group IDs listed later. The information 2197 in the DH_GROUP_LIST allows the Responder to select the DH group 2198 preferred by itself and the Initiator. Based on the DH_GROUP_LIST in 2199 the R1 packet, the Initiator can determine if the Responder has 2200 selected the best possible choice based on the Initiator's and 2201 Responder's preferences. If the Responder's choice differs from the 2202 best choice, the Initiator can conclude that there was an attempted 2203 downgrade attack. 2205 When selecting the DH group for the DIFFIE_HELLMAN parameter in the 2206 R1 packet, the Responder MUST select the first DH Group ID in the 2207 Responder's DH_GROUP_LIST that is contained in the Initiator's 2208 DH_GROUP_LIST. 2210 5.2.11. HIP_MAC 2212 0 1 2 3 2213 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 2214 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2215 | Type | Length | 2216 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2217 | | 2218 | HMAC | 2219 / / 2220 / +-------------------------------+ 2221 | | Padding | 2222 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2224 Type 61505 2225 Length length in octets, excluding Type, Length, and 2226 Padding 2227 HMAC HMAC computed over the HIP packet, excluding the 2228 HIP_MAC parameter and any following parameters, such 2229 as HIP_SIGNATURE, HIP_SIGNATURE_2, 2230 ECHO_REQUEST_UNSIGNED, or ECHO_RESPONSE_UNSIGNED. 2231 The checksum field MUST be set to zero and the HIP 2232 header length in the HIP common header MUST be 2233 calculated not to cover any excluded parameters 2234 when the HMAC is calculated. The size of the 2235 HMAC is the natural size of the hash computation 2236 output depending on the used hash function. 2238 The HMAC uses RHASH as hash algorithm. The calculation and 2239 verification process is presented in Section 6.4.1. 2241 5.2.12. HIP_MAC_2 2243 The parameter structure is the same as in Section 5.2.11. The fields 2244 are: 2246 Type 61569 2247 Length length in octets, excluding Type, Length, and 2248 Padding 2249 HMAC HMAC computed over the HIP packet, excluding the 2250 HIP_MAC parameter and any following parameters such 2251 as HIP_SIGNATURE, HIP_SIGNATURE_2, 2252 ECHO_REQUEST_UNSIGNED, or ECHO_RESPONSE_UNSIGNED, 2253 and including an additional sender's HOST_ID 2254 parameter during the HMAC calculation. The 2255 checksum field MUST be set to zero and the HIP 2256 header length in the HIP common header MUST be 2257 calculated not to cover any excluded parameters 2258 when the HMAC is calculated. The size of the 2259 HMAC is the natural size of the hash computation 2260 output depending on the used hash function. 2262 The HMAC uses RHASH as hash algorithm. The calculation and 2263 verification process is presented in Section 6.4.1. 2265 5.2.13. HIP_SIGNATURE 2267 0 1 2 3 2268 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 2269 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2270 | Type | Length | 2271 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2272 | SIG alg | Signature / 2273 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2274 / | Padding | 2275 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2277 Type 61697 2278 Length length in octets, excluding Type, Length, and 2279 Padding 2280 SIG alg signature algorithm 2281 Signature the signature is calculated over the HIP packet, 2282 excluding the HIP_SIGNATURE parameter and any 2283 parameters that follow the HIP_SIGNATURE parameter. 2284 The checksum field MUST be set to zero, and the HIP 2285 header length in the HIP common header MUST be 2286 calculated only to the beginning of the 2287 HIP_SIGNATURE parameter when the signature is 2288 calculated. 2290 The signature algorithms are defined in Section 5.2.8. The signature 2291 in the Signature field is encoded using the proper method depending 2292 on the signature algorithm (e.g., according to [RFC3110] in case of 2293 RSA/SHA-1, according to [RFC5702] in case of RSA/SHA-256, according 2294 to [RFC2536] in case of DSA, or according to [fundamental-ecc] in 2295 case of ECDSA). 2297 The HIP_SIGNATURE calculation and verification process is presented 2298 in Section 6.4.2. 2300 5.2.14. HIP_SIGNATURE_2 2302 The parameter structure is the same as in Section 5.2.13. The fields 2303 are: 2305 Type 61633 2306 Length length in octets, excluding Type, Length, and 2307 Padding 2308 SIG alg signature algorithm 2309 Signature Within the R1 packet that contains the 2310 HIP_SIGNATURE_2 parameter, the Initiator's HIT, the 2311 checksum field, and the Opaque and Random #I fields 2312 in the PUZZLE parameter MUST be set to zero while 2313 computing the HIP_SIGNATURE_2 signature. Further, 2314 the HIP packet length in the HIP header MUST be 2315 adjusted as if the HIP_SIGNATURE_2 was not in the 2316 packet during the signature calculation, i.e., the 2317 HIP packet length points to the beginning of 2318 the HIP_SIGNATURE_2 parameter during signing and 2319 verification. 2321 Zeroing the Initiator's HIT makes it possible to create R1 packets 2322 beforehand, to minimize the effects of possible DoS attacks. Zeroing 2323 the Random #I and Opaque fields within the PUZZLE parameter allows 2324 these fields to be populated dynamically on precomputed R1s. 2326 Signature calculation and verification follows the process in 2327 Section 6.4.2. 2329 5.2.15. SEQ 2331 0 1 2 3 2332 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 2333 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2334 | Type | Length | 2335 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2336 | Update ID | 2337 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2339 Type 385 2340 Length 4 2341 Update ID 32-bit sequence number 2343 The Update ID is an unsigned quantity, initialized by a host to zero 2344 upon moving to ESTABLISHED state. The Update ID has scope within a 2345 single HIP association, and not across multiple associations or 2346 multiple hosts. The Update ID is incremented by one before each new 2347 UPDATE that is sent by the host; the first UPDATE packet originated 2348 by a host has an Update ID of 0. 2350 5.2.16. ACK 2352 0 1 2 3 2353 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 2354 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2355 | Type | Length | 2356 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2357 | peer Update ID | 2358 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2360 Type 449 2361 Length variable (multiple of 4) 2362 peer Update ID 32-bit sequence number corresponding to the 2363 Update ID being ACKed. 2365 The ACK parameter includes one or more Update IDs that have been 2366 received from the peer. The Length field identifies the number of 2367 peer Update IDs that are present in the parameter. 2369 5.2.17. ENCRYPTED 2371 0 1 2 3 2372 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 2373 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2374 | Type | Length | 2375 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2376 | Reserved | 2377 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2378 | IV / 2379 / / 2380 / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2381 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / 2382 / Encrypted data / 2383 / / 2384 / +-------------------------------+ 2385 / | Padding | 2386 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2388 Type 641 2389 Length length in octets, excluding Type, Length, and 2390 Padding 2391 Reserved zero when sent, ignored when received 2392 IV Initialization vector, if needed, otherwise 2393 nonexistent. The length of the IV is inferred from 2394 the HIP_CIPHER. 2395 Encrypted The data is encrypted using an encryption algorithm 2396 data as defined in the HIP_CIPHER parameter. 2398 The ENCRYPTED parameter encapsulates another parameter, the encrypted 2399 data, which holds one or more HIP parameters in block encrypted form. 2401 Consequently, the first fields in the encapsulated parameter(s) are 2402 Type and Length of the first such parameter, allowing the contents to 2403 be easily parsed after decryption. 2405 The field labelled "Encrypted data" consists of the output of one or 2406 more HIP parameters concatenated together that have been passed 2407 through an encryption algorithm. Each of these inner parameters is 2408 padded according to the rules of Section 5.2.1 for padding individual 2409 parameters. As a result, the concatenated parameters will be a block 2410 of data that is 8-byte aligned. 2412 Some encryption algorithms require that the data to be encrypted must 2413 be a multiple of the cipher algorithm block size. In this case, the 2414 above block of data MUST include additional padding, as specified by 2415 the encryption algorithm. The size of the extra padding is selected 2416 so that the length of the unencrypted data block is a multiple of the 2417 cipher block size. The encryption algorithm may specify padding 2418 bytes other than zero; for example, AES [FIPS.197.2001] uses the 2419 PKCS5 padding scheme (see section 6.1.1 of [RFC2898]) where the 2420 remaining n bytes to fill the block each have the value n. This 2421 yields an "unencrypted data" block that is transformed to an 2422 "encrypted data" block by the cipher suite. This extra padding added 2423 to the set of parameters to satisfy the cipher block alignment rules 2424 is not counted in HIP TLV length fields, and this extra padding 2425 should be removed by the cipher suite upon decryption. 2427 Note that the length of the cipher suite output may be smaller or 2428 larger than the length of the set of parameters to be encrypted, 2429 since the encryption process may compress the data or add additional 2430 padding to the data. 2432 Once this encryption process is completed, the Encrypted data field 2433 is ready for inclusion in the Parameter. If necessary, additional 2434 Padding for 8-byte alignment is then added according to the rules of 2435 Section 5.2.1. 2437 5.2.18. NOTIFICATION 2439 The NOTIFICATION parameter is used to transmit informational data, 2440 such as error conditions and state transitions, to a HIP peer. A 2441 NOTIFICATION parameter may appear in the NOTIFY packet type. The use 2442 of the NOTIFICATION parameter in other packet types is for further 2443 study. 2445 0 1 2 3 2446 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 2447 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2448 | Type | Length | 2449 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2450 | Reserved | Notify Message Type | 2451 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2452 | / 2453 / Notification Data / 2454 / +---------------+ 2455 / | Padding | 2456 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2458 Type 832 2459 Length length in octets, excluding Type, Length, and 2460 Padding 2461 Reserved zero when sent, ignored when received 2462 Notify Message specifies the type of notification 2463 Type 2464 Notification informational or error data transmitted in addition 2465 Data to the Notify Message Type. Values for this field 2466 are type specific (see below). 2467 Padding any Padding, if necessary, to make the parameter a 2468 multiple of 8 bytes. 2470 Notification information can be error messages specifying why an SA 2471 could not be established. It can also be status data that a process 2472 managing an SA database wishes to communicate with a peer process. 2473 The table below lists the Notification messages and their 2474 corresponding values. 2476 To avoid certain types of attacks, a Responder SHOULD avoid sending a 2477 NOTIFICATION to any host with which it has not successfully verified 2478 a puzzle solution. 2480 Types in the range 0-16383 are intended for reporting errors and in 2481 the range 16384-65535 for other status information. An 2482 implementation that receives a NOTIFY packet with a NOTIFICATION 2483 error parameter in response to a request packet (e.g., I1, I2, 2484 UPDATE) SHOULD assume that the corresponding request has failed 2485 entirely. Unrecognized error types MUST be ignored except that they 2486 SHOULD be logged. 2488 Notify payloads with status types MUST be ignored if not recognized. 2490 NOTIFICATION PARAMETER - ERROR TYPES Value 2491 ------------------------------------ ----- 2492 UNSUPPORTED_CRITICAL_PARAMETER_TYPE 1 2494 Sent if the parameter type has the "critical" bit set and the 2495 parameter type is not recognized. Notification Data contains 2496 the two-octet parameter type. 2498 INVALID_SYNTAX 7 2500 Indicates that the HIP message received was invalid because 2501 some type, length, or value was out of range or because the 2502 request was rejected for policy reasons. To avoid a denial- 2503 of-service attack using forged messages, this status may only be 2504 returned for packets whose HIP_MAC (if present) and SIGNATURE have 2505 been verified. This status MUST be sent in response to any 2506 error not covered by one of the other status types, and should 2507 not contain details to avoid leaking information to someone 2508 probing a node. To aid debugging, more detailed error 2509 information SHOULD be written to a console or log. 2511 NO_DH_PROPOSAL_CHOSEN 14 2513 None of the proposed group IDs was acceptable. 2515 INVALID_DH_CHOSEN 15 2517 The DH Group ID field does not correspond to one offered 2518 by the Responder. 2520 NO_HIP_PROPOSAL_CHOSEN 16 2522 None of the proposed HIT Suites or HIP Encryption Algorithms was 2523 acceptable. 2525 INVALID_HIP_CIPHER_CHOSEN 17 2527 The HIP_CIPHER Crypto ID does not correspond to 2528 one offered by the Responder. 2530 AUTHENTICATION_FAILED 24 2532 Sent in response to a HIP signature failure, except when 2533 the signature verification fails in a NOTIFY message. 2535 CHECKSUM_FAILED 26 2537 Sent in response to a HIP checksum failure. 2539 HIP_MAC_FAILED 28 2540 Sent in response to a HIP HMAC failure. 2542 ENCRYPTION_FAILED 32 2544 The Responder could not successfully decrypt the 2545 ENCRYPTED parameter. 2547 INVALID_HIT 40 2549 Sent in response to a failure to validate the peer's 2550 HIT from the corresponding HI. 2552 BLOCKED_BY_POLICY 42 2554 The Responder is unwilling to set up an association 2555 for some policy reason (e.g., received HIT is NULL 2556 and policy does not allow opportunistic mode). 2558 SERVER_BUSY_PLEASE_RETRY 44 2560 The Responder is unwilling to set up an association as it is 2561 suffering under some kind of overload and has chosen to shed load 2562 by rejecting the Initiator's request. The Initiator may retry; 2563 however, the Initiator MUST find another (different) puzzle 2564 solution for any such retries. Note that the Initiator may need 2565 to obtain a new puzzle with a new I1/R1 exchange. 2567 NOTIFY MESSAGES - STATUS TYPES Value 2568 ------------------------------ ----- 2570 I2_ACKNOWLEDGEMENT 16384 2572 The Responder has an I2 from the Initiator but had to queue the 2573 I2 for processing. The puzzle was correctly solved and the 2574 Responder is willing to set up an association but currently has a 2575 number of I2s in the processing queue. R2 will be sent after the 2576 I2 has been processed. 2578 5.2.19. ECHO_REQUEST_SIGNED 2580 0 1 2 3 2581 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 2582 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2583 | Type | Length | 2584 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2585 | Opaque data (variable length) | 2586 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2588 Type 897 2589 Length variable 2590 Opaque data opaque data, supposed to be meaningful only to the 2591 node that sends ECHO_REQUEST_SIGNED and receives a 2592 corresponding ECHO_RESPONSE_SIGNED or 2593 ECHO_RESPONSE_UNSIGNED. 2595 The ECHO_REQUEST_SIGNED parameter contains an opaque blob of data 2596 that the sender wants to get echoed back in the corresponding reply 2597 packet. 2599 The ECHO_REQUEST_SIGNED and corresponding echo response parameters 2600 MAY be used for any purpose where a node wants to carry some state in 2601 a request packet and get it back in a response packet. The 2602 ECHO_REQUEST_SIGNED is covered by the HIP_MAC and SIGNATURE. A HIP 2603 packet can contain only one ECHO_REQUEST_SIGNED or 2604 ECHO_REQUEST_UNSIGNED parameter. The ECHO_REQUEST_SIGNED parameter 2605 MUST be responded to with a corresponding echo response. 2606 ECHO_RESPONSE_SIGNED SHOULD be used, but if it is not possible, e.g., 2607 due to a middlebox-provided response, it MAY be responded to with an 2608 ECHO_RESPONSE_UNSIGNED. 2610 5.2.20. ECHO_REQUEST_UNSIGNED 2612 0 1 2 3 2613 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 2614 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2615 | Type | Length | 2616 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2617 | Opaque data (variable length) | 2618 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2620 Type 63661 2621 Length variable 2622 Opaque data opaque data, supposed to be meaningful only to the 2623 node that sends ECHO_REQUEST_UNSIGNED and receives a 2624 corresponding ECHO_RESPONSE_UNSIGNED. 2626 The ECHO_REQUEST_UNSIGNED parameter contains an opaque blob of data 2627 that the sender wants to get echoed back in the corresponding reply 2628 packet. 2630 The ECHO_REQUEST_UNSIGNED and corresponding echo response parameters 2631 MAY be used for any purpose where a node wants to carry some state in 2632 a request packet and get it back in a response packet. The 2633 ECHO_REQUEST_UNSIGNED is not covered by the HIP_MAC and SIGNATURE. A 2634 HIP packet can contain one or more ECHO_REQUEST_UNSIGNED parameters. 2635 It is possible that middleboxes add ECHO_REQUEST_UNSIGNED parameters 2636 in HIP packets passing by. The sender has to create the Opaque field 2637 so that it can later identify and remove the corresponding 2638 ECHO_RESPONSE_UNSIGNED parameter. 2640 The ECHO_REQUEST_UNSIGNED parameter MUST be responded to with an 2641 ECHO_RESPONSE_UNSIGNED parameter. 2643 5.2.21. ECHO_RESPONSE_SIGNED 2645 0 1 2 3 2646 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 2647 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2648 | Type | Length | 2649 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2650 | Opaque data (variable length) | 2651 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2653 Type 961 2654 Length variable 2655 Opaque data opaque data, copied unmodified from the 2656 ECHO_REQUEST_SIGNED or ECHO_REQUEST_UNSIGNED 2657 parameter that triggered this response. 2659 The ECHO_RESPONSE_SIGNED parameter contains an opaque blob of data 2660 that the sender of the ECHO_REQUEST_SIGNED wants to get echoed back. 2661 The opaque data is copied unmodified from the ECHO_REQUEST_SIGNED 2662 parameter. 2664 The ECHO_REQUEST_SIGNED and ECHO_RESPONSE_SIGNED parameters MAY be 2665 used for any purpose where a node wants to carry some state in a 2666 request packet and get it back in a response packet. The 2667 ECHO_RESPONSE_SIGNED is covered by the HIP_MAC and SIGNATURE. 2669 5.2.22. ECHO_RESPONSE_UNSIGNED 2671 0 1 2 3 2672 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 2673 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2674 | Type | Length | 2675 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2676 | Opaque data (variable length) | 2677 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2679 Type 63425 2680 Length variable 2681 Opaque data opaque data, copied unmodified from the 2682 ECHO_REQUEST_SIGNED or ECHO_REQUEST_UNSIGNED 2683 parameter that triggered this response. 2685 The ECHO_RESPONSE_UNSIGNED parameter contains an opaque blob of data 2686 that the sender of the ECHO_REQUEST_SIGNED or ECHO_REQUEST_UNSIGNED 2687 wants to get echoed back. The opaque data is copied unmodified from 2688 the corresponding echo request parameter. 2690 The echo request and ECHO_RESPONSE_UNSIGNED parameters MAY be used 2691 for any purpose where a node wants to carry some state in a request 2692 packet and get it back in a response packet. The 2693 ECHO_RESPONSE_UNSIGNED is not covered by the HIP_MAC and SIGNATURE. 2695 5.3. HIP Packets 2697 There are eight basic HIP packets (see Table 10). Four are for the 2698 HIP base exchange, one is for updating, one is for sending 2699 notifications, and two are for closing a HIP association. 2701 +------------------+------------------------------------------------+ 2702 | Packet type | Packet name | 2703 +------------------+------------------------------------------------+ 2704 | 1 | I1 - the HIP Initiator Packet | 2705 | | | 2706 | 2 | R1 - the HIP Responder Packet | 2707 | | | 2708 | 3 | I2 - the Second HIP Initiator Packet | 2709 | | | 2710 | 4 | R2 - the Second HIP Responder Packet | 2711 | | | 2712 | 16 | UPDATE - the HIP Update Packet | 2713 | | | 2714 | 17 | NOTIFY - the HIP Notify Packet | 2715 | | | 2716 | 18 | CLOSE - the HIP Association Closing Packet | 2717 | | | 2718 | 19 | CLOSE_ACK - the HIP Closing Acknowledgment | 2719 | | Packet | 2720 +------------------+------------------------------------------------+ 2722 Table 10: HIP packets and packet type numbers 2724 Packets consist of the fixed header as described in Section 5.1, 2725 followed by the parameters. The parameter part, in turn, consists of 2726 zero or more TLV-coded parameters. 2728 In addition to the base packets, other packet types will be defined 2729 later in separate specifications. For example, support for mobility 2730 and multi-homing is not included in this specification. 2732 See Notation (Section 2.2) for used operations. 2734 In the future, an OPTIONAL upper-layer payload MAY follow the HIP 2735 header. The Next Header field in the header indicates if there is 2736 additional data following the HIP header. The HIP packet, however, 2737 MUST NOT be fragmented. This limits the size of the possible 2738 additional data in the packet. 2740 5.3.1. I1 - the HIP Initiator Packet 2742 The HIP header values for the I1 packet: 2744 Header: 2745 Packet Type = 1 2746 SRC HIT = Initiator's HIT 2747 DST HIT = Responder's HIT, or NULL 2749 IP ( HIP ( DH_GROUP_LIST ) ) 2751 The I1 packet contains the fixed HIP header and the Initiator's 2752 DH_GROUP_LIST. 2754 Valid control bits: none 2756 The Initiator gets the Responder's HIT either from a DNS lookup of 2757 the Responder's FQDN, from some other repository, or from a local 2758 table. If the Initiator does not know the Responder's HIT, it may 2759 attempt to use opportunistic mode by using NULL (all zeros) as the 2760 Responder's HIT. See also "HIP Opportunistic Mode" (Section 4.1.8). 2762 Since this packet is so easy to spoof even if it were signed, no 2763 attempt is made to add to its generation or processing cost. 2765 The Initiator includes a DH_GROUP_LIST parameter in the I1 to inform 2766 the Responder of its preferred DH Group IDs. Note that the 2767 DH_GROUP_LIST in the I1 packet is not protected by a signature. 2769 Implementations MUST be able to handle a storm of received I1 2770 packets, discarding those with common content that arrive within a 2771 small time delta. 2773 5.3.2. R1 - the HIP Responder Packet 2775 The HIP header values for the R1 packet: 2777 Header: 2778 Packet Type = 2 2779 SRC HIT = Responder's HIT 2780 DST HIT = Initiator's HIT 2782 IP ( HIP ( [ R1_COUNTER, ] 2783 PUZZLE, 2784 DIFFIE_HELLMAN, 2785 HIP_CIPHER, 2786 HOST_ID, 2787 HIT_SUITE_LIST, 2788 DH_GROUP_LIST, 2789 [ ECHO_REQUEST_SIGNED, ] 2790 HIP_SIGNATURE_2 ) 2791 <, ECHO_REQUEST_UNSIGNED >i) 2793 Valid control bits: A 2795 If the Responder's HI is an anonymous one, the A control MUST be set. 2797 The Initiator's HIT MUST match the one received in I1. If the 2798 Responder has multiple HIs, the Responder's HIT used MUST match 2799 Initiator's request. If the Initiator used opportunistic mode, the 2800 Responder may select freely among its HIs. See also "HIP 2801 Opportunistic Mode" (Section 4.1.8). 2803 The R1 generation counter is used to determine the currently valid 2804 generation of puzzles. The value is increased periodically, and it 2805 is RECOMMENDED that it is increased at least as often as solutions to 2806 old puzzles are no longer accepted. 2808 The Puzzle contains a Random #I and the difficulty K. The difficulty 2809 K indicates the number of lower-order bits, in the puzzle hash 2810 result, that must be zeros; see Section 4.1.2. The Random #I is not 2811 covered by the signature and must be zeroed during the signature 2812 calculation, allowing the sender to select and set the #I into a 2813 precomputed R1 just prior sending it to the peer. 2815 The Responder selects the Diffie-Hellman public value based on the 2816 Initiator's preference expressed in the DH_GROUP_LIST parameter in 2817 the I1. The Responder sends back its own preference based on which 2818 it chose the DH public value as DH_GROUP_LIST. This allows the 2819 Initiator to determine whether its own DH_GROUP_LIST in the I1 was 2820 manipulated by an attacker. 2822 The Diffie-Hellman public value is ephemeral, and one value SHOULD be 2823 used only for one connection. Once the Responder has received a 2824 valid response to an R1 packet, that Diffie-Hellman value SHOULD be 2825 deprecated. Because it is possible that the Responder has sent the 2826 same Diffie-Hellman value to different hosts simultaneously in 2827 corresponding R1 packets, those responses should also be accepted. 2828 However, as a defense against I1 storms, an implementation MAY 2829 propose, and re-use if not avoidable, the same Diffie-Hellman value 2830 for a period of time, for example, 15 minutes. By using a small 2831 number of different puzzles for a given Diffie-Hellman value, the R1 2832 packets can be precomputed and delivered as quickly as I1 packets 2833 arrive. A scavenger process should clean up unused Diffie-Hellman 2834 values and puzzles. 2836 Re-using Diffie-Hellman public keys opens up the potential security 2837 risk of more than one Initiator ending up with the same keying 2838 material (due to faulty random number generators). Also, more than 2839 one Initiator using the same Responder public key half may lead to 2840 potentially easier cryptographic attacks and to imperfect forward 2841 security. 2843 However, these risks involved in re-using the same key are 2844 statistical; that is, the authors are not aware of any mechanism that 2845 would allow manipulation of the protocol so that the risk of the re- 2846 use of any given Responder Diffie-Hellman public key would differ 2847 from the base probability. Consequently, it is RECOMMENDED that 2848 implementations avoid re-using the same DH key with multiple 2849 Initiators, but because the risk is considered statistical and not 2850 known to be manipulable, the implementations MAY re-use a key in 2851 order to ease resource-constrained implementations and to increase 2852 the probability of successful communication with legitimate clients 2853 even under an I1 storm. In particular, when it is too expensive to 2854 generate enough precomputed R1 packets to supply each potential 2855 Initiator with a different DH key, the Responder MAY send the same DH 2856 key to several Initiators, thereby creating the possibility of 2857 multiple legitimate Initiators ending up using the same Responder- 2858 side public key. However, as soon as the Responder knows that it 2859 will use a particular DH key, it SHOULD stop offering it. This 2860 design is aimed to allow resource-constrained Responders to offer 2861 services under I1 storms and to simultaneously make the probability 2862 of DH key re-use both statistical and as low as possible. 2864 If a future version of this protocol is considered, we strongly 2865 recommend that these issues be studied again. Especially, the 2866 current design allows hosts to become potentially more vulnerable to 2867 a statistical, low-probability problem during I1 storm attacks than 2868 what they are if no attack is taking place; whether this is 2869 acceptable or not should be reconsidered in the light of any new 2870 experience gained. 2872 The HIP_CIPHER contains the encryption algorithms supported by the 2873 Responder to encrypt the ENCRYPTED parameter, in the order of 2874 preference. All implementations MUST support AES [RFC3602]. 2876 The HIT_SUITE_LIST parameter is an ordered list of the Responder's 2877 preferred and supported HIT Suites. The list allows the Initiator to 2878 determine whether its own source HIT is suitable. 2880 The ECHO_REQUEST_SIGNED and ECHO_REQUEST_UNSIGNED contains data that 2881 the sender wants to receive unmodified in the corresponding response 2882 packet in the ECHO_RESPONSE_SIGNED or ECHO_RESPONSE_UNSIGNED 2883 parameter. 2885 The signature is calculated over the whole HIP envelope, after 2886 setting the Initiator's HIT, header checksum, as well as the Opaque 2887 field and the Random #I in the PUZZLE parameter temporarily to zero, 2888 and excluding any parameters that follow the signature, as described 2889 in Section 5.2.14. This allows the Responder to use precomputed R1s. 2890 The Initiator SHOULD validate this signature. It SHOULD check that 2891 the Responder's HI received matches with the one expected, if any. 2893 5.3.3. I2 - the Second HIP Initiator Packet 2895 The HIP header values for the I2 packet: 2897 Header: 2898 Type = 3 2899 SRC HIT = Initiator's HIT 2900 DST HIT = Responder's HIT 2902 IP ( HIP ( [R1_COUNTER,] 2903 SOLUTION, 2904 DIFFIE_HELLMAN, 2905 HIP_CIPHER, 2906 ENCRYPTED { HOST_ID } or HOST_ID, 2907 [ ECHO_RESPONSE_SIGNED ,] 2908 HIP_MAC, 2909 HIP_SIGNATURE 2910 <, ECHO_RESPONSE_UNSIGNED>i ) ) 2912 Valid control bits: A 2914 The HITs used MUST match the ones used previously. 2916 If the Initiator's HI is an anonymous one, the A control MUST be set. 2918 The Initiator MAY include an unmodified copy of the R1_COUNTER 2919 parameter received in the corresponding R1 packet into the I2 packet. 2921 The Solution contains the Random #I from R1 and the computed #J. The 2922 low-order K bits of the RHASH(I | ... | J) MUST be zero. 2924 The Diffie-Hellman value is ephemeral. If precomputed, a scavenger 2925 process should clean up unused Diffie-Hellman values. The Responder 2926 may re-use Diffie-Hellman values under some conditions as specified 2927 in Section 5.3.2. 2929 The HIP_CIPHER contains the single encryption transform selected by 2930 the Initiator, that will be used to encrypt the ENCRYPTED parameter. 2931 The chosen cipher MUST correspond to one offered by the Responder in 2932 the R1. All implementations MUST support AES m [RFC3602]. 2934 The Initiator's HI MAY be encrypted using the HIP_CIPHER encryption 2935 algorithm. The keying material is derived from the Diffie-Hellman 2936 exchanged as defined in Section 6.5. 2938 The ECHO_RESPONSE_SIGNED and ECHO_RESPONSE_UNSIGNED contain the 2939 unmodified Opaque data copied from the corresponding echo request 2940 parameter. 2942 The HMAC is calculated over the whole HIP envelope, excluding any 2943 parameters after the HIP_MAC, as described in Section 6.4.1. The 2944 Responder MUST validate the HIP_MAC. 2946 The signature is calculated over the whole HIP envelope, excluding 2947 any parameters after the HIP_SIGNATURE, as described in 2948 Section 5.2.13. The Responder MUST validate this signature. It MAY 2949 use either the HI in the packet or the HI acquired by some other 2950 means. 2952 5.3.4. R2 - the Second HIP Responder Packet 2954 The HIP header values for the R2 packet: 2956 Header: 2957 Packet Type = 4 2958 SRC HIT = Responder's HIT 2959 DST HIT = Initiator's HIT 2961 IP ( HIP ( HIP_MAC_2, HIP_SIGNATURE ) ) 2963 Valid control bits: none 2965 The HIP_MAC_2 is calculated over the whole HIP envelope, with 2966 Responder's HOST_ID parameter concatenated with the HIP envelope. 2967 The HOST_ID parameter is removed after the HMAC calculation. The 2968 procedure is described in Section 6.4.1. 2970 The signature is calculated over the whole HIP envelope. 2972 The Initiator MUST validate both the HIP_MAC and the signature. 2974 5.3.5. UPDATE - the HIP Update Packet 2976 Support for the UPDATE packet is MANDATORY. 2978 The HIP header values for the UPDATE packet: 2980 Header: 2981 Packet Type = 16 2982 SRC HIT = Sender's HIT 2983 DST HIT = Recipient's HIT 2985 IP ( HIP ( [SEQ, ACK, ] HIP_MAC, HIP_SIGNATURE ) ) 2987 Valid control bits: None 2988 The UPDATE packet contains mandatory HIP_MAC and HIP_SIGNATURE 2989 parameters, and other optional parameters. 2991 The UPDATE packet contains zero or one SEQ parameter. The presence 2992 of a SEQ parameter indicates that the receiver MUST ACK the UPDATE. 2993 An UPDATE that does not contain a SEQ parameter is simply an ACK of a 2994 previous UPDATE and itself MUST NOT be ACKed. 2996 An UPDATE packet contains zero or one ACK parameters. The ACK 2997 parameter echoes the SEQ sequence number of the UPDATE packet being 2998 ACKed. A host MAY choose to ACK more than one UPDATE packet at a 2999 time; e.g., the ACK may contain the last two SEQ values received, for 3000 robustness to ACK loss. ACK values are not cumulative; each received 3001 unique SEQ value requires at least one corresponding ACK value in 3002 reply. Received ACKs that are redundant are ignored. 3004 The UPDATE packet may contain both a SEQ and an ACK parameter. In 3005 this case, the ACK is being piggybacked on an outgoing UPDATE. In 3006 general, UPDATEs carrying SEQ SHOULD be ACKed upon completion of the 3007 processing of the UPDATE. A host MAY choose to hold the UPDATE 3008 carrying ACK for a short period of time to allow for the possibility 3009 of piggybacking the ACK parameter, in a manner similar to TCP delayed 3010 acknowledgments. 3012 A sender MAY choose to forgo reliable transmission of a particular 3013 UPDATE (e.g., it becomes overcome by events). The semantics are such 3014 that the receiver MUST acknowledge the UPDATE, but the sender MAY 3015 choose to not care about receiving the ACK. 3017 UPDATEs MAY be retransmitted without incrementing SEQ. If the same 3018 subset of parameters is included in multiple UPDATEs with different 3019 SEQs, the host MUST ensure that the receiver's processing of the 3020 parameters multiple times will not result in a protocol error. 3022 5.3.6. NOTIFY - the HIP Notify Packet 3024 The NOTIFY packet is OPTIONAL. The NOTIFY packet MAY be used to 3025 provide information to a peer. Typically, NOTIFY is used to indicate 3026 some type of protocol error or negotiation failure. NOTIFY packets 3027 are unacknowledged. The receiver can handle the packet only as 3028 informational, and SHOULD NOT change its HIP state (Section 4.4.2) 3029 based purely on a received NOTIFY packet. 3031 The HIP header values for the NOTIFY packet: 3033 Header: 3034 Packet Type = 17 3035 SRC HIT = Sender's HIT 3036 DST HIT = Recipient's HIT, or zero if unknown 3038 IP ( HIP (i, [HOST_ID, ] HIP_SIGNATURE) ) 3040 Valid control bits: None 3042 The NOTIFY packet is used to carry one or more NOTIFICATION 3043 parameters. 3045 5.3.7. CLOSE - the HIP Association Closing Packet 3047 The HIP header values for the CLOSE packet: 3049 Header: 3050 Packet Type = 18 3051 SRC HIT = Sender's HIT 3052 DST HIT = Recipient's HIT 3054 IP ( HIP ( ECHO_REQUEST_SIGNED, HIP_MAC, HIP_SIGNATURE ) ) 3056 Valid control bits: none 3058 The sender MUST include an ECHO_REQUEST_SIGNED used to validate 3059 CLOSE_ACK received in response, and both an HIP_MAC and a signature 3060 (calculated over the whole HIP envelope). 3062 The receiver peer MUST validate both the HIP_MAC and the signature if 3063 it has a HIP association state, and MUST reply with a CLOSE_ACK 3064 containing an ECHO_RESPONSE_SIGNED corresponding to the received 3065 ECHO_REQUEST_SIGNED. 3067 5.3.8. CLOSE_ACK - the HIP Closing Acknowledgment Packet 3069 The HIP header values for the CLOSE_ACK packet: 3071 Header: 3072 Packet Type = 19 3073 SRC HIT = Sender's HIT 3074 DST HIT = Recipient's HIT 3076 IP ( HIP ( ECHO_RESPONSE_SIGNED, HIP_MAC, HIP_SIGNATURE ) ) 3078 Valid control bits: none 3079 The sender MUST include both an HMAC and signature (calculated over 3080 the whole HIP envelope). 3082 The receiver peer MUST validate both the HMAC and the signature. 3084 5.4. ICMP Messages 3086 When a HIP implementation detects a problem with an incoming packet, 3087 and it either cannot determine the identity of the sender of the 3088 packet or does not have any existing HIP association with the sender 3089 of the packet, it MAY respond with an ICMP packet. Any such replies 3090 MUST be rate-limited as described in [RFC2463]. In most cases, the 3091 ICMP packet will have the Parameter Problem type (12 for ICMPv4, 4 3092 for ICMPv6), with the Pointer field pointing to the field that caused 3093 the ICMP message to be generated. 3095 5.4.1. Invalid Version 3097 If a HIP implementation receives a HIP packet that has an 3098 unrecognized HIP version number, it SHOULD respond, rate-limited, 3099 with an ICMP packet with type Parameter Problem, the Pointer pointing 3100 to the VER./RES. byte in the HIP header. 3102 5.4.2. Other Problems with the HIP Header and Packet Structure 3104 If a HIP implementation receives a HIP packet that has other 3105 unrecoverable problems in the header or packet format, it MAY 3106 respond, rate-limited, with an ICMP packet with type Parameter 3107 Problem, the Pointer pointing to the field that failed to pass the 3108 format checks. However, an implementation MUST NOT send an ICMP 3109 message if the checksum fails; instead, it MUST silently drop the 3110 packet. 3112 5.4.3. Invalid Puzzle Solution 3114 If a HIP implementation receives an I2 packet that has an invalid 3115 puzzle solution, the behavior depends on the underlying version of 3116 IP. If IPv6 is used, the implementation SHOULD respond with an ICMP 3117 packet with type Parameter Problem, the Pointer pointing to the 3118 beginning of the Puzzle solution #J field in the SOLUTION payload in 3119 the HIP message. 3121 If IPv4 is used, the implementation MAY respond with an ICMP packet 3122 with the type Parameter Problem, copying enough of bytes from the I2 3123 message so that the SOLUTION parameter fits into the ICMP message, 3124 the Pointer pointing to the beginning of the Puzzle solution #J 3125 field, as in the IPv6 case. Note, however, that the resulting ICMPv4 3126 message exceeds the typical ICMPv4 message size as defined in 3128 [RFC0792]. 3130 5.4.4. Non-Existing HIP Association 3132 If a HIP implementation receives a CLOSE or UPDATE packet, or any 3133 other packet whose handling requires an existing association, that 3134 has either a Receiver or Sender HIT that does not match with any 3135 existing HIP association, the implementation MAY respond, rate- 3136 limited, with an ICMP packet with the type Parameter Problem, and 3137 with the Pointer pointing to the beginning of the first HIT that does 3138 not match. 3140 A host MUST NOT reply with such an ICMP if it receives any of the 3141 following messages: I1, R2, I2, R2, and NOTIFY. When introducing new 3142 packet types, a specification SHOULD define the appropriate rules for 3143 sending or not sending this kind of ICMP reply. 3145 6. Packet Processing 3147 Each host is assumed to have a single HIP protocol implementation 3148 that manages the host's HIP associations and handles requests for new 3149 ones. Each HIP association is governed by a conceptual state 3150 machine, with states defined above in Section 4.4. The HIP 3151 implementation can simultaneously maintain HIP associations with more 3152 than one host. Furthermore, the HIP implementation may have more 3153 than one active HIP association with another host; in this case, HIP 3154 associations are distinguished by their respective HITs. It is not 3155 possible to have more than one HIP association between any given pair 3156 of HITs. Consequently, the only way for two hosts to have more than 3157 one parallel association is to use different HITs, at least at one 3158 end. 3160 The processing of packets depends on the state of the HIP 3161 association(s) with respect to the authenticated or apparent 3162 originator of the packet. A HIP implementation determines whether it 3163 has an active association with the originator of the packet based on 3164 the HITs. In the case of user data carried in a specific transport 3165 format, the transport format document specifies how the incoming 3166 packets are matched with the active associations. 3168 6.1. Processing Outgoing Application Data 3170 In a HIP host, an application can send application-level data using 3171 an identifier specified via the underlying API. The API can be a 3172 backwards-compatible API (see [RFC5338]), using identifiers that look 3173 similar to IP addresses, or a completely new API, providing enhanced 3174 services related to Host Identities. Depending on the HIP 3175 implementation, the identifier provided to the application may be 3176 different; for example, it can be a HIT or an IP address. 3178 The exact format and method for transferring the data from the source 3179 HIP host to the destination HIP host is defined in the corresponding 3180 transport format document. The actual data is transferred in the 3181 network using the appropriate source and destination IP addresses. 3183 In this document, conceptual processing rules are defined only for 3184 the base case where both hosts have only single usable IP addresses; 3185 the multi-address multi-homing case will be specified separately. 3187 The following conceptual algorithm describes the steps that are 3188 required for handling outgoing datagrams destined to a HIT. 3190 1. If the datagram has a specified source address, it MUST be a HIT. 3191 If it is not, the implementation MAY replace the source address 3192 with a HIT. Otherwise, it MUST drop the packet. 3194 2. If the datagram has an unspecified source address, the 3195 implementation must choose a suitable source HIT for the 3196 datagram. 3198 3. If there is no active HIP association with the given HIT pair, one must be created by running the base 3200 exchange. While waiting for the base exchange to complete, the 3201 implementation SHOULD queue at least one packet per HIP 3202 association to be formed, and it MAY queue more than one. 3204 4. Once there is an active HIP association for the given HIT pair, the outgoing datagram is passed to 3206 transport handling. The possible transport formats are defined 3207 in separate documents, of which the ESP transport format for HIP 3208 is mandatory for all HIP implementations. 3210 5. Before sending the packet, the HITs in the datagram are replaced 3211 with suitable IP addresses. For IPv6, the rules defined in 3212 [RFC3484] SHOULD be followed. Note that this HIT-to-IP-address 3213 conversion step MAY also be performed at some other point in the 3214 stack, e.g., before wrapping the packet into the output format. 3216 6.2. Processing Incoming Application Data 3218 The following conceptual algorithm describes the incoming datagram 3219 handling when HITs are used at the receiving host as application- 3220 level identifiers. More detailed steps for processing packets are 3221 defined in corresponding transport format documents. 3223 1. The incoming datagram is mapped to an existing HIP association, 3224 typically using some information from the packet. For example, 3225 such mapping may be based on the ESP Security Parameter Index 3226 (SPI). 3228 2. The specific transport format is unwrapped, in a way depending on 3229 the transport format, yielding a packet that looks like a 3230 standard (unencrypted) IP packet. If possible, this step SHOULD 3231 also verify that the packet was indeed (once) sent by the remote 3232 HIP host, as identified by the HIP association. 3234 Depending on the used transport mode, the verification method can 3235 vary. While the HI (as well as HIT) is used as the higher-layer 3236 identifier, the verification method has to verify that the data 3237 packet was sent by a node identity and that the actual identity 3238 maps to this particular HIT. When using ESP transport format 3239 [RFC5202], the verification is done using the SPI value in the 3240 data packet to find the corresponding SA with associated HIT and 3241 key, and decrypting the packet with that associated key. 3243 3. The IP addresses in the datagram are replaced with the HITs 3244 associated with the HIP association. Note that this IP-address- 3245 to-HIT conversion step MAY also be performed at some other point 3246 in the stack. 3248 4. The datagram is delivered to the upper layer. When 3249 demultiplexing the datagram, the right upper-layer socket is 3250 based on the HITs. 3252 6.3. Solving the Puzzle 3254 This subsection describes the puzzle-solving details. 3256 In R1, the values I and K are sent in network byte order. Similarly, 3257 in I2, the values I and J are sent in network byte order. The hash 3258 is created by concatenating, in network byte order, the following 3259 data, in the following order and using the RHASH algorithm: 3261 n-bit random value I (where n is RHASH_len), in network byte 3262 order, as appearing in R1 and I2. 3264 128-bit Initiator's HIT, in network byte order, as appearing in 3265 the HIP Payload in R1 and I2. 3267 128-bit Responder's HIT, in network byte order, as appearing in 3268 the HIP Payload in R1 and I2. 3270 n-bit random value J (where n is RHASH_len), in network byte 3271 order, as appearing in I2. 3273 In order to be a valid response puzzle, the K low-order bits of the 3274 resulting RHASH digest must be zero. 3276 Notes: 3278 i) The length of the data to be hashed is variable depending on 3279 the output length of the Responder's hash function RHASH. 3281 ii) All the data in the hash input MUST be in network byte order. 3283 iii) The order of the Initiator's and Responder's HITs are 3284 different in the R1 and I2 packets; see Section 5.1. Care must be 3285 taken to copy the values in the right order to the hash input. 3287 The following procedure describes the processing steps involved, 3288 assuming that the Responder chooses to precompute the R1 packets: 3290 Precomputation by the Responder: 3291 Sets up the puzzle difficulty K. 3292 Creates a signed R1 and caches it. 3294 Responder: 3295 Selects a suitable cached R1. 3296 Generates a random number I. 3297 Sends I and K in an R1. 3298 Saves I and K for a Delta time. 3300 Initiator: 3301 Generates repeated attempts to solve the puzzle until a matching J 3302 is found: 3303 Ltrunc( RHASH( I | HIT-I | HIT-R | J ), K ) == 0 3304 Sends I and J in an I2. 3306 Responder: 3307 Verifies that the received I is a saved one. 3308 Finds the right K based on I. 3309 Computes V := Ltrunc( RHASH( I | HIT-I | HIT-R | J ), K ) 3310 Rejects if V != 0 3311 Accept if V == 0 3313 6.4. HIP_MAC and SIGNATURE Calculation and Verification 3315 The following subsections define the actions for processing HIP_MAC, 3316 HIP_MAC_2, HIP_SIGNATURE and HIP_SIGNATURE_2 parameters. 3318 6.4.1. HMAC Calculation 3320 The following process applies both to the HIP_MAC and HIP_MAC_2 3321 parameters. When processing HIP_MAC_2, the difference is that the 3322 HIP_MAC calculation includes a pseudo HOST_ID field containing the 3323 Responder's information as sent in the R1 packet earlier. 3325 Both the Initiator and the Responder should take some care when 3326 verifying or calculating the HIP_MAC_2. Specifically, the Responder 3327 should preserve other parameters than the HOST_ID when sending the 3328 R2. Also, the Initiator has to preserve the HOST_ID exactly as it 3329 was received in the R1 packet. 3331 The scope of the calculation for HIP_MAC and HIP_MAC_2 is: 3333 HMAC: { HIP header | [ Parameters ] } 3335 where Parameters include all HIP parameters of the packet that is 3336 being calculated with Type values from 1 to (HIP_MAC's Type value - 3337 1) and exclude parameters with Type values greater or equal to 3338 HIP_MAC's Type value. 3340 During HIP_MAC calculation, the following applies: 3342 o In the HIP header, the Checksum field is set to zero. 3344 o In the HIP header, the Header Length field value is calculated to 3345 the beginning of the HIP_MAC parameter. 3347 Parameter order is described in Section 5.2.1. 3349 HIP_MAC_2: { HIP header | [ Parameters ] | HOST_ID } 3351 where Parameters include all HIP parameters for the packet that is 3352 being calculated with Type values from 1 to (HIP_MAC_2's Type value - 3353 1) and exclude parameters with Type values greater or equal to 3354 HIP_MAC_2's Type value. 3356 During HIP_MAC_2 calculation, the following applies: 3358 o In the HIP header, the Checksum field is set to zero. 3360 o In the HIP header, the Header Length field value is calculated to 3361 the beginning of the HIP_MAC_2 parameter and added to the length 3362 of the concatenated HOST_ID parameter length. 3364 o HOST_ID parameter is exactly in the form it was received in the R1 3365 packet from the Responder. 3367 Parameter order is described in Section 5.2.1, except that the 3368 HOST_ID parameter in this calculation is added to the end. 3370 The HIP_MAC parameter is defined in Section 5.2.11 and the HIP_MAC_2 3371 parameter in Section 5.2.12. The HMAC calculation and verification 3372 process (the process applies both to HIP_MAC and HIP_MAC_2 except 3373 where HIP_MAC_2 is mentioned separately) is as follows: 3375 Packet sender: 3377 1. Create the HIP packet, without the HIP_MAC, HIP_SIGNATURE, 3378 HIP_SIGNATURE_2, or any other parameter with greater Type value 3379 than the HIP_MAC parameter has. 3381 2. In case of HIP_MAC_2 calculation, add a HOST_ID (Responder) 3382 parameter to the end of the packet. 3384 3. Calculate the Header Length field in the HIP header including the 3385 added HOST_ID parameter in case of HIP_MAC_2. 3387 4. Compute the HMAC using either HIP-gl or HIP-lg integrity key 3388 retrieved from KEYMAT as defined in Section 6.5. 3390 5. In case of HIP_MAC_2, remove the HOST_ID parameter from the 3391 packet. 3393 6. Add the HIP_MAC parameter to the packet and any parameter with 3394 greater Type value than the HIP_MAC's (HIP_MAC_2's) that may 3395 follow, including possible HIP_SIGNATURE or HIP_SIGNATURE_2 3396 parameters 3398 7. Recalculate the Length field in the HIP header. 3400 Packet receiver: 3402 1. Verify the HIP header Length field. 3404 2. Remove the HIP_MAC or HIP_MAC_2 parameter, as well as all other 3405 parameters that follow it with greater Type value including 3406 possible HIP_SIGNATURE or HIP_SIGNATURE_2 fields, saving the 3407 contents if they will be needed later. 3409 3. In case of HIP_MAC_2, build and add a HOST_ID parameter (with 3410 Responder information) to the packet. The HOST_ID parameter 3411 should be identical to the one previously received from the 3412 Responder. 3414 4. Recalculate the HIP packet length in the HIP header and clear the 3415 Checksum field (set it to all zeros). In case of HIP_MAC_2, the 3416 length is calculated with the added HOST_ID parameter. 3418 5. Compute the HMAC using either HIP-gl or HIP-lg integrity key as 3419 defined in Section 6.5 and verify it against the received HMAC. 3421 6. Set Checksum and Header Length field in the HIP header to 3422 original values. 3424 7. In case of HIP_MAC_2, remove the HOST_ID parameter from the 3425 packet before further processing. 3427 6.4.2. Signature Calculation 3429 The following process applies both to the HIP_SIGNATURE and 3430 HIP_SIGNATURE_2 parameters. When processing HIP_SIGNATURE_2, the 3431 only difference is that instead of HIP_SIGNATURE parameter, the 3432 HIP_SIGNATURE_2 parameter is used, and the Initiator's HIT and PUZZLE 3433 Opaque and Random #I fields are cleared (set to all zeros) before 3434 computing the signature. The HIP_SIGNATURE parameter is defined in 3435 Section 5.2.13 and the HIP_SIGNATURE_2 parameter in Section 5.2.14. 3437 The scope of the calculation for HIP_SIGNATURE and HIP_SIGNATURE_2 3438 is: 3440 HIP_SIGNATURE: { HIP header | [ Parameters ] } 3442 where Parameters include all HIP parameters for the packet that is 3443 being calculated with Type values from 1 to (HIP_SIGNATURE's Type 3444 value - 1). 3446 During signature calculation, the following apply: 3448 o In the HIP header, the Checksum field is set to zero. 3450 o In the HIP header, the Header Length field value is calculated to 3451 the beginning of the HIP_SIGNATURE parameter. 3453 Parameter order is described in Section 5.2.1. 3455 HIP_SIGNATURE_2: { HIP header | [ Parameters ] } 3456 where Parameters include all HIP parameters for the packet that is 3457 being calculated with Type values from 1 to (HIP_SIGNATURE_2's Type 3458 value - 1). 3460 During signature calculation, the following apply: 3462 o In the HIP header, the Initiator's HIT field and Checksum fields 3463 are set to zero. 3465 o In the HIP header, the Header Length field value is calculated to 3466 the beginning of the HIP_SIGNATURE_2 parameter. 3468 o PUZZLE parameter's Opaque and Random #I fields are set to zero. 3470 Parameter order is described in Section 5.2.1. 3472 Signature calculation and verification process (the process applies 3473 both to HIP_SIGNATURE and HIP_SIGNATURE_2 except in the case where 3474 HIP_SIGNATURE_2 is separately mentioned): 3476 Packet sender: 3478 1. Create the HIP packet without the HIP_SIGNATURE parameter or any 3479 parameters that follow the HIP_SIGNATURE parameter. 3481 2. Calculate the Length field and zero the Checksum field in the HIP 3482 header. In case of HIP_SIGNATURE_2, set Initiator's HIT field in 3483 the HIP header as well as PUZZLE parameter's Opaque and Random #I 3484 fields to zero. 3486 3. Compute the signature using the private key corresponding to the 3487 Host Identifier (public key). 3489 4. Add the HIP_SIGNATURE parameter to the packet. 3491 5. Add any parameters that follow the HIP_SIGNATURE parameter. 3493 6. Recalculate the Length field in the HIP header, and calculate the 3494 Checksum field. 3496 Packet receiver: 3498 1. Verify the HIP header Length field. 3500 2. Save the contents of the HIP_SIGNATURE parameter and any 3501 parameters following the HIP_SIGNATURE parameter and remove them 3502 from the packet. 3504 3. Recalculate the HIP packet Length in the HIP header and clear the 3505 Checksum field (set it to all zeros). In case of 3506 HIP_SIGNATURE_2, set Initiator's HIT field in HIP header as well 3507 as PUZZLE parameter's Opaque and Random #I fields to zero. 3509 4. Compute the signature and verify it against the received 3510 signature using the packet sender's Host Identifier (public key). 3512 5. Restore the original packet by adding removed parameters (in step 3513 2) and resetting the values that were set to zero (in step 3). 3515 The verification can use either the HI received from a HIP packet, 3516 the HI from a DNS query, if the FQDN has been received in the HOST_ID 3517 packet, or one received by some other means. 3519 6.5. HIP KEYMAT Generation 3521 HIP keying material is derived from the Diffie-Hellman session key, 3522 Kij, produced during the HIP base exchange (Section 4.1.3). The 3523 Initiator has Kij during the creation of the I2 packet, and the 3524 Responder has Kij once it receives the I2 packet. This is why I2 can 3525 already contain encrypted information. 3527 The KEYMAT is derived by feeding Kij into HKDF [RFC5869] using the 3528 RHASH hash function. 3530 where 3532 info = sort(HIT-I | HIT-R) 3533 salt = I | J 3535 Sort(HIT-I | HIT-R) is defined as the network byte order 3536 concatenation of the two HITs, with the smaller HIT preceding the 3537 larger HIT, resulting from the numeric comparison of the two HITs 3538 interpreted as positive (unsigned) 128-bit integers in network byte 3539 order. 3541 I and J values are from the puzzle and its solution that were 3542 exchanged in R1 and I2 messages when this HIP association was set up. 3543 Both hosts have to store I and J values for the HIP association for 3544 future use. 3546 The initial keys are drawn sequentially in the order that is 3547 determined by the numeric comparison of the two HITs, with comparison 3548 method described in the previous paragraph. HOST_g denotes the host 3549 with the greater HIT value, and HOST_l the host with the lower HIT 3550 value. 3552 The drawing order for initial keys: 3554 HIP-gl encryption key for HOST_g's outgoing HIP packets 3556 HIP-gl integrity (HMAC) key for HOST_g's outgoing HIP packets 3558 HIP-lg encryption key (currently unused) for HOST_l's outgoing HIP 3559 packets 3561 HIP-lg integrity (HMAC) key for HOST_l's outgoing HIP packets 3563 The number of bits drawn for a given algorithm is the "natural" size 3564 of the keys. For the mandatory algorithms, the following sizes 3565 apply: 3567 AES 128 or 256 bits 3569 SHA-1 160 bits 3571 SHA-256 256 bits 3573 SHA-384 384 bits 3575 NULL 0 bits 3577 If other key sizes are used, they must be treated as different 3578 encryption algorithms and defined separately. 3580 6.6. Initiation of a HIP Exchange 3582 An implementation may originate a HIP exchange to another host based 3583 on a local policy decision, usually triggered by an application 3584 datagram, in much the same way that an IPsec IKE key exchange can 3585 dynamically create a Security Association. Alternatively, a system 3586 may initiate a HIP exchange if it has rebooted or timed out, or 3587 otherwise lost its HIP state, as described in Section 4.5.4. 3589 The implementation prepares an I1 packet and sends it to the IP 3590 address that corresponds to the peer host. The IP address of the 3591 peer host may be obtained via conventional mechanisms, such as DNS 3592 lookup. The I1 contents are specified in Section 5.3.1. The 3593 selection of which Host Identity to use, if a host has more than one 3594 to choose from, is typically a policy decision. 3596 The following steps define the conceptual processing rules for 3597 initiating a HIP exchange: 3599 1. The Initiator gets one or more of the Responder's HITs and one or 3600 more addresses either from a DNS lookup of the Responder's FQDN, 3601 from some other repository, or from a local table. If the 3602 Initiator does not know the Responder's HIT, it may attempt 3603 opportunistic mode by using NULL (all zeros) as the Responder's 3604 HIT. See also "HIP Opportunistic Mode" (Section 4.1.8). If the 3605 Initiator can choose from multiple Responder HITs, it selects a 3606 HIT for which the Initiator supports the HIT Suite. 3608 2. The Initiator sends an I1 to one of the Responder's addresses. 3609 The selection of which address to use is a local policy decision. 3611 3. The Initiator includes the DH_GROUP_LIST in the I1 packet. The 3612 selection and order of DH Group IDs in the DH_GROUP_LIST MUST be 3613 stored by the Initiator because this list is needed for later R1 3614 processing. In most cases, the preferences regarding the DH 3615 Groups will be static, so no per-association storage is 3616 necessary. 3618 4. Upon sending an I1, the sender transitions to state I1-SENT, 3619 starts a timer whose timeout value SHOULD be larger than the 3620 worst-case anticipated RTT, and SHOULD increment a timeout 3621 counter associated with the I1. 3623 5. Upon timeout, the sender SHOULD retransmit the I1 and restart the 3624 timer, up to a maximum of I1_RETRIES_MAX tries. 3626 6.6.1. Sending Multiple I1s in Parallel 3628 For the sake of minimizing the session establishment latency, an 3629 implementation MAY send the same I1 to more than one of the 3630 Responder's addresses. However, it MUST NOT send to more than three 3631 (3) addresses in parallel. Furthermore, upon timeout, the 3632 implementation MUST refrain from sending the same I1 packet to 3633 multiple addresses. That is, if it retries to initialize the 3634 connection after timeout, it MUST NOT send the I1 packet to more than 3635 one destination address. These limitations are placed in order to 3636 avoid congestion of the network, and potential DoS attacks that might 3637 happen, e.g., because someone's claim to have hundreds or thousands 3638 of addresses could generate a huge number of I1 messages from the 3639 Initiator. 3641 As the Responder is not guaranteed to distinguish the duplicate I1s 3642 it receives at several of its addresses (because it avoids storing 3643 states when it answers back an R1), the Initiator may receive several 3644 duplicate R1s. 3646 The Initiator SHOULD then select the initial preferred destination 3647 address using the source address of the selected received R1, and use 3648 the preferred address as a source address for the I2. Processing 3649 rules for received R1s are discussed in Section 6.8. 3651 6.6.2. Processing Incoming ICMP Protocol Unreachable Messages 3653 A host may receive an ICMP 'Destination Protocol Unreachable' message 3654 as a response to sending a HIP I1 packet. Such a packet may be an 3655 indication that the peer does not support HIP, or it may be an 3656 attempt to launch an attack by making the Initiator believe that the 3657 Responder does not support HIP. 3659 When a system receives an ICMP 'Destination Protocol Unreachable' 3660 message while it is waiting for an R1, it MUST NOT terminate the 3661 wait. It MAY continue as if it had not received the ICMP message, 3662 and send a few more I1s. Alternatively, it MAY take the ICMP message 3663 as a hint that the peer most probably does not support HIP, and 3664 return to state UNASSOCIATED earlier than otherwise. However, at 3665 minimum, it MUST continue waiting for an R1 for a reasonable time 3666 before returning to UNASSOCIATED. 3668 6.7. Processing Incoming I1 Packets 3670 An implementation SHOULD reply to an I1 with an R1 packet, unless the 3671 implementation is unable or unwilling to set up a HIP association. 3672 If the implementation is unable to set up a HIP association, the host 3673 SHOULD send an ICMP Destination Protocol Unreachable, 3674 Administratively Prohibited, message to the I1 source address. If 3675 the implementation is unwilling to set up a HIP association, the host 3676 MAY ignore the I1. This latter case may occur during a DoS attack 3677 such as an I1 flood. 3679 The implementation MUST be able to handle a storm of received I1 3680 packets, discarding those with common content that arrive within a 3681 small time delta. 3683 A spoofed I1 can result in an R1 attack on a system. An R1 sender 3684 MUST have a mechanism to rate-limit R1s to an address. 3686 It is RECOMMENDED that the HIP state machine does not transition upon 3687 sending an R1. 3689 The following steps define the conceptual processing rules for 3690 responding to an I1 packet: 3692 1. The Responder MUST check that the Responder's HIT in the received 3693 I1 is either one of its own HITs or NULL. 3695 2. If the Responder is in ESTABLISHED state, the Responder MAY 3696 respond to this with an R1 packet, prepare to drop existing SAs, 3697 and stay at ESTABLISHED state. 3699 3. If the Responder is in I1-SENT state, it must make a comparison 3700 between the sender's HIT and its own (i.e., the receiver's) HIT. 3701 If the sender's HIT is greater than its own HIT, it should drop 3702 the I1 and stay at I1-SENT. If the sender's HIT is smaller than 3703 its own HIT, it should send R1 and stay at I1-SENT. The HIT 3704 comparison goes similarly as in Section 6.5. 3706 4. If the implementation chooses to respond to the I1 with an R1 3707 packet, it creates a new R1 or selects a precomputed R1 according 3708 to the format described in Section 5.3.2. It creates or chooses 3709 an R1 that contains its most preferred DH public value that is 3710 also contained in the DH_GROUP_LIST in the I1 packet. If no 3711 suitable DH Group ID was contained in the DH_GROUP_LIST in the I1 3712 packet, it sends an R1 with an arbitrary DH public key. 3714 5. The R1 MUST contain the received Responder's HIT, unless the 3715 received HIT is NULL, in which case the Responder SHOULD select a 3716 HIT that is constructed with the MUST algorithm in Section 3, 3717 which is currently RSA. Other than that, selecting the HIT is a 3718 local policy matter. 3720 6. The Responder sends the R1 to the source IP address of the I1 3721 packet. 3723 6.7.1. R1 Management 3725 All compliant implementations MUST produce R1 packets. An R1 packet 3726 MAY be precomputed. An R1 packet MAY be reused for time Delta T, 3727 which is implementation dependent, and SHOULD be deprecated and not 3728 used once a valid response I2 packet has been received from an 3729 Initiator. During an I1 message storm, an R1 packet may be re-used 3730 beyond this limit. R1 information MUST NOT be discarded until Delta 3731 S after T. Time S is the delay needed for the last I2 to arrive back 3732 to the Responder. 3734 Implementations that support multiple DH groups MAY pre-compute R1 3735 packets for each supported group so that incoming I1 packets with 3736 different DH Group IDs in the DH_GROUP_LIST can be served quickly. 3738 An implementation MAY keep state about received I1s and match the 3739 received I2s against the state, as discussed in Section 4.1.1. 3741 6.7.2. Handling Malformed Messages 3743 If an implementation receives a malformed I1 message, it SHOULD NOT 3744 respond with a NOTIFY message, as such practice could open up a 3745 potential denial-of-service danger. Instead, it MAY respond with an 3746 ICMP packet, as defined in Section 5.4. 3748 6.8. Processing Incoming R1 Packets 3750 A system receiving an R1 MUST first check to see if it has sent an I1 3751 to the originator of the R1 (i.e., it is in state I1-SENT). If so, 3752 it SHOULD process the R1 as described below, send an I2, and go to 3753 state I2-SENT, setting a timer to protect the I2. If the system is 3754 in state I2-SENT, it MAY respond to an R1 if the R1 has a larger R1 3755 generation counter; if so, it should drop its state due to processing 3756 the previous R1 and start over from state I1-SENT. If the system is 3757 in any other state with respect to that host, it SHOULD silently drop 3758 the R1. 3760 When sending multiple I1s, an Initiator SHOULD wait for a small 3761 amount of time after the first R1 reception to allow possibly 3762 multiple R1s to arrive, and it SHOULD respond to an R1 among the set 3763 with the largest R1 generation counter. 3765 The following steps define the conceptual processing rules for 3766 responding to an R1 packet: 3768 1. A system receiving an R1 MUST first check to see if it has sent 3769 an I1 to the originator of the R1 (i.e., it has a HIP 3770 association that is in state I1-SENT and that is associated with 3771 the HITs in the R1). Unless the I1 was sent in opportunistic 3772 mode (see Section 4.1.8), the IP addresses in the received R1 3773 packet SHOULD be ignored and, when looking up the right HIP 3774 association, the received R1 SHOULD be matched against the 3775 associations using only the HITs. If a match exists, the system 3776 should process the R1 as described below. 3778 2. Otherwise, if the system is in any other state than I1-SENT or 3779 I2-SENT with respect to the HITs included in the R1, it SHOULD 3780 silently drop the R1 and remain in the current state. 3782 3. If the HIP association state is I1-SENT or I2-SENT, the received 3783 Initiator's HIT MUST correspond to the HIT used in the original, 3784 and the I1 and the Responder's HIT MUST correspond to the one 3785 used, unless the I1 contained a NULL HIT. 3787 4. The system SHOULD validate the R1 signature before applying 3788 further packet processing, according to Section 5.2.14. 3790 5. If the HIP association state is I1-SENT, and multiple valid R1s 3791 are present, the system MUST select from among the R1s with the 3792 largest R1 generation counter. 3794 6. The system MUST check that the Initiator HIT Suite is contained 3795 in the HIT_SUITE_LIST parameter in the R1 packet (i.e., the 3796 Initiator's HIT Suite is supported by the Responder). If the 3797 HIT Suite is supported by the Responder, the system proceeds 3798 normally. Otherwise, the system MAY stay in state I1-sent and 3799 restart the BEX by sending a new I1 packet with a Initiator HIT 3800 that is supported by the Responder and hence is contained in the 3801 HIT_SUITE_LIST in the R1 packet. The system MAY abort the BEX 3802 if no suitable source HIT is available. The system SHOULD wait 3803 for acceptable time span to allow further R1 packets with higher 3804 R1 generation counters to arrive before restarting or aborting 3805 the BEX. 3807 7. The system MUST check that the DH Group ID in the DH parameter 3808 in the R1 matches the first DH Suite ID in the Responder's 3809 DH_GROUP_LIST in the R1 that was also contained in the 3810 Initiator's DH_GROUP_LIST in the I1. If the two DH Group ID of 3811 the DH parameter does not express the Responder's best choice, 3812 the Initiator can conclude that the DH_GROUP_LIST in the I1 was 3813 adversely modified. In such case, the Initiator MAY send a new 3814 I1 packet, however, it SHOULD not change its preference in the 3815 DH_GROUP_LIST in the new I1. Alternatively, the Initiator MAY 3816 abort the HIP exchange. 3818 8. If the HIP association state is I2-SENT, the system MAY reenter 3819 state I1-SENT and process the received R1 if it has a larger R1 3820 generation counter than the R1 responded to previously. 3822 9. The R1 packet may have the A bit set -- in this case, the system 3823 MAY choose to refuse it by dropping the R1 and returning to 3824 state UNASSOCIATED. The system SHOULD consider dropping the R1 3825 only if it used a NULL HIT in I1. If the A bit is set, the 3826 Responder's HIT is anonymous and should not be stored. 3828 10. The system SHOULD attempt to validate the HIT against the 3829 received Host Identity by using the received Host Identity to 3830 construct a HIT and verify that it matches the Sender's HIT. 3832 11. The system MUST store the received R1 generation counter for 3833 future reference. 3835 12. The system attempts to solve the puzzle in R1. The system MUST 3836 terminate the search after exceeding the remaining lifetime of 3837 the puzzle. If the puzzle is not successfully solved, the 3838 implementation may either resend I1 within the retry bounds or 3839 abandon the HIP exchange. 3841 13. The system computes standard Diffie-Hellman keying material 3842 according to the public value and Group ID provided in the 3843 DIFFIE_HELLMAN parameter. The Diffie-Hellman keying material 3844 Kij is used for key extraction as specified in Section 6.5. If 3845 the received Diffie-Hellman Group ID is not supported, the 3846 implementation may either resend I1 within the retry bounds or 3847 abandon the HIP exchange. 3849 14. The system selects the HIP_CIPHER ID from the choices presented 3850 in the R1 packet and uses the selected values subsequently when 3851 generating and using encryption keys, and when sending the I2. 3852 If the proposed alternatives are not acceptable to the system, 3853 it may either resend I1 within the retry bounds or abandon the 3854 HIP exchange. 3856 15. The system initializes the remaining variables in the associated 3857 state, including Update ID counters. 3859 16. The system prepares and sends an I2, as described in 3860 Section 5.3.3. 3862 17. The system SHOULD start a timer whose timeout value should be 3863 larger than the worst-case anticipated RTT, and MUST increment a 3864 timeout counter associated with the I2. The sender SHOULD 3865 retransmit the I2 upon a timeout and restart the timer, up to a 3866 maximum of I2_RETRIES_MAX tries. 3868 18. If the system is in state I1-SENT, it shall transition to state 3869 I2-SENT. If the system is in any other state, it remains in the 3870 current state. 3872 6.8.1. Handling Malformed Messages 3874 If an implementation receives a malformed R1 message, it MUST 3875 silently drop the packet. Sending a NOTIFY or ICMP would not help, 3876 as the sender of the R1 typically doesn't have any state. An 3877 implementation SHOULD wait for some more time for a possibly good R1, 3878 after which it MAY try again by sending a new I1 packet. 3880 6.9. Processing Incoming I2 Packets 3882 Upon receipt of an I2, the system MAY perform initial checks to 3883 determine whether the I2 corresponds to a recent R1 that has been 3884 sent out, if the Responder keeps such state. For example, the sender 3885 could check whether the I2 is from an address or HIT that has 3886 recently received an R1 from it. The R1 may have had Opaque data 3887 included that was echoed back in the I2. If the I2 is considered to 3888 be suspect, it MAY be silently discarded by the system. 3890 Otherwise, the HIP implementation SHOULD process the I2. This 3891 includes validation of the puzzle solution, generating the Diffie- 3892 Hellman key, decrypting the Initiator's Host Identity, verifying the 3893 signature, creating state, and finally sending an R2. 3895 The following steps define the conceptual processing rules for 3896 responding to an I2 packet: 3898 1. The system MAY perform checks to verify that the I2 corresponds 3899 to a recently sent R1. Such checks are implementation 3900 dependent. See Appendix A for a description of an example 3901 implementation. 3903 2. The system MUST check that the Responder's HIT corresponds to 3904 one of its own HITs. 3906 3. The system MUST further check that the Initiator's HIT Suite is 3907 supported. The Responder SHOULD drop I2 packets with 3908 unsupported Initiator HITs silently. 3910 4. If the system's state machine is in the R2-SENT state, the 3911 system MAY check if the newly received I2 is similar to the one 3912 that triggered moving to R2-SENT. If so, it MAY retransmit a 3913 previously sent R2, reset the R2-SENT timer, and the state 3914 machine stays in R2-SENT. 3916 5. If the system's state machine is in the I2-SENT state, the 3917 system makes a comparison between its local and sender's HITs 3918 (similarly as in Section 6.5). If the local HIT is smaller than 3919 the sender's HIT, it should drop the I2 packet, use the peer 3920 Diffie-Hellman key and nonce I from the R1 packet received 3921 earlier, and get the local Diffie-Hellman key and nonce J from 3922 the I2 packet sent to the peer earlier. Otherwise, the system 3923 should process the received I2 packet and drop any previously 3924 derived Diffie-Hellman keying material Kij it might have formed 3925 upon sending the I2 previously. The peer Diffie-Hellman key and 3926 the nonce J are taken from the just arrived I2 packet. The 3927 local Diffie-Hellman key and the nonce I are the ones that were 3928 earlier sent in the R1 packet. 3930 6. If the system's state machine is in the I1-SENT state, and the 3931 HITs in the I2 match those used in the previously sent I1, the 3932 system uses this received I2 as the basis for the HIP 3933 association it was trying to form, and stops retransmitting I1 3934 (provided that the I2 passes the below additional checks). 3936 7. If the system's state machine is in any other state than R2- 3937 SENT, the system SHOULD check that the echoed R1 generation 3938 counter in I2 is within the acceptable range. Implementations 3939 MUST accept puzzles from the current generation and MAY accept 3940 puzzles from earlier generations. If the newly received I2 is 3941 outside the accepted range, the I2 is stale (perhaps replayed) 3942 and SHOULD be dropped. 3944 8. The system MUST validate the solution to the puzzle by computing 3945 the hash described in Section 5.3.3 using the same RHASH 3946 algorithm. 3948 9. The I2 MUST have a single value in the HIP_CIPHER parameter, 3949 which MUST match one of the values offered to the Initiator in 3950 the R1 packet. 3952 10. The system must derive Diffie-Hellman keying material Kij based 3953 on the public value and Group ID in the DIFFIE_HELLMAN 3954 parameter. This key is used to derive the HIP association keys, 3955 as described in Section 6.5. If the Diffie-Hellman Group ID is 3956 unsupported, the I2 packet is silently dropped. 3958 11. The encrypted HOST_ID is decrypted by the Initiator encryption 3959 key defined in Section 6.5. If the decrypted data is not a 3960 HOST_ID parameter, the I2 packet is silently dropped. 3962 12. The implementation SHOULD also verify that the Initiator's HIT 3963 in the I2 corresponds to the Host Identity sent in the I2. 3964 (Note: some middleboxes may not able to make this verification.) 3966 13. The system MUST verify the HMAC according to the procedures in 3967 Section 5.2.11. 3969 14. The system MUST verify the HIP_SIGNATURE according to 3970 Section 5.2.13 and Section 5.3.3. 3972 15. If the checks above are valid, then the system proceeds with 3973 further I2 processing; otherwise, it discards the I2 and its 3974 state machine remains in the same state. 3976 16. The I2 packet may have the A bit set -- in this case, the system 3977 MAY choose to refuse it by dropping the I2 and the state machine 3978 returns to state UNASSOCIATED. If the A bit is set, the 3979 Initiator's HIT is anonymous and should not be stored. 3981 17. The system initializes the remaining variables in the associated 3982 state, including Update ID counters. 3984 18. Upon successful processing of an I2 when the system's state 3985 machine is in state UNASSOCIATED, I1-SENT, I2-SENT, or R2-SENT, 3986 an R2 is sent and the system's state machine transitions to 3987 state R2-SENT. 3989 19. Upon successful processing of an I2 when the system's state 3990 machine is in state ESTABLISHED, the old HIP association is 3991 dropped and a new one is installed, an R2 is sent, and the 3992 system's state machine transitions to R2-SENT. 3994 20. Upon the system's state machine transitioning to R2-SENT, the 3995 system starts a timer. The state machine transitions to 3996 ESTABLISHED if some data has been received on the incoming HIP 3997 association, or an UPDATE packet has been received (or some 3998 other packet that indicates that the peer system's state machine 3999 has moved to ESTABLISHED). If the timer expires (allowing for 4000 maximal retransmissions of I2s), the state machine transitions 4001 to ESTABLISHED. 4003 6.9.1. Handling Malformed Messages 4005 If an implementation receives a malformed I2 message, the behavior 4006 SHOULD depend on how many checks the message has already passed. If 4007 the puzzle solution in the message has already been checked, the 4008 implementation SHOULD report the error by responding with a NOTIFY 4009 packet. Otherwise, the implementation MAY respond with an ICMP 4010 message as defined in Section 5.4. 4012 6.10. Processing Incoming R2 Packets 4014 An R2 received in states UNASSOCIATED, I1-SENT, or ESTABLISHED 4015 results in the R2 being dropped and the state machine staying in the 4016 same state. If an R2 is received in state I2-SENT, it SHOULD be 4017 processed. 4019 The following steps define the conceptual processing rules for an 4020 incoming R2 packet: 4022 1. The system MUST verify that the HITs in use correspond to the 4023 HITs that were received in the R1. 4025 2. The system MUST verify the HIP_MAC_2 according to the procedures 4026 in Section 5.2.12. 4028 3. The system MUST verify the HIP signature according to the 4029 procedures in Section 5.2.13. 4031 4. If any of the checks above fail, there is a high probability of 4032 an ongoing man-in-the-middle or other security attack. The 4033 system SHOULD act accordingly, based on its local policy. 4035 5. If the system is in any other state than I2-SENT, the R2 is 4036 silently dropped. 4038 6. Upon successful processing of the R2, the state machine moves to 4039 state ESTABLISHED. 4041 6.11. Sending UPDATE Packets 4043 A host sends an UPDATE packet when it wants to update some 4044 information related to a HIP association. There are a number of 4045 likely situations, e.g., mobility management and rekeying of an 4046 existing ESP Security Association. The following paragraphs define 4047 the conceptual rules for sending an UPDATE packet to the peer. 4048 Additional steps can be defined in other documents where the UPDATE 4049 packet is used. 4051 The system first determines whether there are any outstanding UPDATE 4052 messages that may conflict with the new UPDATE message under 4053 consideration. When multiple UPDATEs are outstanding (not yet 4054 acknowledged), the sender must assume that such UPDATEs may be 4055 processed in an arbitrary order. Therefore, any new UPDATEs that 4056 depend on a previous outstanding UPDATE being successfully received 4057 and acknowledged MUST be postponed until reception of the necessary 4058 ACK(s) occurs. One way to prevent any conflicts is to only allow one 4059 outstanding UPDATE at a time. However, allowing multiple UPDATEs may 4060 improve the performance of mobility and multihoming protocols. 4062 The following steps define the conceptual processing rules for 4063 sending UPDATE packets. 4065 1. The first UPDATE packet is sent with Update ID of zero. 4066 Otherwise, the system increments its own Update ID value by one 4067 before continuing the below steps. 4069 2. The system creates an UPDATE packet that contains a SEQ parameter 4070 with the current value of Update ID. The UPDATE packet may also 4071 include an ACK of the peer's Update ID found in a received UPDATE 4072 SEQ parameter, if any. 4074 3. The system sends the created UPDATE packet and starts an UPDATE 4075 timer. The default value for the timer is 2 * RTT estimate. If 4076 multiple UPDATEs are outstanding, multiple timers are in effect. 4078 4. If the UPDATE timer expires, the UPDATE is resent. The UPDATE 4079 can be resent UPDATE_RETRY_MAX times. The UPDATE timer SHOULD be 4080 exponentially backed off for subsequent retransmissions. If no 4081 acknowledgment is received from the peer after UPDATE_RETRY_MAX 4082 times, the HIP association is considered to be broken and the 4083 state machine should move from state ESTABLISHED to state CLOSING 4084 as depicted in Section 4.4.4. The UPDATE timer is cancelled upon 4085 receiving an ACK from the peer that acknowledges receipt of the 4086 UPDATE. 4088 6.12. Receiving UPDATE Packets 4090 When a system receives an UPDATE packet, its processing depends on 4091 the state of the HIP association and the presence and values of the 4092 SEQ and ACK parameters. Typically, an UPDATE message also carries 4093 optional parameters whose handling is defined in separate documents. 4095 For each association, the peer's next expected in-sequence Update ID 4096 ("peer Update ID") is stored. Initially, this value is zero. Update 4097 ID comparisons of "less than" and "greater than" are performed with 4098 respect to a circular sequence number space. 4100 The sender may send multiple outstanding UPDATE messages. These 4101 messages are processed in the order in which they are received at the 4102 receiver (i.e., no resequencing is performed). When processing 4103 UPDATEs out-of-order, the receiver MUST keep track of which UPDATEs 4104 were previously processed, so that duplicates or retransmissions are 4105 ACKed and not reprocessed. A receiver MAY choose to define a receive 4106 window of Update IDs that it is willing to process at any given time, 4107 and discard received UPDATEs falling outside of that window. 4109 The following steps define the conceptual processing rules for 4110 receiving UPDATE packets. 4112 1. If there is no corresponding HIP association, the implementation 4113 MAY reply with an ICMP Parameter Problem, as specified in 4114 Section 5.4.4. 4116 2. If the association is in the ESTABLISHED state and the SEQ (but 4117 not ACK) parameter is present, the UPDATE is processed and 4118 replied to as described in Section 6.12.1. 4120 3. If the association is in the ESTABLISHED state and the ACK (but 4121 not SEQ) parameter is present, the UPDATE is processed as 4122 described in Section 6.12.2. 4124 4. If the association is in the ESTABLISHED state and there is both 4125 an ACK and SEQ in the UPDATE, the ACK is first processed as 4126 described in Section 6.12.2, and then the rest of the UPDATE is 4127 processed as described in Section 6.12.1. 4129 6.12.1. Handling a SEQ Parameter in a Received UPDATE Message 4131 The following steps define the conceptual processing rules for 4132 handling a SEQ parameter in a received UPDATE packet. 4134 1. If the Update ID in the received SEQ is not the next in the 4135 sequence of Update IDs and is greater than the receiver's window 4136 for new UPDATEs, the packet MUST be dropped. 4138 2. If the Update ID in the received SEQ corresponds to an UPDATE 4139 that has recently been processed, the packet is treated as a 4140 retransmission. The HIP_MAC verification (next step) MUST NOT be 4141 skipped. (A byte-by-byte comparison of the received and a stored 4142 packet would be OK, though.) It is recommended that a host cache 4143 UPDATE packets sent with ACKs to avoid the cost of generating a 4144 new ACK packet to respond to a replayed UPDATE. The system MUST 4145 acknowledge, again, such (apparent) UPDATE message 4146 retransmissions but SHOULD also consider rate-limiting such 4147 retransmission responses to guard against replay attacks. 4149 3. The system MUST verify the HIP_MAC in the UPDATE packet. If the 4150 verification fails, the packet MUST be dropped. 4152 4. The system MAY verify the SIGNATURE in the UPDATE packet. If the 4153 verification fails, the packet SHOULD be dropped and an error 4154 message logged. 4156 5. If a new SEQ parameter is being processed, the parameters in the 4157 UPDATE are then processed. The system MUST record the Update ID 4158 in the received SEQ parameter, for replay protection. 4160 6. An UPDATE acknowledgment packet with ACK parameter is prepared 4161 and sent to the peer. This ACK parameter may be included in a 4162 separate UPDATE or piggybacked in an UPDATE with SEQ parameter, 4163 as described in Section 5.3.5. The ACK parameter MAY acknowledge 4164 more than one of the peer's Update IDs. 4166 6.12.2. Handling an ACK Parameter in a Received UPDATE Packet 4168 The following steps define the conceptual processing rules for 4169 handling an ACK parameter in a received UPDATE packet. 4171 1. The sequence number reported in the ACK must match with an 4172 earlier sent UPDATE packet that has not already been 4173 acknowledged. If no match is found or if the ACK does not 4174 acknowledge a new UPDATE, the packet MUST either be dropped if no 4175 SEQ parameter is present, or the processing steps in 4176 Section 6.12.1 are followed. 4178 2. The system MUST verify the HIP_MAC in the UPDATE packet. If the 4179 verification fails, the packet MUST be dropped. 4181 3. The system MAY verify the SIGNATURE in the UPDATE packet. If the 4182 verification fails, the packet SHOULD be dropped and an error 4183 message logged. 4185 4. The corresponding UPDATE timer is stopped (see Section 6.11) so 4186 that the now acknowledged UPDATE is no longer retransmitted. If 4187 multiple UPDATEs are newly acknowledged, multiple timers are 4188 stopped. 4190 6.13. Processing NOTIFY Packets 4192 Processing NOTIFY packets is OPTIONAL. If processed, any errors in a 4193 received NOTIFICATION parameter SHOULD be logged. Received errors 4194 MUST be considered only as informational, and the receiver SHOULD NOT 4195 change its HIP state (Section 4.4.2) purely based on the received 4196 NOTIFY message. 4198 6.14. Processing CLOSE Packets 4200 When the host receives a CLOSE message, it responds with a CLOSE_ACK 4201 message and moves to CLOSED state. (The authenticity of the CLOSE 4202 message is verified using both HIP_MAC and SIGNATURE). This 4203 processing applies whether or not the HIP association state is 4204 CLOSING in order to handle CLOSE messages from both ends that cross 4205 in flight. 4207 The HIP association is not discarded before the host moves from the 4208 UNASSOCIATED state. 4210 Once the closing process has started, any need to send data packets 4211 will trigger creating and establishing of a new HIP association, 4212 starting with sending an I1. 4214 If there is no corresponding HIP association, the CLOSE packet is 4215 dropped. 4217 6.15. Processing CLOSE_ACK Packets 4219 When a host receives a CLOSE_ACK message, it verifies that it is in 4220 CLOSING or CLOSED state and that the CLOSE_ACK was in response to the 4221 CLOSE (using the included ECHO_RESPONSE_SIGNED in response to the 4222 sent ECHO_REQUEST_SIGNED). 4224 The CLOSE_ACK uses HIP_MAC and SIGNATURE for verification. The state 4225 is discarded when the state changes to UNASSOCIATED and, after that, 4226 the host MAY respond with an ICMP Parameter Problem to an incoming 4227 CLOSE message (see Section 5.4.4). 4229 6.16. Handling State Loss 4231 In the case of system crash and unanticipated state loss, the system 4232 SHOULD delete the corresponding HIP state, including the keying 4233 material. That is, the state SHOULD NOT be stored on stable storage. 4234 If the implementation does drop the state (as RECOMMENDED), it MUST 4235 also drop the peer's R1 generation counter value, unless a local 4236 policy explicitly defines that the value of that particular host is 4237 stored. An implementation MUST NOT store R1 generation counters by 4238 default, but storing R1 generation counter values, if done, MUST be 4239 configured by explicit HITs. 4241 7. HIP Policies 4243 There are a number of variables that will influence the HIP exchanges 4244 that each host must support. All HIP implementations MUST support 4245 more than one simultaneous HI, at least one of which SHOULD be 4246 reserved for anonymous usage. Although anonymous HIs will be rarely 4247 used as Responders' HIs, they will be common for Initiators. Support 4248 for more than two HIs is RECOMMENDED. 4250 Many Initiators would want to use a different HI for different 4251 Responders. The implementations SHOULD provide for an ACL of 4252 Initiator's HIT to Responder's HIT. This ACL SHOULD also include 4253 preferred transform and local lifetimes. 4255 The value of K used in the HIP R1 packet can also vary by policy. K 4256 should never be greater than 20, but for trusted partners it could be 4257 as low as 0. 4259 Responders would need a similar ACL, representing which hosts they 4260 accept HIP exchanges, and the preferred transform and local 4261 lifetimes. Wildcarding SHOULD be supported for this ACL also. 4263 8. Changes from RFC 5201 4265 This section summarizes the changes made from [RFC5201]. 4267 8.1. Changes from draft-ietf-hip-rfc5201-bis-01 4269 o Changed RHASH-len to RHASH_len to avoid confusion in calculations 4270 (- could be minus) 4272 o Added RHASH_len to list of abbreviations 4274 o Fixed length of puzzle I and J to be 1*RHASH_len 4276 o Changed RHASH-len to RHASH_len to avoid confusion in calculations 4277 (- could be minus) 4279 o Added RHASH_len to list of abbreviations 4281 o Fixed length of puzzle I and J to be 1*RHASH_len 4283 o Included HIT_SUITEs. 4285 o Added DH negotiation to I1 and R1. 4287 o Added DH_LIST parameter. 4289 o Added text for DH Group negotiation. 4291 o Removed second DH public value from DH parameter. 4293 o Added ECC to HI generation. 4295 o Added Responder HIT selection to opportunistic mode. 4297 o Added ECDSA HI text and references (not complete yet). 4299 o Added separate section on aborting BEX. 4301 o Added separate section on downgrade attack prevention. 4303 o Added text about DH Group selection for use cases without I1. 4305 o Removed type range allocation for parameters related to HIP 4306 transform types. 4308 o New type range allocation for parameters that are only covered by 4309 a signature if a signature is present (Applies to DH_GROUP_LIST). 4311 o Renamed HIP_TRANSFORM to HIP_CIPHER and removed hashes from it - 4312 hashes are determined by RHASH. 4314 o The length of I and J for the puzzle now depends on RHASH. 4316 o New keymat generation. 4318 o Puzzle seed and solution now use RHASH and have variable length. 4320 o Moved timing definitions closer to state machine. 4322 o Simplified text regarding puzzle lifetime. 4324 o Clarified the description of the use of I in the puzzle 4326 o Removed "Opportunistic mode" description from general definitions. 4328 o More consistency across the old RFC5201 text. Aligned 4329 capitalization and abbreviations. 4331 o Extended protocol overview to include restart option. 4333 o Extended state machine to include restart option because of 4334 unsupported Algorithms. 4336 o Replaced SHA-1 with SHA-256 for required implementation. 4338 o Added OGA list parameter (715) for detecting the Responder's set 4339 of OGAs. 4341 o Added Appendix on ORCHID use in HITs. 4343 o Added truncated SHA-256 option for HITs. 4345 o Added truncated SHA-1 option for HITs. 4347 o Added text about new ORCHID structure to HIT overview. 4349 o Moved Editor role to Robert Moskowitz. 4351 o Added SHA-256 to puzzle parameter. 4353 o Generalized LTRUNC to be hash-function agnostic. 4355 o Added text about RHASH depending on OGA. 4357 8.2. Changes from draft-ietf-hip-rfc5201-bis-00 4359 o Added reasoning why BIS document is needed. 4361 8.3. Contents of draft-ietf-hip-rfc5201-bis-00 4363 o RFC5201 was submitted as draft-RFC. 4365 9. Security Considerations 4367 HIP is designed to provide secure authentication of hosts. HIP also 4368 attempts to limit the exposure of the host to various denial-of- 4369 service and man-in-the-middle (MitM) attacks. In so doing, HIP 4370 itself is subject to its own DoS and MitM attacks that potentially 4371 could be more damaging to a host's ability to conduct business as 4372 usual. 4374 Denial-of-service attacks often take advantage of the cost of start 4375 of state for a protocol on the Responder compared to the 'cheapness' 4376 on the Initiator. HIP makes no attempt to increase the cost of the 4377 start of state on the Initiator, but makes an effort to reduce the 4378 cost to the Responder. This is done by having the Responder start 4379 the 3-way exchange instead of the Initiator, making the HIP protocol 4380 4 packets long. In doing this, packet 2 becomes a 'stock' packet 4381 that the Responder MAY use many times, until some Initiator has 4382 provided a valid response to such an R1 packet. During an I1 storm, 4383 the host may reuse the same DH value also even if some Initiator has 4384 provided a valid response using that particular DH value. However, 4385 such behavior is discouraged and should be avoided. Using the same 4386 Diffie-Hellman values and random puzzle #I value has some risks. 4387 This risk needs to be balanced against a potential storm of HIP I1 4388 packets. 4390 This shifting of the start of state cost to the Initiator in creating 4391 the I2 HIP packet, presents another DoS attack. The attacker spoofs 4392 the I1 HIP packet and the Responder sends out the R1 HIP packet. 4393 This could conceivably tie up the 'Initiator' with evaluating the R1 4394 HIP packet, and creating the I2 HIP packet. The defense against this 4395 attack is to simply ignore any R1 packet where a corresponding I1 was 4396 not sent. 4398 A second form of DoS attack arrives in the I2 HIP packet. Once the 4399 attacking Initiator has solved the puzzle, it can send packets with 4400 spoofed IP source addresses with either an invalid encrypted HIP 4401 payload component or a bad HIP signature. This would take resources 4402 in the Responder's part to reach the point to discover that the I2 4403 packet cannot be completely processed. The defense against this 4404 attack is after N bad I2 packets, the Responder would discard any I2s 4405 that contain the given Initiator HIT. This will shut down the 4406 attack. The attacker would have to request another R1 and use that 4407 to launch a new attack. The Responder could up the value of K while 4408 under attack. On the downside, valid I2s might get dropped too. 4410 A third form of DoS attack is emulating the restart of state after a 4411 reboot of one of the partners. A restarting host would send an I1 to 4412 a peer, which would respond with an R1 even if it were in the 4413 ESTABLISHED state. If the I1 were spoofed, the resulting R1 would be 4414 received unexpectedly by the spoofed host and would be dropped, as in 4415 the first case above. 4417 A fourth form of DoS attack is emulating the end of state. HIP 4418 relies on timers plus a CLOSE/CLOSE_ACK handshake to explicitly 4419 signal the end of a HIP association. Because both CLOSE and 4420 CLOSE_ACK messages contain an HIP_MAC, an outsider cannot close a 4421 connection. The presence of an additional SIGNATURE allows 4422 middleboxes to inspect these messages and discard the associated 4423 state (for e.g., firewalling, SPI-based NATing, etc.). However, the 4424 optional behavior of replying to CLOSE with an ICMP Parameter Problem 4425 packet (as described in Section 5.4.4) might allow an IP spoofer 4426 sending CLOSE messages to launch reflection attacks. 4428 A fifth form of DoS attack is replaying R1s to cause the Initiator to 4429 solve stale puzzles and become out of synchronization with the 4430 Responder. The R1 generation counter is a monotonically increasing 4431 counter designed to protect against this attack, as described in 4432 Section 4.1.4. 4434 Man-in-the-middle attacks are difficult to defend against, without 4435 third-party authentication. A skillful MitM could easily handle all 4436 parts of HIP, but HIP indirectly provides the following protection 4437 from a MitM attack. If the Responder's HI is retrieved from a signed 4438 DNS zone, a certificate, or through some other secure means, the 4439 Initiator can use this to validate the R1 HIP packet. 4441 Likewise, if the Initiator's HI is in a secure DNS zone, a trusted 4442 certificate, or otherwise securely available, the Responder can 4443 retrieve the HI (after having got the I2 HIP packet) and verify that 4444 the HI indeed can be trusted. However, since an Initiator may choose 4445 to use an anonymous HI, it knowingly risks a MitM attack. The 4446 Responder may choose not to accept a HIP exchange with an anonymous 4447 Initiator. 4449 The HIP Opportunistic Mode concept has been introduced in this 4450 document, but this document does not specify what the semantics of 4451 such a connection setup are for applications. There are certain 4452 concerns with opportunistic mode, as discussed in Section 4.1.8. 4454 NOTIFY messages are used only for informational purposes and they are 4455 unacknowledged. A HIP implementation cannot rely solely on the 4456 information received in a NOTIFY message because the packet may have 4457 been replayed. It SHOULD NOT change any state information based 4458 purely on a received NOTIFY message. 4460 Since not all hosts will ever support HIP, ICMP 'Destination Protocol 4461 Unreachable' messages are to be expected and present a DoS attack. 4462 Against an Initiator, the attack would look like the Responder does 4463 not support HIP, but shortly after receiving the ICMP message, the 4464 Initiator would receive a valid R1 HIP packet. Thus, to protect from 4465 this attack, an Initiator should not react to an ICMP message until a 4466 reasonable delta time to get the real Responder's R1 HIP packet. A 4467 similar attack against the Responder is more involved. Normally, if 4468 an I1 message received by a Responder was a bogus one sent by an 4469 attacker, the Responder may receive an ICMP message from the IP 4470 address the R1 message was sent to. However, a sophisticated 4471 attacker can try to take advantage of such a behavior and try to 4472 break up the HIP exchange by sending such an ICMP message to the 4473 Responder before the Initiator has a chance to send a valid I2 4474 message. Hence, the Responder SHOULD NOT act on such an ICMP 4475 message. Especially, it SHOULD NOT remove any minimal state created 4476 when it sent the R1 HIP packet (if it did create one), but wait for 4477 either a valid I2 HIP packet or the natural timeout (that is, if R1 4478 packets are tracked at all). Likewise, the Initiator should ignore 4479 any ICMP message while waiting for an R2 HIP packet, and should 4480 delete any pending state only after a natural timeout. 4482 10. IANA Considerations 4484 IANA has reserved protocol number 139 for the Host Identity Protocol. 4486 This document defines a new 128-bit value under the CGA Message Type 4487 namespace [RFC3972], 0xF0EF F02F BFF4 3D0F E793 0C3C 6E61 74EA, to be 4488 used for HIT generation as specified in ORCHID [RFC4843-bis]. 4490 This document also creates a set of new namespaces. These are 4491 described below. 4493 Packet Type 4495 The 7-bit Packet Type field in a HIP protocol packet describes the 4496 type of a HIP protocol message. It is defined in Section 5.1. 4497 The current values are defined in Sections 5.3.1 through 5.3.8. 4499 New values are assigned through IETF Consensus [RFC2434]. 4501 HIP Version 4503 The four-bit Version field in a HIP protocol packet describes the 4504 version of the HIP protocol. It is defined in Section 5.1. The 4505 currently defined values are 1 and 2. The version of this 4506 document is 2. New values are assigned through IETF Consensus. 4508 HIT Suite 4510 The four-bit HIT Suite ID uses the OGA field in the ORCHID to 4511 express the type of the HIT. This document defines two HIT 4512 Suites. 4514 The HIT Suite ID is also carried in the four higher-order bits of 4515 the ID field in the HIT_SUITE_LIST parameter. The four lower- 4516 order bits are reserved for future extensions of the HIT Suite ID 4517 space beyond 16 values. 4519 At the time being, the HIT Suite uses only four bits because these 4520 bits have to be carried in the HIT. Using more bits for the HIT 4521 Suite ID reduces the cryptographic strength of the HIT. HIT Suite 4522 IDs must be allocated carefully to avoid namespace exhaustion. 4523 Moreover, deprecated IDs should be reused after an appropriate 4524 time span. If 16 Suite IDs prove insufficient and more HIT Suite 4525 IDs are needed concurrently, more bits can be used for the HIT 4526 Suite ID by using one HIT Suite ID (0) to indicate that more bits 4527 should be used. The HIT_SUITE_LIST parameter already supports 4528 8-bit HIT Suite IDs, should longer IDs be needed. Possible 4529 extensions of the HIT Suite ID space to eight-bit and new HIT 4530 Suite IDs are defined through IETF Consensus. 4532 Parameter Type 4534 The 16-bit Type field in a HIP parameter describes the type of the 4535 parameter. It is defined in Section 5.2.1. The current values 4536 are defined in Sections 5.2.3 through 5.2.22. 4538 With the exception of the assigned Type codes, the Type codes 0 4539 through 1023 and 61440 through 65535 are reserved for future base 4540 protocol extensions, and are assigned through IETF Consensus. 4542 The Type codes 32768 through 49141 are reserved for 4543 experimentation. Types SHOULD be selected in a random fashion 4544 from this range, thereby reducing the probability of collisions. 4545 A method employing genuine randomness (such as flipping a coin) 4546 SHOULD be used. 4548 All other Type codes are assigned through First Come First Served, 4549 with Specification Required [RFC2434]. 4551 Group ID 4553 The eight-bit Group ID values appear in the DIFFIE_HELLMAN 4554 parameter and the DH_GROUP_LIST parameter and are defined in 4555 Section 5.2.6. New values either from the reserved or unassigned 4556 space are assigned through IETF Consensus. 4558 HIP Cipher ID 4560 The 16-bit Cipher ID values in a HIP_CIPHER parameter are defined 4561 in Section 5.2.7. New values either from the reserved or 4562 unassigned space are assigned through IETF Consensus. 4564 DI-Type 4566 The four-bit DI-Type values in a HOST_ID parameter are defined in 4567 Section 5.2.8. New values are assigned through IETF Consensus. 4569 Notify Message Type 4571 The 16-bit Notify Message Type values in a NOTIFICATION parameter 4572 are defined in Section 5.2.18. 4574 Notify Message Type values 1-10 are used for informing about 4575 errors in packet structures, values 11-20 for informing about 4576 problems in parameters containing cryptographic related material, 4577 values 21-30 for informing about problems in authentication or 4578 packet integrity verification. Parameter numbers above 30 can be 4579 used for informing about other types of errors or events. Values 4580 51-8191 are error types reserved to be allocated by IANA. Values 4581 8192-16383 are error types for experimentation. Values 16385- 4582 40959 are status types to be allocated by IANA, and values 40960- 4583 65535 are status types for experimentation. New values in ranges 4584 51-8191 and 16385-40959 are assigned through First Come First 4585 Served, with Specification Required. 4587 11. Acknowledgments 4589 The drive to create HIP came to being after attending the MALLOC 4590 meeting at the 43rd IETF meeting. Baiju Patel and Hilarie Orman 4591 really gave the original author, Bob Moskowitz, the assist to get HIP 4592 beyond 5 paragraphs of ideas. It has matured considerably since the 4593 early versions thanks to extensive input from IETFers. Most 4594 importantly, its design goals are articulated and are different from 4595 other efforts in this direction. Particular mention goes to the 4596 members of the NameSpace Research Group of the IRTF. Noel Chiappa 4597 provided valuable input at early stages of discussions about 4598 identifier handling and Keith Moore the impetus to provide 4599 resolvability. Steve Deering provided encouragement to keep working, 4600 as a solid proposal can act as a proof of ideas for a research group. 4602 Many others contributed; extensive security tips were provided by 4603 Steve Bellovin. Rob Austein kept the DNS parts on track. Paul 4604 Kocher taught Bob Moskowitz how to make the puzzle exchange expensive 4605 for the Initiator to respond, but easy for the Responder to validate. 4606 Bill Sommerfeld supplied the Birthday concept, which later evolved 4607 into the R1 generation counter, to simplify reboot management. Erik 4608 Nordmark supplied the CLOSE-mechanism for closing connections. 4609 Rodney Thayer and Hugh Daniels provided extensive feedback. In the 4610 early times of this document, John Gilmore kept Bob Moskowitz 4611 challenged to provide something of value. 4613 During the later stages of this document, when the editing baton was 4614 transferred to Pekka Nikander, the input from the early implementors 4615 was invaluable. Without having actual implementations, this document 4616 would not be on the level it is now. 4618 In the usual IETF fashion, a large number of people have contributed 4619 to the actual text or ideas. The list of these people include Jeff 4620 Ahrenholz, Francis Dupont, Derek Fawcus, George Gross, Andrew 4621 McGregor, Julien Laganier, Miika Komu, Mika Kousa, Jan Melen, Henrik 4622 Petander, Michael Richardson, Rene Hummen, Tim Shepard, Jorma Wall, 4623 and Jukka Ylitalo. Our apologies to anyone whose name is missing. 4625 Once the HIP Working Group was founded in early 2004, a number of 4626 changes were introduced through the working group process. Most 4627 notably, the original document was split in two, one containing the 4628 base exchange and the other one defining how to use ESP. Some 4629 modifications to the protocol proposed by Aura, et al., [AUR03] were 4630 added at a later stage. 4632 12. References 4634 12.1. Normative References 4636 [FIPS.180-2.2002] National Institute of Standards and Technology, 4637 "Secure Hash Standard", FIPS PUB 180-2, 4638 August 2002, . 4641 [FIPS.95-1.1993] National Institute of Standards and Technology, 4642 "Codes for the Identification of Federal and 4643 Federally Assisted Organizations", FIPS PUB 95-1, 4644 January 1993. 4646 [RFC0768] Postel, J., "User Datagram Protocol", STD 6, 4647 RFC 768, August 1980. 4649 [RFC1035] Mockapetris, P., "Domain names - implementation 4650 and specification", STD 13, RFC 1035, 4651 November 1987. 4653 [RFC2119] Bradner, S., "Key words for use in RFCs to 4654 Indicate Requirement Levels", BCP 14, RFC 2119, 4655 March 1997. 4657 [RFC2404] Madson, C. and R. Glenn, "The Use of HMAC-SHA-1-96 4658 within ESP and AH", RFC 2404, November 1998. 4660 [RFC2451] Pereira, R. and R. Adams, "The ESP CBC-Mode Cipher 4661 Algorithms", RFC 2451, November 1998. 4663 [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, 4664 Version 6 (IPv6) Specification", RFC 2460, 4665 December 1998. 4667 [RFC2463] Conta, A. and S. Deering, "Internet Control 4668 Message Protocol (ICMPv6) for the Internet 4669 Protocol Version 6 (IPv6) Specification", 4670 RFC 2463, December 1998. 4672 [RFC2536] Eastlake, D., "DSA KEYs and SIGs in the Domain 4673 Name System (DNS)", RFC 2536, March 1999. 4675 [RFC2898] Kaliski, B., "PKCS #5: Password-Based Cryptography 4676 Specification Version 2.0", RFC 2898, 4677 September 2000. 4679 [RFC3110] Eastlake, D., "RSA/SHA-1 SIGs and RSA KEYs in the 4680 Domain Name System (DNS)", RFC 3110, May 2001. 4682 [RFC3484] Draves, R., "Default Address Selection for 4683 Internet Protocol version 6 (IPv6)", RFC 3484, 4684 February 2003. 4686 [RFC3526] Kivinen, T. and M. Kojo, "More Modular Exponential 4687 (MODP) Diffie-Hellman groups for Internet Key 4688 Exchange (IKE)", RFC 3526, May 2003. 4690 [RFC3602] Frankel, S., Glenn, R., and S. Kelly, "The AES-CBC 4691 Cipher Algorithm and Its Use with IPsec", 4692 RFC 3602, September 2003. 4694 [RFC3972] Aura, T., "Cryptographically Generated Addresses 4695 (CGA)", RFC 3972, March 2005. 4697 [RFC4034] Arends, R., Austein, R., Larson, M., Massey, D., 4698 and S. Rose, "Resource Records for the DNS 4699 Security Extensions", RFC 4034, March 2005. 4701 [RFC4282] Aboba, B., Beadles, M., Arkko, J., and P. Eronen, 4702 "The Network Access Identifier", RFC 4282, 4703 December 2005. 4705 [RFC4307] Schiller, J., "Cryptographic Algorithms for Use in 4706 the Internet Key Exchange Version 2 (IKEv2)", 4707 RFC 4307, December 2005. 4709 [RFC4753] Fu, D. and J. Solinas, "ECP Groups For IKE and 4710 IKEv2", RFC 4753, January 2007. 4712 [RFC4843-bis] Nikander, P., Laganier, J., and F. Dupont, "STUB: 4713 An IPv6 Prefix for Overlay Routable Cryptographic 4714 Hash Identifiers (ORCHID)", 4715 draft-laganier-rfc4843-bis-00 (work in progress), 4716 February 2010. 4718 [RFC4868] Kelly, S. and S. Frankel, "Using HMAC-SHA-256, 4719 HMAC-SHA-384, and HMAC-SHA-512 with IPsec", 4720 RFC 4868, May 2007. 4722 [RFC5201] Moskowitz, R., Nikander, P., Jokela, P., and T. 4723 Henderson, "Host Identity Protocol", RFC 5201, 4724 April 2008. 4726 [RFC5202] Jokela, P., Moskowitz, R., and P. Nikander, "Using 4727 the Encapsulating Security Payload (ESP) Transport 4728 Format with the Host Identity Protocol (HIP)", 4729 RFC 5202, April 2008. 4731 [RFC5702] Jansen, J., "Use of SHA-2 Algorithms with RSA in 4732 DNSKEY and RRSIG Resource Records for DNSSEC", 4733 RFC 5702, October 2009. 4735 [RFC5869] Krawczyk, H. and P. Eronen, "HMAC-based Extract- 4736 and-Expand Key Derivation Function (HKDF)", 4737 RFC 5869, May 2010. 4739 [fundamental-ecc] McGrew, D. and K. Igoe, "Fundamental Elliptic 4740 Curve Cryptography Algorithms", 4741 draft-mcgrew-fundamental-ecc-03 (work in 4742 progress), May 2010. 4744 12.2. Informative References 4746 [AUR03] Aura, T., Nagarajan, A., and A. Gurtov, "Analysis 4747 of the HIP Base Exchange Protocol", in Proceedings 4748 of 10th Australasian Conference on Information 4749 Security and Privacy, July 2003. 4751 [CRO03] Crosby, SA. and DS. Wallach, "Denial of Service 4752 via Algorithmic Complexity Attacks", in 4753 Proceedings of Usenix Security Symposium 2003, 4754 Washington, DC., August 2003. 4756 [DIF76] Diffie, W. and M. Hellman, "New Directions in 4757 Cryptography", IEEE Transactions on Information 4758 Theory vol. IT-22, number 6, pages 644-654, 4759 Nov 1976. 4761 [FIPS.197.2001] National Institute of Standards and Technology, 4762 "Advanced Encryption Standard (AES)", FIPS PUB 4763 197, November 2001, . 4766 [KAU03] Kaufman, C., Perlman, R., and B. Sommerfeld, "DoS 4767 protection for UDP-based protocols", ACM 4768 Conference on Computer and Communications 4769 Security , Oct 2003. 4771 [KRA03] Krawczyk, H., "SIGMA: The 'SIGn-and-MAc' Approach 4772 to Authenticated Diffie-Hellman and Its Use in the 4773 IKE-Protocols", in Proceedings of CRYPTO 2003, 4774 pages 400-425, August 2003. 4776 [RFC0792] Postel, J., "Internet Control Message Protocol", 4777 STD 5, RFC 792, September 1981. 4779 [RFC2434] Narten, T. and H. Alvestrand, "Guidelines for 4780 Writing an IANA Considerations Section in RFCs", 4781 BCP 26, RFC 2434, October 1998. 4783 [RFC4306] Kaufman, C., "Internet Key Exchange (IKEv2) 4784 Protocol", RFC 4306, December 2005. 4786 [RFC5204] Laganier, J. and L. Eggert, "Host Identity 4787 Protocol (HIP) Rendezvous Extension", RFC 5204, 4788 April 2008. 4790 [RFC5205] Nikander, P. and J. Laganier, "Host Identity 4791 Protocol (HIP) Domain Name System (DNS) 4792 Extensions", RFC 5205, April 2008. 4794 [RFC5206] Nikander, P., Henderson, T., Vogt, C., and J. 4795 Arkko, "End-Host Mobility and Multihoming with the 4796 Host Identity Protocol", RFC 5206, April 2008. 4798 [RFC5338] Henderson, T., Nikander, P., and M. Komu, "Using 4799 the Host Identity Protocol with Legacy 4800 Applications", RFC 5338, September 2008. 4802 [RFC5533] Nordmark, E. and M. Bagnulo, "Shim6: Level 3 4803 Multihoming Shim Protocol for IPv6", RFC 5533, 4804 June 2009. 4806 [btns-c-api] Richardson, M., Williams, N., Komu, M., and S. 4807 Tarkoma, "C-Bindings for IPsec Application 4808 Programming Interfaces", draft-ietf-btns-c-api-04 4809 (work in progress), March 2009. 4811 [rfc4423-bis] Moskowitz, R., "Host Identity Protocol 4812 Architecture", draft-moskowitz-hip-rfc4423-bis-01 4813 (work in progress), June 2010. 4815 Appendix A. Using Responder Puzzles 4817 As mentioned in Section 4.1.1, the Responder may delay state creation 4818 and still reject most spoofed I2s by using a number of pre-calculated 4819 R1s and a local selection function. This appendix defines one 4820 possible implementation in detail. The purpose of this appendix is 4821 to give the implementors an idea on how to implement the mechanism. 4822 If the implementation is based on this appendix, it MAY contain some 4823 local modification that makes an attacker's task harder. 4825 The Responder creates a secret value S, that it regenerates 4826 periodically. The Responder needs to remember the two latest values 4827 of S. Each time the S is regenerated, the R1 generation counter 4828 value is incremented by one. 4830 The Responder generates a pre-signed R1 packet. The signature for 4831 pre-generated R1s must be recalculated when the Diffie-Hellman key is 4832 recomputed or when the R1_COUNTER value changes due to S value 4833 regeneration. 4835 When the Initiator sends the I1 packet for initializing a connection, 4836 the Responder gets the HIT and IP address from the packet, and 4837 generates an I value for the puzzle. The I value is set to the pre- 4838 signed R1 packet. 4840 I value calculation: 4841 I = Ltrunc( RHASH ( S | HIT-I | HIT-R | IP-I | IP-R ), n) 4842 where n = RHASH_len 4844 The RHASH algorithm is the same that is used to generate the 4845 Responder's HIT value. 4847 From an incoming I2 packet, the Responder gets the required 4848 information to validate the puzzle: HITs, IP addresses, and the 4849 information of the used S value from the R1_COUNTER. Using these 4850 values, the Responder can regenerate the I, and verify it against the 4851 I received in the I2 packet. If the I values match, it can verify 4852 the solution using I, J, and difficulty K. If the I values do not 4853 match, the I2 is dropped. 4855 puzzle_check: 4856 V := Ltrunc( RHASH( I2.I | I2.hit_i | I2.hit_r | I2.J ), K ) 4857 if V != 0, drop the packet 4859 If the puzzle solution is correct, the I and J values are stored for 4860 later use. They are used as input material when keying material is 4861 generated. 4863 Keeping state about failed puzzle solutions depends on the 4864 implementation. Although it is possible for the Responder not to 4865 keep any state information, it still may do so to protect itself 4866 against certain attacks (see Section 4.1.1). 4868 Appendix B. Generating a Public Key Encoding from an HI 4870 The following pseudo-code illustrates the process to generate a 4871 public key encoding from an HI for both RSA and DSA. 4873 The symbol := denotes assignment; the symbol += denotes appending. 4874 The pseudo-function encode_in_network_byte_order takes two 4875 parameters, an integer (bignum) and a length in bytes, and returns 4876 the integer encoded into a byte string of the given length. 4878 switch ( HI.algorithm ) 4879 { 4881 case RSA: 4882 buffer := encode_in_network_byte_order ( HI.RSA.e_len, 4883 ( HI.RSA.e_len > 255 ) ? 3 : 1 ) 4884 buffer += encode_in_network_byte_order ( HI.RSA.e, HI.RSA.e_len ) 4885 buffer += encode_in_network_byte_order ( HI.RSA.n, HI.RSA.n_len ) 4886 break; 4888 case DSA: 4889 buffer := encode_in_network_byte_order ( HI.DSA.T , 1 ) 4890 buffer += encode_in_network_byte_order ( HI.DSA.Q , 20 ) 4891 buffer += encode_in_network_byte_order ( HI.DSA.P , 64 + 4892 8 * HI.DSA.T ) 4893 buffer += encode_in_network_byte_order ( HI.DSA.G , 64 + 4894 8 * HI.DSA.T ) 4895 buffer += encode_in_network_byte_order ( HI.DSA.Y , 64 + 4896 8 * HI.DSA.T ) 4897 break; 4899 } 4901 Appendix C. Example Checksums for HIP Packets 4903 The HIP checksum for HIP packets is specified in Section 5.1.1. 4904 Checksums for TCP and UDP packets running over HIP-enabled security 4905 associations are specified in Section 3.5. The examples below use IP 4906 addresses of 192.168.0.1 and 192.168.0.2 (and their respective IPv4- 4907 compatible IPv6 formats), and HITs with the prefix of 2001:10 4908 followed by zeros, followed by a decimal 1 or 2, respectively. 4910 The following example is defined only for testing a checksum 4911 calculation. The address format for the IPv4-compatible IPv6 address 4912 is not a valid one, but using these IPv6 addresses when testing an 4913 IPv6 implementation gives the same checksum output as an IPv4 4914 implementation with the corresponding IPv4 addresses. 4916 C.1. IPv6 HIP Example (I1) 4918 Source Address: ::192.168.0.1 4919 Destination Address: ::192.168.0.2 4920 Upper-Layer Packet Length: 40 0x28 4921 Next Header: 139 0x8b 4922 Payload Protocol: 59 0x3b 4923 Header Length: 4 0x4 4924 Packet Type: 1 0x1 4925 Version: 1 0x1 4926 Reserved: 1 0x1 4927 Control: 0 0x0 4928 Checksum: 446 0x1be 4929 Sender's HIT : 2001:10::1 4930 Receiver's HIT: 2001:10::2 4932 C.2. IPv4 HIP Packet (I1) 4934 The IPv4 checksum value for the same example I1 packet is the same as 4935 the IPv6 checksum (since the checksums due to the IPv4 and IPv6 4936 pseudo-header components are the same). 4938 C.3. TCP Segment 4940 Regardless of whether IPv6 or IPv4 is used, the TCP and UDP sockets 4941 use the IPv6 pseudo-header format [RFC2460], with the HITs used in 4942 place of the IPv6 addresses. 4944 Sender's HIT: 2001:10::1 4945 Receiver's HIT: 2001:10::2 4946 Upper-Layer Packet Length: 20 0x14 4947 Next Header: 6 0x06 4948 Source port: 65500 0xffdc 4949 Destination port: 22 0x0016 4950 Sequence number: 1 0x00000001 4951 Acknowledgment number: 0 0x00000000 4952 Header length: 20 0x14 4953 Flags: SYN 0x02 4954 Window size: 65535 0xffff 4955 Checksum: 28618 0x6fca 4956 Urgent pointer: 0 0x0000 4958 0x0000: 6000 0000 0014 0640 2001 0010 0000 0000 4959 0x0010: 0000 0000 0000 0001 2001 0010 0000 0000 4960 0x0020: 0000 0000 0000 0002 ffdc 0016 0000 0001 4961 0x0030: 0000 0000 5002 ffff 6fca 0000 4963 Appendix D. ECDH-160 Group 4965 The ECDH-160 group is rated at 80 bits strength. Once this was 4966 considered appropriate for one year of security. Today should be 4967 used only when the host is not powerful enough (e.g., some PDAs) and 4968 when security requirements are low (e.g., during normal web surfing). 4970 Appendix E. HIT Suites and HIT Generation 4972 The HIT as an ORCHID [RFC4843-bis] consists of three parts: A 28-bit 4973 prefix, a 4-bit encoding of the ORCHID generation algorithm (OGA) and 4974 the representation of the public key. The OGA is an index pointing 4975 to the specific algorithm by which the public key and the 96-bit 4976 hashed encoding is generated. The OGA is protocol specific and is to 4977 be interpreted as defined below for all protocols that use the same 4978 context ID as HIP. HIP groups sets of valid combinations of 4979 signature and hash algorithms into HIT Suites. These HIT suites are 4980 addressed by an index, which is transmitted in the OGA field of the 4981 ORCHID. 4983 The set of used HIT Suites will be extended to counter the progress 4984 in computation capabilities and vulnerabilities in the employed 4985 algorithms. The intended use of the HIT Suites is to introduce a new 4986 HIT Suite and phase out an old one before it becomes insecure. Since 4987 the 4-bit OGA field only permits 15 HIT Suites (the HIT Suite with ID 4988 0 is reserved) to be used in parallel, phased-out HIT Suites must be 4989 reused at some point. In such a case, there will be a rollover of 4990 the HIT Suite ID and the next newly introduced HIT Suite will start 4991 with a lower HIT Suite index than the previoulsy introduced one. The 4992 rollover effectively deprecates the reused HIT Suite. For a smooth 4993 transition, the HIT Suite should be deprecated a considerable time 4994 before the HIT Suite index is reused. 4996 Since the number of HIT Suites is tightly limited to 16, the HIT 4997 Suites must be assigned carefully. Hence, sets of suitable 4998 algorithms are grouped in a HIT Suite. 5000 The HIT Suite of the Responder's HIT determines the RHASH and the 5001 hash function to be used for the HMAC in HIP control packets as well 5002 as the signature algorithm family used for generating the HI. The 5003 list of HIT Suites is defined in Table 11. 5005 The following HIT Suites are defined for HIT generation. The input 5006 for each generation algorithm is the encoding of the HI as defined in 5007 Section 3.2. The output is 96 bits long and is directly used in the 5008 ORCHID. 5010 +-------+----------+-----------------+------------------------------+ 5011 | Index | Hash | Signature | Description | 5012 | | function | algorithm | | 5013 | | | family | | 5014 +-------+----------+-----------------+------------------------------+ 5015 | 0 | | | Reserved | 5016 | 1 | SHA-1 | RSA, DSA | RSA or DSA HI hashed with | 5017 | | | | SHA-1, truncated to 96 bits | 5018 | 2 | SHA-256 | ECDSA | ECDSA HI hashed with | 5019 | | | | SHA-256, truncated to 96 | 5020 | | | | bits | 5021 | 3 | SHA-384 | ECDSA | ECDSA HI hashed with | 5022 | | | | SHA-384, truncated to 96 | 5023 | | | | bits | 5024 +-------+----------+-----------------+------------------------------+ 5026 Table 11: HIT Suites 5028 Authors' Addresses 5030 Robert Moskowitz (editor) 5031 ICSA labs, An Independent Division of Verizon Business 5032 1000 Bent Creek Blvd, Suite 200 5033 Mechanicsburg, PA 5034 USA 5036 EMail: robert.moskowitz@icsalabs.com 5038 Petri Jokela 5039 Ericsson Research NomadicLab 5040 JORVAS FIN-02420 5041 FINLAND 5043 Phone: +358 9 299 1 5044 EMail: petri.jokela@nomadiclab.com 5046 Thomas R. Henderson 5047 The Boeing Company 5048 P.O. Box 3707 5049 Seattle, WA 5050 USA 5052 EMail: thomas.r.henderson@boeing.com 5053 Tobias Heer 5054 RWTH Aachen University, Distributed Systems Group 5055 Ahornstrasse 55 5056 Aachen 52062 5057 Germany 5059 EMail: heer@cs.rwth-aachen.de 5060 URI: http://ds.cs.rwth-aachen.de/members/heer