idnits 2.17.1 draft-moskowitz-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 1954 has weird spacing: '...c Value leng...' == Line 1956 has weird spacing: '...c Value the ...' == Line 2444 has weird spacing: '...ication info...' == Line 2570 has weird spacing: '...ue data opaqu...' == Line 2602 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 (July 1, 2010) is 5040 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 2009, but not defined == Missing Reference: 'RFC4754' is mentioned on line 2087, but not defined == Missing Reference: 'RFC5639' is mentioned on line 2088, but not defined == Unused Reference: 'RFC2404' is defined on line 4535, but no explicit reference was found in the text == Unused Reference: 'RFC4307' is defined on line 4583, but no explicit reference was found in the text == Unused Reference: 'RFC4868' is defined on line 4596, 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 ICSAlabs 4 Obsoletes: 5201 (if approved) P. Jokela 5 Intended status: Standards Track Ericsson Research NomadicLab 6 Expires: January 2, 2011 T. Henderson 7 The Boeing Company 8 T. Heer 9 RWTH Aachen University, 10 Distributed Systems Group 11 July 1, 2010 13 Host Identity Protocol 14 draft-moskowitz-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 January 2, 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 . . . . . . . . . . . . . 6 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 . . . . . . . . . . . . . . . . . . . . . . . 8 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 . . . . . . . . . . . . . . . 10 91 4. Protocol Overview . . . . . . . . . . . . . . . . . . . . . . 11 92 4.1. Creating a HIP Association . . . . . . . . . . . . . . . 12 93 4.1.1. HIP Puzzle Mechanism . . . . . . . . . . . . . . . . 13 94 4.1.2. Puzzle Exchange . . . . . . . . . . . . . . . . . . . 14 95 4.1.3. Authenticated Diffie-Hellman Protocol with DH 96 Group Negotiation . . . . . . . . . . . . . . . . . . 15 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 . . . . . . . . . . . . . . . 19 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 . . . . . . . . . . . . . . . . . 25 109 4.4.4. Simplified HIP State Diagram . . . . . . . . . . . . 32 110 4.5. User Data Considerations . . . . . . . . . . . . . . . . 34 111 4.5.1. TCP and UDP Pseudo-Header Computation for User Data . 34 112 4.5.2. Sending Data on HIP Packets . . . . . . . . . . . . . 34 113 4.5.3. Transport Formats . . . . . . . . . . . . . . . . . . 34 114 4.5.4. Reboot, Timeout, and Restart of HIP . . . . . . . . . 34 115 4.6. Certificate Distribution . . . . . . . . . . . . . . . . 35 116 5. Packet Formats . . . . . . . . . . . . . . . . . . . . . . . 35 117 5.1. Payload Format . . . . . . . . . . . . . . . . . . . . . 35 118 5.1.1. Checksum . . . . . . . . . . . . . . . . . . . . . . 36 119 5.1.2. HIP Controls . . . . . . . . . . . . . . . . . . . . 37 120 5.1.3. HIP Fragmentation Support . . . . . . . . . . . . . . 37 121 5.2. HIP Parameters . . . . . . . . . . . . . . . . . . . . . 38 122 5.2.1. TLV Format . . . . . . . . . . . . . . . . . . . . . 41 123 5.2.2. Defining New Parameters . . . . . . . . . . . . . . . 42 124 5.2.3. R1_COUNTER . . . . . . . . . . . . . . . . . . . . . 43 125 5.2.4. PUZZLE . . . . . . . . . . . . . . . . . . . . . . . 44 126 5.2.5. SOLUTION . . . . . . . . . . . . . . . . . . . . . . 45 127 5.2.6. DIFFIE_HELLMAN . . . . . . . . . . . . . . . . . . . 46 128 5.2.7. HIP_CIPHER . . . . . . . . . . . . . . . . . . . . . 47 129 5.2.8. HOST_ID . . . . . . . . . . . . . . . . . . . . . . . 48 130 5.2.9. HIT_SUITE_LIST . . . . . . . . . . . . . . . . . . . 50 131 5.2.10. DH_GROUP_LIST . . . . . . . . . . . . . . . . . . . . 51 132 5.2.11. HIP_MAC . . . . . . . . . . . . . . . . . . . . . . . 52 133 5.2.12. HIP_MAC_2 . . . . . . . . . . . . . . . . . . . . . . 52 134 5.2.13. HIP_SIGNATURE . . . . . . . . . . . . . . . . . . . . 53 135 5.2.14. HIP_SIGNATURE_2 . . . . . . . . . . . . . . . . . . . 54 136 5.2.15. SEQ . . . . . . . . . . . . . . . . . . . . . . . . . 54 137 5.2.16. ACK . . . . . . . . . . . . . . . . . . . . . . . . . 55 138 5.2.17. ENCRYPTED . . . . . . . . . . . . . . . . . . . . . . 56 139 5.2.18. NOTIFICATION . . . . . . . . . . . . . . . . . . . . 57 140 5.2.19. ECHO_REQUEST_SIGNED . . . . . . . . . . . . . . . . . 61 141 5.2.20. ECHO_REQUEST_UNSIGNED . . . . . . . . . . . . . . . . 61 142 5.2.21. ECHO_RESPONSE_SIGNED . . . . . . . . . . . . . . . . 62 143 5.2.22. ECHO_RESPONSE_UNSIGNED . . . . . . . . . . . . . . . 63 144 5.3. HIP Packets . . . . . . . . . . . . . . . . . . . . . . . 63 145 5.3.1. I1 - the HIP Initiator Packet . . . . . . . . . . . . 64 146 5.3.2. R1 - the HIP Responder Packet . . . . . . . . . . . . 65 147 5.3.3. I2 - the Second HIP Initiator Packet . . . . . . . . 68 148 5.3.4. R2 - the Second HIP Responder Packet . . . . . . . . 69 149 5.3.5. UPDATE - the HIP Update Packet . . . . . . . . . . . 69 150 5.3.6. NOTIFY - the HIP Notify Packet . . . . . . . . . . . 70 151 5.3.7. CLOSE - the HIP Association Closing Packet . . . . . 71 152 5.3.8. CLOSE_ACK - the HIP Closing Acknowledgment Packet . . 71 153 5.4. ICMP Messages . . . . . . . . . . . . . . . . . . . . . . 72 154 5.4.1. Invalid Version . . . . . . . . . . . . . . . . . . . 72 155 5.4.2. Other Problems with the HIP Header and Packet 156 Structure . . . . . . . . . . . . . . . . . . . . . . 72 157 5.4.3. Invalid Puzzle Solution . . . . . . . . . . . . . . . 72 158 5.4.4. Non-Existing HIP Association . . . . . . . . . . . . 73 159 6. Packet Processing . . . . . . . . . . . . . . . . . . . . . . 73 160 6.1. Processing Outgoing Application Data . . . . . . . . . . 73 161 6.2. Processing Incoming Application Data . . . . . . . . . . 74 162 6.3. Solving the Puzzle . . . . . . . . . . . . . . . . . . . 75 163 6.4. HIP_MAC and SIGNATURE Calculation and Verification . . . 77 164 6.4.1. HMAC Calculation . . . . . . . . . . . . . . . . . . 77 165 6.4.2. Signature Calculation . . . . . . . . . . . . . . . . 79 166 6.5. HIP KEYMAT Generation . . . . . . . . . . . . . . . . . . 81 167 6.6. Initiation of a HIP Exchange . . . . . . . . . . . . . . 82 168 6.6.1. Sending Multiple I1s in Parallel . . . . . . . . . . 83 169 6.6.2. Processing Incoming ICMP Protocol Unreachable 170 Messages . . . . . . . . . . . . . . . . . . . . . . 84 171 6.7. Processing Incoming I1 Packets . . . . . . . . . . . . . 84 172 6.7.1. R1 Management . . . . . . . . . . . . . . . . . . . . 85 173 6.7.2. Handling Malformed Messages . . . . . . . . . . . . . 86 174 6.8. Processing Incoming R1 Packets . . . . . . . . . . . . . 86 175 6.8.1. Handling Malformed Messages . . . . . . . . . . . . . 88 176 6.9. Processing Incoming I2 Packets . . . . . . . . . . . . . 88 177 6.9.1. Handling Malformed Messages . . . . . . . . . . . . . 91 178 6.10. Processing Incoming R2 Packets . . . . . . . . . . . . . 91 179 6.11. Sending UPDATE Packets . . . . . . . . . . . . . . . . . 92 180 6.12. Receiving UPDATE Packets . . . . . . . . . . . . . . . . 93 181 6.12.1. Handling a SEQ Parameter in a Received UPDATE 182 Message . . . . . . . . . . . . . . . . . . . . . . . 94 183 6.12.2. Handling an ACK Parameter in a Received UPDATE 184 Packet . . . . . . . . . . . . . . . . . . . . . . . 94 185 6.13. Processing NOTIFY Packets . . . . . . . . . . . . . . . . 95 186 6.14. Processing CLOSE Packets . . . . . . . . . . . . . . . . 95 187 6.15. Processing CLOSE_ACK Packets . . . . . . . . . . . . . . 96 188 6.16. Handling State Loss . . . . . . . . . . . . . . . . . . . 96 189 7. HIP Policies . . . . . . . . . . . . . . . . . . . . . . . . 96 190 8. Security Considerations . . . . . . . . . . . . . . . . . . . 97 191 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 99 192 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 101 193 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 102 194 11.1. Normative References . . . . . . . . . . . . . . . . . . 102 195 11.2. Informative References . . . . . . . . . . . . . . . . . 104 196 Appendix A. Using Responder Puzzles . . . . . . . . . . . . . . 106 197 Appendix B. Generating a Public Key Encoding from an HI . . . . 107 198 Appendix C. Example Checksums for HIP Packets . . . . . . . . . 108 199 C.1. IPv6 HIP Example (I1) . . . . . . . . . . . . . . . . . . 109 200 C.2. IPv4 HIP Packet (I1) . . . . . . . . . . . . . . . . . . 109 201 C.3. TCP Segment . . . . . . . . . . . . . . . . . . . . . . . 109 202 Appendix D. ECDH-160 Group . . . . . . . . . . . . . . . . . . . 110 203 Appendix E. HIT Suites and HIT Generation . . . . . . . . . . . 110 205 1. Introduction 207 This memo specifies the details of the Host Identity Protocol (HIP). 208 A high-level description of the protocol and the underlying 209 architectural thinking is available in the separate HIP architecture 210 description [rfc4423-bis]. Briefly, the HIP architecture proposes an 211 alternative to the dual use of IP addresses as "locators" (routing 212 labels) and "identifiers" (endpoint, or host, identifiers). In HIP, 213 public cryptographic keys, of a public/private key pair, are used as 214 Host Identifiers, to which higher layer protocols are bound instead 215 of an IP address. By using public keys (and their representations) 216 as host identifiers, dynamic changes to IP address sets can be 217 directly authenticated between hosts, and if desired, strong 218 authentication between hosts at the TCP/IP stack level can be 219 obtained. 221 This memo specifies the base HIP protocol ("base exchange") used 222 between hosts to establish an IP-layer communications context, called 223 HIP association, prior to communications. It also defines a packet 224 format and procedures for updating an active HIP association. Other 225 elements of the HIP architecture are specified in other documents, 226 such as. 228 o "Using the Encapsulating Security Payload (ESP) Transport Format 229 with the Host Identity Protocol (HIP)" [RFC5202]: how to use the 230 Encapsulating Security Payload (ESP) for integrity protection and 231 optional encryption 233 o "End-Host Mobility and Multihoming with the Host Identity 234 Protocol" [RFC5206]: how to support mobility and multihoming in 235 HIP 237 o "Host Identity Protocol (HIP) Domain Name System (DNS) Extensions" 238 [RFC5205]: how to extend DNS to contain Host Identity information 240 o "Host Identity Protocol (HIP) Rendezvous Extension" [RFC5204]: 241 using a rendezvous mechanism to contact mobile HIP hosts 243 1.1. A New Namespace and Identifiers 245 The Host Identity Protocol introduces a new namespace, the Host 246 Identity namespace. Some ramifications of this new namespace are 247 explained in the HIP architecture description [rfc4423-bis]. 249 There are two main representations of the Host Identity, the full 250 Host Identifier (HI) and the Host Identity Tag (HIT). The HI is a 251 public key and directly represents the Identity. Since there are 252 different public key algorithms that can be used with different key 253 lengths, the HI is not good for use as a packet identifier, or as an 254 index into the various operational tables needed to support HIP. 255 Consequently, a hash of the HI, the Host Identity Tag (HIT), becomes 256 the operational representation. It is 128 bits long and is used in 257 the HIP payloads and to index the corresponding state in the end 258 hosts. The HIT has an important security property in that it is 259 self-certifying (see Section 3). 261 1.2. The HIP Base Exchange (BEX) 263 The HIP base exchange is a two-party cryptographic protocol used to 264 establish communications context between hosts. The base exchange is 265 a SIGMA-compliant [KRA03] four-packet exchange. The first party is 266 called the Initiator and the second party the Responder. The four- 267 packet design helps to make HIP DoS resilient. The protocol 268 exchanges Diffie-Hellman keys in the 2nd and 3rd packets, and 269 authenticates the parties in the 3rd and 4th packets. Additionally, 270 the Responder starts a puzzle exchange in the 2nd packet, with the 271 Initiator completing it in the 3rd packet before the Responder stores 272 any state from the exchange. 274 The exchange can use the Diffie-Hellman output to encrypt the Host 275 Identity of the Initiator in the 3rd packet (although Aura, et al., 276 [AUR03] notes that such operation may interfere with packet- 277 inspecting middleboxes), or the Host Identity may instead be sent 278 unencrypted. The Responder's Host Identity is not protected. It 279 should be noted, however, that both the Initiator's and the 280 Responder's HITs are transported as such (in cleartext) in the 281 packets, allowing an eavesdropper with a priori knowledge about the 282 parties to verify their identities. 284 Data packets start to flow after the 4th packet. The 3rd and 4th HIP 285 packets may carry a data payload in the future. However, the details 286 of this may be defined later. 288 An existing HIP association can be updated using the update mechanism 289 defined in this document, and when the association is no longer 290 needed, it can be closed using the defined closing mechanism. 292 Finally, HIP is designed as an end-to-end authentication and key 293 establishment protocol, to be used with Encapsulated Security Payload 294 (ESP) [RFC5202] and other end-to-end security protocols. The base 295 protocol does not cover all the fine-grained policy control found in 296 Internet Key Exchange (IKE) [RFC4306] that allows IKE to support 297 complex gateway policies. Thus, HIP is not a replacement for IKE. 299 1.3. Memo Structure 301 The rest of this memo is structured as follows. Section 2 defines 302 the central keywords, notation, and terms used throughout the rest of 303 the document. Section 3 defines the structure of the Host Identity 304 and its various representations. Section 4 gives an overview of the 305 HIP base exchange protocol. Sections 5 and 6 define the detail 306 packet formats and rules for packet processing. Finally, Sections 7, 307 8, and 9 discuss policy, security, and IANA considerations, 308 respectively. 310 2. Terms and Definitions 312 2.1. Requirements Terminology 314 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 315 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 316 document are to be interpreted as described in RFC 2119 [RFC2119]. 318 2.2. Notation 320 [x] indicates that x is optional. 322 {x} indicates that x is encrypted. 324 X(y) indicates that y is a parameter of X. ` 326 i indicates that x exists i times. 328 --> signifies "Initiator to Responder" communication (requests). 330 <-- signifies "Responder to Initiator" communication (replies). 332 | signifies concatenation of information-- e.g., X | Y is the 333 concatenation of X with Y. 335 Ltrunc (H(x), K) denotes the lowest order K bits of the result of 336 the hash function H on the input x. 338 2.3. Definitions 340 Host Identity (HI) The Host Identity is the public key of a 341 signature algorithm and represents the identity of the host. In 342 HIP, a host proves its identity by creating a signature with the 343 private key belonging to its HI (c.f. Section 3). 345 Host Identity Tag (HIT) The Host Identity Tag is a shorthand for the 346 HI in IPv6 format. It is generated by hashing the HI (c.f. 347 Section 3.1). 349 HIT Suite: A HIT Suite groups all cryptographic algorithms that are 350 required to generate and use an HI and its HIT. In particular, 351 these algorithms are: 1) the public key signature algorithm and 2) 352 the hash function, 3) the truncation (c.f. Appendix E). 354 Responder's HIT Hash Algorithm (RHASH): The Hash algorithm used for 355 various hash calculations in this document. The algorithm is the 356 same as is used to generate the Responder's HIT. The RHASH is the 357 hash function defined by the HIT Suite of the Responder's HIT 358 (c.f. Appendix E). 360 3. Host Identifier (HI) and Its Structure 362 In this section, the properties of the Host Identifier and Host 363 Identifier Tag are discussed, and the exact format for them is 364 defined. In HIP, the public key of an asymmetric key pair is used as 365 the Host Identifier (HI). Correspondingly, the host itself is 366 defined as the entity that holds the private key from the key pair. 367 See the HIP architecture specification [rfc4423-bis] for more details 368 about the difference between an identity and the corresponding 369 identifier. 371 HIP implementations MUST support the Rivest Shamir Adelman (RSA) 372 [RFC3110] public key algorithm, and SHOULD support the Digital 373 Signature Algorithm (DSA) [RFC2536] algorithms, and Elliptic Curve 374 Digital Signature Algorithm (ECDSA) Section 5.2.8, ECDSA description; 375 other algorithms MAY be supported. 377 A hashed encoding of the HI, the Host Identity Tag (HIT), is used in 378 protocols to represent the Host Identity. The HIT is 128 bits long 379 and has the following three key properties: i) it is the same length 380 as an IPv6 address and can be used in address-sized fields in APIs 381 and protocols, ii) it is self-certifying (i.e., given a HIT, it is 382 computationally hard to find a Host Identity key that matches the 383 HIT), and iii) the probability of HIT collision between two hosts is 384 very low, hence, it is infeasible for an attacker to find a collision 385 with a HIT that is in use. For details on the security properties of 386 the HIT see [rfc4423-bis]. 388 The structure of the HIT is defined in [RFC4843-bis]. The HIT 389 consists of three parts: first, an IANA assigned prefix to 390 distinguish it from other IPv6 addresses. Second, a four-bit 391 encoding of the algorithms that were used for generating the HI and 392 the hashed representation of HI. Third, a 96-bit hashed 393 representation of the Host Identity. The encoding of the ORCHID 394 generation algorithm and the exact algorithm for generating the 395 hashed representation is specified in Appendix E. 397 Carrying HIs and HITs in the header of user data packets would 398 increase the overhead of packets. Thus, it is not expected that they 399 are carried in every packet, but other methods are used to map the 400 data packets to the corresponding HIs. In some cases, this makes it 401 possible to use HIP without any additional headers in the user data 402 packets. For example, if ESP is used to protect data traffic, the 403 Security Parameter Index (SPI) carried in the ESP header can be used 404 to map the encrypted data packet to the correct HIP association. 406 3.1. Host Identity Tag (HIT) 408 The Host Identity Tag is a 128-bit value -- a hashed encoding of the 409 Host Identifier. There are two advantages of using a hashed encoding 410 over the actual Host Identity public key in protocols. Firstly, its 411 fixed length makes for easier protocol coding and also better manages 412 the packet size cost of this technology. Secondly, it presents a 413 consistent format to the protocol whatever underlying identity 414 technology is used. 416 RFC 4843-bis [RFC4843-bis] specifies 128-bit hash-based identifiers, 417 called Overlay Routable Cryptographic Hash Identifiers (ORCHIDs). 418 Their prefix, allocated from the IPv6 address block, is defined in 419 [RFC4843-bis]. The Host Identity Tag is a type of ORCHID. 421 This document extends [RFC5201] with measures to support crypto 422 agility. One of these measures is to allow for different hash 423 functions for creating a HIT. HIT Suites group sets of algorithms 424 that are required to generate and use a particular HIT. The Suites 425 are encoded in HIT Suite IDs. These HIT Suite IDs are transmitted in 426 the ORCHID Generation Algorithm field in the ORCHID. The HIT Suite 427 ID in the OGA field enables a hosts tell from another host's HIT, 428 whether it can successfully establish a HIP association with that 429 host. 431 3.2. Generating a HIT from an HI 433 The HIT MUST be generated according to the ORCHID generation method 434 described in [RFC4843-bis] using a context ID value of 0xF0EF F02F 435 BFF4 3D0F E793 0C3C 6E61 74EA (this tag value has been generated 436 randomly by the editor of this specification), and an input that 437 encodes the Host Identity field (see Section 5.2.8) present in a HIP 438 payload packet. The class of hash function, signature algorithm, and 439 the algorithm used for generating the HIT from the HI depends on the 440 HIT Suite (see Appendix E) and is indicated by the four bits of the 441 Orchid Generation Algorithm (OGA) field in the ORCHID. Currently, 442 truncated SHA-1 [FIPS.95-1.1993] and truncated SHA-256 443 [FIPS.180-2.2002] are defined as hashes for generating a HIT. 445 For Identities that are either RSA, Digital Signature Algorithm 446 (DSA), or Elliptic Curve DSA (ECDSA) public keys, the ORCHID input 447 consists of the public key encoding as specified in the corresponding 448 DNSSEC documents, taking the algorithm-specific portion of the RDATA 449 part of the KEY RR. There are currently only two defined public key 450 algorithms: RSA/SHA-1 and DSA. Hence, either of the following 451 applies: 453 The RSA public key is encoded as defined in [RFC3110] Section 2, 454 taking the exponent length (e_len), exponent (e), and modulus (n) 455 fields concatenated. The length (n_len) of the modulus (n) can be 456 determined from the total HI Length and the preceding HI fields 457 including the exponent (e). Thus, the data that serves as input 458 for the HIT generation has the same length as the HI. The fields 459 MUST be encoded in network byte order, as defined in [RFC3110]. 461 The DSA public key is encoded as defined in [RFC2536] Section 2, 462 taking the fields T, Q, P, G, and Y, concatenated. Thus, the data 463 to be hashed is 1 + 20 + 3 * 64 + 3 * 8 * T octets long, where T 464 is the size parameter as defined in [RFC2536]. The size parameter 465 T, affecting the field lengths, MUST be selected as the minimum 466 value that is long enough to accommodate P, G, and Y. The fields 467 MUST be encoded in network byte order, as defined in [RFC2536]. 469 The ECDSA public key is encoded as defined in [fundamental-ecc] 470 Section 4.2 and 6. 472 In Appendix B, the public key encoding process is illustrated using 473 pseudo-code. 475 4. Protocol Overview 477 The following material is an overview of the HIP protocol operation, 478 and does not contain all details of the packet formats or the packet 479 processing steps. Sections 5 and 6 describe in more detail the 480 packet formats and packet processing steps, respectively, and are 481 normative in case of any conflicts with this section. 483 The protocol number 139 has been assigned by IANA to the Host 484 Identity Protocol. 486 The HIP payload (Section 5.1) header could be carried in every IP 487 datagram. However, since HIP headers are relatively large (40 488 bytes), it is desirable to 'compress' the HIP header so that the HIP 489 header only occurs in control packets used to establish or change HIP 490 association state. The actual method for header 'compression' and 491 for matching data packets with existing HIP associations (if any) is 492 defined in separate documents, describing transport formats and 493 methods. All HIP implementations MUST implement, at minimum, the ESP 494 transport format for HIP [RFC5202]. 496 4.1. Creating a HIP Association 498 By definition, the system initiating a HIP exchange is the Initiator, 499 and the peer is the Responder. This distinction is forgotten once 500 the base exchange completes, and either party can become the 501 Initiator in future communications. 503 The HIP base exchange serves to manage the establishment of state 504 between an Initiator and a Responder. The first packet, I1, 505 initiates the exchange, and the last three packets, R1, I2, and R2, 506 constitute an authenticated Diffie-Hellman [DIF76] key exchange for 507 session key generation. In the first two packets, the hosts agree on 508 a set of cryptographic identifiers and algorithms that then are used 509 in and after the exchange. During the Diffie-Hellman key exchange, a 510 piece of keying material is generated. The HIP association keys are 511 drawn from this keying material. If other cryptographic keys are 512 needed, e.g., to be used with ESP, they are expected to be drawn from 513 the same keying material. 515 The Initiator first sends a trigger packet, I1, to the Responder. 516 The packet contains the HIT of the Initiator and possibly the HIT of 517 the Responder, if it is known. Moreover, the I1 packet initializes 518 the negotiation of the Diffie-Hellman group that is used for 519 generating the keying material. Therefore, the I1 contains a list of 520 Diffie Hellman Group IDs supported by the Initiator. Note that in 521 some cases it may be possible to replace this trigger packet by some 522 other form of a trigger, in which case the protocol starts with the 523 Responder sending the R1 packet. In such cases, another mechanism to 524 convey the Initiator's supported DH Groups (e.g., by using a default 525 group) must be specified. 527 The second packet, R1, starts the actual authenticated Diffie-Hellman 528 exchange. It contains a puzzle -- a cryptographic challenge that the 529 Initiator must solve before continuing the exchange. The level of 530 difficulty of the puzzle can be adjusted based on level of trust with 531 the Initiator, current load, or other factors. In addition, the R1 532 contains the Responder's Diffie-Hellman parameter and lists of 533 cryptographic algorithms supported by the Responder. Based on these 534 lists, the Initiator can continue, abort, or restart the base 535 exchange with a different selection of cryptographic algorithms. The 536 R1 packet contains a signature that covers selected parts of the 537 message. Some fields are left outside the signature to support pre- 538 created R1s. 540 In the I2 packet, the Initiator must display the solution to the 541 received puzzle. Without a correct solution, the I2 message is 542 discarded. The I2 also contains a Diffie-Hellman parameter that 543 carries needed information for the Responder. The packet is signed 544 by the sender. 546 The R2 packet acknowledges the receipt of the I2 and finalizes the 547 base exchange. The packet is signed. 549 The base exchange is illustrated below. The term "key" refers to the 550 Host Identity public key, and "sig" represents a signature using such 551 a key. The packets contain other parameters not shown in this 552 figure. 554 Initiator Responder 556 I1: DH list 557 --------------------------> 558 select precomputed R1 559 R1: puzzle, DH, key, sig 560 <------------------------- 561 check sig remain stateless 562 solve puzzle 563 I2: solution, DH, {key}, sig 564 --------------------------> 565 compute DH check puzzle 566 check sig 567 R2: sig 568 <-------------------------- 569 check sig compute DH 571 4.1.1. HIP Puzzle Mechanism 573 The purpose of the HIP puzzle mechanism is to protect the Responder 574 from a number of denial-of-service threats. It allows the Responder 575 to delay state creation until receiving I2. Furthermore, the puzzle 576 allows the Responder to use a fairly cheap calculation to check that 577 the Initiator is "sincere" in the sense that it has churned CPU 578 cycles in solving the puzzle. 580 The puzzle mechanism has been explicitly designed to give space for 581 various implementation options. It allows a Responder implementation 582 to completely delay session-specific state creation until a valid I2 583 is received. In such a case, a correctly formatted I2 can be 584 rejected only once the Responder has checked its validity by 585 computing one hash function. On the other hand, the design also 586 allows a Responder implementation to keep state about received I1s, 587 and match the received I2s against the state, thereby allowing the 588 implementation to avoid the computational cost of the hash function. 589 The drawback of this latter approach is the requirement of creating 590 state. Finally, it also allows an implementation to use other 591 combinations of the space-saving and computation-saving mechanisms. 593 The Responder can remain stateless and drop most spoofed I2s because 594 puzzle calculation is based on the Initiator's Host Identity Tag. The 595 idea is that the Responder has a (perhaps varying) number of pre- 596 calculated R1 packets, and it selects one of these based on the 597 information carried in I1. When the Responder then later receives 598 I2, it can verify that the puzzle has been solved using the 599 Initiator's HIT. This makes it impractical for the attacker to first 600 exchange one I1/R1, and then generate a large number of spoofed I2s 601 that seemingly come from different HITs. The method does not protect 602 from an attacker that uses fixed HITs, though. Against such an 603 attacker a viable approach may be to create a piece of local state, 604 and remember that the puzzle check has previously failed. See 605 Appendix A for one possible implementation. Implementations SHOULD 606 include sufficient randomness to the algorithm so that algorithmic 607 complexity attacks become impossible [CRO03]. 609 The Responder can set the puzzle difficulty for Initiator, based on 610 its level of trust of the Initiator. Because the puzzle is not 611 included in the signature calculation, the Responder can use pre- 612 calculated R1 packets and include the puzzle just before sending the 613 R1 to the Initiator. The Responder SHOULD use heuristics to 614 determine when it is under a denial-of-service attack, and set the 615 puzzle difficulty value K appropriately; see below. 617 4.1.2. Puzzle Exchange 619 The Responder starts the puzzle exchange when it receives an I1. The 620 Responder supplies a random number I, and requires the Initiator to 621 find a number J. To select a proper J, the Initiator must create the 622 concatenation of I, the HITs of the parties, and J, and take a hash 623 over this concatenation using the RHASH algorithm. The lowest order 624 K bits of the result MUST be zeros. The value K sets the difficulty 625 of the puzzle. 627 To generate a proper number J, the Initiator will have to generate a 628 number of Js until one produces the hash target of zeros. The 629 Initiator SHOULD give up after exceeding the puzzle lifetime in the 630 PUZZLE parameter (Section 5.2.4). The Responder needs to re-create 631 the concatenation of I, the HITs, and the provided J, and compute the 632 hash once to prove that the Initiator did its assigned task. 634 To prevent precomputation attacks, the Responder MUST select the 635 number I in such a way that the Initiator cannot guess it. 636 Furthermore, the construction MUST allow the Responder to verify that 637 the value I was indeed selected by it and not by the Initiator. See 638 Appendix A for an example on how to implement this. 640 Using the Opaque data field in an ECHO_REQUEST_SIGNED 641 (Section 5.2.19) or in an ECHO_REQUEST_UNSIGNED parameter 642 (Section 5.2.20), the Responder can include some data in R1 that the 643 Initiator must copy unmodified in the corresponding I2 packet. The 644 Responder can generate the Opaque data in various ways; e.g., using 645 encryption or hashing with some secret, the sent I, and possibly 646 other related data. Using the same secret, the received I (from the 647 I2), and the other related data (if any), the Receiver can verify 648 that it has itself sent the I to the Initiator. The Responder MUST 649 periodically change such a used secret. 651 It is RECOMMENDED that the Responder generates a new puzzle and new 652 R1s once every few minutes. Furthermore, it is RECOMMENDED that the 653 Responder remembers an old puzzle at least Lifetime seconds after the 654 puzzle has been deprecated. These time values guarantee that the 655 puzzle is valid for at least Lifetime and at most 2*Lifetime seconds. 656 This limits the usability that an old, solved puzzle has to an 657 attacker. 659 NOTE: The protocol developers explicitly considered whether R1 should 660 include a timestamp in order to protect the Initiator from replay 661 attacks. The decision was to NOT include a timestamp. 663 NOTE: The protocol developers explicitly considered whether a memory 664 bound function should be used for the puzzle instead of a CPU-bound 665 function. The decision was not to use memory-bound functions. At 666 the time of the decision, the idea of memory-bound functions was 667 relatively new and their IPR status were unknown. Once there is more 668 experience about memory-bound functions and once their IPR status is 669 better known, it may be reasonable to reconsider this decision. 671 4.1.3. Authenticated Diffie-Hellman Protocol with DH Group Negotiation 673 The packets R1, I2, and R2 implement a standard authenticated Diffie- 674 Hellman exchange. The Responder sends one of its public Diffie- 675 Hellman keys and its public authentication key, i.e., its Host 676 Identity, in R1. The signature in R1 allows the Initiator to verify 677 that the R1 has been once generated by the Responder. However, since 678 it is precomputed and therefore does not cover association-specific 679 information in the I1 packet, it does not protect from replay 680 attacks. 682 Before the actual authenticated Diffie-Hellman exchange, the 683 Initiator expresses its preference regarding its choice of the DH 684 groups in the I1 packet. The preference is expressed as a sorted 685 list of DH Group IDs. The I1 packet is not protected by a signature. 686 Therefore, this list is sent in an unauthenticated way to avoid 687 costly computations for processing the I1 packet on the Responder's 688 side. Based on the preferences of the Initiator, the Responder sends 689 an R1 packet containing its most suitable public DH value. It also 690 attaches a list of its own preferences to the R1 to convey the basis 691 for the DH group selection to the Initiator. 693 If none of the DH Group IDs in the I1 is supported by the Responder, 694 the Responder selects the DH Group most suitable for it regardless of 695 the Initiator's preference. It then sends the R1 containing this DH 696 Group and its list of supported DH Group IDs to the Initiator. 698 When the Initiator receives an R1, it gets one of the Responder's 699 public Diffie-Hellman values and the list of DH Group IDs supported 700 by the Responder. This list is covered by the signature in the R1 701 packet to avoid forgery. The Initiator compares the Group ID of the 702 public DH value in the R1 packet to the list of supported DH Group 703 IDs in the R1 packets and to its own preferences expressed in the 704 list of supported DH Group IDs. The Initiator continues the BEX only 705 if the Group ID of the public DH value of the Responder matches the 706 preferences of both Initiator and Responder. Otherwise, the 707 communication is subject of a downgrade attack and the Initiator must 708 restart the key exchange with a new I1 packet or must abort the key 709 exchange. If the Responder's choice of the DH Group is not supported 710 by the Initiator, the Initiator may abort the handshake or send a new 711 I1 with a different list of supported DH Groups. However, the 712 Initiator MUST verify the signature of the R1 packet before 713 restarting or aborting the handshake. It MUST silently ignore the R1 714 packet if the signature is not valid. 716 If the preferences regarding the DH Group ID match, the Initiator 717 computes the Diffie-Hellman session key (Kij). It creates a HIP 718 association using keying material from the session key (see 719 Section 6.5), and may use the association to encrypt its public 720 authentication key, i.e., Host Identity. The resulting I2 contains 721 the Initiator's Diffie-Hellman key and its (optionally encrypted) 722 public authentication key. The signature in I2 covers all of the 723 packet. 725 The Responder extracts the Initiator Diffie-Hellman public key from 726 the I2, computes the Diffie-Hellman session key, creates a 727 corresponding HIP association, and decrypts the Initiator's public 728 authentication key. It can then verify the signature using the 729 authentication key. 731 The final message, R2, is needed to protect the Initiator from replay 732 attacks. 734 4.1.4. HIP Replay Protection 736 The HIP protocol includes the following mechanisms to protect against 737 malicious replays. Responders are protected against replays of I1 738 packets by virtue of the stateless response to I1s with presigned R1 739 messages. Initiators are protected against R1 replays by a 740 monotonically increasing "R1 generation counter" included in the R1. 741 Responders are protected against replays or false I2s by the puzzle 742 mechanism (Section 4.1.1 above), and optional use of opaque data. 743 Hosts are protected against replays to R2s and UPDATEs by use of a 744 less expensive HMAC verification preceding HIP signature 745 verification. 747 The R1 generation counter is a monotonically increasing 64-bit 748 counter that may be initialized to any value. The scope of the 749 counter MAY be system-wide but SHOULD be per Host Identity, if there 750 is more than one local host identity. The value of this counter 751 SHOULD be kept across system reboots and invocations of the HIP base 752 exchange. This counter indicates the current generation of puzzles. 753 Implementations MUST accept puzzles from the current generation and 754 MAY accept puzzles from earlier generations. A system's local 755 counter MUST be incremented at least as often as every time old R1s 756 cease to be valid, and SHOULD never be decremented, lest the host 757 expose its peers to the replay of previously generated, higher 758 numbered R1s. The R1 counter SHOULD NOT roll over. 760 A host may receive more than one R1, either due to sending multiple 761 I1s (Section 6.6.1) or due to a replay of an old R1. When sending 762 multiple I1s, an Initiator SHOULD wait for a small amount of time (a 763 reasonable time may be 2 * expected RTT) after the first R1 reception 764 to allow possibly multiple R1s to arrive, and it SHOULD respond to an 765 R1 among the set with the largest R1 generation counter. If an 766 Initiator is processing an R1 or has already sent an I2 (still 767 waiting for R2) and it receives another R1 with a larger R1 768 generation counter, it MAY elect to restart R1 processing with the 769 fresher R1, as if it were the first R1 to arrive. 771 Upon conclusion of an active HIP association with another host, the 772 R1 generation counter associated with the peer host SHOULD be 773 flushed. A local policy MAY override the default flushing of R1 774 counters on a per-HIT basis. The reason for recommending the 775 flushing of this counter is that there may be hosts where the R1 776 generation counter (occasionally) decreases; e.g., due to hardware 777 failure. 779 4.1.5. Refusing a HIP Exchange 781 A HIP-aware host may choose not to accept a HIP exchange. If the 782 host's policy is to only be an Initiator, it should begin its own HIP 783 exchange. A host MAY choose to have such a policy since only the 784 Initiator's HI is protected in the exchange. There is a risk of a 785 race condition if each host's policy is to only be an Initiator, at 786 which point the HIP exchange will fail. 788 If the host's policy does not permit it to enter into a HIP exchange 789 with the Initiator, it should send an ICMP 'Destination Unreachable, 790 Administratively Prohibited' message. A more complex HIP packet is 791 not used here as it actually opens up more potential DoS attacks than 792 a simple ICMP message. 794 4.1.6. Aborting a HIP Exchange 796 Two HIP hosts may encounter situations in which they cannot complete 797 a HIP exchange because of insufficient suport for cryptographic 798 algorithms, in particular the HIT Suites and DH Groups. After 799 receiving the R1 packet, the Initiator can determine whether the 800 Responder supports the required cryptographic operations to 801 successfully establish a HIP association. The Initiator can abort 802 the BEX silently after receiving an R1 packet that indicates an 803 unsupported set of algorithms. The specific conditions are described 804 below. 806 The R1 packet contains a signed list of HIT Suite IDs supported by 807 the Responder. Therefore, the Initiator can determine whether its 808 source HIT is supported by the Responder. If the HIT Suite ID of the 809 Initiator's HIT is not contained in the list of HIT Suites, the 810 Initiator MAY abort the handshake silently or MAY restart the 811 handshake with a new I1 packet that contains a source HIT supported 812 by the Responder. 814 During the Handshake, the Initiator and the Responder agree on a DH 815 Group. The Responder selects the DH Group and its DH public value in 816 the R1 based on the list of DH Suite IDs in the I1 packet. If the 817 responder supports none of the DH Groups selected by the Initiator, 818 the Responder selects an arbitrary DH and replies an R1 containing 819 its list of supported DH Group IDs. In this case, the Initiator will 820 receive an R1 packet containing the DH public value for an 821 unsupported DH Group and the Responder's DH Group list in the signed 822 part of the R1 packet. At this point, the Initiator MAY abort the 823 handshake or MAY restart the handshake by sending a new I1 containing 824 a selection of DH Group IDs that is supported by the Responder. 826 4.1.7. HIP Downgrade Protection 828 In a downgrade attack, an attacker manipulates the packets of an 829 Initiator and/or a Responder to unnoticeably influence the result of 830 the cryptographic negotiations in the BEX to its favor. As a result, 831 the victims select weaker cryptographic algorithms than they would 832 have without the attacker's interference. Downgrade attacks can only 833 be successful if these are not detected by the victims and the 834 victims assume a secure communication channel. 836 In HIP, almost all packet parameters related to cryptographic 837 negotiations are covered by signatures. These parameters cannot be 838 directly manipulated in a downgrade attack without invalidating the 839 signature. However, signed packets can be subject to replay attacks. 840 In such a replay attack, the attacker could use an old BEX packet 841 with an outdated selection of cryptographic algorithms and replay it 842 instead of a more recent packet with a collection of stronger 843 cryptographic algorithms. Signed packets that could be subject to 844 this replay attack are the R1 and I2 packet. However, replayed R1 845 and I2 packets cannot be used to successfully establish a HIP BEX 846 because these packets also contain the public DH values of the 847 Initiator and the Responder. Old DH values from replayed packet will 848 lead to invalid keying material and mismatching shared secrets. 850 In contrast to the first version of HIP [RFC5201], this version 851 begins the negotiation of the DH Groups already in the first BEX 852 packet, the I1. The I1 is, by intention, not protected by a 853 signature to avoid CPU-intensive cryptographic operations for 854 processing floods of I1s. Hence, the list of DH Group IDs in the I1 855 is vulnerable to forgery and manipulation. To thwart an unnoticed 856 manipulation of the I1 packet, the Responder chooses the DH Group 857 deterministically and includes its own list of DH Group IDs in the 858 signed part of the R1 packet. The Initiator can detect an attempted 859 downgrade attack by comparing the list of DH Group IDs in the R1 860 packet to its own preferences in the I1. If the choice of the DH 861 Group in the R1 packet does not equal the best match of the two 862 lists, the Initiator can conclude that its list in the I1 was altered 863 by an attacker. In this case, the Initiator can restart or abort the 864 BEX. As mentioned before, the detection of the downgrade attack is 865 sufficient to prevent it. 867 4.1.8. HIP Opportunistic Mode 869 It is possible to initiate a HIP negotiation even if the Responder's 870 HI (and HIT) is unknown. In this case, the connection initializing 871 I1 packet contains NULL (all zeros) as the destination HIT. This 872 kind of connection setup is called opportunistic mode. 874 The Responder may have multiple HITs due to multiple supported HIT 875 Suites. Since the Responder's HIT Suite is not determined by the 876 destination HIT of the I1 packet, the Responder can freely select a 877 HIT of any HIT Suite. The complete set of HIT Suites supported by 878 the Initiator is not known to the Responder. Therefore, the 879 Responder SHOULD use a Responder HIT of the same HIT Suite as the 880 Initiator's HIT because this HIT Suite is obviously supported by the 881 Initiator. If the Responder selects a different HIT that is not 882 supported by the Initiator, the Initiator MAY restart the BEX with an 883 I1 packet with a source HIT that is contained in the list of the 884 Responder's HIT Suites in the R1 packet. 886 Note that the Initiator cannot verify the signature of the R1 packet 887 if the Responder's HIT Suite is not supported. Therefore, the 888 Initiator MUST treat R1 packets with unsupported Responder HITs as 889 potentially forged and MUST NOT use any parameters from the 890 unverified R1 besides the HIT Suite List. Moreover, an Initiator 891 that uses a unverified HIT Suite List to determine a possible source 892 HIT from an R1 packet MUST verify that the HIT_SUITE_LIST in the 893 first unverified R1 packet matches the HIT_SUITE_LIST in the second 894 R1 packet for which the Initiator supports the signature algorithm. 895 The Initiator MUST restart the BEX with a new I1 packet with a source 896 HIT mentioned in the verifiable R1 if the two lists do not match to 897 mitigate downgrade attacks. 899 There are both security and API issues involved with the 900 opportunistic mode. 902 Given that the Responder's HI is not known by the Initiator, there 903 must be suitable API calls that allow the Initiator to request, 904 directly or indirectly, that the underlying kernel initiate the HIP 905 base exchange solely based on locators. The Responder's HI will be 906 tentatively available in the R1 packet, and in an authenticated form 907 once the R2 packet has been received and verified. Hence, it could 908 be communicated to the application via new API mechanisms. However, 909 with a backwards-compatible API the application sees only the 910 locators used for the initial contact. Depending on the desired 911 semantics of the API, this can raise the following issues: 913 o The actual locators may later change if an UPDATE message is used, 914 even if from the API perspective the session still appears to be 915 between specific locators. The locator update is still secure, 916 however, and the session is still between the same nodes. 918 o Different sessions between the same locators may result in 919 connections to different nodes, if the implementation no longer 920 remembers which identifier the peer had in another session. This 921 is possible when the peer's locator has changed for legitimate 922 reasons or when an attacker pretends to be a node that has the 923 peer's locator. Therefore, when using opportunistic mode, HIP 924 MUST NOT place any expectation that the peer's HI returned in the 925 R1 message matches any HI previously seen from that address. 927 If the HIP implementation and application do not have the same 928 understanding of what constitutes a session, this may even happen 929 within the same session. For instance, an implementation may not 930 know when HIP state can be purged for UDP-based applications. 932 o As with all HIP exchanges, the handling of locator-based or 933 interface-based policy is unclear for opportunistic mode HIP. An 934 application may make a connection to a specific locator because 935 the application has knowledge of the security properties along the 936 network to that locator. If one of the nodes moves and the 937 locators are updated, these security properties may not be 938 maintained. Depending on the security policy of the application, 939 this may be a problem. This is an area of ongoing study. As an 940 example, there is work to create an API that applications can use 941 to specify their security requirements in a similar context 942 [btns-c-api]. 944 In addition, the following security considerations apply. The 945 generation counter mechanism will be less efficient in protecting 946 against replays of the R1 packet, given that the Responder can choose 947 a replay that uses any HI, not just the one given in the I1 packet. 949 More importantly, the opportunistic exchange is vulnerable to man-in- 950 the-middle attacks, because the Initiator does not have any public 951 key information about the peer. To assess the impacts of this 952 vulnerability, we compare it to vulnerabilities in current, non-HIP- 953 capable communications. 955 An attacker on the path between the two peers can insert itself as a 956 man-in-the-middle by providing its own identifier to the Initiator 957 and then initiating another HIP session towards the Responder. For 958 this to be possible, the Initiator must employ opportunistic mode, 959 and the Responder must be configured to accept a connection from any 960 HIP-enabled node. 962 An attacker outside the path will be unable to do so, given that it 963 cannot respond to the messages in the base exchange. 965 These properties are characteristic also of communications in the 966 current Internet. A client contacting a server without employing 967 end-to-end security may find itself talking to the server via a man- 968 in-the-middle, assuming again that the server is willing to talk to 969 anyone. 971 If end-to-end security is in place, then the worst that can happen in 972 both the opportunistic HIP and normal IP cases is denial-of-service; 973 an entity on the path can disrupt communications, but will be unable 974 to insert itself as a man-in-the-middle. 976 However, once the opportunistic exchange has successfully completed, 977 HIP provides integrity protection and confidentiality for the 978 communications, and can securely change the locators of the 979 endpoints. 981 As a result, it is believed that the HIP opportunistic mode is at 982 least as secure as current IP. 984 4.2. Updating a HIP Association 986 A HIP association between two hosts may need to be updated over time. 987 Examples include the need to rekey expiring user data security 988 associations, add new security associations, or change IP addresses 989 associated with hosts. The UPDATE packet is used for those and other 990 similar purposes. This document only specifies the UPDATE packet 991 format and basic processing rules, with mandatory parameters. The 992 actual usage is defined in separate specifications. 994 HIP provides a general purpose UPDATE packet, which can carry 995 multiple HIP parameters, for updating the HIP state between two 996 peers. The UPDATE mechanism has the following properties: 998 UPDATE messages carry a monotonically increasing sequence number 999 and are explicitly acknowledged by the peer. Lost UPDATEs or 1000 acknowledgments may be recovered via retransmission. Multiple 1001 UPDATE messages may be outstanding under certain circumstances. 1003 UPDATE is protected by both HIP_MAC and HIP_SIGNATURE parameters, 1004 since processing UPDATE signatures alone is a potential DoS attack 1005 against intermediate systems. 1007 UPDATE packets are explicitly acknowledged by the use of an 1008 acknowledgment parameter that echoes an individual sequence number 1009 received from the peer. A single UPDATE packet may contain both a 1010 sequence number and one or more acknowledgment numbers (i.e., 1011 piggybacked acknowledgment(s) for the peer's UPDATE). 1013 The UPDATE packet is defined in Section 5.3.5. 1015 4.3. Error Processing 1017 HIP error processing behavior depends on whether or not there exists 1018 an active HIP association. In general, if a HIP association exists 1019 between the sender and receiver of a packet causing an error 1020 condition, the receiver SHOULD respond with a NOTIFY packet. On the 1021 other hand, if there are no existing HIP associations between the 1022 sender and receiver, or the receiver cannot reasonably determine the 1023 identity of the sender, the receiver MAY respond with a suitable ICMP 1024 message; see Section 5.4 for more details. 1026 The HIP protocol and state machine is designed to recover from one of 1027 the parties crashing and losing its state. The following scenarios 1028 describe the main use cases covered by the design. 1030 No prior state between the two systems. 1032 The system with data to send is the Initiator. The process 1033 follows the standard four-packet base exchange, establishing 1034 the HIP association. 1036 The system with data to send has no state with the receiver, but 1037 the receiver has a residual HIP association. 1039 The system with data to send is the Initiator. The Initiator 1040 acts as in no prior state, sending I1 and getting R1. When the 1041 Responder receives a valid I2, the old association is 1042 'discovered' and deleted, and the new association is 1043 established. 1045 The system with data to send has a HIP association, but the 1046 receiver does not. 1048 The system sends data on the outbound user data security 1049 association. The receiver 'detects' the situation when it 1050 receives a user data packet that it cannot match to any HIP 1051 association. The receiving host MUST discard this packet. 1053 Optionally, the receiving host MAY send an ICMP packet, with 1054 the type Parameter Problem, to inform the sender that the HIP 1055 association does not exist (see Section 5.4), and it MAY 1056 initiate a new HIP negotiation. However, responding with these 1057 optional mechanisms is implementation or policy dependent. 1059 4.4. HIP State Machine 1061 The HIP protocol itself has little state. In the HIP base exchange, 1062 there is an Initiator and a Responder. Once the security 1063 associations (SAs) are established, this distinction is lost. If the 1064 HIP state needs to be re-established, the controlling parameters are 1065 which peer still has state and which has a datagram to send to its 1066 peer. The following state machine attempts to capture these 1067 processes. 1069 The state machine is presented in a single system view, representing 1070 either an Initiator or a Responder. There is not a complete overlap 1071 of processing logic here and in the packet definitions. Both are 1072 needed to completely implement HIP. 1074 This document extends the state machine defined in [RFC5201] and 1075 introduces a restart option to allow for the negotiation of 1076 cryptographic algorithms. The only change to the previous state 1077 machine is a transition from state I1-SENT to I1-SENT - the restart 1078 option. An Initiator is required to restart the HIP exchange if the 1079 Responder does not support the HIT Suite of the Initiator. In this 1080 case, the Initiator restarts the HIP exchange by sending a new I1 1081 packet with a source HIT supported by the Responder. 1083 Implementors must understand that the state machine, as described 1084 here, is informational. Specific implementations are free to 1085 implement the actual functions differently. Section 6 describes the 1086 packet processing rules in more detail. This state machine focuses 1087 on the HIP I1, R1, I2, and R2 packets only. Other states may be 1088 introduced by mechanisms in other specifications (such as mobility 1089 and multihoming). 1091 4.4.1. Timespan Definitions 1093 Unused Association Lifetime (UAL): Implementation-specific time for 1094 which, if no packet is sent or received for this time interval, a 1095 host MAY begin to tear down an active association. 1097 Maximum Segment Lifetime (MSL): Maximum time that a TCP segment is 1098 expected to spend in the network. 1100 Exchange Complete (EC): Time that the host spends at the R2-SENT 1101 before it moves to ESTABLISHED state. The time is n * I2 1102 retransmission timeout, where n is about I2_RETRIES_MAX. 1104 4.4.2. HIP States 1106 +---------------------+---------------------------------------------+ 1107 | State | Explanation | 1108 +---------------------+---------------------------------------------+ 1109 | UNASSOCIATED | State machine start | 1110 | | | 1111 | I1-SENT | Initiating base exchange | 1112 | | | 1113 | I2-SENT | Waiting to complete base exchange | 1114 | | | 1115 | R2-SENT | Waiting to complete base exchange | 1116 | | | 1117 | ESTABLISHED | HIP association established | 1118 | | | 1119 | CLOSING | HIP association closing, no data can be | 1120 | | sent | 1121 | | | 1122 | CLOSED | HIP association closed, no data can be sent | 1123 | | | 1124 | E-FAILED | HIP exchange failed | 1125 +---------------------+---------------------------------------------+ 1127 Table 1: HIP States 1129 4.4.3. HIP State Processes 1131 System behavior in state UNASSOCIATED, Table 2. 1133 +---------------------+---------------------------------------------+ 1134 | Trigger | Action | 1135 +---------------------+---------------------------------------------+ 1136 | User data to send, | Send I1 and go to I1-SENT | 1137 | requiring a new HIP | | 1138 | association | | 1139 | | | 1140 | Receive I1 | Send R1 and stay at UNASSOCIATED | 1141 | | | 1142 | Receive I2, process | If successful, send R2 and go to R2-SENT | 1143 | | | 1144 | | If fail, stay at UNASSOCIATED | 1145 | | | 1146 | Receive user data | Optionally send ICMP as defined in | 1147 | for unknown HIP | Section 5.4 and stay at UNASSOCIATED | 1148 | association | | 1149 | | | 1150 | Receive CLOSE | Optionally send ICMP Parameter Problem and | 1151 | | stay at UNASSOCIATED | 1152 | Receive ANYOTHER | Drop and stay at UNASSOCIATED | 1153 +---------------------+---------------------------------------------+ 1155 Table 2: UNASSOCIATED - Start state 1157 System behavior in state I1-SENT, Table 3. 1159 +---------------------+---------------------------------------------+ 1160 | Trigger | Action | 1161 +---------------------+---------------------------------------------+ 1162 | Receive I1 | If the local HIT is smaller than the peer | 1163 | | HIT, drop I1 and stay at I1-SENT | 1164 | | | 1165 | | If the local HIT is greater than the peer | 1166 | | HIT, send R1 and stay at I1_SENT | 1167 | | | 1168 | Receive I2, process | If successful, send R2 and go to R2-SENT | 1169 | | | 1170 | | If fail, stay at I1-SENT | 1171 | | | 1172 | Receive R1, process | If HIT Suite of own HIT is not supported by | 1173 | | the peer, select supported own HIT, send I1 | 1174 | | and stay at I1-SENT | 1175 | | | 1176 | | If successful, send I2 and go to I2-SENT | 1177 | | | 1178 | | If fail, stay at I1-SENT | 1179 | | | 1180 | Receive ANYOTHER | Drop and stay at I1-SENT | 1181 | | | 1182 | Timeout, increment | If counter is less than I1_RETRIES_MAX, | 1183 | timeout counter | send I1 and stay at I1-SENT | 1184 | | | 1185 | | If counter is greater than I1_RETRIES_MAX, | 1186 | | go to E-FAILED | 1187 +---------------------+---------------------------------------------+ 1189 Table 3: I1-SENT - Initiating HIP 1191 System behavior in state I2-SENT, Table 4. 1193 +---------------------+---------------------------------------------+ 1194 | Trigger | Action | 1195 +---------------------+---------------------------------------------+ 1196 | Receive I1 | Send R1 and stay at I2-SENT | 1197 | | | 1198 | Receive R1, process | If successful, send I2 and cycle at I2-SENT | 1199 | | | 1200 | | If fail, stay at I2-SENT | 1201 | | | 1202 | Receive I2, process | If successful and local HIT is smaller than | 1203 | | the peer HIT, drop I2 and stay at I2-SENT | 1204 | | | 1205 | | If successful and local HIT is greater than | 1206 | | the peer HIT, send R2 and go to R2-SENT | 1207 | | | 1208 | | If fail, stay at I2-SENT | 1209 | | | 1210 | Receive R2, process | If successful, go to ESTABLISHED | 1211 | | | 1212 | | If fail, stay at I2-SENT | 1213 | | | 1214 | Receive ANYOTHER | Drop and stay at I2-SENT | 1215 | | | 1216 | Timeout, increment | If counter is less than I2_RETRIES_MAX, | 1217 | timeout counter | send I2 and stay at I2-SENT | 1218 | | | 1219 | | If counter is greater than I2_RETRIES_MAX, | 1220 | | go to E-FAILED | 1221 +---------------------+---------------------------------------------+ 1223 Table 4: I2-SENT - Waiting to finish HIP 1225 System behavior in state R2-SENT, Table 5. 1227 +---------------------+---------------------------------------------+ 1228 | Trigger | Action | 1229 +---------------------+---------------------------------------------+ 1230 | Receive I1 | Send R1 and stay at R2-SENT | 1231 | | | 1232 | Receive I2, process | If successful, send R2 and cycle at R2-SENT | 1233 | | | 1234 | | If fail, stay at R2-SENT | 1235 | | | 1236 | Receive R1 | Drop and stay at R2-SENT | 1237 | | | 1238 | Receive R2 | Drop and stay at R2-SENT | 1239 | | | 1240 | Receive data or | Move to ESTABLISHED | 1241 | UPDATE | | 1242 | | | 1243 | Exchange Complete | Move to ESTABLISHED | 1244 | Timeout | | 1245 +---------------------+---------------------------------------------+ 1247 Table 5: R2-SENT - Waiting to finish HIP 1249 System behavior in state ESTABLISHED, Table 6. 1251 +---------------------+---------------------------------------------+ 1252 | Trigger | Action | 1253 +---------------------+---------------------------------------------+ 1254 | Receive I1 | Send R1 and stay at ESTABLISHED | 1255 | | | 1256 | Receive I2, process | If successful, send R2, drop old HIP | 1257 | with puzzle and | association, establish a new HIP | 1258 | possible Opaque | association, go to R2-SENT | 1259 | data verification | | 1260 | | | 1261 | | If fail, stay at ESTABLISHED | 1262 | | | 1263 | Receive R1 | Drop and stay at ESTABLISHED | 1264 | | | 1265 | Receive R2 | Drop and stay at ESTABLISHED | 1266 | | | 1267 | Receive user data | Process and stay at ESTABLISHED | 1268 | for HIP association | | 1269 | | | 1270 | No packet | Send CLOSE and go to CLOSING | 1271 | sent/received | | 1272 | during UAL minutes | | 1273 | | | 1274 | Receive CLOSE, | If successful, send CLOSE_ACK and go to | 1275 | process | CLOSED | 1276 | | | 1277 | | If fail, stay at ESTABLISHED | 1278 +---------------------+---------------------------------------------+ 1280 Table 6: ESTABLISHED - HIP association established 1282 System behavior in state CLOSING, Table 7. 1284 +---------------------+---------------------------------------------+ 1285 | Trigger | Action | 1286 +---------------------+---------------------------------------------+ 1287 | User data to send, | Send I1 and stay at CLOSING | 1288 | requires the | | 1289 | creation of another | | 1290 | incarnation of the | | 1291 | HIP association | | 1292 | | | 1293 | Receive I1 | Send R1 and stay at CLOSING | 1294 | | | 1295 | Receive I2, process | If successful, send R2 and go to R2-SENT | 1296 | | | 1297 | | If fail, stay at CLOSING | 1298 | | | 1299 | Receive R1, process | If successful, send I2 and go to I2-SENT | 1300 | | | 1301 | | If fail, stay at CLOSING | 1302 | | | 1303 | Receive CLOSE, | If successful, send CLOSE_ACK, discard | 1304 | process | state and go to CLOSED | 1305 | | | 1306 | | If fail, stay at CLOSING | 1307 | | | 1308 | Receive CLOSE_ACK, | If successful, discard state and go to | 1309 | process | UNASSOCIATED | 1310 | | | 1311 | | If fail, stay at CLOSING | 1312 | | | 1313 | Receive ANYOTHER | Drop and stay at CLOSING | 1314 | | | 1315 | Timeout, increment | If timeout sum is less than UAL+MSL | 1316 | timeout sum, reset | minutes, retransmit CLOSE and stay at | 1317 | timer | CLOSING | 1318 | | | 1319 | | If timeout sum is greater than UAL+MSL | 1320 | | minutes, go to UNASSOCIATED | 1321 +---------------------+---------------------------------------------+ 1323 Table 7: CLOSING - HIP association has not been used for UAL minutes 1324 System behavior in state CLOSED, Table 8. 1326 +---------------------+---------------------------------------------+ 1327 | Trigger | Action | 1328 +---------------------+---------------------------------------------+ 1329 | Datagram to send, | Send I1, and stay at CLOSED | 1330 | requires the | | 1331 | creation of another | | 1332 | incarnation of the | | 1333 | HIP association | | 1334 | | | 1335 | Receive I1 | Send R1 and stay at CLOSED | 1336 | | | 1337 | Receive I2, process | If successful, send R2 and go to R2-SENT | 1338 | | | 1339 | | If fail, stay at CLOSED | 1340 | | | 1341 | Receive R1, process | If successful, send I2 and go to I2-SENT | 1342 | | | 1343 | | If fail, stay at CLOSED | 1344 | | | 1345 | Receive CLOSE, | If successful, send CLOSE_ACK, stay at | 1346 | process | CLOSED | 1347 | | | 1348 | | If fail, stay at CLOSED | 1349 | | | 1350 | Receive CLOSE_ACK, | If successful, discard state and go to | 1351 | process | UNASSOCIATED | 1352 | | | 1353 | | If fail, stay at CLOSED | 1354 | | | 1355 | Receive ANYOTHER | Drop and stay at CLOSED | 1356 | | | 1357 | Timeout (UAL+2MSL) | Discard state, and go to UNASSOCIATED | 1358 +---------------------+---------------------------------------------+ 1360 Table 8: CLOSED - CLOSE_ACK sent, resending CLOSE_ACK if necessary 1362 System behavior in state E-FAILED, Table 9. 1364 +-------------------------+-----------------------------------------+ 1365 | Trigger | Action | 1366 +-------------------------+-----------------------------------------+ 1367 | Wait for | Go to UNASSOCIATED. Re-negotiation is | 1368 | implementation-specific | possible after moving to UNASSOCIATED | 1369 | time | state. | 1370 +-------------------------+-----------------------------------------+ 1371 Table 9: E-FAILED - HIP failed to establish association with peer 1373 4.4.4. Simplified HIP State Diagram 1375 The following diagram shows the major state transitions. Transitions 1376 based on received packets implicitly assume that the packets are 1377 successfully authenticated or processed. 1379 +-+ +----------------------------+ 1380 I1 received, send R1 | | | | 1381 | v v | 1382 Datagram to send +--------------+ I2 received, send R2 | 1383 +---------------| UNASSOCIATED |----------------+ | 1384 | +-+ +--------------+ | | 1385 Send I1 | | | Alg. not supported, send I1 | | 1386 v | v | | 1387 +---------+ I2 received, send R2 | | 1388 +---->| I1-SENT |---------------------------------------+ | | 1389 | +---------+ | | | 1390 | | +------------------------+ | | | 1391 | | R1 received, | I2 received, send R2 | | | | 1392 | v send I2 | v v v | 1393 | +---------+ | +---------+ | 1394 | +->| I2-SENT |------------+ | R2-SENT |<----+ | 1395 | | +---------+ +---------+ | | 1396 | | | | | | 1397 | | | data| | | 1398 | |receive | or| | | 1399 | |R1, send | EC timeout| receive I2,| | 1400 | |I2 |R2 received +--------------+ | send R2| | 1401 | | +----------->| ESTABLISHED |<--------+ | | 1402 | | +--------------+ | | 1403 | | | | | receive I2, send R2 | | 1404 | | recv+------------+ | +------------------------+ | 1405 | | CLOSE,| | | | 1406 | | send| No packet sent| | | 1407 | | CLOSE_ACK| /received for | timeout | | 1408 | | | UAL min, send | +---------+<-+ (UAL+MSL) | | 1409 | | | CLOSE +--->| CLOSING |--+ retransmit | | 1410 | | | +---------+ CLOSE | | 1411 +--|------------|----------------------+| | | | | | 1412 +------------|-----------------------+ | | +-----------------+ | 1413 | | +-----------+ +-------------------|--+ 1414 | +-----------+ | receive CLOSE, CLOSE_ACK | | 1415 | | | send CLOSE_ACK received or | | 1416 | | | timeout | | 1417 | | | (UAL+MSL) | | 1418 | v v | | 1419 | +--------+ receive I2, send R2 | | 1420 +-----------------------| CLOSED |----------------------------+ | 1421 +--------+ /-----------------------+ 1422 ^ | \-------/ timeout (UAL+2MSL), 1423 | | move to UNASSOCIATED 1424 +-+ 1425 CLOSE received, send CLOSE_ACK 1427 4.5. User Data Considerations 1429 4.5.1. TCP and UDP Pseudo-Header Computation for User Data 1431 When computing TCP and UDP checksums on user data packets that flow 1432 through sockets bound to HITs, the IPv6 pseudo-header format 1433 [RFC2460] MUST be used, even if the actual addresses on the packet 1434 are IPv4 addresses. Additionally, the HITs MUST be used in the place 1435 of the IPv6 addresses in the IPv6 pseudo-header. Note that the 1436 pseudo-header for actual HIP payloads is computed differently; see 1437 Section 5.1.1. 1439 4.5.2. Sending Data on HIP Packets 1441 A future version of this document may define how to include user data 1442 on various HIP packets. However, currently the HIP header is a 1443 terminal header, and not followed by any other headers. 1445 4.5.3. Transport Formats 1447 The actual data transmission format, used for user data after the HIP 1448 base exchange, is not defined in this document. Such transport 1449 formats and methods are described in separate specifications. All 1450 HIP implementations MUST implement, at minimum, the ESP transport 1451 format for HIP [RFC5202]. 1453 4.5.4. Reboot, Timeout, and Restart of HIP 1455 Simulating a loss of state is a potential DoS attack. The following 1456 process has been crafted to manage state recovery without presenting 1457 a DoS opportunity. 1459 If a host reboots or the HIP association times out, it has lost its 1460 HIP state. If the host that lost state has a datagram to send to the 1461 peer, it simply restarts the HIP base exchange. After the base 1462 exchange has completed, the Initiator can create a new payload 1463 association and start sending data. The peer does not reset its 1464 state until it receives a valid I2 HIP packet. 1466 If a system receives a user data packet that cannot be matched to any 1467 existing HIP association, it is possible that it has lost the state 1468 and its peer has not. It MAY send an ICMP packet with the Parameter 1469 Problem type, and with the pointer pointing to the referred HIP- 1470 related association information. Reacting to such traffic depends on 1471 the implementation and the environment where the implementation is 1472 used. 1474 If the host, that apparently has lost its state, decides to restart 1475 the HIP base exchange, it sends an I1 packet to the peer. After the 1476 base exchange has been completed successfully, the Initiator can 1477 create a new HIP association and the peer drops its old payload 1478 associations and creates a new one. 1480 4.6. Certificate Distribution 1482 This document does not define how to use certificates or how to 1483 transfer them between hosts. These functions are expected to be 1484 defined in a future specification. A parameter type value, meant to 1485 be used for carrying certificates, is reserved, though: CERT, Type 1486 768; see Section 5.2. 1488 5. Packet Formats 1490 5.1. Payload Format 1492 All HIP packets start with a fixed header. 1494 0 1 2 3 1495 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 1496 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1497 | Next Header | Header Length |0| Packet Type | VER. | RES.|1| 1498 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1499 | Checksum | Controls | 1500 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1501 | Sender's Host Identity Tag (HIT) | 1502 | | 1503 | | 1504 | | 1505 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1506 | Receiver's Host Identity Tag (HIT) | 1507 | | 1508 | | 1509 | | 1510 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1511 | | 1512 / HIP Parameters / 1513 / / 1514 | | 1515 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1517 The HIP header is logically an IPv6 extension header. However, this 1518 document does not describe processing for Next Header values other 1519 than decimal 59, IPPROTO_NONE, the IPv6 'no next header' value. 1520 Future documents MAY do so. However, current implementations MUST 1521 ignore trailing data if an unimplemented Next Header value is 1522 received. 1524 The Header Length field contains the length of the HIP Header and HIP 1525 parameters in 8-byte units, excluding the first 8 bytes. Since all 1526 HIP headers MUST contain the sender's and receiver's HIT fields, the 1527 minimum value for this field is 4, and conversely, the maximum length 1528 of the HIP Parameters field is (255*8)-32 = 2008 bytes. Note: this 1529 sets an additional limit for sizes of parameters included in the 1530 Parameters field, independent of the individual parameter maximum 1531 lengths. 1533 The Packet Type indicates the HIP packet type. The individual packet 1534 types are defined in the relevant sections. If a HIP host receives a 1535 HIP packet that contains an unknown packet type, it MUST drop the 1536 packet. 1538 The HIP Version is four bits. The current version is 2. The version 1539 number is expected to be incremented only if there are incompatible 1540 changes to the protocol. Most extensions can be handled by defining 1541 new packet types, new parameter types, or new controls. 1543 The following three bits are reserved for future use. They MUST be 1544 zero when sent, and they SHOULD be ignored when handling a received 1545 packet. 1547 The two fixed bits in the header are reserved for potential SHIM6 1548 compatibility [RFC5533]. For implementations adhering (only) to this 1549 specification, they MUST be set as shown when sending and MUST be 1550 ignored when receiving. This is to ensure optimal forward 1551 compatibility. Note that for implementations that implement other 1552 compatible specifications in addition to this specification, the 1553 corresponding rules may well be different. For example, in the case 1554 that the forthcoming SHIM6 protocol happens to be compatible with 1555 this specification, an implementation that implements both this 1556 specification and the SHIM6 protocol may need to check these bits in 1557 order to determine how to handle the packet. 1559 The HIT fields are always 128 bits (16 bytes) long. 1561 5.1.1. Checksum 1563 Since the checksum covers the source and destination addresses in the 1564 IP header, it must be recomputed on HIP-aware NAT devices. 1566 If IPv6 is used to carry the HIP packet, the pseudo-header [RFC2460] 1567 contains the source and destination IPv6 addresses, HIP packet length 1568 in the pseudo-header length field, a zero field, and the HIP protocol 1569 number (see Section 4) in the Next Header field. The length field is 1570 in bytes and can be calculated from the HIP header length field: (HIP 1571 Header Length + 1) * 8. 1573 In case of using IPv4, the IPv4 UDP pseudo-header format [RFC0768] is 1574 used. In the pseudo-header, the source and destination addresses are 1575 those used in the IP header, the zero field is obviously zero, the 1576 protocol is the HIP protocol number (see Section 4), and the length 1577 is calculated as in the IPv6 case. 1579 5.1.2. HIP Controls 1581 The HIP Controls section conveys information about the structure of 1582 the packet and capabilities of the host. 1584 The following fields have been defined: 1586 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1587 | | | | | | | | | | | | | | | |A| 1588 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1590 A - Anonymous: If this is set, the sender's HI in this packet is 1591 anonymous, i.e., one not listed in a directory. Anonymous HIs 1592 SHOULD NOT be stored. This control is set in packets R1 and/or 1593 I2. The peer receiving an anonymous HI may choose to refuse it. 1595 The rest of the fields are reserved for future use and MUST be set to 1596 zero on sent packets and ignored on received packets. 1598 5.1.3. HIP Fragmentation Support 1600 A HIP implementation must support IP fragmentation/reassembly. 1601 Fragment reassembly MUST be implemented in both IPv4 and IPv6, but 1602 fragment generation is REQUIRED to be implemented in IPv4 (IPv4 1603 stacks and networks will usually do this by default) and RECOMMENDED 1604 to be implemented in IPv6. In IPv6 networks, the minimum MTU is 1605 larger, 1280 bytes, than in IPv4 networks. The larger MTU size is 1606 usually sufficient for most HIP packets, and therefore fragment 1607 generation may not be needed. If a host expects to send HIP packets 1608 that are larger than the minimum IPv6 MTU, it MUST implement fragment 1609 generation even for IPv6. 1611 In IPv4 networks, HIP packets may encounter low MTUs along their 1612 routed path. Since HIP does not provide a mechanism to use multiple 1613 IP datagrams for a single HIP packet, support for path MTU discovery 1614 does not bring any value to HIP in IPv4 networks. HIP-aware NAT 1615 devices MUST perform any IPv4 reassembly/fragmentation. 1617 All HIP implementations have to be careful while employing a 1618 reassembly algorithm so that the algorithm is sufficiently resistant 1619 to DoS attacks. 1621 Because certificate chains can cause the packet to be fragmented and 1622 fragmentation can open implementation to denial-of-service attacks 1623 [KAU03], it is strongly recommended that the separate document 1624 specifying the certificate usage in the HIP Base Exchange defines the 1625 usage of "Hash and URL" formats rather than including certificates in 1626 exchanges. With this, most problems related to DoS attacks with 1627 fragmentation can be avoided. 1629 5.2. HIP Parameters 1631 The HIP Parameters are used to carry the public key associated with 1632 the sender's HIT, together with related security and other 1633 information. They consist of ordered parameters, encoded in TLV 1634 format. 1636 The following parameter types are currently defined. 1638 +------------------------+-------+----------+-----------------------+ 1639 | TLV | Type | Length | Data | 1640 +------------------------+-------+----------+-----------------------+ 1641 | R1_COUNTER | 128 | 12 | System Boot Counter | 1642 | | | | | 1643 | PUZZLE | 257 | 12 | K and Random #I | 1644 | | | | | 1645 | SOLUTION | 321 | 20 | K, Random #I and | 1646 | | | | puzzle solution J | 1647 | | | | | 1648 | SEQ | 385 | 4 | Update packet ID | 1649 | | | | number | 1650 | | | | | 1651 | ACK | 449 | variable | Update packet ID | 1652 | | | | number | 1653 | | | | | 1654 | DIFFIE_HELLMAN | 513 | variable | public key | 1655 | | | | | 1656 | HIP_CIPHER | 579 | variable | HIP encryption | 1657 | | | | algorithm | 1658 | | | | | 1659 | ENCRYPTED | 641 | variable | Encrypted part of I2 | 1660 | | | | packet | 1661 | | | | | 1662 | HOST_ID | 705 | variable | Host Identity with | 1663 | | | | Fully-Qualified | 1664 | | | | Domain FQDN (Name) or | 1665 | | | | Network Access | 1666 | | | | Identifier (NAI) | 1667 | | | | | 1668 | HIT_SUITE_LIST | 715 | variable | Ordered list of the | 1669 | | | | HIT suites supported | 1670 | | | | by the Responder | 1671 | | | | | 1672 | CERT | 768 | variable | HI Certificate; used | 1673 | | | | to transfer | 1674 | | | | certificates. Usage | 1675 | | | | is currently not | 1676 | | | | defined, but it will | 1677 | | | | be specified in a | 1678 | | | | separate document | 1679 | | | | once needed. | 1680 | | | | | 1681 | NOTIFICATION | 832 | variable | Informational data | 1682 | | | | | 1683 | ECHO_REQUEST_SIGNED | 897 | variable | Opaque data to be | 1684 | | | | echoed back; under | 1685 | | | | signature | 1686 | ECHO_RESPONSE_SIGNED | 961 | variable | Opaque data echoed | 1687 | | | | back; under signature | 1688 | | | | | 1689 | DH_GROUP_LIST | 2151 | variable | Ordered list of DH | 1690 | | | | Group IDs supported | 1691 | | | | by a host | 1692 | | | | | 1693 | HIP_MAC | 61505 | variable | HMAC-based message | 1694 | | | | authentication code, | 1695 | | | | with key material | 1696 | | | | from KEYMAT | 1697 | | | | | 1698 | HIP_MAC_2 | 61569 | variable | HMAC based message | 1699 | | | | authentication code, | 1700 | | | | with key material | 1701 | | | | from KEYMAT. | 1702 | | | | Compared to HIP_MAC, | 1703 | | | | the HOST_ID parameter | 1704 | | | | is included in | 1705 | | | | HIP_MAC_2 | 1706 | | | | calculation. | 1707 | | | | | 1708 | HIP_SIGNATURE_2 | 61633 | variable | Signature of the R1 | 1709 | | | | packet | 1710 | | | | | 1711 | HIP_SIGNATURE | 61697 | variable | Signature of the | 1712 | | | | packet | 1713 | | | | | 1714 | ECHO_REQUEST_UNSIGNED | 63661 | variable | Opaque data to be | 1715 | | | | echoed back; after | 1716 | | | | signature | 1717 | | | | | 1718 | ECHO_RESPONSE_UNSIGNED | 63425 | variable | Opaque data echoed | 1719 | | | | back; after signature | 1720 +------------------------+-------+----------+-----------------------+ 1722 Because the ordering (from lowest to highest) of HIP parameters is 1723 strictly enforced (see Section 5.2.1), the parameter type values for 1724 existing parameters have been spaced to allow for future protocol 1725 extensions. Parameters numbered between 0-1023 are used in HIP 1726 handshake and update procedures and are covered by signatures. 1727 Parameters numbered between 1024-2047 are reserved. Parameters 1728 numbered between 2048-4095 are used for parameters that are covered 1729 by a signature but may also be present in packets without signatures. 1730 Parameters numbered between 4096 and (2^16 - 2^12) 61439 are 1731 reserved. Parameters numbered between 61440-62463 are used for 1732 signatures and signed MACs. Parameters numbered between 62464-63487 1733 are used for parameters that fall outside of the signed area of the 1734 packet. Parameters numbered between 63488-64511 are used for 1735 rendezvous and other relaying services. Parameters numbered between 1736 64512-65535 are reserved. 1738 5.2.1. TLV Format 1740 The TLV-encoded parameters are described in the following 1741 subsections. The type-field value also describes the order of these 1742 fields in the packet, except for type values from 2048 to 4095 which 1743 are reserved for new transport forms. The parameters MUST be 1744 included in the packet such that their types form an increasing 1745 order. If the parameter can exist multiple times in the packet, the 1746 type value may be the same in consecutive parameters. If the order 1747 does not follow this rule, the packet is considered to be malformed 1748 and it MUST be discarded. 1750 Parameters using type values from 2048 up to 4095 are transport 1751 formats. Currently, one transport format is defined: the ESP 1752 transport format [RFC5202]. The order of these parameters does not 1753 follow the order of their type value, but they are put in the packet 1754 in order of preference. The first of the transport formats it the 1755 most preferred, and so on. 1757 All of the TLV parameters have a length (including Type and Length 1758 fields), which is a multiple of 8 bytes. When needed, padding MUST 1759 be added to the end of the parameter so that the total length becomes 1760 a multiple of 8 bytes. This rule ensures proper alignment of data. 1761 Any added padding bytes MUST be zeroed by the sender, and their 1762 values SHOULD NOT be checked by the receiver. 1764 Consequently, the Length field indicates the length of the Contents 1765 field (in bytes). The total length of the TLV parameter (including 1766 Type, Length, Contents, and Padding) is related to the Length field 1767 according to the following formula: 1769 Total Length = 11 + Length - (Length + 3) % 8; 1771 where % is the modulo operator 1772 0 1 2 3 1773 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 1774 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1775 | Type |C| Length | 1776 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1777 | | 1778 / Contents / 1779 / +-+-+-+-+-+-+-+-+ 1780 | | Padding | 1781 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1783 Type Type code for the parameter. 16 bits long, C-bit 1784 being part of the Type code. 1785 C Critical. One if this parameter is critical, and 1786 MUST be recognized by the recipient, zero otherwise. 1787 The C bit is considered to be a part of the Type 1788 field. Consequently, critical parameters are always 1789 odd and non-critical ones have an even value. 1790 Length Length of the Contents, in bytes excluding Type, 1791 Length, and Padding. 1792 Contents Parameter specific, defined by Type 1793 Padding Padding, 0-7 bytes, added if needed 1795 Critical parameters MUST be recognized by the recipient. If a 1796 recipient encounters a critical parameter that it does not recognize, 1797 it MUST NOT process the packet any further. It MAY send an ICMP or 1798 NOTIFY, as defined in Section 4.3. 1800 Non-critical parameters MAY be safely ignored. If a recipient 1801 encounters a non-critical parameter that it does not recognize, it 1802 SHOULD proceed as if the parameter was not present in the received 1803 packet. 1805 5.2.2. Defining New Parameters 1807 Future specifications may define new parameters as needed. When 1808 defining new parameters, care must be taken to ensure that the 1809 parameter type values are appropriate and leave suitable space for 1810 other future extensions. One must remember that the parameters MUST 1811 always be arranged in increasing order by Type code, thereby limiting 1812 the order of parameters (see Section 5.2.1). 1814 The following rules must be followed when defining new parameters. 1816 1. The low-order bit C of the Type code is used to distinguish 1817 between critical and non-critical parameters. 1819 2. A new parameter may be critical only if an old recipient ignoring 1820 it would cause security problems. In general, new parameters 1821 SHOULD be defined as non-critical, and expect a reply from the 1822 recipient. 1824 3. If a system implements a new critical parameter, it MUST provide 1825 the ability to set the associated feature off, such that the 1826 critical parameter is not sent at all. The configuration option 1827 must be well documented. Implementations operating in a mode 1828 adhering to this specification MUST disable the sending of new 1829 critical parameters. In other words, the management interface 1830 MUST allow vanilla standards-only mode as a default configuration 1831 setting, and MAY allow new critical payloads to be configured on 1832 (and off). 1834 4. See Section 9 for allocation rules regarding Type codes. 1836 5.2.3. R1_COUNTER 1838 0 1 2 3 1839 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 1840 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1841 | Type | Length | 1842 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1843 | Reserved, 4 bytes | 1844 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1845 | R1 generation counter, 8 bytes | 1846 | | 1847 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1849 Type 128 1850 Length 12 1851 R1 generation 1852 counter The current generation of valid puzzles 1854 The R1_COUNTER parameter contains a 64-bit unsigned integer in 1855 network-byte order, indicating the current generation of valid 1856 puzzles. The sender is supposed to increment this counter 1857 periodically. It is RECOMMENDED that the counter value is 1858 incremented at least as often as old PUZZLE values are deprecated so 1859 that SOLUTIONs to them are no longer accepted. 1861 The R1_COUNTER parameter is optional. It SHOULD be included in the 1862 R1 (in which case, it is covered by the signature), and if present in 1863 the R1, it MAY be echoed (including the Reserved field verbatim) by 1864 the Initiator in the I2. 1866 5.2.4. PUZZLE 1868 0 1 2 3 1869 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 1870 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1871 | Type | Length | 1872 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1873 | K, 1 byte | Lifetime | Opaque, 2 bytes | 1874 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1875 | Random #I, n bytes | 1876 / / 1877 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1879 Type 257 1880 Length 4+RHASH-len/8 1881 K K is the number of verified bits 1882 Lifetime puzzle lifetime 2^(value-32) seconds 1883 Opaque data set by the Responder, indexing the puzzle 1884 Random #I random number of size RHASH-len bits 1886 Random #I is represented as a n-bit integer (where n is RHASH-len/2), 1887 K and Lifetime as 8-bit integers, all in network byte order. 1889 The PUZZLE parameter contains the puzzle difficulty K and a n-bit 1890 puzzle random integer #I. The Puzzle Lifetime indicates the time 1891 during which the puzzle solution is valid, and sets a time limit that 1892 should not be exceeded by the Initiator while it attempts to solve 1893 the puzzle. The lifetime is indicated as a power of 2 using the 1894 formula 2^(Lifetime-32) seconds. A puzzle MAY be augmented with an 1895 ECHO_REQUEST_SIGNED or an ECHO_REQUEST_UNSIGNED parameter included in 1896 the R1; the contents of the echo request are then echoed back in the 1897 ECHO_RESPONSE_SIGNED or in the ECHO_RESPONSE_UNSIGNED, allowing the 1898 Responder to use the included information as a part of its puzzle 1899 processing. 1901 The Opaque and Random #I field are not covered by the HIP_SIGNATURE_2 1902 parameter. 1904 5.2.5. SOLUTION 1906 0 1 2 3 1907 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 1908 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1909 | Type | Length | 1910 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1911 | K, 1 byte | Reserved | Opaque, 2 bytes | 1912 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1913 | Random #I, n bytes | 1914 / / 1915 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1916 | Puzzle solution #J, n bytes | 1917 / / 1918 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1920 Type 321 1921 Length 4 + RHASH-len/4 1922 K K is the number of verified bits 1923 Reserved zero when sent, ignored when received 1924 Opaque copied unmodified from the received PUZZLE 1925 parameter 1926 Random #I random number of size RHASH-len bits 1927 Puzzle solution #J random number of size RHASH-len bits 1929 Random #I and Random #J are represented as n-bit integers (where n is 1930 RHASH-len/2), K as an 8-bit integer, all in network byte order. 1932 The SOLUTION parameter contains a solution to a puzzle. It also 1933 echoes back the random difficulty K, the Opaque field, and the puzzle 1934 integer #I. 1936 5.2.6. DIFFIE_HELLMAN 1938 0 1 2 3 1939 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 1940 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1941 | Type | Length | 1942 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1943 | Group ID | Public Value Length | Public Value / 1944 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1945 / | 1946 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1947 / | Padding | 1948 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1950 Type 513 1951 Length length in octets, excluding Type, Length, and 1952 Padding 1953 Group ID defines values for p and g 1954 Public Value length of the following Public Value in octets 1955 Length 1956 Public Value the sender's public Diffie-Hellman key 1958 The following Group IDs have been defined: 1960 Group Value 1961 Reserved 0 1962 DEPRECATED 1 1963 DEPRECATED 2 1964 1536-bit MODP group 3 [RFC3526] 1965 3072-bit MODP group 4 [RFC3526] 1966 DEPRECATED 5 1967 DEPRECATED 6 1968 160-bit random ECP group 7 [Appendix D, draft-mcgrew-fundamental-ecc-02.txt] 1969 256-bit random ECP group 8 [RFC4753, draft-mcgrew-fundamental-ecc-02.txt] 1970 384-bit random ECP group 9 [RFC4753, draft-mcgrew-fundamental-ecc-02.txt] 1971 521-bit random ECP group 10 [RFC4753, draft-mcgrew-fundamental-ecc-02.txt] 1973 The MODP Diffie-Hellman groups are defined in [RFC3526]. The ECDH 1974 groups 8 - 10 are defined in [RFC4753] and [fundamental-ecc]. ECDH 1975 group 7 is covered in Appendix D. 1977 A HIP implementation MUST implement Group ID 3. The 160-bit ECP 1978 group can be used when lower security is enough (e.g., web surfing) 1979 and when the equipment is not powerful enough (e.g., some PDAs). 1980 Implementations SHOULD implement Group IDs 4 and 8. 1982 To avoid unnecessary failures during the base exchange, the rest of 1983 the groups SHOULD be implemented in hosts where resources are 1984 adequate. 1986 5.2.7. HIP_CIPHER 1988 0 1 2 3 1989 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 1990 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1991 | Type | Length | 1992 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1993 | Cipher ID #1 | Cipher ID #2 | 1994 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1995 | Cipher ID #n | Padding | 1996 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1998 Type 579 1999 Length length in octets, excluding Type, Length, and 2000 Padding 2001 Cipher ID defines the cipher algorithm to be used for 2002 encrypting parts of the HIP packet 2004 The following Cipher IDs are defined: 2006 Suite ID Value 2008 RESERVED 0 2009 NULL-ENCRYPT 1 ([RFC2410]) 2010 AES-128-CBC 2 ([RFC3602]) 2011 3DES-CBC 3 ([RFC2451]) 2013 The sender of a HIP_CIPHER parameter MUST make sure that there are no 2014 more than six (6) Cipher IDs in one HIP_CIPHER parameter. 2015 Conversely, a recipient MUST be prepared to handle received transport 2016 parameters that contain more than six Cipher IDs by accepting the 2017 first six Cipher IDs and dropping the rest. The limited number of 2018 transforms sets the maximum size of the HIP_CIPHER parameter. As the 2019 default configuration, the HIP_CIPHER parameter MUST contain at least 2020 one of the mandatory Cipher IDs. There MAY be a configuration option 2021 that allows the administrator to override this default. 2023 The Responder lists supported and desired Cipher IDs in order of 2024 preference in the R1, up to the maximum of six Cipher IDs. The 2025 Initiator MUST choose only one of the corresponding Cipher IDs. That 2026 Cipher ID will be used for generating the ENCRYPTED parameter. 2028 Mandatory implementation: AES-CBC, NULL-ENCRYPTION is included for 2029 testing purposes. NULL-ENCRYPTION SHOULD NOT be configurable via the 2030 UI. 2032 5.2.8. HOST_ID 2034 0 1 2 3 2035 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 2036 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2037 | Type | Length | 2038 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2039 | HI Length |DI-type| DI Length | 2040 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2041 | Host Identity / 2042 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2043 / | Domain Identifier / 2044 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2045 / | Padding | 2046 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2048 Type 705 2049 Length length in octets, excluding Type, Length, and 2050 Padding 2051 HI Length length of the Host Identity in octets 2052 DI-type type of the following Domain Identifier field 2053 DI Length length of the FQDN or NAI in octets 2054 Host Identity actual Host Identity 2055 Domain Identifier the identifier of the sender 2057 The Host Identity is represented in the DNSKEY format for RSA and 2058 DSA. For these, the Public Key field from RFC 4034 [RFC4034] is 2059 used. For ECC Host Identities this field is defined here directly. 2061 Algorithms Values 2063 RESERVED 0 2064 DSA 3 [RFC2536] (RECOMMENDED) 2065 RSA 5 [RFC3110] (REQUIRED) 2066 ECDSA 7 [fundamental-ecc] (RECOMMENDED) 2068 For ECDSA the Host Identity is represented by the following fields: 2070 0 1 2 3 2071 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 2072 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2073 | ECC Curve | | 2074 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2075 | Public Key / 2076 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2078 ECC Curve Curve label 2079 Public Key Represented in Octect-string format [fundamental-ecc] 2081 Required ECC Curve values are: 2083 Curve Values 2085 RESERVED 0 2086 NIST-ECDSA-256 1 [RFC4754] 2087 NIST-ECDSA-384 2 [RFC4754] 2088 brainpoolP160r1 3 [RFC5639] 2090 The following DI-types have been defined: 2092 Type Value 2093 none included 0 2094 FQDN 1 2095 NAI 2 2097 FQDN Fully Qualified Domain Name, in binary format. 2098 NAI Network Access Identifier 2100 The format for the FQDN is defined in RFC 1035 [RFC1035] Section 3.1. 2101 The format for NAI is defined in [RFC4282] 2103 If there is no Domain Identifier, i.e., the DI-type field is zero, 2104 the DI Length field is set to zero as well. 2106 5.2.9. HIT_SUITE_LIST 2108 0 1 2 3 2109 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 2110 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2111 | Type | Length | 2112 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2113 | ID #1 | ID #2 | ID #3 | ID #4 | 2114 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2115 | ID #n | Padding | 2116 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2118 Type 715 2119 Length number of HIT Suite IDs 2120 ID defines a HIT Suite ID supported by the host. 2121 The list of IDs is ordered by preference of the 2122 host. Each HIT Suite ID is one octet long. The four 2123 higher-order bits correspond to the HIT Suite ID in 2124 the ORCHID OGA field. The four lower-order bits are 2125 set to 0. 2127 The ID field in the HIT_SUITE_LIST is defined as eight-bit field 2128 opposed to the four-bit HIT Suite ID and OGA field in the ORCHID. 2129 This difference is a measure to accommodate larger HIT Suite IDs if 2130 the 16 available values prove insufficient. In that case, one of the 2131 16 values (0) will be used to indicate that four additional bits of 2132 the ORCHID will be used to encode the HIT Suite ID. Hence, the 2133 current four-bit HIT Suite-IDs only use the four higher order bits in 2134 the ID field. Future documents may define the use of the four lower- 2135 order bits in the ID field. ^ 2137 The following HIT Suites ID are defined: 2139 HIT Suite ID 2140 RESERVED 0 2141 RSA/DSA/SHA-1 1 (REQUIRED) 2142 ECDSA/SHA-256 2 (RECOMMENDED) 2143 ECDSA/SHA-384 3 (RECOMMENDED) 2145 The HIT_SUITE_LIST parameter contains a list of the supported HIT 2146 suite IDs of the Responder. The Responder sends the HIT_SUITE_LIST 2147 in the signed part of the R1 packet. Based on the HIT_SUITE_LIST, 2148 the Initiator can determine which source HITs are supported by the 2149 Responder. 2151 5.2.10. DH_GROUP_LIST 2153 0 1 2 3 2154 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 2155 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2156 | Type | Length | 2157 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2158 | DH GROUP ID #1| DH GROUP ID #2| DH GROUP ID #3| DH GROUP ID #4| 2159 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2160 | DH GROUP ID #n| Padding | 2161 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2163 Type 2151 2164 Length number of DH Group IDs 2165 DH GROUP ID defines a DH GROUP ID supported by the host. 2166 The list of IDs is ordered by preference of the 2167 host. The list of define DH Group IDs in the 2168 DIFFIE_HELLMAN parameter. Each DH Group ID is one 2169 octet long. 2171 The DH_GROUP_LIST parameter contains the list of supported DH Group 2172 IDs of a host. The Initiator sends the DH_GROUP_LIST in the I1 2173 packet, the Responder sends it in the signed part of the R1 packet. 2174 The DH Group IDs in the DH_GROUP_LIST are listed in the order of 2175 their preference of the host. DH Group IDs that are listed first are 2176 preferred compared to the DH Group IDs listed later. The information 2177 in the DH_GROUP_LIST allows the Responder to select the DH group 2178 preferred by itself and the Initiator. Based on the DH_GROUP_LIST in 2179 the R1 packet, the Initiator can determine if the Responder has 2180 selected the best possible choice based on the Initiator's and 2181 Responder's preferences. If the Responder's choice differs from the 2182 best choice, the Initiator can conclude that there was an attempted 2183 downgrade attack. 2185 When selecting the DH group for the DIFFIE_HELLMAN parameter in the 2186 R1 packet, the Responder MUST select the first DH Group ID in the 2187 Responder's DH_GROUP_LIST that is contained in the Initiator's 2188 DH_GROUP_LIST. 2190 5.2.11. HIP_MAC 2192 0 1 2 3 2193 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 2194 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2195 | Type | Length | 2196 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2197 | | 2198 | HMAC | 2199 / / 2200 / +-------------------------------+ 2201 | | Padding | 2202 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2204 Type 61505 2205 Length length in octets, excluding Type, Length, and 2206 Padding 2207 HMAC HMAC computed over the HIP packet, excluding the 2208 HIP_MAC parameter and any following parameters, such 2209 as HIP_SIGNATURE, HIP_SIGNATURE_2, 2210 ECHO_REQUEST_UNSIGNED, or ECHO_RESPONSE_UNSIGNED. 2211 The checksum field MUST be set to zero and the HIP 2212 header length in the HIP common header MUST be 2213 calculated not to cover any excluded parameters 2214 when the HMAC is calculated. The size of the 2215 HMAC is the natural size of the hash computation 2216 output depending on the used hash function. 2218 The HMAC uses RHASH as hash algorithm. The calculation and 2219 verification process is presented in Section 6.4.1. 2221 5.2.12. HIP_MAC_2 2223 The parameter structure is the same as in Section 5.2.11. The fields 2224 are: 2226 Type 61569 2227 Length length in octets, excluding Type, Length, and 2228 Padding 2229 HMAC HMAC computed over the HIP packet, excluding the 2230 HIP_MAC parameter and any following parameters such 2231 as HIP_SIGNATURE, HIP_SIGNATURE_2, 2232 ECHO_REQUEST_UNSIGNED, or ECHO_RESPONSE_UNSIGNED, 2233 and including an additional sender's HOST_ID 2234 parameter during the HMAC calculation. The 2235 checksum field MUST be set to zero and the HIP 2236 header length in the HIP common header MUST be 2237 calculated not to cover any excluded parameters 2238 when the HMAC is calculated. The size of the 2239 HMAC is the natural size of the hash computation 2240 output depending on the used hash function. 2242 The HMAC uses RHASH as hash algorithm. The calculation and 2243 verification process is presented in Section 6.4.1. 2245 5.2.13. HIP_SIGNATURE 2247 0 1 2 3 2248 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 2249 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2250 | Type | Length | 2251 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2252 | SIG alg | Signature / 2253 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2254 / | Padding | 2255 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2257 Type 61697 2258 Length length in octets, excluding Type, Length, and 2259 Padding 2260 SIG alg signature algorithm 2261 Signature the signature is calculated over the HIP packet, 2262 excluding the HIP_SIGNATURE parameter and any 2263 parameters that follow the HIP_SIGNATURE parameter. 2264 The checksum field MUST be set to zero, and the HIP 2265 header length in the HIP common header MUST be 2266 calculated only to the beginning of the 2267 HIP_SIGNATURE parameter when the signature is 2268 calculated. 2270 The signature algorithms are defined in Section 5.2.8. The signature 2271 in the Signature field is encoded using the proper method depending 2272 on the signature algorithm (e.g., according to [RFC3110] in case of 2273 RSA/SHA-1, according to [RFC5702] in case of RSA/SHA-256, according 2274 to [RFC2536] in case of DSA, or according to [fundamental-ecc] in 2275 case of ECDSA). 2277 The HIP_SIGNATURE calculation and verification process is presented 2278 in Section 6.4.2. 2280 5.2.14. HIP_SIGNATURE_2 2282 The parameter structure is the same as in Section 5.2.13. The fields 2283 are: 2285 Type 61633 2286 Length length in octets, excluding Type, Length, and 2287 Padding 2288 SIG alg signature algorithm 2289 Signature Within the R1 packet that contains the 2290 HIP_SIGNATURE_2 parameter, the Initiator's HIT, the 2291 checksum field, and the Opaque and Random #I fields 2292 in the PUZZLE parameter MUST be set to zero while 2293 computing the HIP_SIGNATURE_2 signature. Further, 2294 the HIP packet length in the HIP header MUST be 2295 adjusted as if the HIP_SIGNATURE_2 was not in the 2296 packet during the signature calculation, i.e., the 2297 HIP packet length points to the beginning of 2298 the HIP_SIGNATURE_2 parameter during signing and 2299 verification. 2301 Zeroing the Initiator's HIT makes it possible to create R1 packets 2302 beforehand, to minimize the effects of possible DoS attacks. Zeroing 2303 the Random #I and Opaque fields within the PUZZLE parameter allows 2304 these fields to be populated dynamically on precomputed R1s. 2306 Signature calculation and verification follows the process in 2307 Section 6.4.2. 2309 5.2.15. SEQ 2311 0 1 2 3 2312 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 2313 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2314 | Type | Length | 2315 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2316 | Update ID | 2317 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2319 Type 385 2320 Length 4 2321 Update ID 32-bit sequence number 2323 The Update ID is an unsigned quantity, initialized by a host to zero 2324 upon moving to ESTABLISHED state. The Update ID has scope within a 2325 single HIP association, and not across multiple associations or 2326 multiple hosts. The Update ID is incremented by one before each new 2327 UPDATE that is sent by the host; the first UPDATE packet originated 2328 by a host has an Update ID of 0. 2330 5.2.16. ACK 2332 0 1 2 3 2333 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 2334 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2335 | Type | Length | 2336 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2337 | peer Update ID | 2338 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2340 Type 449 2341 Length variable (multiple of 4) 2342 peer Update ID 32-bit sequence number corresponding to the 2343 Update ID being ACKed. 2345 The ACK parameter includes one or more Update IDs that have been 2346 received from the peer. The Length field identifies the number of 2347 peer Update IDs that are present in the parameter. 2349 5.2.17. ENCRYPTED 2351 0 1 2 3 2352 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 2353 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2354 | Type | Length | 2355 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2356 | Reserved | 2357 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2358 | IV / 2359 / / 2360 / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2361 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / 2362 / Encrypted data / 2363 / / 2364 / +-------------------------------+ 2365 / | Padding | 2366 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2368 Type 641 2369 Length length in octets, excluding Type, Length, and 2370 Padding 2371 Reserved zero when sent, ignored when received 2372 IV Initialization vector, if needed, otherwise 2373 nonexistent. The length of the IV is inferred from 2374 the HIP_CIPHER. 2375 Encrypted The data is encrypted using an encryption algorithm 2376 data as defined in the HIP_CIPHER parameter. 2378 The ENCRYPTED parameter encapsulates another parameter, the encrypted 2379 data, which holds one or more HIP parameters in block encrypted form. 2381 Consequently, the first fields in the encapsulated parameter(s) are 2382 Type and Length of the first such parameter, allowing the contents to 2383 be easily parsed after decryption. 2385 The field labelled "Encrypted data" consists of the output of one or 2386 more HIP parameters concatenated together that have been passed 2387 through an encryption algorithm. Each of these inner parameters is 2388 padded according to the rules of Section 5.2.1 for padding individual 2389 parameters. As a result, the concatenated parameters will be a block 2390 of data that is 8-byte aligned. 2392 Some encryption algorithms require that the data to be encrypted must 2393 be a multiple of the cipher algorithm block size. In this case, the 2394 above block of data MUST include additional padding, as specified by 2395 the encryption algorithm. The size of the extra padding is selected 2396 so that the length of the unencrypted data block is a multiple of the 2397 cipher block size. The encryption algorithm may specify padding 2398 bytes other than zero; for example, AES [FIPS.197.2001] uses the 2399 PKCS5 padding scheme (see section 6.1.1 of [RFC2898]) where the 2400 remaining n bytes to fill the block each have the value n. This 2401 yields an "unencrypted data" block that is transformed to an 2402 "encrypted data" block by the cipher suite. This extra padding added 2403 to the set of parameters to satisfy the cipher block alignment rules 2404 is not counted in HIP TLV length fields, and this extra padding 2405 should be removed by the cipher suite upon decryption. 2407 Note that the length of the cipher suite output may be smaller or 2408 larger than the length of the set of parameters to be encrypted, 2409 since the encryption process may compress the data or add additional 2410 padding to the data. 2412 Once this encryption process is completed, the Encrypted data field 2413 is ready for inclusion in the Parameter. If necessary, additional 2414 Padding for 8-byte alignment is then added according to the rules of 2415 Section 5.2.1. 2417 5.2.18. NOTIFICATION 2419 The NOTIFICATION parameter is used to transmit informational data, 2420 such as error conditions and state transitions, to a HIP peer. A 2421 NOTIFICATION parameter may appear in the NOTIFY packet type. The use 2422 of the NOTIFICATION parameter in other packet types is for further 2423 study. 2425 0 1 2 3 2426 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 2427 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2428 | Type | Length | 2429 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2430 | Reserved | Notify Message Type | 2431 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2432 | / 2433 / Notification Data / 2434 / +---------------+ 2435 / | Padding | 2436 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2438 Type 832 2439 Length length in octets, excluding Type, Length, and 2440 Padding 2441 Reserved zero when sent, ignored when received 2442 Notify Message specifies the type of notification 2443 Type 2444 Notification informational or error data transmitted in addition 2445 Data to the Notify Message Type. Values for this field 2446 are type specific (see below). 2447 Padding any Padding, if necessary, to make the parameter a 2448 multiple of 8 bytes. 2450 Notification information can be error messages specifying why an SA 2451 could not be established. It can also be status data that a process 2452 managing an SA database wishes to communicate with a peer process. 2453 The table below lists the Notification messages and their 2454 corresponding values. 2456 To avoid certain types of attacks, a Responder SHOULD avoid sending a 2457 NOTIFICATION to any host with which it has not successfully verified 2458 a puzzle solution. 2460 Types in the range 0-16383 are intended for reporting errors and in 2461 the range 16384-65535 for other status information. An 2462 implementation that receives a NOTIFY packet with a NOTIFICATION 2463 error parameter in response to a request packet (e.g., I1, I2, 2464 UPDATE) SHOULD assume that the corresponding request has failed 2465 entirely. Unrecognized error types MUST be ignored except that they 2466 SHOULD be logged. 2468 Notify payloads with status types MUST be ignored if not recognized. 2470 NOTIFICATION PARAMETER - ERROR TYPES Value 2471 ------------------------------------ ----- 2472 UNSUPPORTED_CRITICAL_PARAMETER_TYPE 1 2474 Sent if the parameter type has the "critical" bit set and the 2475 parameter type is not recognized. Notification Data contains 2476 the two-octet parameter type. 2478 INVALID_SYNTAX 7 2480 Indicates that the HIP message received was invalid because 2481 some type, length, or value was out of range or because the 2482 request was rejected for policy reasons. To avoid a denial- 2483 of-service attack using forged messages, this status may only be 2484 returned for packets whose HIP_MAC (if present) and SIGNATURE have 2485 been verified. This status MUST be sent in response to any 2486 error not covered by one of the other status types, and should 2487 not contain details to avoid leaking information to someone 2488 probing a node. To aid debugging, more detailed error 2489 information SHOULD be written to a console or log. 2491 NO_DH_PROPOSAL_CHOSEN 14 2493 None of the proposed group IDs was acceptable. 2495 INVALID_DH_CHOSEN 15 2497 The DH Group ID field does not correspond to one offered 2498 by the Responder. 2500 NO_HIP_PROPOSAL_CHOSEN 16 2502 None of the proposed HIT Suites or HIP Encryption Algorithms was 2503 acceptable. 2505 INVALID_HIP_CIPHER_CHOSEN 17 2507 The HIP_CIPHER Crypto ID does not correspond to 2508 one offered by the Responder. 2510 AUTHENTICATION_FAILED 24 2512 Sent in response to a HIP signature failure, except when 2513 the signature verification fails in a NOTIFY message. 2515 CHECKSUM_FAILED 26 2517 Sent in response to a HIP checksum failure. 2519 HIP_MAC_FAILED 28 2520 Sent in response to a HIP HMAC failure. 2522 ENCRYPTION_FAILED 32 2524 The Responder could not successfully decrypt the 2525 ENCRYPTED parameter. 2527 INVALID_HIT 40 2529 Sent in response to a failure to validate the peer's 2530 HIT from the corresponding HI. 2532 BLOCKED_BY_POLICY 42 2534 The Responder is unwilling to set up an association 2535 for some policy reason (e.g., received HIT is NULL 2536 and policy does not allow opportunistic mode). 2538 SERVER_BUSY_PLEASE_RETRY 44 2540 The Responder is unwilling to set up an association as it is 2541 suffering under some kind of overload and has chosen to shed load 2542 by rejecting the Initiator's request. The Initiator may retry; 2543 however, the Initiator MUST find another (different) puzzle 2544 solution for any such retries. Note that the Initiator may need 2545 to obtain a new puzzle with a new I1/R1 exchange. 2547 NOTIFY MESSAGES - STATUS TYPES Value 2548 ------------------------------ ----- 2550 I2_ACKNOWLEDGEMENT 16384 2552 The Responder has an I2 from the Initiator but had to queue the 2553 I2 for processing. The puzzle was correctly solved and the 2554 Responder is willing to set up an association but currently has a 2555 number of I2s in the processing queue. R2 will be sent after the 2556 I2 has been processed. 2558 5.2.19. ECHO_REQUEST_SIGNED 2560 0 1 2 3 2561 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 2562 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2563 | Type | Length | 2564 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2565 | Opaque data (variable length) | 2566 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2568 Type 897 2569 Length variable 2570 Opaque data opaque data, supposed to be meaningful only to the 2571 node that sends ECHO_REQUEST_SIGNED and receives a 2572 corresponding ECHO_RESPONSE_SIGNED or 2573 ECHO_RESPONSE_UNSIGNED. 2575 The ECHO_REQUEST_SIGNED parameter contains an opaque blob of data 2576 that the sender wants to get echoed back in the corresponding reply 2577 packet. 2579 The ECHO_REQUEST_SIGNED and corresponding echo response parameters 2580 MAY be used for any purpose where a node wants to carry some state in 2581 a request packet and get it back in a response packet. The 2582 ECHO_REQUEST_SIGNED is covered by the HIP_MAC and SIGNATURE. A HIP 2583 packet can contain only one ECHO_REQUEST_SIGNED or 2584 ECHO_REQUEST_UNSIGNED parameter. The ECHO_REQUEST_SIGNED parameter 2585 MUST be responded to with a corresponding echo response. 2586 ECHO_RESPONSE_SIGNED SHOULD be used, but if it is not possible, e.g., 2587 due to a middlebox-provided response, it MAY be responded to with an 2588 ECHO_RESPONSE_UNSIGNED. 2590 5.2.20. ECHO_REQUEST_UNSIGNED 2592 0 1 2 3 2593 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 2594 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2595 | Type | Length | 2596 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2597 | Opaque data (variable length) | 2598 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2600 Type 63661 2601 Length variable 2602 Opaque data opaque data, supposed to be meaningful only to the 2603 node that sends ECHO_REQUEST_UNSIGNED and receives a 2604 corresponding ECHO_RESPONSE_UNSIGNED. 2606 The ECHO_REQUEST_UNSIGNED parameter contains an opaque blob of data 2607 that the sender wants to get echoed back in the corresponding reply 2608 packet. 2610 The ECHO_REQUEST_UNSIGNED and corresponding echo response parameters 2611 MAY be used for any purpose where a node wants to carry some state in 2612 a request packet and get it back in a response packet. The 2613 ECHO_REQUEST_UNSIGNED is not covered by the HIP_MAC and SIGNATURE. A 2614 HIP packet can contain one or more ECHO_REQUEST_UNSIGNED parameters. 2615 It is possible that middleboxes add ECHO_REQUEST_UNSIGNED parameters 2616 in HIP packets passing by. The sender has to create the Opaque field 2617 so that it can later identify and remove the corresponding 2618 ECHO_RESPONSE_UNSIGNED parameter. 2620 The ECHO_REQUEST_UNSIGNED parameter MUST be responded to with an 2621 ECHO_RESPONSE_UNSIGNED parameter. 2623 5.2.21. ECHO_RESPONSE_SIGNED 2625 0 1 2 3 2626 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 2627 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2628 | Type | Length | 2629 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2630 | Opaque data (variable length) | 2631 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2633 Type 961 2634 Length variable 2635 Opaque data opaque data, copied unmodified from the 2636 ECHO_REQUEST_SIGNED or ECHO_REQUEST_UNSIGNED 2637 parameter that triggered this response. 2639 The ECHO_RESPONSE_SIGNED parameter contains an opaque blob of data 2640 that the sender of the ECHO_REQUEST_SIGNED wants to get echoed back. 2641 The opaque data is copied unmodified from the ECHO_REQUEST_SIGNED 2642 parameter. 2644 The ECHO_REQUEST_SIGNED and ECHO_RESPONSE_SIGNED parameters MAY be 2645 used for any purpose where a node wants to carry some state in a 2646 request packet and get it back in a response packet. The 2647 ECHO_RESPONSE_SIGNED is covered by the HIP_MAC and SIGNATURE. 2649 5.2.22. ECHO_RESPONSE_UNSIGNED 2651 0 1 2 3 2652 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 2653 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2654 | Type | Length | 2655 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2656 | Opaque data (variable length) | 2657 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2659 Type 63425 2660 Length variable 2661 Opaque data opaque data, copied unmodified from the 2662 ECHO_REQUEST_SIGNED or ECHO_REQUEST_UNSIGNED 2663 parameter that triggered this response. 2665 The ECHO_RESPONSE_UNSIGNED parameter contains an opaque blob of data 2666 that the sender of the ECHO_REQUEST_SIGNED or ECHO_REQUEST_UNSIGNED 2667 wants to get echoed back. The opaque data is copied unmodified from 2668 the corresponding echo request parameter. 2670 The echo request and ECHO_RESPONSE_UNSIGNED parameters MAY be used 2671 for any purpose where a node wants to carry some state in a request 2672 packet and get it back in a response packet. The 2673 ECHO_RESPONSE_UNSIGNED is not covered by the HIP_MAC and SIGNATURE. 2675 5.3. HIP Packets 2677 There are eight basic HIP packets (see Table 10). Four are for the 2678 HIP base exchange, one is for updating, one is for sending 2679 notifications, and two are for closing a HIP association. 2681 +------------------+------------------------------------------------+ 2682 | Packet type | Packet name | 2683 +------------------+------------------------------------------------+ 2684 | 1 | I1 - the HIP Initiator Packet | 2685 | | | 2686 | 2 | R1 - the HIP Responder Packet | 2687 | | | 2688 | 3 | I2 - the Second HIP Initiator Packet | 2689 | | | 2690 | 4 | R2 - the Second HIP Responder Packet | 2691 | | | 2692 | 16 | UPDATE - the HIP Update Packet | 2693 | | | 2694 | 17 | NOTIFY - the HIP Notify Packet | 2695 | | | 2696 | 18 | CLOSE - the HIP Association Closing Packet | 2697 | | | 2698 | 19 | CLOSE_ACK - the HIP Closing Acknowledgment | 2699 | | Packet | 2700 +------------------+------------------------------------------------+ 2702 Table 10: HIP packets and packet type numbers 2704 Packets consist of the fixed header as described in Section 5.1, 2705 followed by the parameters. The parameter part, in turn, consists of 2706 zero or more TLV-coded parameters. 2708 In addition to the base packets, other packet types will be defined 2709 later in separate specifications. For example, support for mobility 2710 and multi-homing is not included in this specification. 2712 See Notation (Section 2.2) for used operations. 2714 In the future, an OPTIONAL upper-layer payload MAY follow the HIP 2715 header. The Next Header field in the header indicates if there is 2716 additional data following the HIP header. The HIP packet, however, 2717 MUST NOT be fragmented. This limits the size of the possible 2718 additional data in the packet. 2720 5.3.1. I1 - the HIP Initiator Packet 2722 The HIP header values for the I1 packet: 2724 Header: 2725 Packet Type = 1 2726 SRC HIT = Initiator's HIT 2727 DST HIT = Responder's HIT, or NULL 2729 IP ( HIP ( DH_GROUP_LIST ) ) 2731 The I1 packet contains the fixed HIP header and the Initiator's 2732 DH_GROUP_LIST. 2734 Valid control bits: none 2736 The Initiator gets the Responder's HIT either from a DNS lookup of 2737 the Responder's FQDN, from some other repository, or from a local 2738 table. If the Initiator does not know the Responder's HIT, it may 2739 attempt to use opportunistic mode by using NULL (all zeros) as the 2740 Responder's HIT. See also "HIP Opportunistic Mode" (Section 4.1.8). 2742 Since this packet is so easy to spoof even if it were signed, no 2743 attempt is made to add to its generation or processing cost. 2745 The Initiator includes a DH_GROUP_LIST parameter in the I1 to inform 2746 the Responder of its preferred DH Group IDs. Note that the 2747 DH_GROUP_LIST in the I1 packet is not protected by a signature. 2749 Implementations MUST be able to handle a storm of received I1 2750 packets, discarding those with common content that arrive within a 2751 small time delta. 2753 5.3.2. R1 - the HIP Responder Packet 2755 The HIP header values for the R1 packet: 2757 Header: 2758 Packet Type = 2 2759 SRC HIT = Responder's HIT 2760 DST HIT = Initiator's HIT 2762 IP ( HIP ( [ R1_COUNTER, ] 2763 PUZZLE, 2764 DIFFIE_HELLMAN, 2765 HIP_CIPHER, 2766 HOST_ID, 2767 HIT_SUITE_LIST, 2768 DH_GROUP_LIST, 2769 [ ECHO_REQUEST_SIGNED, ] 2770 HIP_SIGNATURE_2 ) 2771 <, ECHO_REQUEST_UNSIGNED >i) 2773 Valid control bits: A 2775 If the Responder's HI is an anonymous one, the A control MUST be set. 2777 The Initiator's HIT MUST match the one received in I1. If the 2778 Responder has multiple HIs, the Responder's HIT used MUST match 2779 Initiator's request. If the Initiator used opportunistic mode, the 2780 Responder may select freely among its HIs. See also "HIP 2781 Opportunistic Mode" (Section 4.1.8). 2783 The R1 generation counter is used to determine the currently valid 2784 generation of puzzles. The value is increased periodically, and it 2785 is RECOMMENDED that it is increased at least as often as solutions to 2786 old puzzles are no longer accepted. 2788 The Puzzle contains a Random #I and the difficulty K. The difficulty 2789 K indicates the number of lower-order bits, in the puzzle hash 2790 result, that must be zeros; see Section 4.1.2. The Random #I is not 2791 covered by the signature and must be zeroed during the signature 2792 calculation, allowing the sender to select and set the #I into a 2793 precomputed R1 just prior sending it to the peer. 2795 The Responder selects the Diffie-Hellman public value based on the 2796 Initiator's preference expressed in the DH_GROUP_LIST parameter in 2797 the I1. The Responder sends back its own preference based on which 2798 it chose the DH public value as DH_GROUP_LIST. This allows the 2799 Initiator to determine whether its own DH_GROUP_LIST in the I1 was 2800 manipulated by an attacker. 2802 The Diffie-Hellman public value is ephemeral, and one value SHOULD be 2803 used only for one connection. Once the Responder has received a 2804 valid response to an R1 packet, that Diffie-Hellman value SHOULD be 2805 deprecated. Because it is possible that the Responder has sent the 2806 same Diffie-Hellman value to different hosts simultaneously in 2807 corresponding R1 packets, those responses should also be accepted. 2808 However, as a defense against I1 storms, an implementation MAY 2809 propose, and re-use if not avoidable, the same Diffie-Hellman value 2810 for a period of time, for example, 15 minutes. By using a small 2811 number of different puzzles for a given Diffie-Hellman value, the R1 2812 packets can be precomputed and delivered as quickly as I1 packets 2813 arrive. A scavenger process should clean up unused Diffie-Hellman 2814 values and puzzles. 2816 Re-using Diffie-Hellman public keys opens up the potential security 2817 risk of more than one Initiator ending up with the same keying 2818 material (due to faulty random number generators). Also, more than 2819 one Initiator using the same Responder public key half may lead to 2820 potentially easier cryptographic attacks and to imperfect forward 2821 security. 2823 However, these risks involved in re-using the same key are 2824 statistical; that is, the authors are not aware of any mechanism that 2825 would allow manipulation of the protocol so that the risk of the re- 2826 use of any given Responder Diffie-Hellman public key would differ 2827 from the base probability. Consequently, it is RECOMMENDED that 2828 implementations avoid re-using the same DH key with multiple 2829 Initiators, but because the risk is considered statistical and not 2830 known to be manipulable, the implementations MAY re-use a key in 2831 order to ease resource-constrained implementations and to increase 2832 the probability of successful communication with legitimate clients 2833 even under an I1 storm. In particular, when it is too expensive to 2834 generate enough precomputed R1 packets to supply each potential 2835 Initiator with a different DH key, the Responder MAY send the same DH 2836 key to several Initiators, thereby creating the possibility of 2837 multiple legitimate Initiators ending up using the same Responder- 2838 side public key. However, as soon as the Responder knows that it 2839 will use a particular DH key, it SHOULD stop offering it. This 2840 design is aimed to allow resource-constrained Responders to offer 2841 services under I1 storms and to simultaneously make the probability 2842 of DH key re-use both statistical and as low as possible. 2844 If a future version of this protocol is considered, we strongly 2845 recommend that these issues be studied again. Especially, the 2846 current design allows hosts to become potentially more vulnerable to 2847 a statistical, low-probability problem during I1 storm attacks than 2848 what they are if no attack is taking place; whether this is 2849 acceptable or not should be reconsidered in the light of any new 2850 experience gained. 2852 The HIP_CIPHER contains the encryption algorithms supported by the 2853 Responder to encrypt the ENCRYPTED parameter, in the order of 2854 preference. All implementations MUST support AES [RFC3602]. 2856 The HIT_SUITE_LIST parameter is an ordered list of the Responder's 2857 preferred and supported HIT Suites. The list allows the Initiator to 2858 determine whether its own source HIT is suitable. 2860 The ECHO_REQUEST_SIGNED and ECHO_REQUEST_UNSIGNED contains data that 2861 the sender wants to receive unmodified in the corresponding response 2862 packet in the ECHO_RESPONSE_SIGNED or ECHO_RESPONSE_UNSIGNED 2863 parameter. 2865 The signature is calculated over the whole HIP envelope, after 2866 setting the Initiator's HIT, header checksum, as well as the Opaque 2867 field and the Random #I in the PUZZLE parameter temporarily to zero, 2868 and excluding any parameters that follow the signature, as described 2869 in Section 5.2.14. This allows the Responder to use precomputed R1s. 2870 The Initiator SHOULD validate this signature. It SHOULD check that 2871 the Responder's HI received matches with the one expected, if any. 2873 5.3.3. I2 - the Second HIP Initiator Packet 2875 The HIP header values for the I2 packet: 2877 Header: 2878 Type = 3 2879 SRC HIT = Initiator's HIT 2880 DST HIT = Responder's HIT 2882 IP ( HIP ( [R1_COUNTER,] 2883 SOLUTION, 2884 DIFFIE_HELLMAN, 2885 HIP_CIPHER, 2886 ENCRYPTED { HOST_ID } or HOST_ID, 2887 [ ECHO_RESPONSE_SIGNED ,] 2888 HIP_MAC, 2889 HIP_SIGNATURE 2890 <, ECHO_RESPONSE_UNSIGNED>i ) ) 2892 Valid control bits: A 2894 The HITs used MUST match the ones used previously. 2896 If the Initiator's HI is an anonymous one, the A control MUST be set. 2898 The Initiator MAY include an unmodified copy of the R1_COUNTER 2899 parameter received in the corresponding R1 packet into the I2 packet. 2901 The Solution contains the Random #I from R1 and the computed #J. The 2902 low-order K bits of the RHASH(I | ... | J) MUST be zero. 2904 The Diffie-Hellman value is ephemeral. If precomputed, a scavenger 2905 process should clean up unused Diffie-Hellman values. The Responder 2906 may re-use Diffie-Hellman values under some conditions as specified 2907 in Section 5.3.2. 2909 The HIP_CIPHER contains the single encryption transform selected by 2910 the Initiator, that will be used to encrypt the ENCRYPTED parameter. 2911 The chosen cipher MUST correspond to one offered by the Responder in 2912 the R1. All implementations MUST support AES m [RFC3602]. 2914 The Initiator's HI MAY be encrypted using the HIP_CIPHER encryption 2915 algorithm. The keying material is derived from the Diffie-Hellman 2916 exchanged as defined in Section 6.5. 2918 The ECHO_RESPONSE_SIGNED and ECHO_RESPONSE_UNSIGNED contain the 2919 unmodified Opaque data copied from the corresponding echo request 2920 parameter. 2922 The HMAC is calculated over the whole HIP envelope, excluding any 2923 parameters after the HIP_MAC, as described in Section 6.4.1. The 2924 Responder MUST validate the HIP_MAC. 2926 The signature is calculated over the whole HIP envelope, excluding 2927 any parameters after the HIP_SIGNATURE, as described in 2928 Section 5.2.13. The Responder MUST validate this signature. It MAY 2929 use either the HI in the packet or the HI acquired by some other 2930 means. 2932 5.3.4. R2 - the Second HIP Responder Packet 2934 The HIP header values for the R2 packet: 2936 Header: 2937 Packet Type = 4 2938 SRC HIT = Responder's HIT 2939 DST HIT = Initiator's HIT 2941 IP ( HIP ( HIP_MAC_2, HIP_SIGNATURE ) ) 2943 Valid control bits: none 2945 The HIP_MAC_2 is calculated over the whole HIP envelope, with 2946 Responder's HOST_ID parameter concatenated with the HIP envelope. 2947 The HOST_ID parameter is removed after the HMAC calculation. The 2948 procedure is described in Section 6.4.1. 2950 The signature is calculated over the whole HIP envelope. 2952 The Initiator MUST validate both the HIP_MAC and the signature. 2954 5.3.5. UPDATE - the HIP Update Packet 2956 Support for the UPDATE packet is MANDATORY. 2958 The HIP header values for the UPDATE packet: 2960 Header: 2961 Packet Type = 16 2962 SRC HIT = Sender's HIT 2963 DST HIT = Recipient's HIT 2965 IP ( HIP ( [SEQ, ACK, ] HIP_MAC, HIP_SIGNATURE ) ) 2967 Valid control bits: None 2968 The UPDATE packet contains mandatory HIP_MAC and HIP_SIGNATURE 2969 parameters, and other optional parameters. 2971 The UPDATE packet contains zero or one SEQ parameter. The presence 2972 of a SEQ parameter indicates that the receiver MUST ACK the UPDATE. 2973 An UPDATE that does not contain a SEQ parameter is simply an ACK of a 2974 previous UPDATE and itself MUST NOT be ACKed. 2976 An UPDATE packet contains zero or one ACK parameters. The ACK 2977 parameter echoes the SEQ sequence number of the UPDATE packet being 2978 ACKed. A host MAY choose to ACK more than one UPDATE packet at a 2979 time; e.g., the ACK may contain the last two SEQ values received, for 2980 robustness to ACK loss. ACK values are not cumulative; each received 2981 unique SEQ value requires at least one corresponding ACK value in 2982 reply. Received ACKs that are redundant are ignored. 2984 The UPDATE packet may contain both a SEQ and an ACK parameter. In 2985 this case, the ACK is being piggybacked on an outgoing UPDATE. In 2986 general, UPDATEs carrying SEQ SHOULD be ACKed upon completion of the 2987 processing of the UPDATE. A host MAY choose to hold the UPDATE 2988 carrying ACK for a short period of time to allow for the possibility 2989 of piggybacking the ACK parameter, in a manner similar to TCP delayed 2990 acknowledgments. 2992 A sender MAY choose to forgo reliable transmission of a particular 2993 UPDATE (e.g., it becomes overcome by events). The semantics are such 2994 that the receiver MUST acknowledge the UPDATE, but the sender MAY 2995 choose to not care about receiving the ACK. 2997 UPDATEs MAY be retransmitted without incrementing SEQ. If the same 2998 subset of parameters is included in multiple UPDATEs with different 2999 SEQs, the host MUST ensure that the receiver's processing of the 3000 parameters multiple times will not result in a protocol error. 3002 5.3.6. NOTIFY - the HIP Notify Packet 3004 The NOTIFY packet is OPTIONAL. The NOTIFY packet MAY be used to 3005 provide information to a peer. Typically, NOTIFY is used to indicate 3006 some type of protocol error or negotiation failure. NOTIFY packets 3007 are unacknowledged. The receiver can handle the packet only as 3008 informational, and SHOULD NOT change its HIP state (Section 4.4.2) 3009 based purely on a received NOTIFY packet. 3011 The HIP header values for the NOTIFY packet: 3013 Header: 3014 Packet Type = 17 3015 SRC HIT = Sender's HIT 3016 DST HIT = Recipient's HIT, or zero if unknown 3018 IP ( HIP (i, [HOST_ID, ] HIP_SIGNATURE) ) 3020 Valid control bits: None 3022 The NOTIFY packet is used to carry one or more NOTIFICATION 3023 parameters. 3025 5.3.7. CLOSE - the HIP Association Closing Packet 3027 The HIP header values for the CLOSE packet: 3029 Header: 3030 Packet Type = 18 3031 SRC HIT = Sender's HIT 3032 DST HIT = Recipient's HIT 3034 IP ( HIP ( ECHO_REQUEST_SIGNED, HIP_MAC, HIP_SIGNATURE ) ) 3036 Valid control bits: none 3038 The sender MUST include an ECHO_REQUEST_SIGNED used to validate 3039 CLOSE_ACK received in response, and both an HIP_MAC and a signature 3040 (calculated over the whole HIP envelope). 3042 The receiver peer MUST validate both the HIP_MAC and the signature if 3043 it has a HIP association state, and MUST reply with a CLOSE_ACK 3044 containing an ECHO_RESPONSE_SIGNED corresponding to the received 3045 ECHO_REQUEST_SIGNED. 3047 5.3.8. CLOSE_ACK - the HIP Closing Acknowledgment Packet 3049 The HIP header values for the CLOSE_ACK packet: 3051 Header: 3052 Packet Type = 19 3053 SRC HIT = Sender's HIT 3054 DST HIT = Recipient's HIT 3056 IP ( HIP ( ECHO_RESPONSE_SIGNED, HIP_MAC, HIP_SIGNATURE ) ) 3058 Valid control bits: none 3059 The sender MUST include both an HMAC and signature (calculated over 3060 the whole HIP envelope). 3062 The receiver peer MUST validate both the HMAC and the signature. 3064 5.4. ICMP Messages 3066 When a HIP implementation detects a problem with an incoming packet, 3067 and it either cannot determine the identity of the sender of the 3068 packet or does not have any existing HIP association with the sender 3069 of the packet, it MAY respond with an ICMP packet. Any such replies 3070 MUST be rate-limited as described in [RFC2463]. In most cases, the 3071 ICMP packet will have the Parameter Problem type (12 for ICMPv4, 4 3072 for ICMPv6), with the Pointer field pointing to the field that caused 3073 the ICMP message to be generated. 3075 5.4.1. Invalid Version 3077 If a HIP implementation receives a HIP packet that has an 3078 unrecognized HIP version number, it SHOULD respond, rate-limited, 3079 with an ICMP packet with type Parameter Problem, the Pointer pointing 3080 to the VER./RES. byte in the HIP header. 3082 5.4.2. Other Problems with the HIP Header and Packet Structure 3084 If a HIP implementation receives a HIP packet that has other 3085 unrecoverable problems in the header or packet format, it MAY 3086 respond, rate-limited, with an ICMP packet with type Parameter 3087 Problem, the Pointer pointing to the field that failed to pass the 3088 format checks. However, an implementation MUST NOT send an ICMP 3089 message if the checksum fails; instead, it MUST silently drop the 3090 packet. 3092 5.4.3. Invalid Puzzle Solution 3094 If a HIP implementation receives an I2 packet that has an invalid 3095 puzzle solution, the behavior depends on the underlying version of 3096 IP. If IPv6 is used, the implementation SHOULD respond with an ICMP 3097 packet with type Parameter Problem, the Pointer pointing to the 3098 beginning of the Puzzle solution #J field in the SOLUTION payload in 3099 the HIP message. 3101 If IPv4 is used, the implementation MAY respond with an ICMP packet 3102 with the type Parameter Problem, copying enough of bytes from the I2 3103 message so that the SOLUTION parameter fits into the ICMP message, 3104 the Pointer pointing to the beginning of the Puzzle solution #J 3105 field, as in the IPv6 case. Note, however, that the resulting ICMPv4 3106 message exceeds the typical ICMPv4 message size as defined in 3108 [RFC0792]. 3110 5.4.4. Non-Existing HIP Association 3112 If a HIP implementation receives a CLOSE or UPDATE packet, or any 3113 other packet whose handling requires an existing association, that 3114 has either a Receiver or Sender HIT that does not match with any 3115 existing HIP association, the implementation MAY respond, rate- 3116 limited, with an ICMP packet with the type Parameter Problem, and 3117 with the Pointer pointing to the beginning of the first HIT that does 3118 not match. 3120 A host MUST NOT reply with such an ICMP if it receives any of the 3121 following messages: I1, R2, I2, R2, and NOTIFY. When introducing new 3122 packet types, a specification SHOULD define the appropriate rules for 3123 sending or not sending this kind of ICMP reply. 3125 6. Packet Processing 3127 Each host is assumed to have a single HIP protocol implementation 3128 that manages the host's HIP associations and handles requests for new 3129 ones. Each HIP association is governed by a conceptual state 3130 machine, with states defined above in Section 4.4. The HIP 3131 implementation can simultaneously maintain HIP associations with more 3132 than one host. Furthermore, the HIP implementation may have more 3133 than one active HIP association with another host; in this case, HIP 3134 associations are distinguished by their respective HITs. It is not 3135 possible to have more than one HIP association between any given pair 3136 of HITs. Consequently, the only way for two hosts to have more than 3137 one parallel association is to use different HITs, at least at one 3138 end. 3140 The processing of packets depends on the state of the HIP 3141 association(s) with respect to the authenticated or apparent 3142 originator of the packet. A HIP implementation determines whether it 3143 has an active association with the originator of the packet based on 3144 the HITs. In the case of user data carried in a specific transport 3145 format, the transport format document specifies how the incoming 3146 packets are matched with the active associations. 3148 6.1. Processing Outgoing Application Data 3150 In a HIP host, an application can send application-level data using 3151 an identifier specified via the underlying API. The API can be a 3152 backwards-compatible API (see [RFC5338]), using identifiers that look 3153 similar to IP addresses, or a completely new API, providing enhanced 3154 services related to Host Identities. Depending on the HIP 3155 implementation, the identifier provided to the application may be 3156 different; for example, it can be a HIT or an IP address. 3158 The exact format and method for transferring the data from the source 3159 HIP host to the destination HIP host is defined in the corresponding 3160 transport format document. The actual data is transferred in the 3161 network using the appropriate source and destination IP addresses. 3163 In this document, conceptual processing rules are defined only for 3164 the base case where both hosts have only single usable IP addresses; 3165 the multi-address multi-homing case will be specified separately. 3167 The following conceptual algorithm describes the steps that are 3168 required for handling outgoing datagrams destined to a HIT. 3170 1. If the datagram has a specified source address, it MUST be a HIT. 3171 If it is not, the implementation MAY replace the source address 3172 with a HIT. Otherwise, it MUST drop the packet. 3174 2. If the datagram has an unspecified source address, the 3175 implementation must choose a suitable source HIT for the 3176 datagram. 3178 3. If there is no active HIP association with the given HIT pair, one must be created by running the base 3180 exchange. While waiting for the base exchange to complete, the 3181 implementation SHOULD queue at least one packet per HIP 3182 association to be formed, and it MAY queue more than one. 3184 4. Once there is an active HIP association for the given HIT pair, the outgoing datagram is passed to 3186 transport handling. The possible transport formats are defined 3187 in separate documents, of which the ESP transport format for HIP 3188 is mandatory for all HIP implementations. 3190 5. Before sending the packet, the HITs in the datagram are replaced 3191 with suitable IP addresses. For IPv6, the rules defined in 3192 [RFC3484] SHOULD be followed. Note that this HIT-to-IP-address 3193 conversion step MAY also be performed at some other point in the 3194 stack, e.g., before wrapping the packet into the output format. 3196 6.2. Processing Incoming Application Data 3198 The following conceptual algorithm describes the incoming datagram 3199 handling when HITs are used at the receiving host as application- 3200 level identifiers. More detailed steps for processing packets are 3201 defined in corresponding transport format documents. 3203 1. The incoming datagram is mapped to an existing HIP association, 3204 typically using some information from the packet. For example, 3205 such mapping may be based on the ESP Security Parameter Index 3206 (SPI). 3208 2. The specific transport format is unwrapped, in a way depending on 3209 the transport format, yielding a packet that looks like a 3210 standard (unencrypted) IP packet. If possible, this step SHOULD 3211 also verify that the packet was indeed (once) sent by the remote 3212 HIP host, as identified by the HIP association. 3214 Depending on the used transport mode, the verification method can 3215 vary. While the HI (as well as HIT) is used as the higher-layer 3216 identifier, the verification method has to verify that the data 3217 packet was sent by a node identity and that the actual identity 3218 maps to this particular HIT. When using ESP transport format 3219 [RFC5202], the verification is done using the SPI value in the 3220 data packet to find the corresponding SA with associated HIT and 3221 key, and decrypting the packet with that associated key. 3223 3. The IP addresses in the datagram are replaced with the HITs 3224 associated with the HIP association. Note that this IP-address- 3225 to-HIT conversion step MAY also be performed at some other point 3226 in the stack. 3228 4. The datagram is delivered to the upper layer. When 3229 demultiplexing the datagram, the right upper-layer socket is 3230 based on the HITs. 3232 6.3. Solving the Puzzle 3234 This subsection describes the puzzle-solving details. 3236 In R1, the values I and K are sent in network byte order. Similarly, 3237 in I2, the values I and J are sent in network byte order. The hash 3238 is created by concatenating, in network byte order, the following 3239 data, in the following order and using the RHASH algorithm: 3241 n-bit random value I (where n is RHASH-len/2), in network byte 3242 order, as appearing in R1 and I2. 3244 128-bit Initiator's HIT, in network byte order, as appearing in 3245 the HIP Payload in R1 and I2. 3247 128-bit Responder's HIT, in network byte order, as appearing in 3248 the HIP Payload in R1 and I2. 3250 n-bit random value J (where n is RHASH-len/2), in network byte 3251 order, as appearing in I2. 3253 In order to be a valid response puzzle, the K low-order bits of the 3254 resulting RHASH digest must be zero. 3256 Notes: 3258 i) The length of the data to be hashed is variable depending on 3259 the output length of the Responder's hash function RHASH. 3261 ii) All the data in the hash input MUST be in network byte order. 3263 iii) The order of the Initiator's and Responder's HITs are 3264 different in the R1 and I2 packets; see Section 5.1. Care must be 3265 taken to copy the values in the right order to the hash input. 3267 The following procedure describes the processing steps involved, 3268 assuming that the Responder chooses to precompute the R1 packets: 3270 Precomputation by the Responder: 3271 Sets up the puzzle difficulty K. 3272 Creates a signed R1 and caches it. 3274 Responder: 3275 Selects a suitable cached R1. 3276 Generates a random number I. 3277 Sends I and K in an R1. 3278 Saves I and K for a Delta time. 3280 Initiator: 3281 Generates repeated attempts to solve the puzzle until a matching J 3282 is found: 3283 Ltrunc( RHASH( I | HIT-I | HIT-R | J ), K ) == 0 3284 Sends I and J in an I2. 3286 Responder: 3287 Verifies that the received I is a saved one. 3288 Finds the right K based on I. 3289 Computes V := Ltrunc( RHASH( I | HIT-I | HIT-R | J ), K ) 3290 Rejects if V != 0 3291 Accept if V == 0 3293 6.4. HIP_MAC and SIGNATURE Calculation and Verification 3295 The following subsections define the actions for processing HIP_MAC, 3296 HIP_MAC_2, HIP_SIGNATURE and HIP_SIGNATURE_2 parameters. 3298 6.4.1. HMAC Calculation 3300 The following process applies both to the HIP_MAC and HIP_MAC_2 3301 parameters. When processing HIP_MAC_2, the difference is that the 3302 HIP_MAC calculation includes a pseudo HOST_ID field containing the 3303 Responder's information as sent in the R1 packet earlier. 3305 Both the Initiator and the Responder should take some care when 3306 verifying or calculating the HIP_MAC_2. Specifically, the Responder 3307 should preserve other parameters than the HOST_ID when sending the 3308 R2. Also, the Initiator has to preserve the HOST_ID exactly as it 3309 was received in the R1 packet. 3311 The scope of the calculation for HIP_MAC and HIP_MAC_2 is: 3313 HMAC: { HIP header | [ Parameters ] } 3315 where Parameters include all HIP parameters of the packet that is 3316 being calculated with Type values from 1 to (HIP_MAC's Type value - 3317 1) and exclude parameters with Type values greater or equal to 3318 HIP_MAC's Type value. 3320 During HIP_MAC calculation, the following applies: 3322 o In the HIP header, the Checksum field is set to zero. 3324 o In the HIP header, the Header Length field value is calculated to 3325 the beginning of the HIP_MAC parameter. 3327 Parameter order is described in Section 5.2.1. 3329 HIP_MAC_2: { HIP header | [ Parameters ] | HOST_ID } 3331 where Parameters include all HIP parameters for the packet that is 3332 being calculated with Type values from 1 to (HIP_MAC_2's Type value - 3333 1) and exclude parameters with Type values greater or equal to 3334 HIP_MAC_2's Type value. 3336 During HIP_MAC_2 calculation, the following applies: 3338 o In the HIP header, the Checksum field is set to zero. 3340 o In the HIP header, the Header Length field value is calculated to 3341 the beginning of the HIP_MAC_2 parameter and added to the length 3342 of the concatenated HOST_ID parameter length. 3344 o HOST_ID parameter is exactly in the form it was received in the R1 3345 packet from the Responder. 3347 Parameter order is described in Section 5.2.1, except that the 3348 HOST_ID parameter in this calculation is added to the end. 3350 The HIP_MAC parameter is defined in Section 5.2.11 and the HIP_MAC_2 3351 parameter in Section 5.2.12. The HMAC calculation and verification 3352 process (the process applies both to HIP_MAC and HIP_MAC_2 except 3353 where HIP_MAC_2 is mentioned separately) is as follows: 3355 Packet sender: 3357 1. Create the HIP packet, without the HIP_MAC, HIP_SIGNATURE, 3358 HIP_SIGNATURE_2, or any other parameter with greater Type value 3359 than the HIP_MAC parameter has. 3361 2. In case of HIP_MAC_2 calculation, add a HOST_ID (Responder) 3362 parameter to the end of the packet. 3364 3. Calculate the Header Length field in the HIP header including the 3365 added HOST_ID parameter in case of HIP_MAC_2. 3367 4. Compute the HMAC using either HIP-gl or HIP-lg integrity key 3368 retrieved from KEYMAT as defined in Section 6.5. 3370 5. In case of HIP_MAC_2, remove the HOST_ID parameter from the 3371 packet. 3373 6. Add the HIP_MAC parameter to the packet and any parameter with 3374 greater Type value than the HIP_MAC's (HIP_MAC_2's) that may 3375 follow, including possible HIP_SIGNATURE or HIP_SIGNATURE_2 3376 parameters 3378 7. Recalculate the Length field in the HIP header. 3380 Packet receiver: 3382 1. Verify the HIP header Length field. 3384 2. Remove the HIP_MAC or HIP_MAC_2 parameter, as well as all other 3385 parameters that follow it with greater Type value including 3386 possible HIP_SIGNATURE or HIP_SIGNATURE_2 fields, saving the 3387 contents if they will be needed later. 3389 3. In case of HIP_MAC_2, build and add a HOST_ID parameter (with 3390 Responder information) to the packet. The HOST_ID parameter 3391 should be identical to the one previously received from the 3392 Responder. 3394 4. Recalculate the HIP packet length in the HIP header and clear the 3395 Checksum field (set it to all zeros). In case of HIP_MAC_2, the 3396 length is calculated with the added HOST_ID parameter. 3398 5. Compute the HMAC using either HIP-gl or HIP-lg integrity key as 3399 defined in Section 6.5 and verify it against the received HMAC. 3401 6. Set Checksum and Header Length field in the HIP header to 3402 original values. 3404 7. In case of HIP_MAC_2, remove the HOST_ID parameter from the 3405 packet before further processing. 3407 6.4.2. Signature Calculation 3409 The following process applies both to the HIP_SIGNATURE and 3410 HIP_SIGNATURE_2 parameters. When processing HIP_SIGNATURE_2, the 3411 only difference is that instead of HIP_SIGNATURE parameter, the 3412 HIP_SIGNATURE_2 parameter is used, and the Initiator's HIT and PUZZLE 3413 Opaque and Random #I fields are cleared (set to all zeros) before 3414 computing the signature. The HIP_SIGNATURE parameter is defined in 3415 Section 5.2.13 and the HIP_SIGNATURE_2 parameter in Section 5.2.14. 3417 The scope of the calculation for HIP_SIGNATURE and HIP_SIGNATURE_2 3418 is: 3420 HIP_SIGNATURE: { HIP header | [ Parameters ] } 3422 where Parameters include all HIP parameters for the packet that is 3423 being calculated with Type values from 1 to (HIP_SIGNATURE's Type 3424 value - 1). 3426 During signature calculation, the following apply: 3428 o In the HIP header, the Checksum field is set to zero. 3430 o In the HIP header, the Header Length field value is calculated to 3431 the beginning of the HIP_SIGNATURE parameter. 3433 Parameter order is described in Section 5.2.1. 3435 HIP_SIGNATURE_2: { HIP header | [ Parameters ] } 3436 where Parameters include all HIP parameters for the packet that is 3437 being calculated with Type values from 1 to (HIP_SIGNATURE_2's Type 3438 value - 1). 3440 During signature calculation, the following apply: 3442 o In the HIP header, the Initiator's HIT field and Checksum fields 3443 are set to zero. 3445 o In the HIP header, the Header Length field value is calculated to 3446 the beginning of the HIP_SIGNATURE_2 parameter. 3448 o PUZZLE parameter's Opaque and Random #I fields are set to zero. 3450 Parameter order is described in Section 5.2.1. 3452 Signature calculation and verification process (the process applies 3453 both to HIP_SIGNATURE and HIP_SIGNATURE_2 except in the case where 3454 HIP_SIGNATURE_2 is separately mentioned): 3456 Packet sender: 3458 1. Create the HIP packet without the HIP_SIGNATURE parameter or any 3459 parameters that follow the HIP_SIGNATURE parameter. 3461 2. Calculate the Length field and zero the Checksum field in the HIP 3462 header. In case of HIP_SIGNATURE_2, set Initiator's HIT field in 3463 the HIP header as well as PUZZLE parameter's Opaque and Random #I 3464 fields to zero. 3466 3. Compute the signature using the private key corresponding to the 3467 Host Identifier (public key). 3469 4. Add the HIP_SIGNATURE parameter to the packet. 3471 5. Add any parameters that follow the HIP_SIGNATURE parameter. 3473 6. Recalculate the Length field in the HIP header, and calculate the 3474 Checksum field. 3476 Packet receiver: 3478 1. Verify the HIP header Length field. 3480 2. Save the contents of the HIP_SIGNATURE parameter and any 3481 parameters following the HIP_SIGNATURE parameter and remove them 3482 from the packet. 3484 3. Recalculate the HIP packet Length in the HIP header and clear the 3485 Checksum field (set it to all zeros). In case of 3486 HIP_SIGNATURE_2, set Initiator's HIT field in HIP header as well 3487 as PUZZLE parameter's Opaque and Random #I fields to zero. 3489 4. Compute the signature and verify it against the received 3490 signature using the packet sender's Host Identifier (public key). 3492 5. Restore the original packet by adding removed parameters (in step 3493 2) and resetting the values that were set to zero (in step 3). 3495 The verification can use either the HI received from a HIP packet, 3496 the HI from a DNS query, if the FQDN has been received in the HOST_ID 3497 packet, or one received by some other means. 3499 6.5. HIP KEYMAT Generation 3501 HIP keying material is derived from the Diffie-Hellman session key, 3502 Kij, produced during the HIP base exchange (Section 4.1.3). The 3503 Initiator has Kij during the creation of the I2 packet, and the 3504 Responder has Kij once it receives the I2 packet. This is why I2 can 3505 already contain encrypted information. 3507 The KEYMAT is derived by feeding Kij into HKDF [RFC5869] using the 3508 RHASH hash function. 3510 where 3512 info = sort(HIT-I | HIT-R) 3513 salt = I | J 3515 Sort(HIT-I | HIT-R) is defined as the network byte order 3516 concatenation of the two HITs, with the smaller HIT preceding the 3517 larger HIT, resulting from the numeric comparison of the two HITs 3518 interpreted as positive (unsigned) 128-bit integers in network byte 3519 order. 3521 I and J values are from the puzzle and its solution that were 3522 exchanged in R1 and I2 messages when this HIP association was set up. 3523 Both hosts have to store I and J values for the HIP association for 3524 future use. 3526 The initial keys are drawn sequentially in the order that is 3527 determined by the numeric comparison of the two HITs, with comparison 3528 method described in the previous paragraph. HOST_g denotes the host 3529 with the greater HIT value, and HOST_l the host with the lower HIT 3530 value. 3532 The drawing order for initial keys: 3534 HIP-gl encryption key for HOST_g's outgoing HIP packets 3536 HIP-gl integrity (HMAC) key for HOST_g's outgoing HIP packets 3538 HIP-lg encryption key (currently unused) for HOST_l's outgoing HIP 3539 packets 3541 HIP-lg integrity (HMAC) key for HOST_l's outgoing HIP packets 3543 The number of bits drawn for a given algorithm is the "natural" size 3544 of the keys. For the mandatory algorithms, the following sizes 3545 apply: 3547 AES 128 or 256 bits 3549 SHA-1 160 bits 3551 SHA-256 256 bits 3553 SHA-384 384 bits 3555 NULL 0 bits 3557 If other key sizes are used, they must be treated as different 3558 encryption algorithms and defined separately. 3560 6.6. Initiation of a HIP Exchange 3562 An implementation may originate a HIP exchange to another host based 3563 on a local policy decision, usually triggered by an application 3564 datagram, in much the same way that an IPsec IKE key exchange can 3565 dynamically create a Security Association. Alternatively, a system 3566 may initiate a HIP exchange if it has rebooted or timed out, or 3567 otherwise lost its HIP state, as described in Section 4.5.4. 3569 The implementation prepares an I1 packet and sends it to the IP 3570 address that corresponds to the peer host. The IP address of the 3571 peer host may be obtained via conventional mechanisms, such as DNS 3572 lookup. The I1 contents are specified in Section 5.3.1. The 3573 selection of which Host Identity to use, if a host has more than one 3574 to choose from, is typically a policy decision. 3576 The following steps define the conceptual processing rules for 3577 initiating a HIP exchange: 3579 1. The Initiator gets one or more of the Responder's HITs and one or 3580 more addresses either from a DNS lookup of the Responder's FQDN, 3581 from some other repository, or from a local table. If the 3582 Initiator does not know the Responder's HIT, it may attempt 3583 opportunistic mode by using NULL (all zeros) as the Responder's 3584 HIT. See also "HIP Opportunistic Mode" (Section 4.1.8). If the 3585 Initiator can choose from multiple Responder HITs, it selects a 3586 HIT for which the Initiator supports the HIT Suite. 3588 2. The Initiator sends an I1 to one of the Responder's addresses. 3589 The selection of which address to use is a local policy decision. 3591 3. The Initiator includes the DH_GROUP_LIST in the I1 packet. The 3592 selection and order of DH Group IDs in the DH_GROUP_LIST MUST be 3593 stored by the Initiator because this list is needed for later R1 3594 processing. In most cases, the preferences regarding the DH 3595 Groups will be static, so no per-association storage is 3596 necessary. 3598 4. Upon sending an I1, the sender transitions to state I1-SENT, 3599 starts a timer whose timeout value SHOULD be larger than the 3600 worst-case anticipated RTT, and SHOULD increment a timeout 3601 counter associated with the I1. 3603 5. Upon timeout, the sender SHOULD retransmit the I1 and restart the 3604 timer, up to a maximum of I1_RETRIES_MAX tries. 3606 6.6.1. Sending Multiple I1s in Parallel 3608 For the sake of minimizing the session establishment latency, an 3609 implementation MAY send the same I1 to more than one of the 3610 Responder's addresses. However, it MUST NOT send to more than three 3611 (3) addresses in parallel. Furthermore, upon timeout, the 3612 implementation MUST refrain from sending the same I1 packet to 3613 multiple addresses. That is, if it retries to initialize the 3614 connection after timeout, it MUST NOT send the I1 packet to more than 3615 one destination address. These limitations are placed in order to 3616 avoid congestion of the network, and potential DoS attacks that might 3617 happen, e.g., because someone's claim to have hundreds or thousands 3618 of addresses could generate a huge number of I1 messages from the 3619 Initiator. 3621 As the Responder is not guaranteed to distinguish the duplicate I1s 3622 it receives at several of its addresses (because it avoids storing 3623 states when it answers back an R1), the Initiator may receive several 3624 duplicate R1s. 3626 The Initiator SHOULD then select the initial preferred destination 3627 address using the source address of the selected received R1, and use 3628 the preferred address as a source address for the I2. Processing 3629 rules for received R1s are discussed in Section 6.8. 3631 6.6.2. Processing Incoming ICMP Protocol Unreachable Messages 3633 A host may receive an ICMP 'Destination Protocol Unreachable' message 3634 as a response to sending a HIP I1 packet. Such a packet may be an 3635 indication that the peer does not support HIP, or it may be an 3636 attempt to launch an attack by making the Initiator believe that the 3637 Responder does not support HIP. 3639 When a system receives an ICMP 'Destination Protocol Unreachable' 3640 message while it is waiting for an R1, it MUST NOT terminate the 3641 wait. It MAY continue as if it had not received the ICMP message, 3642 and send a few more I1s. Alternatively, it MAY take the ICMP message 3643 as a hint that the peer most probably does not support HIP, and 3644 return to state UNASSOCIATED earlier than otherwise. However, at 3645 minimum, it MUST continue waiting for an R1 for a reasonable time 3646 before returning to UNASSOCIATED. 3648 6.7. Processing Incoming I1 Packets 3650 An implementation SHOULD reply to an I1 with an R1 packet, unless the 3651 implementation is unable or unwilling to set up a HIP association. 3652 If the implementation is unable to set up a HIP association, the host 3653 SHOULD send an ICMP Destination Protocol Unreachable, 3654 Administratively Prohibited, message to the I1 source address. If 3655 the implementation is unwilling to set up a HIP association, the host 3656 MAY ignore the I1. This latter case may occur during a DoS attack 3657 such as an I1 flood. 3659 The implementation MUST be able to handle a storm of received I1 3660 packets, discarding those with common content that arrive within a 3661 small time delta. 3663 A spoofed I1 can result in an R1 attack on a system. An R1 sender 3664 MUST have a mechanism to rate-limit R1s to an address. 3666 It is RECOMMENDED that the HIP state machine does not transition upon 3667 sending an R1. 3669 The following steps define the conceptual processing rules for 3670 responding to an I1 packet: 3672 1. The Responder MUST check that the Responder's HIT in the received 3673 I1 is either one of its own HITs or NULL. 3675 2. If the Responder is in ESTABLISHED state, the Responder MAY 3676 respond to this with an R1 packet, prepare to drop existing SAs, 3677 and stay at ESTABLISHED state. 3679 3. If the Responder is in I1-SENT state, it must make a comparison 3680 between the sender's HIT and its own (i.e., the receiver's) HIT. 3681 If the sender's HIT is greater than its own HIT, it should drop 3682 the I1 and stay at I1-SENT. If the sender's HIT is smaller than 3683 its own HIT, it should send R1 and stay at I1-SENT. The HIT 3684 comparison goes similarly as in Section 6.5. 3686 4. If the implementation chooses to respond to the I1 with an R1 3687 packet, it creates a new R1 or selects a precomputed R1 according 3688 to the format described in Section 5.3.2. It creates or chooses 3689 an R1 that contains its most preferred DH public value that is 3690 also contained in the DH_GROUP_LIST in the I1 packet. If no 3691 suitable DH Group ID was contained in the DH_GROUP_LIST in the I1 3692 packet, it sends an R1 with an arbitrary DH public key. 3694 5. The R1 MUST contain the received Responder's HIT, unless the 3695 received HIT is NULL, in which case the Responder SHOULD select a 3696 HIT that is constructed with the MUST algorithm in Section 3, 3697 which is currently RSA. Other than that, selecting the HIT is a 3698 local policy matter. 3700 6. The Responder sends the R1 to the source IP address of the I1 3701 packet. 3703 6.7.1. R1 Management 3705 All compliant implementations MUST produce R1 packets. An R1 packet 3706 MAY be precomputed. An R1 packet MAY be reused for time Delta T, 3707 which is implementation dependent, and SHOULD be deprecated and not 3708 used once a valid response I2 packet has been received from an 3709 Initiator. During an I1 message storm, an R1 packet may be re-used 3710 beyond this limit. R1 information MUST NOT be discarded until Delta 3711 S after T. Time S is the delay needed for the last I2 to arrive back 3712 to the Responder. 3714 Implementations that support multiple DH groups MAY pre-compute R1 3715 packets for each supported group so that incoming I1 packets with 3716 different DH Group IDs in the DH_GROUP_LIST can be served quickly. 3718 An implementation MAY keep state about received I1s and match the 3719 received I2s against the state, as discussed in Section 4.1.1. 3721 6.7.2. Handling Malformed Messages 3723 If an implementation receives a malformed I1 message, it SHOULD NOT 3724 respond with a NOTIFY message, as such practice could open up a 3725 potential denial-of-service danger. Instead, it MAY respond with an 3726 ICMP packet, as defined in Section 5.4. 3728 6.8. Processing Incoming R1 Packets 3730 A system receiving an R1 MUST first check to see if it has sent an I1 3731 to the originator of the R1 (i.e., it is in state I1-SENT). If so, 3732 it SHOULD process the R1 as described below, send an I2, and go to 3733 state I2-SENT, setting a timer to protect the I2. If the system is 3734 in state I2-SENT, it MAY respond to an R1 if the R1 has a larger R1 3735 generation counter; if so, it should drop its state due to processing 3736 the previous R1 and start over from state I1-SENT. If the system is 3737 in any other state with respect to that host, it SHOULD silently drop 3738 the R1. 3740 When sending multiple I1s, an Initiator SHOULD wait for a small 3741 amount of time after the first R1 reception to allow possibly 3742 multiple R1s to arrive, and it SHOULD respond to an R1 among the set 3743 with the largest R1 generation counter. 3745 The following steps define the conceptual processing rules for 3746 responding to an R1 packet: 3748 1. A system receiving an R1 MUST first check to see if it has sent 3749 an I1 to the originator of the R1 (i.e., it has a HIP 3750 association that is in state I1-SENT and that is associated with 3751 the HITs in the R1). Unless the I1 was sent in opportunistic 3752 mode (see Section 4.1.8), the IP addresses in the received R1 3753 packet SHOULD be ignored and, when looking up the right HIP 3754 association, the received R1 SHOULD be matched against the 3755 associations using only the HITs. If a match exists, the system 3756 should process the R1 as described below. 3758 2. Otherwise, if the system is in any other state than I1-SENT or 3759 I2-SENT with respect to the HITs included in the R1, it SHOULD 3760 silently drop the R1 and remain in the current state. 3762 3. If the HIP association state is I1-SENT or I2-SENT, the received 3763 Initiator's HIT MUST correspond to the HIT used in the original, 3764 and the I1 and the Responder's HIT MUST correspond to the one 3765 used, unless the I1 contained a NULL HIT. 3767 4. The system SHOULD validate the R1 signature before applying 3768 further packet processing, according to Section 5.2.14. 3770 5. If the HIP association state is I1-SENT, and multiple valid R1s 3771 are present, the system MUST select from among the R1s with the 3772 largest R1 generation counter. 3774 6. The system MUST check that the Initiator HIT Suite is contained 3775 in the HIT_SUITE_LIST parameter in the R1 packet (i.e., the 3776 Initiator's HIT Suite is supported by the Responder). If the 3777 HIT Suite is supported by the Responder, the system proceeds 3778 normally. Otherwise, the system MAY stay in state I1-sent and 3779 restart the BEX by sending a new I1 packet with a Initiator HIT 3780 that is supported by the Responder and hence is contained in the 3781 HIT_SUITE_LIST in the R1 packet. The system MAY abort the BEX 3782 if no suitable source HIT is available. The system SHOULD wait 3783 for acceptable time span to allow further R1 packets with higher 3784 R1 generation counters to arrive before restarting or aborting 3785 the BEX. 3787 7. The system MUST check that the DH Group ID in the DH parameter 3788 in the R1 matches the first DH Suite ID in the Responder's 3789 DH_GROUP_LIST in the R1 that was also contained in the 3790 Initiator's DH_GROUP_LIST in the I1. If the two DH Group ID of 3791 the DH parameter does not express the Responder's best choice, 3792 the Initiator can conclude that the DH_GROUP_LIST in the I1 was 3793 adversely modified. In such case, the Initiator MAY send a new 3794 I1 packet, however, it SHOULD not change its preference in the 3795 DH_GROUP_LIST in the new I1. Alternatively, the Initiator MAY 3796 abort the HIP exchange. 3798 8. If the HIP association state is I2-SENT, the system MAY reenter 3799 state I1-SENT and process the received R1 if it has a larger R1 3800 generation counter than the R1 responded to previously. 3802 9. The R1 packet may have the A bit set -- in this case, the system 3803 MAY choose to refuse it by dropping the R1 and returning to 3804 state UNASSOCIATED. The system SHOULD consider dropping the R1 3805 only if it used a NULL HIT in I1. If the A bit is set, the 3806 Responder's HIT is anonymous and should not be stored. 3808 10. The system SHOULD attempt to validate the HIT against the 3809 received Host Identity by using the received Host Identity to 3810 construct a HIT and verify that it matches the Sender's HIT. 3812 11. The system MUST store the received R1 generation counter for 3813 future reference. 3815 12. The system attempts to solve the puzzle in R1. The system MUST 3816 terminate the search after exceeding the remaining lifetime of 3817 the puzzle. If the puzzle is not successfully solved, the 3818 implementation may either resend I1 within the retry bounds or 3819 abandon the HIP exchange. 3821 13. The system computes standard Diffie-Hellman keying material 3822 according to the public value and Group ID provided in the 3823 DIFFIE_HELLMAN parameter. The Diffie-Hellman keying material 3824 Kij is used for key extraction as specified in Section 6.5. If 3825 the received Diffie-Hellman Group ID is not supported, the 3826 implementation may either resend I1 within the retry bounds or 3827 abandon the HIP exchange. 3829 14. The system selects the HIP_CIPHER ID from the choices presented 3830 in the R1 packet and uses the selected values subsequently when 3831 generating and using encryption keys, and when sending the I2. 3832 If the proposed alternatives are not acceptable to the system, 3833 it may either resend I1 within the retry bounds or abandon the 3834 HIP exchange. 3836 15. The system initializes the remaining variables in the associated 3837 state, including Update ID counters. 3839 16. The system prepares and sends an I2, as described in 3840 Section 5.3.3. 3842 17. The system SHOULD start a timer whose timeout value should be 3843 larger than the worst-case anticipated RTT, and MUST increment a 3844 timeout counter associated with the I2. The sender SHOULD 3845 retransmit the I2 upon a timeout and restart the timer, up to a 3846 maximum of I2_RETRIES_MAX tries. 3848 18. If the system is in state I1-SENT, it shall transition to state 3849 I2-SENT. If the system is in any other state, it remains in the 3850 current state. 3852 6.8.1. Handling Malformed Messages 3854 If an implementation receives a malformed R1 message, it MUST 3855 silently drop the packet. Sending a NOTIFY or ICMP would not help, 3856 as the sender of the R1 typically doesn't have any state. An 3857 implementation SHOULD wait for some more time for a possibly good R1, 3858 after which it MAY try again by sending a new I1 packet. 3860 6.9. Processing Incoming I2 Packets 3862 Upon receipt of an I2, the system MAY perform initial checks to 3863 determine whether the I2 corresponds to a recent R1 that has been 3864 sent out, if the Responder keeps such state. For example, the sender 3865 could check whether the I2 is from an address or HIT that has 3866 recently received an R1 from it. The R1 may have had Opaque data 3867 included that was echoed back in the I2. If the I2 is considered to 3868 be suspect, it MAY be silently discarded by the system. 3870 Otherwise, the HIP implementation SHOULD process the I2. This 3871 includes validation of the puzzle solution, generating the Diffie- 3872 Hellman key, decrypting the Initiator's Host Identity, verifying the 3873 signature, creating state, and finally sending an R2. 3875 The following steps define the conceptual processing rules for 3876 responding to an I2 packet: 3878 1. The system MAY perform checks to verify that the I2 corresponds 3879 to a recently sent R1. Such checks are implementation 3880 dependent. See Appendix A for a description of an example 3881 implementation. 3883 2. The system MUST check that the Responder's HIT corresponds to 3884 one of its own HITs. 3886 3. The system MUST further check that the Initiator's HIT Suite is 3887 supported. The Responder SHOULD drop I2 packets with 3888 unsupported Initiator HITs silently. 3890 4. If the system's state machine is in the R2-SENT state, the 3891 system MAY check if the newly received I2 is similar to the one 3892 that triggered moving to R2-SENT. If so, it MAY retransmit a 3893 previously sent R2, reset the R2-SENT timer, and the state 3894 machine stays in R2-SENT. 3896 5. If the system's state machine is in the I2-SENT state, the 3897 system makes a comparison between its local and sender's HITs 3898 (similarly as in Section 6.5). If the local HIT is smaller than 3899 the sender's HIT, it should drop the I2 packet, use the peer 3900 Diffie-Hellman key and nonce I from the R1 packet received 3901 earlier, and get the local Diffie-Hellman key and nonce J from 3902 the I2 packet sent to the peer earlier. Otherwise, the system 3903 should process the received I2 packet and drop any previously 3904 derived Diffie-Hellman keying material Kij it might have formed 3905 upon sending the I2 previously. The peer Diffie-Hellman key and 3906 the nonce J are taken from the just arrived I2 packet. The 3907 local Diffie-Hellman key and the nonce I are the ones that were 3908 earlier sent in the R1 packet. 3910 6. If the system's state machine is in the I1-SENT state, and the 3911 HITs in the I2 match those used in the previously sent I1, the 3912 system uses this received I2 as the basis for the HIP 3913 association it was trying to form, and stops retransmitting I1 3914 (provided that the I2 passes the below additional checks). 3916 7. If the system's state machine is in any other state than R2- 3917 SENT, the system SHOULD check that the echoed R1 generation 3918 counter in I2 is within the acceptable range. Implementations 3919 MUST accept puzzles from the current generation and MAY accept 3920 puzzles from earlier generations. If the newly received I2 is 3921 outside the accepted range, the I2 is stale (perhaps replayed) 3922 and SHOULD be dropped. 3924 8. The system MUST validate the solution to the puzzle by computing 3925 the hash described in Section 5.3.3 using the same RHASH 3926 algorithm. 3928 9. The I2 MUST have a single value in the HIP_CIPHER parameter, 3929 which MUST match one of the values offered to the Initiator in 3930 the R1 packet. 3932 10. The system must derive Diffie-Hellman keying material Kij based 3933 on the public value and Group ID in the DIFFIE_HELLMAN 3934 parameter. This key is used to derive the HIP association keys, 3935 as described in Section 6.5. If the Diffie-Hellman Group ID is 3936 unsupported, the I2 packet is silently dropped. 3938 11. The encrypted HOST_ID is decrypted by the Initiator encryption 3939 key defined in Section 6.5. If the decrypted data is not a 3940 HOST_ID parameter, the I2 packet is silently dropped. 3942 12. The implementation SHOULD also verify that the Initiator's HIT 3943 in the I2 corresponds to the Host Identity sent in the I2. 3944 (Note: some middleboxes may not able to make this verification.) 3946 13. The system MUST verify the HMAC according to the procedures in 3947 Section 5.2.11. 3949 14. The system MUST verify the HIP_SIGNATURE according to 3950 Section 5.2.13 and Section 5.3.3. 3952 15. If the checks above are valid, then the system proceeds with 3953 further I2 processing; otherwise, it discards the I2 and its 3954 state machine remains in the same state. 3956 16. The I2 packet may have the A bit set -- in this case, the system 3957 MAY choose to refuse it by dropping the I2 and the state machine 3958 returns to state UNASSOCIATED. If the A bit is set, the 3959 Initiator's HIT is anonymous and should not be stored. 3961 17. The system initializes the remaining variables in the associated 3962 state, including Update ID counters. 3964 18. Upon successful processing of an I2 when the system's state 3965 machine is in state UNASSOCIATED, I1-SENT, I2-SENT, or R2-SENT, 3966 an R2 is sent and the system's state machine transitions to 3967 state R2-SENT. 3969 19. Upon successful processing of an I2 when the system's state 3970 machine is in state ESTABLISHED, the old HIP association is 3971 dropped and a new one is installed, an R2 is sent, and the 3972 system's state machine transitions to R2-SENT. 3974 20. Upon the system's state machine transitioning to R2-SENT, the 3975 system starts a timer. The state machine transitions to 3976 ESTABLISHED if some data has been received on the incoming HIP 3977 association, or an UPDATE packet has been received (or some 3978 other packet that indicates that the peer system's state machine 3979 has moved to ESTABLISHED). If the timer expires (allowing for 3980 maximal retransmissions of I2s), the state machine transitions 3981 to ESTABLISHED. 3983 6.9.1. Handling Malformed Messages 3985 If an implementation receives a malformed I2 message, the behavior 3986 SHOULD depend on how many checks the message has already passed. If 3987 the puzzle solution in the message has already been checked, the 3988 implementation SHOULD report the error by responding with a NOTIFY 3989 packet. Otherwise, the implementation MAY respond with an ICMP 3990 message as defined in Section 5.4. 3992 6.10. Processing Incoming R2 Packets 3994 An R2 received in states UNASSOCIATED, I1-SENT, or ESTABLISHED 3995 results in the R2 being dropped and the state machine staying in the 3996 same state. If an R2 is received in state I2-SENT, it SHOULD be 3997 processed. 3999 The following steps define the conceptual processing rules for an 4000 incoming R2 packet: 4002 1. The system MUST verify that the HITs in use correspond to the 4003 HITs that were received in the R1. 4005 2. The system MUST verify the HIP_MAC_2 according to the procedures 4006 in Section 5.2.12. 4008 3. The system MUST verify the HIP signature according to the 4009 procedures in Section 5.2.13. 4011 4. If any of the checks above fail, there is a high probability of 4012 an ongoing man-in-the-middle or other security attack. The 4013 system SHOULD act accordingly, based on its local policy. 4015 5. If the system is in any other state than I2-SENT, the R2 is 4016 silently dropped. 4018 6. Upon successful processing of the R2, the state machine moves to 4019 state ESTABLISHED. 4021 6.11. Sending UPDATE Packets 4023 A host sends an UPDATE packet when it wants to update some 4024 information related to a HIP association. There are a number of 4025 likely situations, e.g., mobility management and rekeying of an 4026 existing ESP Security Association. The following paragraphs define 4027 the conceptual rules for sending an UPDATE packet to the peer. 4028 Additional steps can be defined in other documents where the UPDATE 4029 packet is used. 4031 The system first determines whether there are any outstanding UPDATE 4032 messages that may conflict with the new UPDATE message under 4033 consideration. When multiple UPDATEs are outstanding (not yet 4034 acknowledged), the sender must assume that such UPDATEs may be 4035 processed in an arbitrary order. Therefore, any new UPDATEs that 4036 depend on a previous outstanding UPDATE being successfully received 4037 and acknowledged MUST be postponed until reception of the necessary 4038 ACK(s) occurs. One way to prevent any conflicts is to only allow one 4039 outstanding UPDATE at a time. However, allowing multiple UPDATEs may 4040 improve the performance of mobility and multihoming protocols. 4042 The following steps define the conceptual processing rules for 4043 sending UPDATE packets. 4045 1. The first UPDATE packet is sent with Update ID of zero. 4046 Otherwise, the system increments its own Update ID value by one 4047 before continuing the below steps. 4049 2. The system creates an UPDATE packet that contains a SEQ parameter 4050 with the current value of Update ID. The UPDATE packet may also 4051 include an ACK of the peer's Update ID found in a received UPDATE 4052 SEQ parameter, if any. 4054 3. The system sends the created UPDATE packet and starts an UPDATE 4055 timer. The default value for the timer is 2 * RTT estimate. If 4056 multiple UPDATEs are outstanding, multiple timers are in effect. 4058 4. If the UPDATE timer expires, the UPDATE is resent. The UPDATE 4059 can be resent UPDATE_RETRY_MAX times. The UPDATE timer SHOULD be 4060 exponentially backed off for subsequent retransmissions. If no 4061 acknowledgment is received from the peer after UPDATE_RETRY_MAX 4062 times, the HIP association is considered to be broken and the 4063 state machine should move from state ESTABLISHED to state CLOSING 4064 as depicted in Section 4.4.4. The UPDATE timer is cancelled upon 4065 receiving an ACK from the peer that acknowledges receipt of the 4066 UPDATE. 4068 6.12. Receiving UPDATE Packets 4070 When a system receives an UPDATE packet, its processing depends on 4071 the state of the HIP association and the presence and values of the 4072 SEQ and ACK parameters. Typically, an UPDATE message also carries 4073 optional parameters whose handling is defined in separate documents. 4075 For each association, the peer's next expected in-sequence Update ID 4076 ("peer Update ID") is stored. Initially, this value is zero. Update 4077 ID comparisons of "less than" and "greater than" are performed with 4078 respect to a circular sequence number space. 4080 The sender may send multiple outstanding UPDATE messages. These 4081 messages are processed in the order in which they are received at the 4082 receiver (i.e., no resequencing is performed). When processing 4083 UPDATEs out-of-order, the receiver MUST keep track of which UPDATEs 4084 were previously processed, so that duplicates or retransmissions are 4085 ACKed and not reprocessed. A receiver MAY choose to define a receive 4086 window of Update IDs that it is willing to process at any given time, 4087 and discard received UPDATEs falling outside of that window. 4089 The following steps define the conceptual processing rules for 4090 receiving UPDATE packets. 4092 1. If there is no corresponding HIP association, the implementation 4093 MAY reply with an ICMP Parameter Problem, as specified in 4094 Section 5.4.4. 4096 2. If the association is in the ESTABLISHED state and the SEQ (but 4097 not ACK) parameter is present, the UPDATE is processed and 4098 replied to as described in Section 6.12.1. 4100 3. If the association is in the ESTABLISHED state and the ACK (but 4101 not SEQ) parameter is present, the UPDATE is processed as 4102 described in Section 6.12.2. 4104 4. If the association is in the ESTABLISHED state and there is both 4105 an ACK and SEQ in the UPDATE, the ACK is first processed as 4106 described in Section 6.12.2, and then the rest of the UPDATE is 4107 processed as described in Section 6.12.1. 4109 6.12.1. Handling a SEQ Parameter in a Received UPDATE Message 4111 The following steps define the conceptual processing rules for 4112 handling a SEQ parameter in a received UPDATE packet. 4114 1. If the Update ID in the received SEQ is not the next in the 4115 sequence of Update IDs and is greater than the receiver's window 4116 for new UPDATEs, the packet MUST be dropped. 4118 2. If the Update ID in the received SEQ corresponds to an UPDATE 4119 that has recently been processed, the packet is treated as a 4120 retransmission. The HIP_MAC verification (next step) MUST NOT be 4121 skipped. (A byte-by-byte comparison of the received and a stored 4122 packet would be OK, though.) It is recommended that a host cache 4123 UPDATE packets sent with ACKs to avoid the cost of generating a 4124 new ACK packet to respond to a replayed UPDATE. The system MUST 4125 acknowledge, again, such (apparent) UPDATE message 4126 retransmissions but SHOULD also consider rate-limiting such 4127 retransmission responses to guard against replay attacks. 4129 3. The system MUST verify the HIP_MAC in the UPDATE packet. If the 4130 verification fails, the packet MUST be dropped. 4132 4. The system MAY verify the SIGNATURE in the UPDATE packet. If the 4133 verification fails, the packet SHOULD be dropped and an error 4134 message logged. 4136 5. If a new SEQ parameter is being processed, the parameters in the 4137 UPDATE are then processed. The system MUST record the Update ID 4138 in the received SEQ parameter, for replay protection. 4140 6. An UPDATE acknowledgment packet with ACK parameter is prepared 4141 and sent to the peer. This ACK parameter may be included in a 4142 separate UPDATE or piggybacked in an UPDATE with SEQ parameter, 4143 as described in Section 5.3.5. The ACK parameter MAY acknowledge 4144 more than one of the peer's Update IDs. 4146 6.12.2. Handling an ACK Parameter in a Received UPDATE Packet 4148 The following steps define the conceptual processing rules for 4149 handling an ACK parameter in a received UPDATE packet. 4151 1. The sequence number reported in the ACK must match with an 4152 earlier sent UPDATE packet that has not already been 4153 acknowledged. If no match is found or if the ACK does not 4154 acknowledge a new UPDATE, the packet MUST either be dropped if no 4155 SEQ parameter is present, or the processing steps in 4156 Section 6.12.1 are followed. 4158 2. The system MUST verify the HIP_MAC in the UPDATE packet. If the 4159 verification fails, the packet MUST be dropped. 4161 3. The system MAY verify the SIGNATURE in the UPDATE packet. If the 4162 verification fails, the packet SHOULD be dropped and an error 4163 message logged. 4165 4. The corresponding UPDATE timer is stopped (see Section 6.11) so 4166 that the now acknowledged UPDATE is no longer retransmitted. If 4167 multiple UPDATEs are newly acknowledged, multiple timers are 4168 stopped. 4170 6.13. Processing NOTIFY Packets 4172 Processing NOTIFY packets is OPTIONAL. If processed, any errors in a 4173 received NOTIFICATION parameter SHOULD be logged. Received errors 4174 MUST be considered only as informational, and the receiver SHOULD NOT 4175 change its HIP state (Section 4.4.2) purely based on the received 4176 NOTIFY message. 4178 6.14. Processing CLOSE Packets 4180 When the host receives a CLOSE message, it responds with a CLOSE_ACK 4181 message and moves to CLOSED state. (The authenticity of the CLOSE 4182 message is verified using both HIP_MAC and SIGNATURE). This 4183 processing applies whether or not the HIP association state is 4184 CLOSING in order to handle CLOSE messages from both ends that cross 4185 in flight. 4187 The HIP association is not discarded before the host moves from the 4188 UNASSOCIATED state. 4190 Once the closing process has started, any need to send data packets 4191 will trigger creating and establishing of a new HIP association, 4192 starting with sending an I1. 4194 If there is no corresponding HIP association, the CLOSE packet is 4195 dropped. 4197 6.15. Processing CLOSE_ACK Packets 4199 When a host receives a CLOSE_ACK message, it verifies that it is in 4200 CLOSING or CLOSED state and that the CLOSE_ACK was in response to the 4201 CLOSE (using the included ECHO_RESPONSE_SIGNED in response to the 4202 sent ECHO_REQUEST_SIGNED). 4204 The CLOSE_ACK uses HIP_MAC and SIGNATURE for verification. The state 4205 is discarded when the state changes to UNASSOCIATED and, after that, 4206 the host MAY respond with an ICMP Parameter Problem to an incoming 4207 CLOSE message (see Section 5.4.4). 4209 6.16. Handling State Loss 4211 In the case of system crash and unanticipated state loss, the system 4212 SHOULD delete the corresponding HIP state, including the keying 4213 material. That is, the state SHOULD NOT be stored on stable storage. 4214 If the implementation does drop the state (as RECOMMENDED), it MUST 4215 also drop the peer's R1 generation counter value, unless a local 4216 policy explicitly defines that the value of that particular host is 4217 stored. An implementation MUST NOT store R1 generation counters by 4218 default, but storing R1 generation counter values, if done, MUST be 4219 configured by explicit HITs. 4221 7. HIP Policies 4223 There are a number of variables that will influence the HIP exchanges 4224 that each host must support. All HIP implementations MUST support 4225 more than one simultaneous HI, at least one of which SHOULD be 4226 reserved for anonymous usage. Although anonymous HIs will be rarely 4227 used as Responders' HIs, they will be common for Initiators. Support 4228 for more than two HIs is RECOMMENDED. 4230 Many Initiators would want to use a different HI for different 4231 Responders. The implementations SHOULD provide for an ACL of 4232 Initiator's HIT to Responder's HIT. This ACL SHOULD also include 4233 preferred transform and local lifetimes. 4235 The value of K used in the HIP R1 packet can also vary by policy. K 4236 should never be greater than 20, but for trusted partners it could be 4237 as low as 0. 4239 Responders would need a similar ACL, representing which hosts they 4240 accept HIP exchanges, and the preferred transform and local 4241 lifetimes. Wildcarding SHOULD be supported for this ACL also. 4243 8. Security Considerations 4245 HIP is designed to provide secure authentication of hosts. HIP also 4246 attempts to limit the exposure of the host to various denial-of- 4247 service and man-in-the-middle (MitM) attacks. In so doing, HIP 4248 itself is subject to its own DoS and MitM attacks that potentially 4249 could be more damaging to a host's ability to conduct business as 4250 usual. 4252 Denial-of-service attacks often take advantage of the cost of start 4253 of state for a protocol on the Responder compared to the 'cheapness' 4254 on the Initiator. HIP makes no attempt to increase the cost of the 4255 start of state on the Initiator, but makes an effort to reduce the 4256 cost to the Responder. This is done by having the Responder start 4257 the 3-way exchange instead of the Initiator, making the HIP protocol 4258 4 packets long. In doing this, packet 2 becomes a 'stock' packet 4259 that the Responder MAY use many times, until some Initiator has 4260 provided a valid response to such an R1 packet. During an I1 storm, 4261 the host may reuse the same DH value also even if some Initiator has 4262 provided a valid response using that particular DH value. However, 4263 such behavior is discouraged and should be avoided. Using the same 4264 Diffie-Hellman values and random puzzle #I value has some risks. 4265 This risk needs to be balanced against a potential storm of HIP I1 4266 packets. 4268 This shifting of the start of state cost to the Initiator in creating 4269 the I2 HIP packet, presents another DoS attack. The attacker spoofs 4270 the I1 HIP packet and the Responder sends out the R1 HIP packet. 4271 This could conceivably tie up the 'Initiator' with evaluating the R1 4272 HIP packet, and creating the I2 HIP packet. The defense against this 4273 attack is to simply ignore any R1 packet where a corresponding I1 was 4274 not sent. 4276 A second form of DoS attack arrives in the I2 HIP packet. Once the 4277 attacking Initiator has solved the puzzle, it can send packets with 4278 spoofed IP source addresses with either an invalid encrypted HIP 4279 payload component or a bad HIP signature. This would take resources 4280 in the Responder's part to reach the point to discover that the I2 4281 packet cannot be completely processed. The defense against this 4282 attack is after N bad I2 packets, the Responder would discard any I2s 4283 that contain the given Initiator HIT. This will shut down the 4284 attack. The attacker would have to request another R1 and use that 4285 to launch a new attack. The Responder could up the value of K while 4286 under attack. On the downside, valid I2s might get dropped too. 4288 A third form of DoS attack is emulating the restart of state after a 4289 reboot of one of the partners. A restarting host would send an I1 to 4290 a peer, which would respond with an R1 even if it were in the 4291 ESTABLISHED state. If the I1 were spoofed, the resulting R1 would be 4292 received unexpectedly by the spoofed host and would be dropped, as in 4293 the first case above. 4295 A fourth form of DoS attack is emulating the end of state. HIP 4296 relies on timers plus a CLOSE/CLOSE_ACK handshake to explicitly 4297 signal the end of a HIP association. Because both CLOSE and 4298 CLOSE_ACK messages contain an HIP_MAC, an outsider cannot close a 4299 connection. The presence of an additional SIGNATURE allows 4300 middleboxes to inspect these messages and discard the associated 4301 state (for e.g., firewalling, SPI-based NATing, etc.). However, the 4302 optional behavior of replying to CLOSE with an ICMP Parameter Problem 4303 packet (as described in Section 5.4.4) might allow an IP spoofer 4304 sending CLOSE messages to launch reflection attacks. 4306 A fifth form of DoS attack is replaying R1s to cause the Initiator to 4307 solve stale puzzles and become out of synchronization with the 4308 Responder. The R1 generation counter is a monotonically increasing 4309 counter designed to protect against this attack, as described in 4310 Section 4.1.4. 4312 Man-in-the-middle attacks are difficult to defend against, without 4313 third-party authentication. A skillful MitM could easily handle all 4314 parts of HIP, but HIP indirectly provides the following protection 4315 from a MitM attack. If the Responder's HI is retrieved from a signed 4316 DNS zone, a certificate, or through some other secure means, the 4317 Initiator can use this to validate the R1 HIP packet. 4319 Likewise, if the Initiator's HI is in a secure DNS zone, a trusted 4320 certificate, or otherwise securely available, the Responder can 4321 retrieve the HI (after having got the I2 HIP packet) and verify that 4322 the HI indeed can be trusted. However, since an Initiator may choose 4323 to use an anonymous HI, it knowingly risks a MitM attack. The 4324 Responder may choose not to accept a HIP exchange with an anonymous 4325 Initiator. 4327 The HIP Opportunistic Mode concept has been introduced in this 4328 document, but this document does not specify what the semantics of 4329 such a connection setup are for applications. There are certain 4330 concerns with opportunistic mode, as discussed in Section 4.1.8. 4332 NOTIFY messages are used only for informational purposes and they are 4333 unacknowledged. A HIP implementation cannot rely solely on the 4334 information received in a NOTIFY message because the packet may have 4335 been replayed. It SHOULD NOT change any state information based 4336 purely on a received NOTIFY message. 4338 Since not all hosts will ever support HIP, ICMP 'Destination Protocol 4339 Unreachable' messages are to be expected and present a DoS attack. 4340 Against an Initiator, the attack would look like the Responder does 4341 not support HIP, but shortly after receiving the ICMP message, the 4342 Initiator would receive a valid R1 HIP packet. Thus, to protect from 4343 this attack, an Initiator should not react to an ICMP message until a 4344 reasonable delta time to get the real Responder's R1 HIP packet. A 4345 similar attack against the Responder is more involved. Normally, if 4346 an I1 message received by a Responder was a bogus one sent by an 4347 attacker, the Responder may receive an ICMP message from the IP 4348 address the R1 message was sent to. However, a sophisticated 4349 attacker can try to take advantage of such a behavior and try to 4350 break up the HIP exchange by sending such an ICMP message to the 4351 Responder before the Initiator has a chance to send a valid I2 4352 message. Hence, the Responder SHOULD NOT act on such an ICMP 4353 message. Especially, it SHOULD NOT remove any minimal state created 4354 when it sent the R1 HIP packet (if it did create one), but wait for 4355 either a valid I2 HIP packet or the natural timeout (that is, if R1 4356 packets are tracked at all). Likewise, the Initiator should ignore 4357 any ICMP message while waiting for an R2 HIP packet, and should 4358 delete any pending state only after a natural timeout. 4360 9. IANA Considerations 4362 IANA has reserved protocol number 139 for the Host Identity Protocol. 4364 This document defines a new 128-bit value under the CGA Message Type 4365 namespace [RFC3972], 0xF0EF F02F BFF4 3D0F E793 0C3C 6E61 74EA, to be 4366 used for HIT generation as specified in ORCHID [RFC4843-bis]. 4368 This document also creates a set of new namespaces. These are 4369 described below. 4371 Packet Type 4373 The 7-bit Packet Type field in a HIP protocol packet describes the 4374 type of a HIP protocol message. It is defined in Section 5.1. 4375 The current values are defined in Sections 5.3.1 through 5.3.8. 4377 New values are assigned through IETF Consensus [RFC2434]. 4379 HIP Version 4381 The four-bit Version field in a HIP protocol packet describes the 4382 version of the HIP protocol. It is defined in Section 5.1. The 4383 currently defined values are 1 and 2. The version of this 4384 document is 2. New values are assigned through IETF Consensus. 4386 HIT Suite 4388 The four-bit HIT Suite ID uses the OGA field in the ORCHID to 4389 express the type of the HIT. This document defines two HIT 4390 Suites. 4392 The HIT Suite ID is also carried in the four higher-order bits of 4393 the ID field in the HIT_SUITE_LIST parameter. The four lower- 4394 order bits are reserved for future extensions of the HIT Suite ID 4395 space beyond 16 values. 4397 At the time being, the HIT Suite uses only four bits because these 4398 bits have to be carried in the HIT. Using more bits for the HIT 4399 Suite ID reduces the cryptographic strength of the HIT. HIT Suite 4400 IDs must be allocated carefully to avoid namespace exhaustion. 4401 Moreover, deprecated IDs should be reused after an appropriate 4402 time span. If 16 Suite IDs prove insufficient and more HIT Suite 4403 IDs are needed concurrently, more bits can be used for the HIT 4404 Suite ID by using one HIT Suite ID (0) to indicate that more bits 4405 should be used. The HIT_SUITE_LIST parameter already supports 4406 8-bit HIT Suite IDs, should longer IDs be needed. Possible 4407 extensions of the HIT Suite ID space to eight-bit and new HIT 4408 Suite IDs are defined through IETF Consensus. 4410 Parameter Type 4412 The 16-bit Type field in a HIP parameter describes the type of the 4413 parameter. It is defined in Section 5.2.1. The current values 4414 are defined in Sections 5.2.3 through 5.2.22. 4416 With the exception of the assigned Type codes, the Type codes 0 4417 through 1023 and 61440 through 65535 are reserved for future base 4418 protocol extensions, and are assigned through IETF Consensus. 4420 The Type codes 32768 through 49141 are reserved for 4421 experimentation. Types SHOULD be selected in a random fashion 4422 from this range, thereby reducing the probability of collisions. 4423 A method employing genuine randomness (such as flipping a coin) 4424 SHOULD be used. 4426 All other Type codes are assigned through First Come First Served, 4427 with Specification Required [RFC2434]. 4429 Group ID 4431 The eight-bit Group ID values appear in the DIFFIE_HELLMAN 4432 parameter and the DH_GROUP_LIST parameter and are defined in 4433 Section 5.2.6. New values either from the reserved or unassigned 4434 space are assigned through IETF Consensus. 4436 HIP Cipher ID 4438 The 16-bit Cipher ID values in a HIP_CIPHER parameter are defined 4439 in Section 5.2.7. New values either from the reserved or 4440 unassigned space are assigned through IETF Consensus. 4442 DI-Type 4444 The four-bit DI-Type values in a HOST_ID parameter are defined in 4445 Section 5.2.8. New values are assigned through IETF Consensus. 4447 Notify Message Type 4449 The 16-bit Notify Message Type values in a NOTIFICATION parameter 4450 are defined in Section 5.2.18. 4452 Notify Message Type values 1-10 are used for informing about 4453 errors in packet structures, values 11-20 for informing about 4454 problems in parameters containing cryptographic related material, 4455 values 21-30 for informing about problems in authentication or 4456 packet integrity verification. Parameter numbers above 30 can be 4457 used for informing about other types of errors or events. Values 4458 51-8191 are error types reserved to be allocated by IANA. Values 4459 8192-16383 are error types for experimentation. Values 16385- 4460 40959 are status types to be allocated by IANA, and values 40960- 4461 65535 are status types for experimentation. New values in ranges 4462 51-8191 and 16385-40959 are assigned through First Come First 4463 Served, with Specification Required. 4465 10. Acknowledgments 4467 The drive to create HIP came to being after attending the MALLOC 4468 meeting at the 43rd IETF meeting. Baiju Patel and Hilarie Orman 4469 really gave the original author, Bob Moskowitz, the assist to get HIP 4470 beyond 5 paragraphs of ideas. It has matured considerably since the 4471 early versions thanks to extensive input from IETFers. Most 4472 importantly, its design goals are articulated and are different from 4473 other efforts in this direction. Particular mention goes to the 4474 members of the NameSpace Research Group of the IRTF. Noel Chiappa 4475 provided valuable input at early stages of discussions about 4476 identifier handling and Keith Moore the impetus to provide 4477 resolvability. Steve Deering provided encouragement to keep working, 4478 as a solid proposal can act as a proof of ideas for a research group. 4480 Many others contributed; extensive security tips were provided by 4481 Steve Bellovin. Rob Austein kept the DNS parts on track. Paul 4482 Kocher taught Bob Moskowitz how to make the puzzle exchange expensive 4483 for the Initiator to respond, but easy for the Responder to validate. 4484 Bill Sommerfeld supplied the Birthday concept, which later evolved 4485 into the R1 generation counter, to simplify reboot management. Erik 4486 Nordmark supplied the CLOSE-mechanism for closing connections. 4487 Rodney Thayer and Hugh Daniels provided extensive feedback. In the 4488 early times of this document, John Gilmore kept Bob Moskowitz 4489 challenged to provide something of value. 4491 During the later stages of this document, when the editing baton was 4492 transferred to Pekka Nikander, the input from the early implementors 4493 was invaluable. Without having actual implementations, this document 4494 would not be on the level it is now. 4496 In the usual IETF fashion, a large number of people have contributed 4497 to the actual text or ideas. The list of these people include Jeff 4498 Ahrenholz, Francis Dupont, Derek Fawcus, George Gross, Andrew 4499 McGregor, Julien Laganier, Miika Komu, Mika Kousa, Jan Melen, Henrik 4500 Petander, Michael Richardson, Rene Hummen, Tim Shepard, Jorma Wall, 4501 and Jukka Ylitalo. Our apologies to anyone whose name is missing. 4503 Once the HIP Working Group was founded in early 2004, a number of 4504 changes were introduced through the working group process. Most 4505 notably, the original document was split in two, one containing the 4506 base exchange and the other one defining how to use ESP. Some 4507 modifications to the protocol proposed by Aura, et al., [AUR03] were 4508 added at a later stage. 4510 11. References 4512 11.1. Normative References 4514 [FIPS.180-2.2002] National Institute of Standards and Technology, 4515 "Secure Hash Standard", FIPS PUB 180-2, 4516 August 2002, . 4519 [FIPS.95-1.1993] National Institute of Standards and Technology, 4520 "Codes for the Identification of Federal and 4521 Federally Assisted Organizations", FIPS PUB 95-1, 4522 January 1993. 4524 [RFC0768] Postel, J., "User Datagram Protocol", STD 6, 4525 RFC 768, August 1980. 4527 [RFC1035] Mockapetris, P., "Domain names - implementation 4528 and specification", STD 13, RFC 1035, 4529 November 1987. 4531 [RFC2119] Bradner, S., "Key words for use in RFCs to 4532 Indicate Requirement Levels", BCP 14, RFC 2119, 4533 March 1997. 4535 [RFC2404] Madson, C. and R. Glenn, "The Use of HMAC-SHA-1-96 4536 within ESP and AH", RFC 2404, November 1998. 4538 [RFC2451] Pereira, R. and R. Adams, "The ESP CBC-Mode Cipher 4539 Algorithms", RFC 2451, November 1998. 4541 [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, 4542 Version 6 (IPv6) Specification", RFC 2460, 4543 December 1998. 4545 [RFC2463] Conta, A. and S. Deering, "Internet Control 4546 Message Protocol (ICMPv6) for the Internet 4547 Protocol Version 6 (IPv6) Specification", 4548 RFC 2463, December 1998. 4550 [RFC2536] Eastlake, D., "DSA KEYs and SIGs in the Domain 4551 Name System (DNS)", RFC 2536, March 1999. 4553 [RFC2898] Kaliski, B., "PKCS #5: Password-Based Cryptography 4554 Specification Version 2.0", RFC 2898, 4555 September 2000. 4557 [RFC3110] Eastlake, D., "RSA/SHA-1 SIGs and RSA KEYs in the 4558 Domain Name System (DNS)", RFC 3110, May 2001. 4560 [RFC3484] Draves, R., "Default Address Selection for 4561 Internet Protocol version 6 (IPv6)", RFC 3484, 4562 February 2003. 4564 [RFC3526] Kivinen, T. and M. Kojo, "More Modular Exponential 4565 (MODP) Diffie-Hellman groups for Internet Key 4566 Exchange (IKE)", RFC 3526, May 2003. 4568 [RFC3602] Frankel, S., Glenn, R., and S. Kelly, "The AES-CBC 4569 Cipher Algorithm and Its Use with IPsec", 4570 RFC 3602, September 2003. 4572 [RFC3972] Aura, T., "Cryptographically Generated Addresses 4573 (CGA)", RFC 3972, March 2005. 4575 [RFC4034] Arends, R., Austein, R., Larson, M., Massey, D., 4576 and S. Rose, "Resource Records for the DNS 4577 Security Extensions", RFC 4034, March 2005. 4579 [RFC4282] Aboba, B., Beadles, M., Arkko, J., and P. Eronen, 4580 "The Network Access Identifier", RFC 4282, 4581 December 2005. 4583 [RFC4307] Schiller, J., "Cryptographic Algorithms for Use in 4584 the Internet Key Exchange Version 2 (IKEv2)", 4585 RFC 4307, December 2005. 4587 [RFC4753] Fu, D. and J. Solinas, "ECP Groups For IKE and 4588 IKEv2", RFC 4753, January 2007. 4590 [RFC4843-bis] Nikander, P., Laganier, J., and F. Dupont, "STUB: 4591 An IPv6 Prefix for Overlay Routable Cryptographic 4592 Hash Identifiers (ORCHID)", 4593 draft-laganier-rfc4843-bis-00 (work in progress), 4594 February 2010. 4596 [RFC4868] Kelly, S. and S. Frankel, "Using HMAC-SHA-256, 4597 HMAC-SHA-384, and HMAC-SHA-512 with IPsec", 4598 RFC 4868, May 2007. 4600 [RFC5201] Moskowitz, R., Nikander, P., Jokela, P., and T. 4601 Henderson, "Host Identity Protocol", RFC 5201, 4602 April 2008. 4604 [RFC5202] Jokela, P., Moskowitz, R., and P. Nikander, "Using 4605 the Encapsulating Security Payload (ESP) Transport 4606 Format with the Host Identity Protocol (HIP)", 4607 RFC 5202, April 2008. 4609 [RFC5702] Jansen, J., "Use of SHA-2 Algorithms with RSA in 4610 DNSKEY and RRSIG Resource Records for DNSSEC", 4611 RFC 5702, October 2009. 4613 [RFC5869] Krawczyk, H. and P. Eronen, "HMAC-based Extract- 4614 and-Expand Key Derivation Function (HKDF)", 4615 RFC 5869, May 2010. 4617 [fundamental-ecc] McGrew, D. and K. Igoe, "Fundamental Elliptic 4618 Curve Cryptography Algorithms", 4619 draft-mcgrew-fundamental-ecc-03 (work in 4620 progress), May 2010. 4622 11.2. Informative References 4624 [AUR03] Aura, T., Nagarajan, A., and A. Gurtov, "Analysis 4625 of the HIP Base Exchange Protocol", in Proceedings 4626 of 10th Australasian Conference on Information 4627 Security and Privacy, July 2003. 4629 [CRO03] Crosby, SA. and DS. Wallach, "Denial of Service 4630 via Algorithmic Complexity Attacks", in 4631 Proceedings of Usenix Security Symposium 2003, 4632 Washington, DC., August 2003. 4634 [DIF76] Diffie, W. and M. Hellman, "New Directions in 4635 Cryptography", IEEE Transactions on Information 4636 Theory vol. IT-22, number 6, pages 644-654, 4637 Nov 1976. 4639 [FIPS.197.2001] National Institute of Standards and Technology, 4640 "Advanced Encryption Standard (AES)", FIPS PUB 4641 197, November 2001, . 4644 [KAU03] Kaufman, C., Perlman, R., and B. Sommerfeld, "DoS 4645 protection for UDP-based protocols", ACM 4646 Conference on Computer and Communications 4647 Security , Oct 2003. 4649 [KRA03] Krawczyk, H., "SIGMA: The 'SIGn-and-MAc' Approach 4650 to Authenticated Diffie-Hellman and Its Use in the 4651 IKE-Protocols", in Proceedings of CRYPTO 2003, 4652 pages 400-425, August 2003. 4654 [RFC0792] Postel, J., "Internet Control Message Protocol", 4655 STD 5, RFC 792, September 1981. 4657 [RFC2434] Narten, T. and H. Alvestrand, "Guidelines for 4658 Writing an IANA Considerations Section in RFCs", 4659 BCP 26, RFC 2434, October 1998. 4661 [RFC4306] Kaufman, C., "Internet Key Exchange (IKEv2) 4662 Protocol", RFC 4306, December 2005. 4664 [RFC5204] Laganier, J. and L. Eggert, "Host Identity 4665 Protocol (HIP) Rendezvous Extension", RFC 5204, 4666 April 2008. 4668 [RFC5205] Nikander, P. and J. Laganier, "Host Identity 4669 Protocol (HIP) Domain Name System (DNS) 4670 Extensions", RFC 5205, April 2008. 4672 [RFC5206] Nikander, P., Henderson, T., Vogt, C., and J. 4673 Arkko, "End-Host Mobility and Multihoming with the 4674 Host Identity Protocol", RFC 5206, April 2008. 4676 [RFC5338] Henderson, T., Nikander, P., and M. Komu, "Using 4677 the Host Identity Protocol with Legacy 4678 Applications", RFC 5338, September 2008. 4680 [RFC5533] Nordmark, E. and M. Bagnulo, "Shim6: Level 3 4681 Multihoming Shim Protocol for IPv6", RFC 5533, 4682 June 2009. 4684 [btns-c-api] Richardson, M., Williams, N., Komu, M., and S. 4685 Tarkoma, "C-Bindings for IPsec Application 4686 Programming Interfaces", draft-ietf-btns-c-api-04 4687 (work in progress), March 2009. 4689 [rfc4423-bis] Moskowitz, R., "Host Identity Protocol 4690 Architecture", draft-moskowitz-hip-rfc4423-bis-00 4691 (work in progress), June 2010. 4693 Appendix A. Using Responder Puzzles 4695 As mentioned in Section 4.1.1, the Responder may delay state creation 4696 and still reject most spoofed I2s by using a number of pre-calculated 4697 R1s and a local selection function. This appendix defines one 4698 possible implementation in detail. The purpose of this appendix is 4699 to give the implementors an idea on how to implement the mechanism. 4700 If the implementation is based on this appendix, it MAY contain some 4701 local modification that makes an attacker's task harder. 4703 The Responder creates a secret value S, that it regenerates 4704 periodically. The Responder needs to remember the two latest values 4705 of S. Each time the S is regenerated, the R1 generation counter 4706 value is incremented by one. 4708 The Responder generates a pre-signed R1 packet. The signature for 4709 pre-generated R1s must be recalculated when the Diffie-Hellman key is 4710 recomputed or when the R1_COUNTER value changes due to S value 4711 regeneration. 4713 When the Initiator sends the I1 packet for initializing a connection, 4714 the Responder gets the HIT and IP address from the packet, and 4715 generates an I value for the puzzle. The I value is set to the pre- 4716 signed R1 packet. 4718 I value calculation: 4719 I = Ltrunc( RHASH ( S | HIT-I | HIT-R | IP-I | IP-R ), n) 4720 where n = RHASH-len/2 4722 The RHASH algorithm is the same that is used to generate the 4723 Responder's HIT value. 4725 From an incoming I2 packet, the Responder gets the required 4726 information to validate the puzzle: HITs, IP addresses, and the 4727 information of the used S value from the R1_COUNTER. Using these 4728 values, the Responder can regenerate the I, and verify it against the 4729 I received in the I2 packet. If the I values match, it can verify 4730 the solution using I, J, and difficulty K. If the I values do not 4731 match, the I2 is dropped. 4733 puzzle_check: 4734 V := Ltrunc( RHASH( I2.I | I2.hit_i | I2.hit_r | I2.J ), K ) 4735 if V != 0, drop the packet 4737 If the puzzle solution is correct, the I and J values are stored for 4738 later use. They are used as input material when keying material is 4739 generated. 4741 Keeping state about failed puzzle solutions depends on the 4742 implementation. Although it is possible for the Responder not to 4743 keep any state information, it still may do so to protect itself 4744 against certain attacks (see Section 4.1.1). 4746 Appendix B. Generating a Public Key Encoding from an HI 4748 The following pseudo-code illustrates the process to generate a 4749 public key encoding from an HI for both RSA and DSA. 4751 The symbol := denotes assignment; the symbol += denotes appending. 4752 The pseudo-function encode_in_network_byte_order takes two 4753 parameters, an integer (bignum) and a length in bytes, and returns 4754 the integer encoded into a byte string of the given length. 4756 switch ( HI.algorithm ) 4757 { 4759 case RSA: 4760 buffer := encode_in_network_byte_order ( HI.RSA.e_len, 4761 ( HI.RSA.e_len > 255 ) ? 3 : 1 ) 4762 buffer += encode_in_network_byte_order ( HI.RSA.e, HI.RSA.e_len ) 4763 buffer += encode_in_network_byte_order ( HI.RSA.n, HI.RSA.n_len ) 4764 break; 4766 case DSA: 4767 buffer := encode_in_network_byte_order ( HI.DSA.T , 1 ) 4768 buffer += encode_in_network_byte_order ( HI.DSA.Q , 20 ) 4769 buffer += encode_in_network_byte_order ( HI.DSA.P , 64 + 4770 8 * HI.DSA.T ) 4771 buffer += encode_in_network_byte_order ( HI.DSA.G , 64 + 4772 8 * HI.DSA.T ) 4773 buffer += encode_in_network_byte_order ( HI.DSA.Y , 64 + 4774 8 * HI.DSA.T ) 4775 break; 4777 } 4779 Appendix C. Example Checksums for HIP Packets 4781 The HIP checksum for HIP packets is specified in Section 5.1.1. 4782 Checksums for TCP and UDP packets running over HIP-enabled security 4783 associations are specified in Section 3.5. The examples below use IP 4784 addresses of 192.168.0.1 and 192.168.0.2 (and their respective IPv4- 4785 compatible IPv6 formats), and HITs with the prefix of 2001:10 4786 followed by zeros, followed by a decimal 1 or 2, respectively. 4788 The following example is defined only for testing a checksum 4789 calculation. The address format for the IPv4-compatible IPv6 address 4790 is not a valid one, but using these IPv6 addresses when testing an 4791 IPv6 implementation gives the same checksum output as an IPv4 4792 implementation with the corresponding IPv4 addresses. 4794 C.1. IPv6 HIP Example (I1) 4796 Source Address: ::192.168.0.1 4797 Destination Address: ::192.168.0.2 4798 Upper-Layer Packet Length: 40 0x28 4799 Next Header: 139 0x8b 4800 Payload Protocol: 59 0x3b 4801 Header Length: 4 0x4 4802 Packet Type: 1 0x1 4803 Version: 1 0x1 4804 Reserved: 1 0x1 4805 Control: 0 0x0 4806 Checksum: 446 0x1be 4807 Sender's HIT : 2001:10::1 4808 Receiver's HIT: 2001:10::2 4810 C.2. IPv4 HIP Packet (I1) 4812 The IPv4 checksum value for the same example I1 packet is the same as 4813 the IPv6 checksum (since the checksums due to the IPv4 and IPv6 4814 pseudo-header components are the same). 4816 C.3. TCP Segment 4818 Regardless of whether IPv6 or IPv4 is used, the TCP and UDP sockets 4819 use the IPv6 pseudo-header format [RFC2460], with the HITs used in 4820 place of the IPv6 addresses. 4822 Sender's HIT: 2001:10::1 4823 Receiver's HIT: 2001:10::2 4824 Upper-Layer Packet Length: 20 0x14 4825 Next Header: 6 0x06 4826 Source port: 65500 0xffdc 4827 Destination port: 22 0x0016 4828 Sequence number: 1 0x00000001 4829 Acknowledgment number: 0 0x00000000 4830 Header length: 20 0x14 4831 Flags: SYN 0x02 4832 Window size: 65535 0xffff 4833 Checksum: 28618 0x6fca 4834 Urgent pointer: 0 0x0000 4836 0x0000: 6000 0000 0014 0640 2001 0010 0000 0000 4837 0x0010: 0000 0000 0000 0001 2001 0010 0000 0000 4838 0x0020: 0000 0000 0000 0002 ffdc 0016 0000 0001 4839 0x0030: 0000 0000 5002 ffff 6fca 0000 4841 Appendix D. ECDH-160 Group 4843 The ECDH-160 group is rated at 80 bits strength. Once this was 4844 considered appropriate for one year of security. Today should be 4845 used only when the host is not powerful enough (e.g., some PDAs) and 4846 when security requirements are low (e.g., during normal web surfing). 4848 Appendix E. HIT Suites and HIT Generation 4850 The HIT as an ORCHID [RFC4843-bis] consists of three parts: A 28-bit 4851 prefix, a 4-bit encoding of the ORCHID generation algorithm (OGA) and 4852 the representation of the public key. The OGA is an index pointing 4853 to the specific algorithm by which the public key and the 96-bit 4854 hashed encoding is generated. The OGA is protocol specific and is to 4855 be interpreted as defined below for all protocols that use the same 4856 context ID as HIP. HIP groups sets of valid combinations of 4857 signature and hash algorithms into HIT Suites. These HIT suites are 4858 addressed by an index, which is transmitted in the OGA field of the 4859 ORCHID. 4861 The set of used HIT Suites will be extended to counter the progress 4862 in computation capabilities and vulnerabilities in the employed 4863 algorithms. The intended use of the HIT Suites is to introduce a new 4864 HIT Suite and phase out an old one before it becomes insecure. Since 4865 the 4-bit OGA field only permits 15 HIT Suites (the HIT Suite with ID 4866 0 is reserved) to be used in parallel, phased-out HIT Suites must be 4867 reused at some point. In such a case, there will be a rollover of 4868 the HIT Suite ID and the next newly introduced HIT Suite will start 4869 with a lower HIT Suite index than the previoulsy introduced one. The 4870 rollover effectively deprecates the reused HIT Suite. For a smooth 4871 transition, the HIT Suite should be deprecated a considerable time 4872 before the HIT Suite index is reused. 4874 Since the number of HIT Suites is tightly limited to 16, the HIT 4875 Suites must be assigned carefully. Hence, sets of suitable 4876 algorithms are grouped in a HIT Suite. 4878 The HIT Suite of the Responder's HIT determines the RHASH and the 4879 hash function to be used for the HMAC in HIP control packets as well 4880 as the signature algorithm family used for generating the HI. The 4881 list of HIT Suites is defined in Table 11. 4883 The following HIT Suites are defined for HIT generation. The input 4884 for each generation algorithm is the encoding of the HI as defined in 4885 Section 3.2. The output is 96 bits long and is directly used in the 4886 ORCHID. 4888 +-------+----------+-----------------+------------------------------+ 4889 | Index | Hash | Signature | Description | 4890 | | function | algorithm | | 4891 | | | family | | 4892 +-------+----------+-----------------+------------------------------+ 4893 | 0 | | | Reserved | 4894 | 1 | SHA-1 | RSA, DSA | RSA or DSA HI hashed with | 4895 | | | | SHA-1, truncated to 96 bits | 4896 | 2 | SHA-256 | ECDSA | ECDSA HI hashed with | 4897 | | | | SHA-256, truncated to 96 | 4898 | | | | bits | 4899 | 3 | SHA-384 | ECDSA | ECDSA HI hashed with | 4900 | | | | SHA-384, truncated to 96 | 4901 | | | | bits | 4902 +-------+----------+-----------------+------------------------------+ 4904 Table 11: HIT Suites 4906 Authors' Addresses 4908 Robert Moskowitz (editor) 4909 ICSA labs, An Independent Division of Verizon Business 4910 1000 Bent Creek Blvd, Suite 200 4911 Mechanicsburg, PA 4912 USA 4914 EMail: robert.moskowitz@icsalabs.com 4916 Petri Jokela 4917 Ericsson Research NomadicLab 4918 JORVAS FIN-02420 4919 FINLAND 4921 Phone: +358 9 299 1 4922 EMail: petri.jokela@nomadiclab.com 4924 Thomas R. Henderson 4925 The Boeing Company 4926 P.O. Box 3707 4927 Seattle, WA 4928 USA 4930 EMail: thomas.r.henderson@boeing.com 4931 Tobias Heer 4932 RWTH Aachen University, Distributed Systems Group 4933 Ahornstrasse 55 4934 Aachen 52062 4935 Germany 4937 EMail: heer@cs.rwth-aachen.de 4938 URI: http://ds.cs.rwth-aachen.de/members/heer