idnits 2.17.1 draft-ietf-hip-base-06.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** It looks like you're using RFC 3978 boilerplate. You should update this to the boilerplate described in the IETF Trust License Policy document (see https://trustee.ietf.org/license-info), which is required now. -- Found old boilerplate from RFC 3978, Section 5.1 on line 20. -- Found old boilerplate from RFC 3978, Section 5.5 on line 4169. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 4146. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 4153. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 4159. ** This document has an original RFC 3978 Section 5.4 Copyright Line, instead of the newer IETF Trust Copyright according to RFC 4748. ** This document has an original RFC 3978 Section 5.5 Disclaimer, instead of the newer disclaimer which includes the IETF Trust according to RFC 4748. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- == No 'Intended status' indicated for this document; assuming Proposed Standard Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- == There are 1 instance of lines with private range IPv4 addresses in the document. If these are generic example addresses, they should be changed to use any of the ranges defined in RFC 6890 (or successor): 192.0.2.x, 198.51.100.x or 203.0.113.x. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the RFC 3978 Section 5.4 Copyright Line does not match the current year == Line 1013 has weird spacing: '...ciation has n...' == Line 1061 has weird spacing: '... failed to es...' == Line 1610 has weird spacing: '...c Value leng...' == Line 1612 has weird spacing: '...c Value the ...' == 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 'MUST not' in this paragraph: The UPDATE packet contains zero or one SEQ parameter. The presence of a SEQ parameter indicates that the receiver MUST ack the UPDATE. An UPDATE that does not contain a SEQ parameter is simply an ACK of a previous UPDATE and itself MUST not be acked. == 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 'MUST not' in this paragraph: All compliant implementations MUST produce R1 packets. An R1 packet MAY be precomputed. An R1 packet MAY be reused for time Delta T, which is implementation dependent, and SHOULD be deprecated and not used once a valid response I2 packet has been received from an Initiator. During I1 message storm, an R1 packet may be re-used beyond this limit. R1 information MUST not be discarded until Delta S after T. Time S is the delay needed for the last I2 to arrive back to the Responder. -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (June 15, 2006) is 6526 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: 'RFC2536' on line 1724 -- Looks like a reference, but probably isn't: 'RFC3110' on line 1725 ** Obsolete normative reference: RFC 1885 (ref. '4') (Obsoleted by RFC 2463) ** Obsolete normative reference: RFC 2409 (ref. '7') (Obsoleted by RFC 4306) ** Downref: Normative reference to an Informational RFC: RFC 2412 (ref. '8') ** Obsolete normative reference: RFC 2434 (ref. '9') (Obsoleted by RFC 5226) ** Obsolete normative reference: RFC 2460 (ref. '11') (Obsoleted by RFC 8200) ** Obsolete normative reference: RFC 2535 (ref. '12') (Obsoleted by RFC 4033, RFC 4034, RFC 4035) ** Obsolete normative reference: RFC 2898 (ref. '14') (Obsoleted by RFC 8018) ** Obsolete normative reference: RFC 3484 (ref. '16') (Obsoleted by RFC 6724) ** Obsolete normative reference: RFC 4307 (ref. '21') (Obsoleted by RFC 8247) == Outdated reference: A later version (-07) exists of draft-laganier-ipv6-khi-01 ** Downref: Normative reference to an Experimental draft: draft-laganier-ipv6-khi (ref. '22') == Outdated reference: A later version (-06) exists of draft-ietf-hip-esp-02 ** Downref: Normative reference to an Experimental draft: draft-ietf-hip-esp (ref. '24') -- Possible downref: Non-RFC (?) normative reference: ref. '25' == Outdated reference: A later version (-12) exists of draft-ietf-shim6-proto-05 Summary: 14 errors (**), 0 flaws (~~), 12 warnings (==), 11 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group R. Moskowitz 3 Internet-Draft ICSAlabs, a Division of TruSecure 4 Expires: December 17, 2006 Corporation 5 P. Nikander 6 P. Jokela (editor) 7 Ericsson Research NomadicLab 8 T. Henderson 9 The Boeing Company 10 June 15, 2006 12 Host Identity Protocol 13 draft-ietf-hip-base-06 15 Status of this Memo 17 By submitting this Internet-Draft, each author represents that any 18 applicable patent or other IPR claims of which he or she is aware 19 have been or will be disclosed, and any of which he or she becomes 20 aware will be disclosed, in accordance with Section 6 of BCP 79. 22 Internet-Drafts are working documents of the Internet Engineering 23 Task Force (IETF), its areas, and its working groups. Note that 24 other groups may also distribute working documents as Internet- 25 Drafts. 27 Internet-Drafts are draft documents valid for a maximum of six months 28 and may be updated, replaced, or obsoleted by other documents at any 29 time. It is inappropriate to use Internet-Drafts as reference 30 material or to cite them other than as "work in progress." 32 The list of current Internet-Drafts can be accessed at 33 http://www.ietf.org/ietf/1id-abstracts.txt. 35 The list of Internet-Draft Shadow Directories can be accessed at 36 http://www.ietf.org/shadow.html. 38 This Internet-Draft will expire on December 17, 2006. 40 Copyright Notice 42 Copyright (C) The Internet Society (2006). 44 Abstract 46 This memo specifies the details of the Host Identity Protocol (HIP). 47 HIP allows consenting hosts to securely establish and maintain shared 48 IP-layer state, allowing separation of the identifier and locator 49 roles of IP addresses, thereby enabling continuity of communications 50 across IP address changes. HIP is based on a Sigma-compliant Diffie- 51 Hellman key exchange, using public-key identifiers from a new Host 52 Identity name space for mutual peer authentication. The protocol is 53 designed to be resistant to Denial-of-Service (DoS) and Man-in-the- 54 middle (MitM) attacks, and when used together with another suitable 55 security protocol, such as Encapsulated Security Payload (ESP), it 56 provides integrity protection and optional encryption for upper layer 57 protocols, suchs as TCP and UDP. Discussion related to this document 58 is going on at the IETF HIP Working Group mailing list. 60 Table of Contents 62 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 5 63 1.1. A New Name Space and Identifiers . . . . . . . . . . . . 5 64 1.2. The HIP Base Exchange . . . . . . . . . . . . . . . . . . 6 65 1.3. Memo structure . . . . . . . . . . . . . . . . . . . . . 6 66 2. Terms and Definitions . . . . . . . . . . . . . . . . . . . . 8 67 2.1. Requirements Terminology . . . . . . . . . . . . . . . . 8 68 2.2. Notation . . . . . . . . . . . . . . . . . . . . . . . . 8 69 2.3. Definitions . . . . . . . . . . . . . . . . . . . . . . . 8 70 3. Host Identifier (HI) and its Representations . . . . . . . . 10 71 3.1. Host Identity Tag (HIT) . . . . . . . . . . . . . . . . . 10 72 3.2. Generating a HIT from a HI . . . . . . . . . . . . . . . 11 73 4. Protocol Overview . . . . . . . . . . . . . . . . . . . . . . 12 74 4.1. Creating a HIP Association . . . . . . . . . . . . . . . 12 75 4.1.1. HIP Puzzle Mechanism . . . . . . . . . . . . . . . . 13 76 4.1.2. Puzzle exchange . . . . . . . . . . . . . . . . . . . 14 77 4.1.3. Authenticated Diffie-Hellman Protocol . . . . . . . . 15 78 4.1.4. HIP Replay Protection . . . . . . . . . . . . . . . . 16 79 4.1.5. Refusing a HIP Exchange . . . . . . . . . . . . . . . 17 80 4.1.6. HIP Opportunistic Mode . . . . . . . . . . . . . . . 17 81 4.2. Updating a HIP Association . . . . . . . . . . . . . . . 18 82 4.3. Error Processing . . . . . . . . . . . . . . . . . . . . 18 83 4.4. HIP State Machine . . . . . . . . . . . . . . . . . . . . 19 84 4.4.1. HIP States . . . . . . . . . . . . . . . . . . . . . 20 85 4.4.2. HIP State Processes . . . . . . . . . . . . . . . . . 21 86 4.4.3. Simplified HIP State Diagram . . . . . . . . . . . . 28 87 4.5. User Data Considerations . . . . . . . . . . . . . . . . 30 88 4.5.1. TCP and UDP Pseudo-header Computation for User Data . 30 89 4.5.2. Sending Data on HIP Packets . . . . . . . . . . . . . 30 90 4.5.3. Transport Formats . . . . . . . . . . . . . . . . . . 30 91 4.5.4. Reboot and SA Timeout Restart of HIP . . . . . . . . 30 92 4.6. Certificate Distribution . . . . . . . . . . . . . . . . 31 93 5. Packet Formats . . . . . . . . . . . . . . . . . . . . . . . 32 94 5.1. Payload Format . . . . . . . . . . . . . . . . . . . . . 32 95 5.1.1. Checksum . . . . . . . . . . . . . . . . . . . . . . 33 96 5.1.2. HIP Controls . . . . . . . . . . . . . . . . . . . . 33 97 5.1.3. HIP Fragmentation Support . . . . . . . . . . . . . . 34 98 5.2. HIP Parameters . . . . . . . . . . . . . . . . . . . . . 34 99 5.2.1. TLV Format . . . . . . . . . . . . . . . . . . . . . 36 100 5.2.2. Defining New Parameters . . . . . . . . . . . . . . . 37 101 5.2.3. R1_COUNTER . . . . . . . . . . . . . . . . . . . . . 38 102 5.2.4. PUZZLE . . . . . . . . . . . . . . . . . . . . . . . 39 103 5.2.5. SOLUTION . . . . . . . . . . . . . . . . . . . . . . 40 104 5.2.6. DIFFIE_HELLMAN . . . . . . . . . . . . . . . . . . . 41 105 5.2.7. HIP_TRANSFORM . . . . . . . . . . . . . . . . . . . . 42 106 5.2.8. HOST_ID . . . . . . . . . . . . . . . . . . . . . . . 43 107 5.2.9. HMAC . . . . . . . . . . . . . . . . . . . . . . . . 44 108 5.2.10. HMAC_2 . . . . . . . . . . . . . . . . . . . . . . . 45 109 5.2.11. HIP_SIGNATURE . . . . . . . . . . . . . . . . . . . . 45 110 5.2.12. HIP_SIGNATURE_2 . . . . . . . . . . . . . . . . . . . 46 111 5.2.13. SEQ . . . . . . . . . . . . . . . . . . . . . . . . . 46 112 5.2.14. ACK . . . . . . . . . . . . . . . . . . . . . . . . . 47 113 5.2.15. ENCRYPTED . . . . . . . . . . . . . . . . . . . . . . 48 114 5.2.16. NOTIFY . . . . . . . . . . . . . . . . . . . . . . . 49 115 5.2.17. ECHO_REQUEST . . . . . . . . . . . . . . . . . . . . 52 116 5.2.18. ECHO_RESPONSE . . . . . . . . . . . . . . . . . . . . 53 117 5.3. HIP Packets . . . . . . . . . . . . . . . . . . . . . . . 53 118 5.3.1. I1 - the HIP Initiator Packet . . . . . . . . . . . . 54 119 5.3.2. R1 - the HIP Responder Packet . . . . . . . . . . . . 55 120 5.3.3. I2 - the Second HIP Initiator Packet . . . . . . . . 56 121 5.3.4. R2 - the Second HIP Responder Packet . . . . . . . . 58 122 5.3.5. UPDATE - the HIP Update Packet . . . . . . . . . . . 58 123 5.3.6. NOTIFY - the HIP Notify Packet . . . . . . . . . . . 59 124 5.3.7. CLOSE - the HIP Association Closing Packet . . . . . 60 125 5.3.8. CLOSE_ACK - the HIP Closing Acknowledgment Packet . . 60 126 5.4. ICMP Messages . . . . . . . . . . . . . . . . . . . . . . 60 127 5.4.1. Invalid Version . . . . . . . . . . . . . . . . . . . 61 128 5.4.2. Other Problems with the HIP Header and Packet 129 Structure . . . . . . . . . . . . . . . . . . . . . . 61 130 5.4.3. Invalid Puzzle Solution . . . . . . . . . . . . . . . 61 131 5.4.4. Non-existing HIP Association . . . . . . . . . . . . 61 132 6. Packet Processing . . . . . . . . . . . . . . . . . . . . . . 63 133 6.1. Processing Outgoing Application Data . . . . . . . . . . 63 134 6.2. Processing Incoming Application Data . . . . . . . . . . 64 135 6.3. Solving the Puzzle . . . . . . . . . . . . . . . . . . . 65 136 6.4. HMAC and SIGNATURE Calculation and Verification . . . . . 66 137 6.4.1. HMAC Calculation . . . . . . . . . . . . . . . . . . 66 138 6.4.2. Signature Calculation . . . . . . . . . . . . . . . . 67 139 6.5. HIP KEYMAT Generation . . . . . . . . . . . . . . . . . . 68 140 6.6. Initiation of a HIP Exchange . . . . . . . . . . . . . . 69 141 6.6.1. Sending Multiple I1s in Parallel . . . . . . . . . . 70 142 6.6.2. Processing Incoming ICMP Protocol Unreachable 143 Messages . . . . . . . . . . . . . . . . . . . . . . 71 145 6.7. Processing Incoming I1 Packets . . . . . . . . . . . . . 71 146 6.7.1. R1 Management . . . . . . . . . . . . . . . . . . . . 72 147 6.7.2. Handling Malformed Messages . . . . . . . . . . . . . 72 148 6.8. Processing Incoming R1 Packets . . . . . . . . . . . . . 72 149 6.8.1. Handling Malformed Messages . . . . . . . . . . . . . 75 150 6.9. Processing Incoming I2 Packets . . . . . . . . . . . . . 75 151 6.9.1. Handling Malformed Messages . . . . . . . . . . . . . 77 152 6.10. Processing Incoming R2 Packets . . . . . . . . . . . . . 77 153 6.11. Sending UPDATE Packets . . . . . . . . . . . . . . . . . 78 154 6.12. Receiving UPDATE Packets . . . . . . . . . . . . . . . . 79 155 6.12.1. Handling a SEQ parameter in a received UPDATE 156 message . . . . . . . . . . . . . . . . . . . . . . . 80 157 6.12.2. Handling an ACK Parameter in a Received UPDATE 158 Packet . . . . . . . . . . . . . . . . . . . . . . . 80 159 6.13. Processing NOTIFY Packets . . . . . . . . . . . . . . . . 81 160 6.14. Processing CLOSE Packets . . . . . . . . . . . . . . . . 81 161 6.15. Processing CLOSE_ACK Packets . . . . . . . . . . . . . . 81 162 6.16. Dropping HIP Associations . . . . . . . . . . . . . . . . 81 163 7. HIP Policies . . . . . . . . . . . . . . . . . . . . . . . . 83 164 8. Security Considerations . . . . . . . . . . . . . . . . . . . 84 165 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 87 166 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 92 167 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 93 168 11.1. Normative References . . . . . . . . . . . . . . . . . . 93 169 11.2. Informative References . . . . . . . . . . . . . . . . . 94 170 Appendix A. Using Responder Puzzles . . . . . . . . . . . . . . 96 171 Appendix B. Generating a Public Key Encoding from a HI . . . . . 97 172 Appendix C. Example Checksums for HIP Packets . . . . . . . . . 98 173 C.1. IPv6 HIP Example (I1) . . . . . . . . . . . . . . . . . . 98 174 C.2. IPv4 HIP Packet (I1) . . . . . . . . . . . . . . . . . . 98 175 C.3. TCP Segment . . . . . . . . . . . . . . . . . . . . . . . 98 176 Appendix D. 384-bit Group . . . . . . . . . . . . . . . . . . . 100 177 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 101 178 Intellectual Property and Copyright Statements . . . . . . . . . 102 180 1. Introduction 182 This memo specifies the details of the Host Identity Protocol (HIP). 183 A high-level description of the protocol and the underlying 184 architectural thinking is available in the separate HIP architecture 185 description [26]. Briefly, the HIP architecture proposes an 186 alternative to the dual use of IP addresses as "locators" (routing 187 labels) and "identifiers" (endpoint, or host, identifiers). In HIP, 188 public cryptographic keys, of a public/private key pair, are used as 189 Host Identifiers, to which higher layer protocols are bound instead 190 of an IP address. By using public keys (and their representations) 191 as host identifiers, dynamic changes to IP address sets can be 192 directly authenticated between hosts and if desired, strong 193 authentication between hosts at the TCP/IP stack level can be 194 obtained. 196 This memo specifies the base HIP protocol ("base exchange") used 197 between hosts to establish an IP-layer communications context, called 198 HIP association, prior to communications. It also defines a packet 199 format and procedures for updating an active HIP association. Other 200 elements of the HIP architecture are specified in other documents, 201 including how HIP can be combined with a variant of the Encapsulating 202 Security Payload (ESP) for integrity protection and optional 203 encryption, mobility and multi-homing extensions to HIP, extensions 204 to the Domain Name System (DNS) for storing Host Identities there, 205 proposals on added HIP-related infrastructure into the networks, and 206 techniques for NAT traversal. 208 1.1. A New Name Space and Identifiers 210 The Host Identity Protocol introduces a new name space, the Host 211 Identity name space. Some ramifications of this new namespace are 212 explained in the HIP architecture description [26]. 214 There are two main representations of the Host Identity, the full 215 Host Identifier (HI) and the Host Identity Tag (HIT The HI is a 216 public key and directly represents the Identity. Since there are 217 different public key algorithms that can be used with different key 218 lengths, the HI is not good for use as a packet identifier, or as an 219 index into the various operational tables needed to support HIP. 220 Consequently, a hash of the HI, the Host Identity Tag (HIT), becomes 221 the operational representation. It is 128 bits long and is used in 222 the HIP payloads and to index the corresponding state in the end 223 hosts. The HIT has an important security property in that it is 224 self-certifying (see Section 3). 226 1.2. The HIP Base Exchange 228 The HIP base exchange is a two-party cryptographic protocol used to 229 establish communications context between hosts. The base exchange is 230 a Sigma-compliant [30] four packet exchange. The first party is 231 called the Initiator and the second party the Responder. The four- 232 packet design helps to make HIP DoS resilient. The protocol 233 exchanges Diffie-Hellman keys in the 2nd and 3rd packets, and 234 authenticates the parties in the 3rd and 4th packets. Additionally, 235 the Responder starts a puzzle exchange in the 2nd packet, with the 236 Initiator completing it in the 3rd packet before the Responder stores 237 any state from the exchange. 239 The exchange can use the Diffie-Hellman output to encrypt the Host 240 Identity of the Initiator in packet 3 (although Aura et al. [29] 241 notes that such operation may interfere with packet-inspecting 242 middleboxes), or the Host Identity may instead be sent unencrypted. 243 The Responder's Host Identity is not protected. It should be noted, 244 however, that both the Initiator's and the Responder's HITs are 245 transported as such (in cleartext) in the packets, allowing an 246 eavesdropper with a priori knowledge about the parties to verify 247 their identities. 249 Data packets start to flow after the 4th packet. The 3rd and 4th HIP 250 packets may carry a data payload in the future. However, the details 251 of this are to be defined later as more implementation experience is 252 gained. 254 An existing HIP association can be updated using the update mechanism 255 defined in this document, and when the association is no longer 256 needed, it can be closed using the defined closing mechanism. 258 Finally, HIP is designed as an end-to-end authentication and key 259 establishment protocol, to be used with Encapsulated Security Payload 260 (ESP) [24] and other end-to-end security protocols. The base 261 protocol lacks the details for security association management and 262 much of the fine-grained policy control found in Internet Key 263 Exchange IKE RFC2409 [7] that allows IKE to support complex gateway 264 policies. Thus, HIP is not a replacement for IKE. 266 1.3. Memo structure 268 The rest of this memo is structured as follows. Section 2 defines 269 the central keywords, notation, and terms used throughout the rest of 270 the document. Section 3 defines the structure of the Host Identity 271 and its various representations. Section 4 gives an overview of the 272 HIP base exchange protocol. Section 5 and Section 6 define the 273 detail packet formats and rules for packet processing. Finally, 274 Section 7, Section 8, and Section 9 discuss policy, security, and 275 IANA considerations, respectively. 277 2. Terms and Definitions 279 2.1. Requirements Terminology 281 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 282 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 283 document are to be interpreted as described in RFC2119 [5]. 285 2.2. Notation 287 [x] indicates that x is optional. 289 {x} indicates that x is encrypted. 291 X(y) indicates that y is a parameter of X. 293 i indicates that x exists i times. 295 --> signifies "Initiator to Responder" communication (requests). 297 <-- signifies "Responder to Initiator" communication (replies). 299 | signifies concatenation of information-- e.g. X | Y is the 300 concatenation of X with Y. 302 Ltrunc (SHA-1(), K) denotes the lowest order K bits of the SHA-1 303 result. 305 2.3. Definitions 307 Unused Association Lifetime (UAL): Implementation-specific time for 308 which, if no packet is sent or received for this time interval, a 309 host MAY begin to tear down an active association. 311 Maximum Segment Lifetime (MSL): Maximum time that a TCP segment is 312 expected to spend in the network. 314 Exchange Complete (EC): Time that the host spends at the R2-SENT 315 before it moves to ESTABLISHED state. The time is n * I2 316 retransmission timeout, where n ~ I2_RETRIES_MAX. 318 HIT Hash Algorithm: hash algorithm used to generate a Host Identity 319 Tag (HIT) from the Host Identity public key. Currently SHA-1 [25] 320 is used. 322 Responder's HIT Hash Algorithm (RHASH): hash algorithm used for 323 various hash calculations in this document. The algorithm is the 324 same as is used to generate the Responder's HIT. RHASH can be 325 determined by inspecting the Prefix of the ORCHID (HIT). The 326 Prefix value has a one-to-one mapping to a hash function. 328 Opportunistic mode: HIP base exchange where the Responder's HIT is 329 not a priori known to the Initiator. 331 3. Host Identifier (HI) and its Representations 333 In this section, the properties of the Host Identifier and Host 334 Identifier Tag are discussed, and the exact format for them is 335 defined. In HIP, public key of an asymmetric key pair is used as the 336 Host Identifier (HI). Correspondingly, the host itself is defined as 337 the entity that holds the private key from the key pair. See the HIP 338 architecture specification [26] for more details about the difference 339 between an identity and the corresponding identifier. 341 HIP implementations MUST support the Rivest Shamir Adelman (RSA) [15] 342 public key algorithm, and SHOULD support the Digital Signature 343 Algorithm (DSA) [13] algorithm; other algorithms MAY be supported. 345 A hashed encoding of the HI, the Host Identity Tag (HIT), is used in 346 protocols to represent the Host Identity. The HIT is 128 bits long 347 and has the following three key properties: i) it is the same length 348 as an IPv6 address and can be used in address-sized fields in APIs 349 and protocols, ii) it is self-certifying (i.e., given a HIT, it is 350 computationally hard to find a Host Identity key that matches the 351 HIT), and iii) the probability of HIT collision between two hosts is 352 very low. 354 Carrying HIs and HITs in the header of user data packets would 355 increase the overhead of packets. Thus, it is not expected that they 356 are carried in every packet, but other methods are used to map the 357 data packets to the corresponding HIs. In some cases, this makes it 358 possible to use HIP without any additional headers in the user data 359 packets. For example, if ESP is used to protect data traffic, the 360 Security Parameter Index (SPI) carried in the ESP header, can be used 361 to map the encrypted data packet to the correct HIP association. 363 3.1. Host Identity Tag (HIT) 365 The Host Identity Tag is a 128 bits long value -- a hashed encoding 366 of the Host Identifier. There are two advantages of using a hashed 367 encoding over the actual Host Identity public key in protocols. 368 Firstly, its fixed length makes for easier protocol coding and also 369 better manages the packet size cost of this technology. Secondly, it 370 presents a consistent format to the protocol whatever underlying 371 identity technology is used. 373 "An IPv6 Prefix for Overlay Routable Cryptographic Hash Identifiers 374 (ORCHID)" [22] has been specified to store 128-bit hash based 375 identifier called Overlay Routable Cryptographic Hash Identifiers 376 (ORCHID) under an 28-bit prefix, proposed to be allocated from the 377 IPv6 address block as defined in [22]. The Host Identity Tag is a 378 type of ORCHID, based on a SHA1 hash of the host identity (Section 2 379 of [22]. 381 3.2. Generating a HIT from a HI 383 The HIT MUST be generated according to the ORCHID generation method 384 described in [22] using a context ID value of 0xF0EF F02F BFF4 3D0F 385 E793 0C3C 6E61 74EA (this tag value has been generated randomly by 386 the editor of this specification), and an input encoding the Host 387 Identity field (see Section 5.2.8) present in a HIP payload packet. 389 For Identities that are either RSA or DSA public keys, this input 390 consists of the public key encoding as specified in the corresponding 391 DNSSEC document, taking the algorithm specific portion of the RDATA 392 part of the KEY RR. There is currently only two defined public key 393 algorithms: RSA and DSA. Hence, either of the following applies: 395 The RSA public key is encoded as defined in RFC3110 [15] Section 396 2, taking the exponent length (e_len), exponent (e) and modulus 397 (n) fields concatenated. The length (n_len) of the modulus (n) 398 can be determined from the total HI Length and the preceding HI 399 fields including the exponent (e). Thus, the data to be hashed 400 has the same length as the HI. The fields MUST be encoded in 401 network byte order, as defined in RFC3110 [15]. 403 The DSA public key is encoded as defined in RFC2536 [13] Section 404 2, taking the fields T, Q, P, G, and Y, concatenated. Thus, the 405 data to be hashed is 1 + 20 + 3 * 64 + 3 * 8 * T octets long, 406 where T is the size parameter as defined in RFC2536 [13]. The 407 size parameter T, affecting the field lengths, MUST be selected as 408 the minimum value that is long enough to accommodate P, G, and Y. 409 The fields MUST be encoded in network byte order, as defined in 410 RFC2536 [13]. 412 In Appendix B the public key encoding generation process is 413 illustrated using pseudo-code. 415 4. Protocol Overview 417 The following material is an overview of the HIP protocol operation, 418 and does not contain all details of the packet formats or the packet 419 processing steps. Section 5 and Section 6 describe in more detail 420 the packet formats and packet processing steps, respectively, and are 421 normative in case of any conflicts with this section. 423 The protocol number for Host Identity Protocol will be assigned by 424 IANA. For testing purposes, the protocol number 253 is currently 425 used. This number has been reserved by IANA for experimental use 426 (see [19]). 428 The HIP payload (Section 5.1) header could be carried in every IP 429 datagram. However, since HIP headers are relatively large (40 430 bytes), it is desirable to 'compress' the HIP header so that the HIP 431 header only occurs in control packets used to establish or change HIP 432 association state. The actual method for header 'compression' and 433 for matching data packets with existing HIP associations (if any) is 434 defined in separate documents, describing transport formats and 435 methods. All HIP implementations MUST implement, at minimum, the ESP 436 transport format for HIP [24]. 438 4.1. Creating a HIP Association 440 By definition, the system initiating a HIP exchange is the Initiator, 441 and the peer is the Responder. This distinction is forgotten once 442 the base exchange completes, and either party can become the 443 Initiator in future communications. 445 The HIP base exchange serves to manage the establishment of state 446 between an Initiator and a Responder. The first packet, I1, 447 initiates the exchange, and the last three packets, R1, I2, and R2, 448 constitute a standard authenticated Diffie-Hellman key exchange for 449 session key generation. During the Diffie-Hellman key exchange, a 450 piece of keying material is generated. The HIP association keys are 451 drawn from this keying material. If other cryptographic keys are 452 needed, e.g., to be used with ESP, they are expected to be drawn from 453 the same keying material. 455 The Initiator first sends a trigger packet, I1, to the Responder. 456 The packet contains only the HIT of the Initiator and possibly the 457 HIT of the Responder, if it is known. Note that in some cases it may 458 be possible to replace this trigger packet by some other form of a 459 trigger, in which case the protocol starts with the Responder sending 460 the R1 packet. 462 The second packet, R1, starts the actual exchange. It contains a 463 puzzle-- a cryptographic challenge that the Initiator must solve 464 before continuing the exchange. The level of difficulty of the 465 puzzle can be adjusted based on level of trust with the Initiator, 466 current load, or other factors. In addition, the R1 contains the 467 initial Diffie-Hellman parameters and a signature, covering part of 468 the message. Some fields are left outside the signature to support 469 pre-created R1s. 471 In the I2 packet, the Initiator must display the solution to the 472 received puzzle. Without a correct solution, the I2 message is 473 discarded. The I2 also contains a Diffie-Hellman parameter that 474 carries needed information for the Responder. The packet is signed 475 by the sender. 477 The R2 packet finalizes the base exchange. The packet is signed. 479 The base exchange is illustrated below. The term "key" refers to the 480 host identity public key, and "sig" represents a signature using such 481 a key. The packets contain other parameters not shown in this 482 figure. 484 Initiator Responder 486 I1: trigger exchange 487 --------------------------> 488 select pre-computed R1 489 R1: puzzle, D-H, key, sig 490 <------------------------- 491 check sig remain stateless 492 solve puzzle 493 I2: solution, D-H, {key}, sig 494 --------------------------> 495 compute D-H check puzzle 496 check sig 497 R2: sig 498 <-------------------------- 499 check sig compute D-H 501 4.1.1. HIP Puzzle Mechanism 503 The purpose of the HIP puzzle mechanism is to protect the Responder 504 from a number of denial-of-service threats. It allows the Responder 505 to delay state creation until receiving I2. Furthermore, the puzzle 506 allows the Responder to use a fairly cheap calculation to check that 507 the Initiator is "sincere" in the sense that it has churned CPU 508 cycles in solving the puzzle. 510 The Puzzle mechanism has been explicitly designed to give space for 511 various implementation options. It allows a Responder implementation 512 to completely delay session specific state creation until a valid I2 513 is received. In such a case a correctly formatted I2 can be rejected 514 only once the Responder has checked its validity by computing one 515 hash function. On the other hand, the design also allows a Responder 516 implementation to keep state about received I1s, and match the 517 received I2s against the state, thereby allowing the implementation 518 to avoid the computational cost of the hash function. The drawback 519 of this latter approach is the requirement of creating state. 520 Finally, it also allows an implementation to use other combinations 521 of the space-saving and computation-saving mechanisms. 523 One possible way for a Responder to remain stateless but drop most 524 spoofed I2s is to base the selection of the puzzle on some function 525 over the Initiator's Host Identity. The idea is that the Responder 526 has a (perhaps varying) number of pre-calculated R1 packets, and it 527 selects one of these based on the information carried in I1. When 528 the Responder then later receives I2, it checks that the puzzle in 529 the I2 matches with the puzzle sent in the R1, thereby making it 530 impractical for the attacker to first exchange one I1/R1, and then 531 generate a large number of spoofed I2s that seemingly come from 532 different IP addresses or use different HITs. The method does not 533 protect from an attacker that uses fixed IP addresses and HITs, 534 though. Against such an attacker a viable approach may be to create 535 a piece of local state, and remember that the puzzle check has 536 previously failed. See Appendix A for one possible implementation. 537 Implementations SHOULD include sufficient randomness to the algorithm 538 so that algorithm complexity attacks become impossible [31]. 540 The Responder can set the puzzle difficulty for Initiator, based on 541 its level of trust of the Initiator. The Responder SHOULD use 542 heuristics to determine when it is under a denial-of-service attack, 543 and set the puzzle difficulty value K appropriately; see below. 545 4.1.2. Puzzle exchange 547 The Responder starts the puzzle exchange when it receives an I1. The 548 Responder supplies a random number I, and requires the Initiator to 549 find a number J. To select a proper J, the Initiator must create the 550 concatenation of I, the HITs of the parties, and J, and take a hash 551 over this concatenation using RHASH algorithm. The lowest order K 552 bits of the result MUST be zeros. The value K sets the difficulty of 553 the puzzle. 555 To generate a proper number J, the Initiator will have to generate a 556 number of Js until one produces the hash target of zero. The 557 Initiator SHOULD give up after exceeding the puzzle lifetime in the 558 PUZZLE parameter (Section 5.2.4). The Responder needs to re-create 559 the concatenation of I, the HITs, and the provided J, and compute the 560 hash once to prove that the Initiator did its assigned task. 562 To prevent pre-computation attacks, the Responder MUST select the 563 number I in such a way that the Initiator cannot guess it. 564 Furthermore, the construction MUST allow the Responder to verify that 565 the value was indeed selected by it and not by the Initiator. See 566 Appendix A for an example on how to implement this. 568 Using the Opaque data field in an ECHO_REQUEST parameter 569 (Section 5.2.17), the Responder can include some data in R1 that the 570 Initiator must copy unmodified in the corresponding I2 packet. The 571 Responder can generate the Opaque data in various ways; e.g. using 572 the sent I, some secret, and possibly other related data. Using this 573 same secret, received I in I2 packet and possible other data, the 574 Receiver can verify that it has itself sent the I to the Initiator. 575 The Responder MUST change such a secret periodically. 577 It is RECOMMENDED that the Responder generates a new puzzle and a new 578 R1 once every few minutes. Furthermore, it is RECOMMENDED that the 579 Responder remembers an old puzzle at least 2*lifetime seconds after 580 it has been deprecated. These time values allow a slower Initiator 581 to solve the puzzle while limiting the usability that an old, solved 582 puzzle has to an attacker. 584 NOTE: The protocol developers explicitly considered whether R1 should 585 include a timestamp in order to protect the Initiator from replay 586 attacks. The decision was to NOT include a timestamp. 588 NOTE: The protocol developers explicitly considered whether a memory 589 bound function should be used for the puzzle instead of a CPU bound 590 function. The decision was not to use memory bound functions. At 591 the time of the decision the idea of memory bound functions was 592 relatively new and their IPR status were unknown. Once there is more 593 experience about memory bound functions and once their IPR status is 594 better known, it may be reasonable to reconsider this decision. 596 4.1.3. Authenticated Diffie-Hellman Protocol 598 The packets R1, I2, and R2 implement a standard authenticated Diffie- 599 Hellman exchange. The Responder sends one or two public Diffie- 600 Hellman keys and its public authentication key, i.e., its host 601 identity, in R1. The signature in R1 allows the Initiator to verify 602 that the R1 has been once generated by the Responder. However, since 603 it is precomputed and therefore does not cover all of the packet, it 604 does not protect from replay attacks. 606 When the Initiator receives an R1, it gets one or two public Diffie- 607 Hellman values from the Responder. If there are two values, it 608 selects the value corresponding to the strongest supported Group ID. 609 and computes the Diffie-Hellman session key. It creates a HIP 610 association using keying material from the session key (see 611 Section 6.5), and may use the association to encrypt its public 612 authentication key, i.e., host identity. The resulting I2 contains 613 the Initiator's Diffie-Hellman key and its (optionally encrypted) 614 public authentication key. The signature in I2 covers all of the 615 packet. 617 The Responder extracts the Initiator Diffie-Hellman public key from 618 the I2, computes the Diffie-Hellman session key, creates a 619 corresponding HIP association, and decrypts the Initiator's public 620 authentication key. It can then verify the signature using the 621 authentication key. 623 The final message, R2, is needed to protect the Initiator from replay 624 attacks. 626 4.1.4. HIP Replay Protection 628 The HIP protocol includes the following mechanisms to protect against 629 malicious replays. Responders are protected against replays of I1 630 packets by virtue of the stateless response to I1s with presigned R1 631 messages. Initiators are protected against R1 replays by a 632 monotonically increasing "R1 generation counter" included in the R1. 633 Responders are protected against replays or false I2s by the puzzle 634 mechanism (Section 4.1.1 above), and optional use of opaque data. 635 Hosts are protected against replays to R2s and UPDATEs by use of a 636 less expensive HMAC verification preceding HIP signature 637 verification. 639 The R1 generation counter is a monotonically increasing 64-bit 640 counter that may be initialized to any value. The scope of the 641 counter MAY be system-wide but SHOULD be per host identity, if there 642 is more than one local host identity. The value of this counter 643 SHOULD be kept across system reboots and invocations of the HIP base 644 exchange. This counter indicates the current generation of puzzles. 645 Implementations MUST accept puzzles from the current generation and 646 MAY accept puzzles from earlier generations. A system's local 647 counter MUST be incremented at least as often as every time old R1s 648 cease to be valid, and SHOULD never be decremented, lest the host 649 expose its peers to the replay of previously generated, higher 650 numbered R1s. Also, the R1 generation counter MUST NOT roll over; if 651 the counter is about to become exhausted, the corresponding HI must 652 be abandoned and replaced with a new one. 654 A host may receive more than one R1, either due to sending multiple 655 I1s (Section 6.6.1) or due to a replay of an old R1. When sending 656 multiple I1s, an initiator SHOULD wait for a small amount of time 657 after the first R1 reception to allow possibly multiple R1s to 658 arrive, and it SHOULD respond to an R1 among the set with the largest 659 R1 generation counter. If an Initiator is processing an R1 or has 660 already sent an I2 (still waiting for R2) and it receives another R1 661 with a larger R1 generation counter, it MAY elect to restart R1 662 processing with the fresher R1, as if it were the first R1 to arrive. 664 Upon conclusion of an active HIP association with another host, the 665 R1 generation counter associated with the peer host SHOULD be 666 flushed. A local policy MAY override the default flushing of R1 667 counters on a per-HIT basis. The reason for recommending the 668 flushing of this counter is that there may be hosts where the R1 669 generation counter (occasionally) decreases; e.g., due to hardware 670 failure. 672 4.1.5. Refusing a HIP Exchange 674 A HIP aware host may choose not to accept a HIP exchange. If the 675 host's policy is to only be an Initiator, it should begin its own HIP 676 exchange. A host MAY choose to have such a policy since only the 677 Initiator HI is protected in the exchange. There is a risk of a race 678 condition if each host's policy is to only be an Initiator, at which 679 point the HIP exchange will fail. 681 If the host's policy does not permit it to enter into a HIP exchange 682 with the Initiator, it should send an ICMP 'Destination Unreachable, 683 Administratively Prohibited' message. A more complex HIP packet is 684 not used here as it actually opens up more potential DoS attacks than 685 a simple ICMP message. 687 4.1.6. HIP Opportunistic Mode 689 It is possible to initiate a HIP negotiation even if the responder's 690 HI (and HIT) is unknown. In this case the connection initializing I1 691 packet contains NULL (all zeros) as the destination HIT. This kind 692 of connection setup is called opportunistic mode. 694 There are multiple security issues involved with opportunistic mode 695 that must be carefully addressed in the implementation. Such a set 696 up is vulnerable to, e.g., man-in-the-middle attacks, because the 697 initializing node does not have any public key information about the 698 peer. 700 While this document defines the concept of the opportunistic mode, 701 and outlines the basic signalling mechanism to trigger it; i.e., send 702 an I1 with a NULL destination HIT, this document does not specify the 703 details of the opportunistic mode. Especially, its security 704 properties are not discussed beyond the warning above. It is 705 expected that a separate document will describe the opportunistic 706 mode in more detail, including its security properties. 708 4.2. Updating a HIP Association 710 A HIP association between two hosts may need to be updated over time. 711 Examples include the need to rekey expiring user data security 712 associations, add new security associations, or change IP addresses 713 associated with hosts. The UPDATE packet is used for those and other 714 similar purposes. This document only specifies the UPDATE packet 715 format and basic processing rules, with mandatory parameters. The 716 actual usage is defined in separate specifications. 718 HIP provides a general purpose UPDATE packet, which can carry 719 multiple HIP parameters, for updating the HIP state between two 720 peers. The UPDATE mechanism has the following properties: 722 UPDATE messages carry a monotonically increasing sequence number 723 and are explicitly acknowledged by the peer. Lost UPDATEs or 724 acknowledgments may be recovered via retransmission. Multiple 725 UPDATE messages may be outstanding under certain circumstances. 727 UPDATE is protected by both HMAC and HIP_SIGNATURE parameters, 728 since processing UPDATE signatures alone is a potential DoS attack 729 against intermediate systems. 731 UPDATE packets are explicitly acknowledged by the use of an 732 acknowledgment parameter that echoes an individual sequence number 733 received from the peer. A single UPDATE packet may contain both a 734 sequence number and one or more acknowledgment numbers (i.e., 735 piggybacked acknowledgment(s) for the peer's UPDATE). 737 The UPDATE packet is defined in Section 5.3.5. 739 4.3. Error Processing 741 HIP error processing behavior depends on whether there exists an 742 active HIP association or not. In general, if a HIP association 743 exists between the sender and receiver of a packet causing an error 744 condition, the receiver SHOULD respond with a NOTIFY packet. On the 745 other hand, if there are no existing HIP associations between the 746 sender and receiver, or the receiver cannot reasonably determine the 747 identity of the sender, the receiver MAY respond with a suitable ICMP 748 message; see Section 5.4 for more details. 750 The HIP protocol and state machine is designed to recover from one of 751 the parties crashing and losing its state. The following scenarios 752 describe the main use cases covered by the design. 754 No prior state between the two systems. 756 The system with data to send is the Initiator. The process 757 follows the standard four packet base exchange, establishing 758 the HIP association. 760 The system with data to send has no state with the receiver, but 761 the receiver has a residual HIP association. 763 The system with data to send is the Initiator. The Initiator 764 acts as in no prior state, sending I1 and getting R1. When the 765 Responder receives a valid I2, the old association is 766 'discovered' and deleted, and the new association is 767 established. 769 The system with data to send has a HIP association, but the 770 receiver does not. 772 The system sends data on the outbound user data security 773 association. The receiver 'detects' the situation when it 774 receives a user data packet that it cannot match to any HIP 775 association. The receiving host MUST discard this packet. 776 Optionally, the receiving host MAY send an ICMP packet with the 777 Parameter Problem type to inform about non-existing HIP 778 association (see Section 5.4), and it MAY initiate a new HIP 779 negotiation. However, responding with these optional 780 mechanisms is implementation or policy dependent. 782 4.4. HIP State Machine 784 The HIP protocol itself has little state. In the HIP base exchange, 785 there is an Initiator and a Responder. Once the SAs are established, 786 this distinction is lost. If the HIP state needs to be re- 787 established, the controlling parameters are which peer still has 788 state and which has a datagram to send to its peer. The following 789 state machine attempts to capture these processes. 791 The state machine is presented in a single system view, representing 792 either an Initiator or a Responder. There is not a complete overlap 793 of processing logic here and in the packet definitions. Both are 794 needed to completely implement HIP. 796 Implementors must understand that the state machine, as described 797 here, is informational. Specific implementations are free to 798 implement the actual functions differently. Section 6 describes the 799 packet processing rules in more detail. This state machine focuses 800 on the HIP I1, R1, I2, and R2 packets only. Other states may be 801 introduced by mechanisms in other specifications (such as mobility 802 and multihoming). 804 4.4.1. HIP States 806 +---------------------+---------------------------------------------+ 807 | State | Explanation | 808 +---------------------+---------------------------------------------+ 809 | UNASSOCIATED | State machine start | 810 | | | 811 | I1-SENT | Initiating base exchange | 812 | | | 813 | I2-SENT | Waiting to complete base exchange | 814 | | | 815 | R2-SENT | Waiting to complete base exchange | 816 | | | 817 | ESTABLISHED | HIP association established | 818 | | | 819 | CLOSING | HIP association closing, no data can be | 820 | | sent | 821 | | | 822 | CLOSED | HIP association closed, no data can be sent | 823 | | | 824 | E-FAILED | HIP exchange failed | 825 +---------------------+---------------------------------------------+ 827 4.4.2. HIP State Processes 829 System behaviour in state UNASSOCIATED, Table 2. 831 +---------------------+---------------------------------------------+ 832 | Trigger | Action | 833 +---------------------+---------------------------------------------+ 834 | User data to send, | Send I1 and go to I1-SENT | 835 | requiring a new HIP | | 836 | association | | 837 | | | 838 | Receive I1 | Send R1 and stay at UNASSOCIATED | 839 | | | 840 | Receive I2, process | If successful, send R2 and go to R2-SENT | 841 | | | 842 | | If fail, stay at UNASSOCIATED | 843 | | | 844 | Receive user data | Optionally send ICMP as defined in | 845 | for unknown HIP | Section 5.4 and stay at UNASSOCIATED | 846 | association | | 847 | | | 848 | Receive CLOSE | Optionally send ICMP Parameter Problem and | 849 | | stay at UNASSOCIATED | 850 | | | 851 | Receive ANYOTHER | Drop and stay at UNASSOCIATED | 852 +---------------------+---------------------------------------------+ 854 Table 2: UNASSOCIATED - Start state 855 System behaviour in state I1-SENT, Table 3. 857 +---------------------+---------------------------------------------+ 858 | Trigger | Action | 859 +---------------------+---------------------------------------------+ 860 | Receive I1 | If the local HIT is smaller than the peer | 861 | | HIT, drop I1 and stay at I1-SENT | 862 | | | 863 | | If the local HIT is greater than the peer | 864 | | HIT, send R1 and stay at I1_SENT | 865 | | | 866 | Receive I2, process | If successful, send R2 and go to R2-SENT | 867 | | | 868 | | If fail, stay at I1-SENT | 869 | | | 870 | Receive R1, process | If successful, send I2 and go to I2-SENT | 871 | | | 872 | | If fail, go to E-FAILED | 873 | | | 874 | Receive ANYOTHER | Drop and stay at I1-SENT | 875 | | | 876 | Timeout, increment | If counter is less than I1_RETRIES_MAX, | 877 | timeout counter | send I1 and stay at I1-SENT | 878 | | | 879 | | If counter is greater than I1_RETRIES_MAX, | 880 | | go to E-FAILED | 881 +---------------------+---------------------------------------------+ 883 Table 3: I1-SENT - Initiating HIP 884 System behaviour in state I2-SENT, Table 4. 886 +---------------------+---------------------------------------------+ 887 | Trigger | Action | 888 +---------------------+---------------------------------------------+ 889 | Receive I1 | Send R1 and stay at I2-SENT | 890 | | | 891 | Receive R1, process | If successful, send I2 and cycle at I2-SENT | 892 | | | 893 | | If fail, stay at I2-SENT | 894 | | | 895 | Receive I2, process | If successful and local HIT is smaller than | 896 | | the peer HIT, drop I2 and stay at I2-SENT | 897 | | | 898 | | If succesful and local HIT is greater than | 899 | | the peer HIT, send R2 and go to R2-SENT | 900 | | | 901 | | If fail, stay at I2-SENT | 902 | | | 903 | Receive R2, process | If successful, go to ESTABLISHED | 904 | | | 905 | | If fail, go to E-FAILED | 906 | | | 907 | Receive ANYOTHER | Drop and stay at I2-SENT | 908 | | | 909 | Timeout, increment | If counter is less than I2_RETRIES_MAX, | 910 | timeout counter | send I2 and stay at I2-SENT | 911 | | | 912 | | If counter is greater than I2_RETRIES_MAX, | 913 | | go to E-FAILED | 914 +---------------------+---------------------------------------------+ 916 Table 4: I2-SENT - Waiting to finish HIP 917 System behaviour in state R2-SENT, Table 5. 919 +---------------------+---------------------------------------------+ 920 | Trigger | Action | 921 +---------------------+---------------------------------------------+ 922 | Receive I1 | Send R1 and stay at R2-SENT | 923 | | | 924 | Receive I2, process | If successful, send R2 and cycle at R2-SENT | 925 | | | 926 | | If fail, stay at R2-SENT | 927 | | | 928 | Receive R1 | Drop and stay at R2-SENT | 929 | | | 930 | Receive R2 | Drop and stay at R2-SENT | 931 | | | 932 | Receive data or | Move to ESTABLISHED | 933 | UPDATE | | 934 | | | 935 | Exchange Complete | Move to ESTABLISHED | 936 | Timeout | | 937 +---------------------+---------------------------------------------+ 939 Table 5: R2-SENT - Waiting to finish HIP 940 System behaviour in state ESTABLISHED, Table 6. 942 +---------------------+---------------------------------------------+ 943 | Trigger | Action | 944 +---------------------+---------------------------------------------+ 945 | Receive I1 | Send R1 and stay at ESTABLISHED | 946 | | | 947 | Receive I2, process | If successful, send R2, drop old HIP | 948 | with puzzle and | association, establish a new HIP | 949 | possible Opaque | association, go to R2-SENT | 950 | data verification | | 951 | | | 952 | | If fail, stay at ESTABLISHED | 953 | | | 954 | Receive R1 | Drop and stay at ESTABLISHED | 955 | | | 956 | Receive R2 | Drop and stay at ESTABLISHED | 957 | | | 958 | Receive user data | Process and stay at ESTABLISHED | 959 | for HIP association | | 960 | | | 961 | No packet | Send CLOSE and go to CLOSING | 962 | sent/received | | 963 | during UAL minutes | | 964 | | | 965 | Receive CLOSE, | If successful, send CLOSE_ACK and go to | 966 | process | CLOSED | 967 | | | 968 | | If fail, stay at ESTABLISHED | 969 +---------------------+---------------------------------------------+ 971 Table 6: ESTABLISHED - HIP association established 972 System behaviour in state CLOSING, Table 7. 974 +---------------------+---------------------------------------------+ 975 | Trigger | Action | 976 +---------------------+---------------------------------------------+ 977 | User data to send, | Send I1 and stay at CLOSING | 978 | requires the | | 979 | creation of another | | 980 | incarnation of the | | 981 | HIP association | | 982 | | | 983 | Receive I1 | Send R1 and stay at CLOSING | 984 | | | 985 | Receive I2, process | If successful, send R2 and go to R2-SENT | 986 | | | 987 | | If fail, stay at CLOSING | 988 | | | 989 | Receive R1, process | If successful, send I2 and go to I2-SENT | 990 | | | 991 | | If fail, stay at CLOSING | 992 | | | 993 | Receive CLOSE, | If successful, send CLOSE_ACK, discard | 994 | process | state and go to CLOSED | 995 | | | 996 | | If fail, stay at CLOSING | 997 | | | 998 | Receive CLOSE_ACK, | If successful, discard state and go to | 999 | process | UNASSOCIATED | 1000 | | | 1001 | | If fail, stay at CLOSING | 1002 | | | 1003 | Receive ANYOTHER | Drop and stay at CLOSING | 1004 | | | 1005 | Timeout, increment | If timeout sum is less than UAL+MSL | 1006 | timeout sum, reset | minutes, retransmit CLOSE and stay at | 1007 | timer | CLOSING | 1008 | | | 1009 | | If timeout sum is greater than UAL+MSL | 1010 | | minutes, go to UNASSOCIATED | 1011 +---------------------+---------------------------------------------+ 1013 Table 7: CLOSING - HIP association has not been used for UAL minutes 1014 System behaviour in state CLOSED, Table 8. 1016 +---------------------+---------------------------------------------+ 1017 | Trigger | Action | 1018 +---------------------+---------------------------------------------+ 1019 | Datagram to send, | Send I1, and stay at CLOSED | 1020 | requires the | | 1021 | creation of another | | 1022 | incarnation of the | | 1023 | HIP association | | 1024 | | | 1025 | Receive I1 | Send R1 and stay at CLOSED | 1026 | | | 1027 | Receive I2, process | If successful, send R2 and go to R2-SENT | 1028 | | | 1029 | | If fail, stay at CLOSED | 1030 | | | 1031 | Receive R1, process | If successful, send I2 and go to I2-SENT | 1032 | | | 1033 | | If fail, stay at CLOSED | 1034 | | | 1035 | Receive CLOSE, | If successful, send CLOSE_ACK, stay at | 1036 | process | CLOSED | 1037 | | | 1038 | | If fail, stay at CLOSED | 1039 | | | 1040 | Receive CLOSE_ACK, | If successful, discard state and go to | 1041 | process | UNASSOCIATED | 1042 | | | 1043 | | If fail, stay at CLOSED | 1044 | | | 1045 | Receive ANYOTHER | Drop and stay at CLOSED | 1046 | | | 1047 | Timeout (UAL+2MSL) | Discard state and go to UNASSOCIATED | 1048 +---------------------+---------------------------------------------+ 1050 Table 8: CLOSED - CLOSE_ACK sent, resending CLOSE_ACK if necessary 1051 System behaviour in state E-FAILED, Table 9. 1053 +---------------------+---------------------------------------------+ 1054 | Trigger | Action | 1055 +---------------------+---------------------------------------------+ 1056 | Wait for | Go to UNASSOCIATED. Re-negotiation is | 1057 | implementation | possible after moving to UNASSOCIATED | 1058 | specific time | state. | 1059 +---------------------+---------------------------------------------+ 1061 Table 9: E-FAILED - HIP failed to establish association with peer 1063 4.4.3. Simplified HIP State Diagram 1065 The following diagram shows the major state transitions. Transitions 1066 based on received packets implicitly assume that the packets are 1067 successfully authenticated or processed. 1069 +-+ +---------------------------+ 1070 I1 received, send R1 | | | | 1071 | v v | 1072 Datagram to send +--------------+ I2 received, send R2 | 1073 +---------------| UNASSOCIATED |---------------+ | 1074 | +--------------+ | | 1075 v | | 1076 +---------+ I2 received, send R2 | | 1077 +---->| I1-SENT |---------------------------------------+ | | 1078 | +---------+ | | | 1079 | | +------------------------+ | | | 1080 | | R1 received, | I2 received, send R2 | | | | 1081 | v send I2 | v v v | 1082 | +---------+ | +---------+ | 1083 | +->| I2-SENT |------------+ | R2-SENT |<----+ | 1084 | | +---------+ +---------+ | | 1085 | | | | | | 1086 | | | data| | | 1087 | |receive | or| | | 1088 | |R1, send | EC timeout| receive I2,| | 1089 | |I2 |R2 received +--------------+ | send R2| | 1090 | | +----------->| ESTABLISHED |<-------+| | | 1091 | | +--------------+ | | 1092 | | | | | | | 1093 | | +------------+ | +------------------------+ | 1094 | | recv| | | | 1095 | | CLOSE,| No packet sent| | | 1096 | | send| /received for | | | 1097 | | CLOSE_ACK| UAL min, send | | | 1098 | | | CLOSE | +---------+<-+ timeout | | 1099 | | | +--->| CLOSING |--+ (UAL+MSL) | | 1100 | | | +---------+ retransmit | | 1101 +--|------------|----------------------+ | | | | CLOSE | | 1102 | +------------|------------------------+ | | +----------------+ | 1103 | | | +-----------+ +------------------|--+ 1104 | | +------------+ | receive CLOSE, CLOSE_ACK | | 1105 | | | | send CLOSE_ACK received or | | 1106 | | v v timeout | | 1107 | | +--------+ (UAL+MSL) | | 1108 | +------------------------| CLOSED |---------------------------+ | 1109 +---------------------------+--------+------------------------------+ 1110 Datagram to send ^ | timeout (UAL+2MSL), 1111 +-+ move to UNASSOCIATED 1112 CLOSE received, 1113 send CLOSE_ACK 1115 4.5. User Data Considerations 1117 4.5.1. TCP and UDP Pseudo-header Computation for User Data 1119 When computing TCP and UDP checksums on user data packets that flow 1120 through sockets bound to HITs, the IPv6 pseudo-header format [11] 1121 MUST be used, even if the actual addresses on the packet are IPv4 1122 addresses. Additionally, the HITs MUST be used in the place of the 1123 IPv6 addresses in the IPv6 pseudo-header. Note that the pseudo- 1124 header for actual HIP payloads is computed differently; see 1125 Section 5.1.1. 1127 4.5.2. Sending Data on HIP Packets 1129 A future version of this document may define how to include user data 1130 on various HIP packets. However, currently the HIP header is a 1131 terminal header, and not followed by any other headers. 1133 4.5.3. Transport Formats 1135 The actual data transmission format, used for user data after the HIP 1136 base exchange, is not defined in this document. Such transport 1137 formats and methods are described in separate specifications. All 1138 HIP implementations MUST implement, at minimum, the ESP transport 1139 format for HIP [24]. 1141 When new transport formats are defined, they get the type value from 1142 the HIP Transform type value space 2048 - 4095. The order in which 1143 the transport formats are presented in the R1 packet, is the 1144 preferred order. The last of the transport formats MUST be ESP 1145 transport format, represented by the ESP_TRANSFORM parameter. 1147 4.5.4. Reboot and SA Timeout Restart of HIP 1149 Simulating a loss of state is a potential DoS attack. The following 1150 process has been crafted to manage state recovery without presenting 1151 a DoS opportunity. 1153 If a host reboots or the HIP association times out, it has lost its 1154 HIP state. If the host that lost state has a datagram to send to the 1155 peer, it simply restarts the HIP base exchange. After the base 1156 exchange has completed, the Initiator can create a new SA and start 1157 sending data. The peer does not reset its state until it receives a 1158 valid I2 HIP packet. 1160 If a system receives a user data packet that cannot be matched to any 1161 existing HIP association, it is possible that it has lost the state 1162 and its peer has not. It MAY send an ICMP packet with the Parameter 1163 Problem type, the Pointer pointing to the referred HIP-related 1164 association information. Reacting to such traffic depends on the 1165 implementation and the environment where the implementation is used. 1167 If the host, that apparently has lost its state, decides to restart 1168 the HIP base exchange, it sends an I1 packet to the peer. After the 1169 base exchange has been completed successfully, the Initiator can 1170 create a new HIP association and the peer drops its OLD SA and 1171 creates a new one. 1173 4.6. Certificate Distribution 1175 HIP base specification does not define how to use certificates or how 1176 to transfer them between hosts. These functions are defined in a 1177 separate specification. A parameter type value, meant to be used for 1178 carrying certificates, is reserved, though: CERT, Type 768; see 1179 Section 5.2. 1181 5. Packet Formats 1183 5.1. Payload Format 1185 All HIP packets start with a fixed header. 1187 0 1 2 3 1188 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 1189 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1190 | Next Header | Header Length |0| Packet Type | VER. | RES.|1| 1191 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1192 | Checksum | Controls | 1193 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1194 | Sender's Host Identity Tag (HIT) | 1195 | | 1196 | | 1197 | | 1198 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1199 | Receiver's Host Identity Tag (HIT) | 1200 | | 1201 | | 1202 | | 1203 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1204 | | 1205 / HIP Parameters / 1206 / / 1207 | | 1208 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1210 The HIP header is logically an IPv6 extension header. However, this 1211 document does not describe processing for Next Header values other 1212 than decimal 59, IPPROTO_NONE, the IPv6 no next header value. Future 1213 documents MAY do so. However, current implementations MUST ignore 1214 trailing data if an unimplemented Next Header value is received. 1216 The Header Length field contains the length of the HIP Header and HIP 1217 parameters in 8 bytes units, excluding the first 8 bytes. Since all 1218 HIP headers MUST contain the sender's and receiver's HIT fields, the 1219 minimum value for this field is 4, and conversely, the maximum length 1220 of the HIP Parameters field is (255*8)-32 = 2008 bytes. Note: this 1221 sets an additional limit for sizes of parameters included in the 1222 Parameters field, independent of the individual parameter maximum 1223 lengths. 1225 The Packet Type indicates the HIP packet type. The individual packet 1226 types are defined in the relevant sections. If a HIP host receives a 1227 HIP packet that contains an unknown packet type, it MUST drop the 1228 packet. 1230 The HIP Version is four bits. The current version is 1. The version 1231 number is expected to be incremented only if there are incompatible 1232 changes to the protocol. Most extensions can be handled by defining 1233 new packet types, new parameter types, or new controls. 1235 The following three bits are reserved for future use. They MUST be 1236 zero when sent, and they SHOULD be ignored when handling a received 1237 packet. 1239 The two fixed bits in the header are reserved for potential SHIM6 1240 compatibility [27]. For implementations adhering (only) to this 1241 specification, they MUST be set as shown when sending and MUST be 1242 ignored when receiving. This is to ensure optimal forward 1243 compatibility. Note that implementations that implement other 1244 compatible specifications in addition to this specification, the 1245 corresponding rules may well be different. For example, in the case 1246 that the forthcoming SHIM6 protocol happens to be compatible with 1247 this specification, an implementation that implements both this 1248 specification and the SHIM6 protocol may need to check these bits in 1249 order to determine how to handle the packet. 1251 The HIT fields are always 128 bits (16 bytes) long. 1253 5.1.1. Checksum 1255 Since the checksum covers the source and destination addresses in the 1256 IP header, it must be recomputed on HIP-aware NAT devies. 1258 If IPv6 is used to carry the HIP packet, the pseudo-header [11] 1259 contains the source and destination IPv6 addresses, HIP packet length 1260 in the pseudo-header length field, a zero field, and the HIP protocol 1261 number (see Section 4) in the Next Header field. The length field is 1262 in bytes and can be calculated from the HIP header length field: (HIP 1263 Header Length + 1) * 8. 1265 In case of using IPv4, the IPv4 UDP pseudo header format [1] is used. 1266 In the pseudo header, the source and destination addresses are those 1267 used in the IP header, the zero field is obviously zero, the protocol 1268 is the HIP protocol number (see Section 4), and the length is 1269 calculated as in the IPv6 case. 1271 5.1.2. HIP Controls 1273 The HIP Controls section conveys information about the structure of 1274 the packet and capabilities of the host. 1276 The following fields have been defined: 1278 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1279 | | | | | | | | | | | | | | | |A| 1280 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1282 A - Anonymous: If this is set, the sender's HI in this packet is 1283 anonymous, i.e., one not listed in a directory. Anonymous HIs 1284 SHOULD NOT be stored. This control is set in packets R1 and/or 1285 I2. The peer receiving an anonymous HI may choose to refuse it. 1287 The rest of the fields are reserved for future use and MUST be set to 1288 zero on sent packets and ignored on received packets. 1290 5.1.3. HIP Fragmentation Support 1292 A HIP implementation must support IP fragmentation / reassembly. 1293 Fragment reassembly MUST be implemented in both IPv4 and IPv6, but 1294 fragment generation is REQUIRED to be implemented in IPv4 (IPv4 1295 stacks and networks will usually do this by default) and RECOMMENDED 1296 to be implemented in IPv6. In IPv6 networks, the minimum MTU is 1297 larger, 1280 bytes, than in IPv4 networks. The larger MTU size is 1298 usually sufficient for most HIP packets, and therefore fragment 1299 generation may not be needed. If a host expects to send HIP packets 1300 that are larger than the minimum IPv6 MTU, it MUST implement fragment 1301 generation even for IPv6. 1303 In IPv4 networks, HIP packets may encounter low MTUs along their 1304 routed path. Since HIP does not provide a mechanism to use multiple 1305 IP datagrams for a single HIP packet, support for path MTU discovery 1306 does not bring any value to HIP in IPv4 networks. HIP-aware NAT 1307 devices MUST perform any IPv4 reassembly/fragmentation. 1309 All HIP implementations have to be careful while employing a 1310 reassembly algorithm so that the algorithm is sufficiently resistant 1311 to DoS attacks. 1313 5.2. HIP Parameters 1315 The HIP Parameters are used to carry the public key associated with 1316 the sender's HIT, together with related security and other 1317 information. They consist of ordered parameters, encoded in TLV 1318 format. 1320 The following parameter types are currently defined. 1322 +------------------+-------+----------+-----------------------------+ 1323 | TLV | Type | Length | Data | 1324 +------------------+-------+----------+-----------------------------+ 1325 | R1_COUNTER | 128 | 12 | System Boot Counter | 1326 | | | | | 1327 | PUZZLE | 257 | 12 | K and Random #I | 1328 | | | | | 1329 | SOLUTION | 321 | 20 | K, Random #I and puzzle | 1330 | | | | solution J | 1331 | | | | | 1332 | SEQ | 385 | 4 | Update packet ID number | 1333 | | | | | 1334 | ACK | 449 | variable | Update packet ID number | 1335 | | | | | 1336 | DIFFIE_HELLMAN | 513 | variable | public key | 1337 | | | | | 1338 | HIP_TRANSFORM | 577 | variable | HIP Encryption and | 1339 | | | | Integrity Transform | 1340 | | | | | 1341 | ENCRYPTED | 641 | variable | Encrypted part of I2 packet | 1342 | | | | | 1343 | HOST_ID | 705 | variable | Host Identity with Fully | 1344 | | | | Qualified Domain Name or | 1345 | | | | NAI | 1346 | | | | | 1347 | CERT | 768 | variable | HI Certificate; used to | 1348 | | | | transfer certificates. | 1349 | | | | Usage defined in a separate | 1350 | | | | document. | 1351 | | | | | 1352 | NOTIFY | 832 | variable | Informational data | 1353 | | | | | 1354 | ECHO_REQUEST | 897 | variable | Opaque data to be echoed | 1355 | | | | back; under signature | 1356 | | | | | 1357 | ECHO_RESPONSE | 961 | variable | Opaque data echoed back; | 1358 | | | | under signature | 1359 | | | | | 1360 | HMAC | 61505 | variable | HMAC based message | 1361 | | | | authentication code, with | 1362 | | | | key material from | 1363 | | | | HIP_TRANSFORM | 1364 | | | | | 1365 | HMAC_2 | 61569 | variable | HMAC based message | 1366 | | | | authentication code, with | 1367 | | | | key material from | 1368 | | | | HIP_TRANSFORM | 1369 | | | | | 1370 | HIP_SIGNATURE_2 | 61633 | variable | Signature of the R1 packet | 1371 | | | | | 1372 | HIP_SIGNATURE | 61697 | variable | Signature of the packet | 1373 | | | | | 1374 | ECHO_REQUEST | 63661 | variable | Opaque data to be echoed | 1375 | | | | back; after signature | 1376 | | | | | 1377 | ECHO_RESPONSE | 63425 | variable | Opaque data echoed back; | 1378 | | | | after signature | 1379 +------------------+-------+----------+-----------------------------+ 1381 Because the ordering (from lowest to highest) of HIP parameters is 1382 strictly enforced (see Section 5.2.1), the parameter type values for 1383 existing parameters have been spaced to allow for future protocol 1384 extensions. Parameters numbered between 0-1023 are used in HIP 1385 handshake and update procedures and are covered by signatures. 1386 Parameters numbered between 1024-2047 are reserved. Parameters 1387 numbered between 2048-4095 are used for parameters related to HIP 1388 transform types. Parameters numbered between 4096 and (2^16 - 2^12) 1389 61439 are reserved. Parameters numbered between 61440-62463 are used 1390 for signatures and signed MACs. Parameters numbered between 62464- 1391 63487 are used for parameters that fall outside of the signed area of 1392 the packet. Parameters numbered between 63488-64511 are used for 1393 rendezvous and other relaying services. Parameters numbered between 1394 64512-65535 are reserved. 1396 5.2.1. TLV Format 1398 The TLV-encoded parameters are described in the following 1399 subsections. The type-field value also describes the order of these 1400 fields in the packet, except for type values from 2048 to 4095 which 1401 are reserved for new transport forms. The parameters MUST be 1402 included in the packet such that their types form an increasing 1403 order. If the order does not follow this rule, the packet is 1404 considered to be malformed and it MUST be discarded. 1406 Parameters using type values from 2048 up to 4095 are transport 1407 formats. Currently, one transport format is defined: the ESP 1408 transport format [24]. The order of these parameters does not follow 1409 the order of their type value, but they are put in the packet in 1410 order of preference. The first of the transport formats it the most 1411 preferred, and so on. 1413 All of the TLV parameters have a length (including Type and Length 1414 fields) which is a multiple of 8 bytes. When needed, padding MUST be 1415 added to the end of the parameter so that the total length becomes a 1416 multiple of 8 bytes. This rule ensures proper alignment of data. If 1417 padding is added, the Length field MUST NOT include the padding. Any 1418 added padding bytes MUST be zeroed by the sender, and their values 1419 SHOULD NOT be checked by the receiver. 1421 Consequently, the Length field indicates the length of the Contents 1422 field (in bytes). The total length of the TLV parameter (including 1423 Type, Length, Contents, and Padding) is related to the Length field 1424 according to the following formula: 1426 Total Length = 11 + Length - (Length + 3) % 8; 1428 0 1 2 3 1429 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 1430 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1431 | Type |C| Length | 1432 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1433 | | 1434 / Contents / 1435 / +-+-+-+-+-+-+-+-+ 1436 | | Padding | 1437 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1439 Type Type code for the parameter. 16 bits long, C-bit 1440 being part of the Type code. 1441 C Critical. One if this parameter is critical, and 1442 MUST be recognized by the recipient, zero otherwise. 1443 The C bit is considered to be a part of the Type 1444 field. Consequently, critical parameters are always 1445 odd and non-critical ones have an even value. 1446 Length Length of the Contents, in bytes. 1447 Contents Parameter specific, defined by Type 1448 Padding Padding, 0-7 bytes, added if needed 1450 Critical parameters MUST be recognized by the recipient. If a 1451 recipient encounters a critical parameter that it does not recognize, 1452 it MUST NOT process the packet any further. It MAY send an ICMP or 1453 NOTIFY, as defined in Section 4.3. 1455 Non-critical parameters MAY be safely ignored. If a recipient 1456 encounters a non-critical parameter that it does not recognize, it 1457 SHOULD proceed as if the parameter was not present in the received 1458 packet. 1460 5.2.2. Defining New Parameters 1462 Future specifications may define new parameters as needed. When 1463 defining new parameters, care must be taken to ensure that the 1464 parameter type values are appropriate and leave suitable space for 1465 other future extensions. One must remember that the parameters MUST 1466 always be arranged in the increasing order by type code, thereby 1467 limiting the order of parameters (see Section 5.2.1). 1469 The following rules must be followed when defining new parameters. 1471 1. The low order bit C of the Type code is used to distinguish 1472 between critical and non-critical parameters. 1474 2. A new parameter may be critical only if an old recipient ignoring 1475 it would cause security problems. In general, new parameters 1476 SHOULD be defined as non-critical, and expect a reply from the 1477 recipient. 1479 3. If a system implements a new critical parameter, it MUST provide 1480 the ability to configure the associated feature off, such that 1481 the critical parameter is not sent at all. The configuration 1482 option must be well documented. By default, sending of such a 1483 new critical parameter SHOULD be off. In other words, the 1484 management interface MUST allow vanilla standards-only mode as a 1485 default configuration setting, and MAY allow new critical 1486 payloads to be configured on (and off). 1488 4. See section Section 9 for allocation rules regarding type codes. 1490 5.2.3. R1_COUNTER 1492 0 1 2 3 1493 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 1494 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1495 | Type | Length | 1496 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1497 | Reserved, 4 bytes | 1498 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1499 | R1 generation counter, 8 bytes | 1500 | | 1501 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1503 Type 128 1504 Length 12 1505 R1 generation 1506 counter The current generation of valid puzzles 1508 The R1_COUNTER parameter contains an 64-bit unsigned integer in 1509 network byte order, indicating the current generation of valid 1510 puzzles. The sender is supposed to increment this counter 1511 periodically. It is RECOMMENDED that the counter value is 1512 incremented at least as often as old PUZZLE values are deprecated so 1513 that SOLUTIONs to them are no longer accepted. 1515 The R1_COUNTER parameter is optional. It SHOULD be included in the 1516 R1 (in which case it is covered by the signature), and if present in 1517 the R1, it MAY be echoed (including the Reserved field verbatim) by 1518 the Initiator in the I2. 1520 5.2.4. PUZZLE 1522 0 1 2 3 1523 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 1524 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1525 | Type | Length | 1526 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1527 | K, 1 byte | Lifetime | Opaque, 2 bytes | 1528 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1529 | Random # I, 8 bytes | 1530 | | 1531 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1533 Type 257 1534 Length 12 1535 K K is the number of verified bits 1536 Lifetime Puzzle lifetime 2^(value-32) seconds 1537 Opaque Data set by the Responder, indexing the puzzle 1538 Random #I random number 1540 Random #I is represented as 64-bit integer, K and Lifetime as 8-bit 1541 integer, all in network byte order. 1543 The PUZZLE parameter contains the puzzle difficulty K and a 64-bit 1544 puzzle random integer #I. The Puzzle Lifetime indicates the time 1545 during which the puzzle solution is valid, and sets a time limit 1546 which should not be exceeded by the Initiator while it attempts to 1547 solve the puzzle. The lifetime is indicated as a power of 2 using 1548 the formula 2^(Lifetime-32) seconds. A puzzle MAY be augmented with 1549 an ECHO_REQUEST parameter included in the R1; the contents of the 1550 ECHO_REQUEST are then echoed back in the ECHO_RESPONSE, allowing the 1551 Responder to use the included information as a part of its puzzle 1552 processing. 1554 The Opaque and Random #I field are not covered by the HIP_SIGNATURE_2 1555 parameter. 1557 5.2.5. SOLUTION 1559 0 1 2 3 1560 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 1561 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1562 | Type | Length | 1563 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1564 | K, 1 byte | Reserved | Opaque, 2 bytes | 1565 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1566 | Random #I, 8 bytes | 1567 | | 1568 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1569 | Puzzle solution #J, 8 bytes | 1570 | | 1571 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1573 Type 321 1574 Length 20 1575 K K is the number of verified bits 1576 Reserved zero when sent, ignored when received 1577 Opaque copied unmodified from the received PUZZLE 1578 parameter 1579 Random #I random number 1580 Puzzle solution 1581 #J random number 1583 Random #I, and Random #J are represented as 64-bit integers, K as an 1584 8-bit integer, all in network byte order. 1586 The SOLUTION parameter contains a solution to a puzzle. It also 1587 echoes back the random difficulty K, the Opaque field, and the puzzle 1588 integer #I. 1590 5.2.6. DIFFIE_HELLMAN 1592 0 1 2 3 1593 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 1594 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1595 | Type | Length | 1596 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1597 | Group ID | Public Value Length | Public Value / 1598 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1599 / | 1600 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1601 | Group ID | Public Value Length | Public Value / 1602 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1603 / | padding | 1604 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1606 Type 513 1607 Length length in octets, excluding Type, Length, and 1608 padding 1609 Group ID defines values for p and g 1610 Public Value length of the following Public Value in octets 1611 Length 1612 Public Value the sender's public Diffie-Hellman key 1614 The following Group IDs have been defined: 1616 Group Value 1617 Reserved 0 1618 384-bit group 1 1619 OAKLEY well known group 1 2 1620 1536-bit MODP group 3 1621 3072-bit MODP group 4 1622 6144-bit MODP group 5 1623 8192-bit MODP group 6 1625 The MODP Diffie-Hellman groups are defined in [17]. The OAKLEY group 1626 is defined in [8]. 1628 The sender can include at most two different Diffie-Hellman public 1629 values in the DIFFIE_HELLMAN parameter. This gives the possibility 1630 e.g. for a server to provide a weaker encryption possibility for a 1631 PDA host that is not powerful enough. It is RECOMMENDED that the 1632 Initiator, receiving more than one public values selects the stronger 1633 one, if it supports it. 1635 A HIP implementation MUST support Group IDs 1 and 3. The 384-bit 1636 group can be used when lower security is enough (e.g. web surfing) 1637 and when the equipment is not powerful enough (e.g. some PDAs). 1639 Equipment powerful enough SHOULD implement also group ID 5. The 384- 1640 bit group is defined in Appendix D. 1642 To avoid unnecessary failures during the base exchange, the rest of 1643 the groups SHOULD be implemented in hosts where resources are 1644 adequate. 1646 5.2.7. HIP_TRANSFORM 1648 0 1 2 3 1649 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 1650 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1651 | Type | Length | 1652 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1653 | Suite-ID #1 | Suite-ID #2 | 1654 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1655 | Suite-ID #n | Padding | 1656 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1658 Type 577 1659 Length length in octets, excluding Type, Length, and 1660 padding 1661 Suite-ID Defines the HIP Suite to be used 1663 The following Suite-IDs are defined ([21],[10]): 1665 Suite-ID Value 1667 RESERVED 0 1668 AES-CBC with HMAC-SHA1 1 1669 3DES-CBC with HMAC-SHA1 2 1670 3DES-CBC with HMAC-MD5 3 1671 BLOWFISH-CBC with HMAC-SHA1 4 1672 NULL-ENCRYPT with HMAC-SHA1 5 1673 NULL-ENCRYPT with HMAC-MD5 6 1675 The sender of a HIP transform parameter MUST make sure that there are 1676 no more than six (6) HIP Suite-IDs in one HIP transform parameter. 1677 Conversely, a recipient MUST be prepared to handle received transport 1678 parameters that contain more than six Suite-IDs. The limited number 1679 of transforms sets the maximum size of HIP_TRANSFORM parameter. As 1680 the default configuration, the HIP_TRANSFORM parameter MUST contain 1681 at least one of the mandatory Suite-IDs. There MAY be a 1682 configuration option that allows the administrator to override this 1683 default. 1685 The Responder lists supported and desired Suite-IDs in order of 1686 preference in the R1, up to the maximum of six Suite-IDs. The 1687 Initiator MUST choose only one of the corresponding Suite-IDs. That 1688 Suite-ID will be used for generating the I2. 1690 Mandatory implementations: AES-CBC with HMAC-SHA1 and NULL-ENCRYPTION 1691 with HMAC-SHA1. 1693 5.2.8. HOST_ID 1695 0 1 2 3 1696 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 1697 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1698 | Type | Length | 1699 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1700 | HI Length |DI-type| DI Length | 1701 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1702 | Host Identity / 1703 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1704 / | Domain Identifier / 1705 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1706 / | Padding | 1707 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1709 Type 705 1710 Length length in octets, excluding Type, Length, and 1711 Padding 1712 HI Length Length of the Host Identity in octets 1713 DI-type type of the following Domain Identifier field 1714 DI Length length of the FQDN or NAI in octets 1715 Host Identity actual host identity 1716 Domain Identifier the identifier of the sender 1718 The Host Identity is represented in RFC2535 [12] format. The 1719 algorithms used in RDATA format are the following: 1721 Algorithms Values 1723 RESERVED 0 1724 DSA 3 [RFC2536] (RECOMMENDED) 1725 RSA 5 [RFC3110] (REQUIRED) 1727 The following DI-types have been defined: 1729 Type Value 1730 none included 0 1731 FQDN 1 1732 NAI 2 1734 FQDN Fully Qualified Domain Name, in binary format. 1735 NAI Network Access Identifier 1737 The format for the FQDN is defined in RFC1035 [3] Section 3.1. The 1738 format for Network Access Identifier is defined in [23] 1740 If there is no Domain Identifier, i.e. the DI-type field is zero, 1741 also the DI Length field is set to zero. 1743 5.2.9. HMAC 1745 0 1 2 3 1746 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 1747 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1748 | Type | Length | 1749 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1750 | | 1751 | HMAC | 1752 / / 1753 / +-------------------------------+ 1754 | | Padding | 1755 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1757 Type 61505 1758 Length length in octets, excluding Type, Length, and 1759 Padding 1760 HMAC HMAC computed over the HIP packet, excluding the 1761 HMAC parameter and any following parameters, such 1762 as HIP_SIGNATURE, HIP_SIGNATURE_2, ECHO_REQUEST, 1763 or ECHO_RESPONSE. The checksum field MUST be set 1764 to zero and the HIP header length in the HIP common 1765 header MUST be calculated not to cover any excluded 1766 parameters when the HMAC is calculated. The size 1767 of the HMAC is the natural size of the hash 1768 computation output depending on the used hash 1769 function. 1771 The HMAC calculation and verification process is presented in 1772 Section 6.4.1 1774 5.2.10. HMAC_2 1776 The parameter structure is the same as in Section 5.2.9. The fields 1777 are: 1779 Type 61569 1780 Length length in octets, excluding Type, Length, and 1781 Padding 1782 HMAC HMAC computed over the HIP packet, excluding the 1783 HMAC parameter and any following parameters such 1784 as HIP_SIGNATURE, HIP_SIGNATURE_2, ECHO_REQUEST, 1785 or ECHO_RESPONSE, and including an additional 1786 sender's HOST_ID parameter during the HMAC 1787 calculation. The checksum field MUST be set to 1788 zero and the HIP header length in the HIP common 1789 header MUST be calculated not to cover any 1790 excluded parameters when the HMAC is calculated. 1791 The size of the HMAC is the natural size of the 1792 hash computation output depending on the used hash 1793 function. 1795 The HMAC calculation and verification process is presented in 1796 Section 6.4.1 1798 5.2.11. HIP_SIGNATURE 1800 0 1 2 3 1801 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 1802 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1803 | Type | Length | 1804 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1805 | SIG alg | Signature / 1806 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1807 / | Padding | 1808 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1810 Type 61697 1811 Length length in octets, excluding Type, Length, and 1812 Padding 1813 SIG alg Signature algorithm 1814 Signature the signature is calculated over the HIP packet, 1815 excluding the HIP_SIGNATURE parameter and any 1816 parameters that follow the HIP_SIGNATURE parameter. 1817 The checksum field MUST be set to zero, and the HIP 1818 header length in the HIP common header MUST be 1819 calculated only to the beginning of the 1820 HIP_SIGNATURE parameter when the signature is 1821 calculated. 1823 The signature algorithms are defined in Section 5.2.8. The signature 1824 in the Signature field is encoded using the proper method depending 1825 on the signature algorithm (e.g. according to [15] in case of RSA, or 1826 according to [13] in case of DSA). 1828 The HIP_SIGNATURE calculation and verification process is presented 1829 in Section 6.4.2 1831 5.2.12. HIP_SIGNATURE_2 1833 The parameter structure is the same as in Section 5.2.11. The fields 1834 are: 1836 Type 61633 1837 Length length in octets, excluding Type, Length, and 1838 Padding 1839 SIG alg Signature algorithm 1840 Signature the signature is calculated over the HIP R1 packet, 1841 excluding the HIP_SIGNATURE_2 parameter and any 1842 parameters that follow. Initiator's HIT, checksum 1843 field, and the Opaque and Random #I fields in the 1844 PUZZLE parameter MUST be set to zero while 1845 computing the HIP_SIGNATURE_2 signature. Further, 1846 the HIP packet length in the HIP header MUST be 1847 calculated to the beginning of the HIP_SIGNATURE_2 1848 parameter when the signature is calculated. 1850 Zeroing the Initiator's HIT makes it possible to create R1 packets 1851 beforehand to minimize the effects of possible DoS attacks. Zeroing 1852 the I and Opaque fields allows these fields to be populated 1853 dynamically on precomputed R1s. 1855 Signature calculation and verification follows the process in 1856 Section 6.4.2. 1858 5.2.13. SEQ 1860 0 1 2 3 1861 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 1862 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1863 | Type | Length | 1864 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1865 | Update ID | 1866 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1868 Type 385 1869 Length 4 1870 Update ID 32-bit sequence number 1872 The Update ID is an unsigned quantity, initialized by a host to zero 1873 upon moving to ESTABLISHED state. The Update ID has scope within a 1874 single HIP association, and not across multiple associations or 1875 multiple hosts. The Update ID is incremented by one before each new 1876 UPDATE that is sent by the host; the first UPDATE packet originated 1877 by a host has an Update ID of 0. 1879 5.2.14. ACK 1881 0 1 2 3 1882 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 1883 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1884 | Type | Length | 1885 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1886 | peer Update ID | 1887 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1889 Type 449 1890 Length variable (multiple of 4) 1891 peer Update ID 32-bit sequence number corresponding to the 1892 Update ID being acked. 1894 The ACK parameter includes one or more Update IDs that have been 1895 received from the peer. The Length field identifies the number of 1896 peer Update IDs that are present in the parameter. 1898 5.2.15. ENCRYPTED 1900 0 1 2 3 1901 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 1902 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1903 | Type | Length | 1904 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1905 | Reserved | 1906 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1907 | IV / 1908 / / 1909 / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1910 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / 1911 / Encrypted data / 1912 / / 1913 / +-------------------------------+ 1914 / | Padding | 1915 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1917 Type 641 1918 Length length in octets, excluding Type, Length, and 1919 Padding 1920 Reserved zero when sent, ignored when received 1921 IV Initialization vector, if needed, otherwise 1922 nonexistent. The length of the IV is inferred from 1923 the HIP transform. 1924 Encrypted The data is encrypted using an encryption algorithm 1925 data as defined in HIP transform. 1926 Padding Any Padding, if necessary, to make the parameter a 1927 multiple of 8 bytes. 1929 The ENCRYPTED parameter encapsulates another parameter, the encrypted 1930 data, which is also in TLV format. Consequently, the first fields in 1931 the encapsulated parameter(s) are Type and Length, allowing the 1932 contents to be easily parsed after decryption. 1934 Both the ENCRYPTED parameter and the encapsulated parameter(s) MUST 1935 be padded. The padding needed for the ENCRYPTED parameter is 1936 referred as the "outer" padding. Correspondingly, the padding for 1937 the parameter(s) encapsulated within the ENCRYPTED parameter is 1938 referred as the "inner" padding. 1940 The inner padding follows exactly the rules of Section 5.2.1. The 1941 outer padding also follows the same rules but with an exception. 1942 Namely, some algorithms require that the data to be encrypted must be 1943 a multiple of the cipher algorithm block size. In this case, the 1944 outer padding MUST include extra padding, as specified by the 1945 encryption algorithm. The size of the extra padding is selected so 1946 that the length of the ENCRYPTED is the minimum value that is both 1947 multiple of eight and the cipher block size. The encryption 1948 algorithm may specify padding bytes other than zero; for example, AES 1949 [32] uses the PKCS5 padding scheme [14] (see section 6.1.1) where the 1950 remaining n bytes to fill the block each have the value n. 1952 Note that the length of the cipher suite output may be smaller or 1953 larger than the length of the data to be encrypted, since the 1954 encryption process may compress the data or add additional padding to 1955 the data. 1957 5.2.16. NOTIFY 1959 The NOTIFY parameter is used to transmit informational data, such as 1960 error conditions and state transitions, to a HIP peer. A NOTIFY 1961 parameter may appear in the NOTIFY packet type. The use of the 1962 NOTIFY parameter in other packet types is for further study. 1964 0 1 2 3 1965 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 1966 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1967 | Type | Length | 1968 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1969 | Reserved | Notify Message Type | 1970 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1971 | / 1972 / Notification data / 1973 / +---------------+ 1974 / | Padding | 1975 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1977 Type 832 1978 Length length in octets, excluding Type, Length, and 1979 Padding 1980 Reserved zero when sent, ignored when received 1981 Notify Message Specifies the type of notification 1982 Type 1983 Notification Informational or error data transmitted in addition 1984 Data to the Notify Message Type. Values for this field 1985 are type specific (see below). 1986 Padding Any Padding, if necessary, to make the parameter a 1987 multiple of 8 bytes. 1989 Notification information can be error messages specifying why an SA 1990 could not be established. It can also be status data that a process 1991 managing an SA database wishes to communicate with a peer process. 1992 The table below lists the Notification messages and their 1993 corresponding values. 1995 To avoid certain types of attacks, a Responder SHOULD avoid sending a 1996 NOTIFY to any host with which it has not successfully verified a 1997 puzzle solution. 1999 Types in the range 0 - 16383 are intended for reporting errors. An 2000 implementation that receives a NOTIFY error parameter in response to 2001 a request packet (e.g., I1, I2, UPDATE), SHOULD assume that the 2002 corresponding request has failed entirely. Unrecognized error types 2003 MUST be ignored except that they SHOULD be logged. 2005 Notify payloads with status types MUST be ignored if not recognized. 2007 NOTIFY PARAMETER - ERROR TYPES Value 2008 ------------------------------ ----- 2010 UNSUPPORTED_CRITICAL_PARAMETER_TYPE 1 2012 Sent if the parameter type has the "critical" bit set and the 2013 parameter type is not recognized. Notification Data contains 2014 the two octet parameter type. 2016 INVALID_SYNTAX 7 2018 Indicates that the HIP message received was invalid because 2019 some type, length, or value was out of range or because the 2020 request was rejected for policy reasons. To avoid a denial of 2021 service attack using forged messages, this status may only be 2022 returned for packets whose HMAC (if present) and SIGNATURE have 2023 been verified. This status MUST be sent in response to any 2024 error not covered by one of the other status types, and should 2025 not contain details to avoid leaking information to someone 2026 probing a node. To aid debugging, more detailed error 2027 information SHOULD be written to a console or log. 2029 NO_DH_PROPOSAL_CHOSEN 14 2031 None of the proposed group IDs was acceptable. 2033 INVALID_DH_CHOSEN 15 2035 The D-H Group ID field does not correspond to one offered 2036 by the Responder. 2038 NO_HIP_PROPOSAL_CHOSEN 16 2040 None of the proposed HIP Transform crypto suites was 2041 acceptable. 2043 INVALID_HIP_TRANSFORM_CHOSEN 17 2045 The HIP Transform crypto suite does not correspond to 2046 one offered by the Responder. 2048 AUTHENTICATION_FAILED 24 2050 Sent in response to a HIP signature failure, except when 2051 the signature verification fails in a NOTIFY message. 2053 CHECKSUM_FAILED 26 2055 Sent in response to a HIP checksum failure. 2057 HMAC_FAILED 28 2059 Sent in response to a HIP HMAC failure. 2061 ENCRYPTION_FAILED 32 2063 The Responder could not successfully decrypt the 2064 ENCRYPTED parameter. 2066 INVALID_HIT 40 2068 Sent in response to a failure to validate the peer's 2069 HIT from the corresponding HI. 2071 BLOCKED_BY_POLICY 42 2073 The Responder is unwilling to set up an association 2074 for some policy reason (e.g. received HIT is NULL 2075 and policy does not allow opportunistic mode). 2077 SERVER_BUSY_PLEASE_RETRY 44 2079 The Responder is unwilling to set up an association 2080 as it is suffering under some kind of overload and 2081 has chosen to shed load by rejecting your request. 2082 You may retry if you wish, however you MUST find 2083 another (different) puzzle solution for any such 2084 retries. Note that you may need to obtain a new 2085 puzzle with a new I1/R1 exchange. 2087 I2_ACKNOWLEDGEMENT 46 2089 The Responder has received your I2 but had to queue 2090 the I2 for processing. The puzzle was correctly solved 2091 and the Responder is willing to set up an association 2092 but has currently a number of I2s in processing queue. 2093 R2 will be sent after the I2 has been processed. 2095 NOTIFY MESSAGES - STATUS TYPES Value 2096 ------------------------------ ----- 2098 (None defined at present) 2100 5.2.17. ECHO_REQUEST 2102 0 1 2 3 2103 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 2104 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2105 | Type | Length | 2106 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2107 | Opaque data (variable length) | 2108 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2110 Type 63661 or 897 2111 Length variable 2112 Opaque data Opaque data, supposed to be meaningful only to the 2113 node that sends ECHO_REQUEST and receives a 2114 corresponding ECHO_RESPONSE. 2116 The ECHO_REQUEST parameter contains an opaque blob of data that the 2117 sender wants to get echoed back in the corresponding reply packet. 2119 The ECHO_REQUEST and ECHO_RESPONSE parameters MAY be used for any 2120 purpose where a node wants to carry some state in a request packet 2121 and get it back in a response packet. The ECHO_REQUEST MAY be 2122 covered by the HMAC and SIGNATURE. This is dictated by the Type 2123 field selected for the parameter; Type 897 ECHO_REQUEST is covered 2124 and Type 63661 is not covered. A HIP packet can contain only one 2125 ECHO_REQUEST parameter. 2127 5.2.18. ECHO_RESPONSE 2129 0 1 2 3 2130 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 2131 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2132 | Type | Length | 2133 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2134 | Opaque data (variable length) | 2135 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2137 Type 63425 or 961 2138 Length variable 2139 Opaque data Opaque data, copied unmodified from the ECHO_REQUEST 2140 parameter that triggered this response. 2142 The ECHO_RESPONSE parameter contains an opaque blob of data that the 2143 sender of the ECHO_REQUEST wants to get echoed back. The opaque data 2144 is copied unmodified from the ECHO_REQUEST parameter. 2146 The ECHO_REQUEST and ECHO_RESPONSE parameters MAY be used for any 2147 purpose where a node wants to carry some state in a request packet 2148 and get it back in a response packet. The ECHO_RESPONSE MAY be 2149 covered by the HMAC and SIGNATURE. This is dictated by the Type 2150 field selected for the parameter; Type 961 ECHO_RESPONSE is covered 2151 and Type 63425 is not. 2153 5.3. HIP Packets 2155 There are eight basic HIP packets (see Table 11). Four are for the 2156 HIP base exchange, one is for updating, one is for sending 2157 notifications, and two for closing a HIP association. 2159 +------------------+------------------------------------------------+ 2160 | Packet type | Packet name | 2161 +------------------+------------------------------------------------+ 2162 | 1 | I1 - the HIP Initiator Packet | 2163 | | | 2164 | 2 | R1 - the HIP Responder Packet | 2165 | | | 2166 | 3 | I2 - the Second HIP Initiator Packet | 2167 | | | 2168 | 4 | R2 - the Second HIP Responder Packet | 2169 | | | 2170 | 16 | UPDATE - the HIP Update Packet | 2171 | | | 2172 | 17 | NOTIFY - the HIP Notify Packet | 2173 | | | 2174 | 18 | CLOSE - the HIP Association Closing Packet | 2175 | | | 2176 | 19 | CLOSE_ACK - the HIP Closing Acknowledgment | 2177 | | Packet | 2178 +------------------+------------------------------------------------+ 2180 Table 11: HIP packets and packet type numbers 2182 Packets consist of the fixed header as described in Section 5.1, 2183 followed by the parameters. The parameter part, in turn, consists of 2184 zero or more TLV coded parameters. 2186 In addition to the base packets, other packets types will be defined 2187 later in separate specifications. For example, support for mobility 2188 and multi-homing is not included in this specification. 2190 See Notation (Section 2.2) for used operations. 2192 In the future, an OPTIONAL upper layer payload MAY follow the HIP 2193 header. The Next Header field in the header indicates if there is 2194 additional data following the HIP header. The HIP packet, however, 2195 MUST NOT be fragmented. This limits the size of the possible 2196 additional data in the packet. 2198 5.3.1. I1 - the HIP Initiator Packet 2200 The HIP header values for the I1 packet: 2202 Header: 2203 Packet Type = 1 2204 SRC HIT = Initiator's HIT 2205 DST HIT = Responder's HIT, or NULL 2207 IP ( HIP () ) 2209 The I1 packet contains only the fixed HIP header. 2211 Valid control bits: none 2213 The Initiator gets the Responder's HIT either from a DNS lookup of 2214 the Responder's FQDN, from some other repository, or from a local 2215 table. If the Initiator does not know the Responder's HIT, it may 2216 attempt opportunistic mode by using NULL (all zeros) as the 2217 Responder's HIT. See also "HIP Opportunistic Mode" (Section 4.1.6)). 2219 Since this packet is so easy to spoof even if it were signed, no 2220 attempt is made to add to its generation or processing cost. 2222 Implementations MUST be able to handle a storm of received I1 2223 packets, discarding those with common content that arrive within a 2224 small time delta. 2226 5.3.2. R1 - the HIP Responder Packet 2228 The HIP header values for the R1 packet: 2230 Header: 2231 Packet Type = 2 2232 SRC HIT = Responder's HIT 2233 DST HIT = Initiator's HIT 2235 IP ( HIP ( [ R1_COUNTER, ] 2236 PUZZLE, 2237 DIFFIE_HELLMAN, 2238 HIP_TRANSFORM, 2239 HOST_ID, 2240 [ ECHO_REQUEST, ] 2241 HIP_SIGNATURE_2 ) 2242 [, ECHO_REQUEST ]) 2244 Valid control bits: A 2246 If the Responder HI is an anonymous one, the A control MUST be set. 2248 The Initiator HIT MUST match the one received in I1. If the 2249 Responder has multiple HIs, the Responder HIT used MUST match 2250 Initiator's request. If the Initiator used opportunistic mode, the 2251 Responder may select freely among its HIs. See also "HIP 2252 Opportunistic Mode" (Section 4.1.6)). 2254 The R1 generation counter is used to determine the currently valid 2255 generation of puzzles. The value is increased periodically, and it 2256 is RECOMMENDED that it is increased at least as often as solutions to 2257 old puzzles are no longer accepted. 2259 The Puzzle contains a random #I and the difficulty K. The difficulty 2260 K is the number of bits that the Initiator must get zero in the 2261 puzzle. The random #I is not covered by the signature and must be 2262 zeroed during the signature calculation, allowing the sender to 2263 select and set the #I into a pre-computed R1 just prior sending it to 2264 the peer. 2266 The Diffie-Hellman value is ephemeral, and one value SHOULD be used 2267 only for one connection. Once the Responder has received a valid 2268 response to an R1 packet, that Diffie-Hellman value SHOULD be 2269 deprecated. Because it is possible that the Responder has sent the 2270 same Diffie-Hellman value to different hosts simultaneously in 2271 corresponding R1 packets also those responses should be accepted. 2272 However, as a defense against I1 storms, an implementation MAY use 2273 the same Diffie-Hellman value for a period of time, for example, 15 2274 minutes. By using a small number of different puzzles for a given 2275 Diffie-Hellman value, the R1 packets can be pre- computed and 2276 delivered as quickly as I1 packets arrive. A scavenger process 2277 should clean up unused DHs and puzzles. 2279 The HIP_TRANSFORM contains the encryption and integrity algorithms 2280 supported by the Responder to protect the HI exchange, in the order 2281 of preference. All implementations MUST support the AES [18] with 2282 HMAC-SHA-1-96 [6]. 2284 The ECHO_REQUEST contains data that the sender wants to receive 2285 unmodified in the corresponding response packet in the ECHO_RESPONSE 2286 parameter. The ECHO_REQUEST can be either covered by the signature, 2287 or it can be left out from it. In the first case, the ECHO_REQUEST 2288 gets Type number 897 and in the latter case 63661. 2290 The signature is calculated over the whole HIP envelope, after 2291 setting the Initiator HIT, header checksum as well as the Opaque 2292 field and the Random #I in the PUZZLE parameter temporarily to zero, 2293 and excluding any parameters that follow the signature, as described 2294 in Section 5.2.12. This allows the Responder to use precomputed R1s. 2295 The Initiator SHOULD validate this signature. It SHOULD check that 2296 the Responder HI received matches with the one expected, if any. 2298 5.3.3. I2 - the Second HIP Initiator Packet 2300 The HIP header values for the I2 packet: 2302 Header: 2303 Type = 3 2304 SRC HIT = Initiator's HIT 2305 DST HIT = Responder's HIT 2307 IP ( HIP ( [R1_COUNTER,] 2308 SOLUTION, 2309 DIFFIE_HELLMAN, 2310 HIP_TRANSFORM, 2311 ENCRYPTED { HOST_ID } or HOST_ID, 2312 [ ECHO_RESPONSE ,] 2313 HMAC, 2314 HIP_SIGNATURE 2315 [, ECHO_RESPONSE] ) ) 2317 Valid control bits: A 2319 The HITs used MUST match the ones used previously. 2321 If the Initiator HI is an anonymous one, the A control MUST be set. 2323 The Initiator MAY include an unmodified copy of the R1_COUNTER 2324 parameter received in the corresponding R1 packet into the I2 packet. 2326 The Solution contains the random # I from R1 and the computed # J. 2327 The low order K bits of the RHASH(I | ... | J) MUST be zero. 2329 The Diffie-Hellman value is ephemeral. If precomputed, a scavenger 2330 process should clean up unused DHs. 2332 The HIP_TRANSFORM contains the single encryption and integrity 2333 transform selected by the Initiator, that will be used to protect the 2334 HI exchange. The chosen transform MUST correspond to one offered by 2335 the Responder in the R1. All implementations MUST support the AES 2336 transform [18]. 2338 The Initiator's HI MAY be encrypted using the HIP_TRANSFORM 2339 encryption algorithm. The keying material is derived from the 2340 Diffie-Hellman exchanged as defined in Section 6.5. 2342 The ECHO_RESPONSE contains the unmodified Opaque data copied from the 2343 corresponding ECHO_REQUEST parameter. The ECHO_RESPONSE can be 2344 either covered by the HMAC and SIGNATURE or not covered. In the 2345 former case, the ECHO_RESPONSE gets Type number 961, in the latter it 2346 is 63425. 2348 The HMAC is calculated over whole HIP envelope, excluding any 2349 parameters after the HMAC, as described in Section 6.4.1. The 2350 Responder MUST validate the HMAC. 2352 The signature is calculated over whole HIP envelope, excluding any 2353 parameters after the HIP_SIGNATURE, as described in Section 5.2.11. 2354 The Responder MUST validate this signature. It MAY use either the HI 2355 in the packet or the HI acquired by some other means. 2357 5.3.4. R2 - the Second HIP Responder Packet 2359 The HIP header values for the R2 packet: 2361 Header: 2362 Packet Type = 4 2363 SRC HIT = Responder's HIT 2364 DST HIT = Initiator's HIT 2366 IP ( HIP ( HMAC_2, HIP_SIGNATURE ) ) 2368 Valid control bits: none 2370 The HMAC_2 is calculated over whole HIP envelope, with Responder's 2371 HOST_ID parameter concatenated with the HIP envelope. The HOST_ID 2372 parameter is removed after the HMAC calculation. The procedure is 2373 described in 8.3.1. 2375 The signature is calculated over whole HIP envelope. 2377 The Initiator MUST validate both the HMAC and the signature. 2379 5.3.5. UPDATE - the HIP Update Packet 2381 Support for the UPDATE packet is MANDATORY. 2383 The HIP header values for the UPDATE packet: 2385 Header: 2386 Packet Type = 16 2387 SRC HIT = Sender's HIT 2388 DST HIT = Recipient's HIT 2390 IP ( HIP ( [SEQ, ACK, ] HMAC, HIP_SIGNATURE ) ) 2392 Valid control bits: None 2394 The UPDATE packet contains mandatory HMAC and HIP_SIGNATURE 2395 parameters, and other optional parameters. 2397 The UPDATE packet contains zero or one SEQ parameter. The presence 2398 of a SEQ parameter indicates that the receiver MUST ack the UPDATE. 2399 An UPDATE that does not contain a SEQ parameter is simply an ACK of a 2400 previous UPDATE and itself MUST not be acked. 2402 An UPDATE packet contains zero or one ACK parameters. The ACK 2403 parameter echoes the SEQ sequence number of the UPDATE packet being 2404 acked. A host MAY choose to ack more than one UPDATE packet at a 2405 time; e.g., the ACK may contain the last two SEQ values received, for 2406 robustness to ack loss. ACK values are not cumulative; each received 2407 unique SEQ value requires at least one corresponding ACK value in 2408 reply. Received ACKs that are redundant are ignored. 2410 The UPDATE packet may contain both a SEQ and an ACK parameter. In 2411 this case, the ACK is being piggybacked on an outgoing UPDATE. In 2412 general, UPDATEs carrying SEQ SHOULD be acked upon completion of the 2413 processing of the UPDATE. A host MAY choose to hold the UPDATE 2414 carrying ACK for a short period of time to allow for the possibility 2415 of piggybacking the ACK parameter, in a manner similar to TCP delayed 2416 acknowledgments. 2418 A sender MAY choose to forego reliable transmission of a particular 2419 UPDATE (e.g., it becomes overcome by events). The semantics are such 2420 that the receiver MUST acknowledge the UPDATE but the sender MAY 2421 choose to not care about receiving the ACK. 2423 UPDATEs MAY be retransmitted without incrementing SEQ. If the same 2424 subset of parameters is included in multiple UPDATEs with different 2425 SEQs, the host MUST ensure that receiver processing of the parameters 2426 multiple times will not result in a protocol error. 2428 5.3.6. NOTIFY - the HIP Notify Packet 2430 The NOTIFY packet is OPTIONAL. The NOTIFY packet MAY be used to 2431 provide information to a peer. Typically, NOTIFY is used to indicate 2432 some type of protocol error or negotiation failure. NOTIFY packets 2433 are unacknowledged. The receiver can handle the packet only as 2434 informational, and SHOULD NOT make any state information changes 2435 based purely on a received NOTIFY packet. 2437 The HIP header values for the NOTIFY packet: 2439 Header: 2440 Packet Type = 17 2441 SRC HIT = Sender's HIT 2442 DST HIT = Recipient's HIT, or zero if unknown 2444 IP ( HIP (i, [HOST_ID, ] HIP_SIGNATURE) ) 2446 Valid control bits: None 2448 The NOTIFY packet is used to carry one or more NOTIFY parameters. 2450 5.3.7. CLOSE - the HIP Association Closing Packet 2452 The HIP header values for the CLOSE packet: 2454 Header: 2455 Packet Type = 18 2456 SRC HIT = Sender's HIT 2457 DST HIT = Recipient's HIT 2459 IP ( HIP ( ECHO_REQUEST, HMAC, HIP_SIGNATURE ) ) 2461 Valid control bits: none 2463 The sender MUST include an ECHO_REQUEST used to validate CLOSE_ACK 2464 received in response, and both an HMAC and a signature (calculated 2465 over the whole HIP envelope). 2467 The receiver peer MUST validate both the HMAC and the signature if it 2468 has a HIP association state, and MUST reply with a CLOSE_ACK 2469 containing an ECHO_REPLY corresponding to the received ECHO_REQUEST. 2471 5.3.8. CLOSE_ACK - the HIP Closing Acknowledgment Packet 2473 The HIP header values for the CLOSE_ACK packet: 2475 Header: 2476 Packet Type = 19 2477 SRC HIT = Sender's HIT 2478 DST HIT = Recipient's HIT 2480 IP ( HIP ( ECHO_REPLY, HMAC, HIP_SIGNATURE ) ) 2482 Valid control bits: none 2484 The sender MUST include both an HMAC and signature (calculated over 2485 the whole HIP envelope). 2487 The receiver peer MUST validate both the HMAC and the signature. 2489 5.4. ICMP Messages 2491 When a HIP implementation detects a problem with an incoming packet, 2492 and it either cannot determine the identity of the sender of the 2493 packet or does not have any existing HIP association with the sender 2494 of the packet, it MAY respond with an ICMP packet. Any such replies 2495 MUST be rate limited as described in [4]. In most cases, the ICMP 2496 packet will have the Parameter Problem type (12 for ICMPv4, 4 for 2497 ICMPv6), with the Pointer field pointing to the field that caused the 2498 ICMP message to be generated. 2500 5.4.1. Invalid Version 2502 If a HIP implementation receives a HIP packet that has an 2503 unrecognized HIP version number, it SHOULD respond, rate limited, 2504 with an ICMP packet with type Parameter Problem, the Pointer pointing 2505 to the VER./RES. byte in the HIP header. 2507 5.4.2. Other Problems with the HIP Header and Packet Structure 2509 If a HIP implementation receives a HIP packet that has other 2510 unrecoverable problems in the header or packet format, it MAY 2511 respond, rate limited, with an ICMP packet with type Parameter 2512 Problem, the Pointer pointing to the field that failed to pass the 2513 format checks. However, an implementation MUST NOT send an ICMP 2514 message if the Checksum fails; instead, it MUST silently drop the 2515 packet. 2517 5.4.3. Invalid Puzzle Solution 2519 If a HIP implementation receives an I2 packet that has an invalid 2520 puzzle solution, the behavior depends on the underlying version of 2521 IP. If IPv6 is used, the implementation SHOULD respond with an ICMP 2522 packet with type Parameter Problem, the Pointer pointing to the 2523 beginning of the Puzzle solution #J field in the SOLUTION payload in 2524 the HIP message. 2526 If IPv4 is used, the implementation MAY respond with an ICMP packet 2527 with the type Parameter Problem, copying enough of bytes from the I2 2528 message so that the SOLUTION parameter fits into the ICMP message, 2529 the Pointer pointing to the beginning of the Puzzle solution #J 2530 field, as in the IPv6 case. Note, however, that the resulting ICMPv4 2531 message exceeds the typical ICMPv4 message size as defined in [2]. 2533 5.4.4. Non-existing HIP Association 2535 If a HIP implementation receives a CLOSE, or UPDATE packet, or any 2536 other packet whose handling requires an existing association, that 2537 has either a Receiver or Sender HIT that does not match with any 2538 existing HIP association, the implementation MAY respond, rate 2539 limited, with an ICMP packet with the type Parameter Problem, the 2540 Pointer pointing to the beginning of the first HIT that does not 2541 match. 2543 A host MUST NOT reply with such an ICMP if it receives any of the 2544 following messages: I1, R2, I2, R2, and NOTIFY. When introducing new 2545 packet types, a specification SHOULD define the appropriate rules for 2546 sending or not sending this kind of ICMP replies. 2548 6. Packet Processing 2550 Each host is assumed to have a single HIP protocol implementation 2551 that manages the host's HIP associations and handles requests for new 2552 ones. Each HIP association is governed by a conceptual state 2553 machine, with states defined above in Section 4.4. The HIP 2554 implementation can simultaneously maintain HIP associations with more 2555 than one host. Furthermore, the HIP implementation may have more 2556 than one active HIP association with another host; in this case, HIP 2557 associations are distinguished by their respective HITs. It is not 2558 possible to have more than one HIP association between any given pair 2559 of HITs. Consequently, the only way for two hosts to have more than 2560 one parallel association is to use different HITs, at least at one 2561 end. 2563 The processing of packets depends on the state of the HIP 2564 association(s) with respect to the authenticated or apparent 2565 originator of the packet. A HIP implementation determines whether it 2566 has an active association with the originator of the packet based on 2567 the HITs. In the case of user data carried in a specific transport 2568 format, the transport format document specifies how the incoming 2569 packets are matched with the active associations. 2571 6.1. Processing Outgoing Application Data 2573 In a HIP host, an application can send application level data using 2574 an identifier specified via the underlying API. The API can be a 2575 backwards compatible API (see [28]), using identifiers that look 2576 similar to IP addresses, or a completely new API, providing enhanced 2577 services related to Host Identities. Depending on the HIP 2578 implementation, the identifier provided to the application may be 2579 different; it can be e.g. a HIT or an IP address. 2581 The exact format and method for transferring the data from the source 2582 HIP host to the destination HIP host is defined in the corresponding 2583 transport format document. The actual data is transferred in the 2584 network using the appropriate source and destination IP addresses. 2586 In this document, conceptual processing rules are defined only for 2587 the base case where both hosts have only single usable IP addresses; 2588 the multi-address multi-homing case will be specified separately. 2590 The following conceptual algorithm describes the steps that are 2591 required for handling outgoing datagrams destined to a HIT. 2593 1. If the datagram has a specified source address, it MUST be a HIT. 2594 If it is not, the implementation MAY replace the source address 2595 with a HIT. Otherwise it MUST drop the packet. 2597 2. If the datagram has an unspecified source address, the 2598 implementation must choose a suitable source HIT for the 2599 datagram. 2601 3. If there is no active HIP association with the given < source, 2602 destination > HIT pair, one must be created by running the base 2603 exchange. While waiting for the base exchange to complete, the 2604 implementation SHOULD queue at least one packet per HIP 2605 association to be formed, and it MAY queue more than one. 2607 4. Once there is an active HIP association for the given < source, 2608 destination > HIT pair, the outgoing datagram is passed to 2609 transport handling. The possible transport formats are defined 2610 in separate documents, of which the ESP transport format for HIP 2611 is mandatory for all HIP implementations. 2613 5. Before sending the packet, the HITs in the datagram are replaced 2614 with suitable IP addresses. For IPv6, the rules defined in [16] 2615 SHOULD be followed. Note that this HIT-to-IP-address conversion 2616 step MAY also be performed at some other point in the stack, 2617 e.g., before wrapping the packet into the output format. 2619 6.2. Processing Incoming Application Data 2621 The following conceptual algorithm describes the incoming datagram 2622 handling when HITs are used at the receiving host as application 2623 level identifiers. More detailed steps for processing packets are 2624 defined in corresponding transport format documents. 2626 1. The incoming datagram is mapped to an existing HIP association, 2627 typically using some information from the packet. For example, 2628 such mapping may be based on ESP Security Parameter Index (SPI). 2630 2. The specific transport format is unwrapped, in a way depending on 2631 the transport format, yielding a packet that looks like a 2632 standard (unencrypted) IP packet. If possible, this step SHOULD 2633 also verify that the packet was indeed (once) sent by the remote 2634 HIP host, as identified by the HIP association. 2636 3. The IP addresses in the datagram are replaced with the HITs 2637 associated with the HIP association. Note that this IP-address- 2638 to-HIT conversion step MAY also be performed at some other point 2639 in the stack. 2641 4. The datagram is delivered to the upper layer. Demultiplexing the 2642 datagram the right upper layer socket is based on the HITs. 2644 6.3. Solving the Puzzle 2646 This subsection describes the puzzle solving details. 2648 In R1, the values I and K are sent in network byte order. Similarly, 2649 in I2 the values I and J are sent in network byte order. The hash is 2650 created by concatenating, in network byte order, the following data, 2651 in the following order and using the RHASH algorithm: 2653 64-bit random value I, in network byte order, as appearing in R1 2654 and I2. 2656 128-bit Initiator HIT, in network byte order, as appearing in the 2657 HIP Payload in R1 and I2. 2659 128-bit Responder HIT, in network byte order, as appearing in the 2660 HIP Payload in R1 and I2. 2662 64-bit random value J, in network byte order, as appearing in I2. 2664 In order to be a valid response puzzle, the K low-order bits of the 2665 resulting RHASH digest must be zero. 2667 Notes: 2669 i) The length of the data to be hashed is 48 bytes. 2671 ii) All the data in the hash input MUST be in network byte order. 2673 iii) The order of the Initiator and Responder HITs are different 2674 in the R1 and I2 packets, see Section 5.1. Care must be taken to 2675 copy the values in right order to the hash input. 2677 The following procedure describes the processing steps involved, 2678 assuming that the Responder chooses to precompute the R1 packets: 2680 Precomputation by the Responder: 2681 Sets up the puzzle difficulty K. 2682 Creates a signed R1 and caches it. 2684 Responder: 2685 Selects a suitable cached R1. 2686 Generates a random number I. 2687 Sends I and K in an R1. 2688 Saves I and K for a Delta time. 2690 Initiator: 2691 Generates repeated attempts to solve the puzzle until a matching J 2692 is found: 2693 Ltrunc( RHASH( I | HIT-I | HIT-R | J ), K ) == 0 2694 Sends I and J in an I2. 2696 Responder: 2697 Verifies that the received I is a saved one. 2698 Finds the right K based on I. 2699 Computes V := Ltrunc( RHASH( I | HIT-I | HIT-R | J ), K ) 2700 Rejects if V != 0 2701 Accept if V == 0 2703 6.4. HMAC and SIGNATURE Calculation and Verification 2705 The following subsections define the actions for processing HMAC, 2706 HIP_SIGNATURE and HIP_SIGNATURE_2 parameters. 2708 6.4.1. HMAC Calculation 2710 The following process applies both to the HMAC and HMAC_2 parameters. 2711 When processing HMAC_2, the difference is that the HMAC calculation 2712 includes a pseudo HOST_ID field containing the Responder's 2713 information as sent in the R1 packet earlier. 2715 Both the Initiator and the Responder should take some care when 2716 verifying or calculating the HMAC_2. Specifically, the Responder 2717 should preserve other parameters than the HOST_ID when sending the 2718 R2. Also, the Initiator has to preserve the HOST_ID exactly as it 2719 was received in the R1 packet. 2721 The HMAC parameter is defined in Section 5.2.9 and HMAC_2 parameter 2722 in Section 5.2.10. HMAC calculation and verification process: 2724 Packet sender: 2726 1. Create the HIP packet, without the HMAC or any possible 2727 HIP_SIGNATURE or HIP_SIGNATURE_2 parameters. 2729 2. In case of HMAC_2 calculation, add a HOST_ID (Responder) 2730 parameter to the packet. 2732 3. Calculate the Length field in the HIP header. 2734 4. Compute the HMAC. 2736 5. In case of HMAC_2, remove the HOST_ID parameter from the packet. 2738 6. Add the HMAC parameter to the packet and any HIP_SIGNATURE or 2739 HIP_SIGNATURE_2 parameters that may follow. 2741 7. Recalculate the Length field in the HIP header. 2743 Packet receiver: 2745 1. Verify the HIP header Length field. 2747 2. Remove the HMAC or HMAC_2 parameter, and if the packet contains 2748 any HIP_SIGNATURE or HIP_SIGNATURE_2 fields, remove them too, 2749 saving the contents if they will be needed later. 2751 3. In case of HMAC_2, build and add a HOST_ID parameter (with 2752 Responder information) to the packet. The HOST_ID parameter 2753 should be identical to the one previously received from the 2754 Responder. 2756 4. Recalculate the HIP packet length in the HIP header and clear the 2757 Checksum field (set it to all zeros). 2759 5. Compute the HMAC and verify it against the received HMAC. 2761 6. In case of HMAC_2, remove the HOST_ID parameter from the packet 2762 before further processing. 2764 6.4.2. Signature Calculation 2766 The following process applies both to the HIP_SIGNATURE and 2767 HIP_SIGNATURE_2 parameters. When processing HIP_SIGNATURE_2, the 2768 only difference is that instead of HIP_SIGNATURE parameter, the 2769 HIP_SIGNATURE_2 parameter is used, and the Initiator's HIT and PUZZLE 2770 Opaque and Random #I fields are cleared (set to all zeros) before 2771 computing the signature. The HIP_SIGNATURE parameter is defined in 2772 Section 5.2.11 and the HIP_SIGNATURE_2 parameter in Section 5.2.12. 2774 Signature calculation and verification process: 2776 Packet sender: 2778 1. Create the HIP packet without the HIP_SIGNATURE parameter or any 2779 parameters that follow the HIP_SIGNATURE parameter. 2781 2. Calculate the Length field and zero the Checksum field in the HIP 2782 header. 2784 3. Compute the signature. 2786 4. Add the HIP_SIGNATURE parameter to the packet. 2788 5. Add any parameters that follow the HIP_SIGNATURE parameter. 2790 6. Recalculate the Length field in the HIP header, and calculate the 2791 Checksum field. 2793 Packet receiver: 2795 1. Verify the HIP header Length field. 2797 2. Save the contents of the HIP_SIGNATURE parameter and any 2798 parameters following the HIP_SIGNATURE parameter and remove them 2799 from the packet. 2801 3. Recalculate the HIP packet Length in the HIP header and clear the 2802 Checksum field (set it to all zeros). 2804 4. Compute the signature and verify it against the received 2805 signature. 2807 The verification can use either the HI received from a HIP packet, 2808 the HI from a DNS query, if the FQDN has been received in the HOST_ID 2809 packet, or one received by some other means. 2811 6.5. HIP KEYMAT Generation 2813 HIP keying material is derived from the Diffie-Hellman Kij produced 2814 during the HIP base exchange. The Initiator has Kij during the 2815 creation of the I2 packet, and the Responder has Kij once it receives 2816 the I2 packet. This is why I2 can already contain encrypted 2817 information. 2819 The KEYMAT is derived by feeding Kij and the HITs into the following 2820 operation; the | operation denotes concatenation. 2822 KEYMAT = K1 | K2 | K3 | ... 2823 where 2825 K1 = RHASH( Kij | sort(HIT-I | HIT-R) | I | J | 0x01 ) 2826 K2 = RHASH( Kij | K1 | 0x02 ) 2827 K3 = RHASH( Kij | K2 | 0x03 ) 2828 ... 2829 K255 = RHASH( Kij | K254 | 0xff ) 2830 K256 = RHASH( Kij | K255 | 0x00 ) 2831 etc. 2833 Sort(HIT-I | HIT-R) is defined as the network byte order 2834 concatenation of the two HITs, with the smaller HIT preceding the 2835 larger HIT, resulting from the numeric comparison of the two HITs 2836 interpreted as positive (unsigned) 128-bit integers in network byte 2837 order. 2839 I and J values are from the puzzle and its solution that were 2840 exchanged in R1 and I2 messages when this HIP association was set up. 2841 Both hosts have to store I and J values for the HIP association for 2842 future use. 2844 The initial keys are drawn sequentially in the order that is 2845 determined by the numeric comparison of the two HITs, with comparison 2846 method described in the previous paragraph. HOST_g denotes the host 2847 with the greater HIT value, and HOST_l the host with the lower HIT 2848 value. 2850 The drawing order for initial keys: 2852 HIP-gl encryption key for HOST_g's outgoing HIP packets 2854 HIP-gl integrity (HMAC) key for HOST_g's outgoing HIP packets 2856 HIP-lg encryption key (currently unused) for HOST_l's outgoing HIP 2857 packets 2859 HIP-lg integrity (HMAC) key for HOST_l's outgoing HIP packets 2861 The number of bits drawn for a given algorithm is the "natural" size 2862 of the keys. For the mandatory algorithms, the following sizes 2863 apply: 2865 AES 128 bits 2867 SHA-1 160 bits 2869 NULL 0 bits 2871 If other key sizes are used, they must be treated as different 2872 encryption algorithms and defined separtely. 2874 6.6. Initiation of a HIP Exchange 2876 An implementation may originate a HIP exchange to another host based 2877 on a local policy decision, usually triggered by an application 2878 datagram, in much the same way that an IPsec IKE key exchange can 2879 dynamically create a Security Association. Alternatively, a system 2880 may initiate a HIP exchange if it has rebooted or timed out, or 2881 otherwise lost its HIP state, as described in Section 4.5.4. 2883 The implementation prepares an I1 packet and sends it to the IP 2884 address that corresponds to the peer host. The IP address of the 2885 peer host may be obtained via conventional mechanisms, such as DNS 2886 lookup. The I1 contents are specified in Section 5.3.1. The 2887 selection of which host identity to use, if a host has more than one 2888 to choose from, is typically a policy decision. 2890 The following steps define the conceptual processing rules for 2891 initiating a HIP exchange: 2893 1. The Initiator gets the Responder's HIT and one or more addresses 2894 either from a DNS lookup of the Responder's FQDN, from some other 2895 repository, or from a local table. If the Initiator does not 2896 know the Responder's HIT, it may attempt opportunistic mode by 2897 using NULL (all zeros) as the Responder's HIT. See also "HIP 2898 Opportunistic Mode" (Section 4.1.6). 2900 2. The Initiator sends an I1 to one of the Responder's addresses. 2901 The selection of which address to use is a local policy decision. 2903 3. Upon sending an I1, the sender shall transition to state I1-SENT, 2904 start a timer whose timeout value should be larger than the 2905 worst-case anticipated RTT, and shall increment a timeout counter 2906 associated with the I1. 2908 4. Upon timeout, the sender SHOULD retransmit the I1 and restart the 2909 timer, up to a maximum of I1_RETRIES_MAX tries. 2911 6.6.1. Sending Multiple I1s in Parallel 2913 For the sake of minimizing the session establishment latency, an 2914 implementation MAY send the same I1 to more than one of the 2915 Responder's addresses. However, it MUST NOT send to more than three 2916 (3) addresses in parallel. Furthermore, upon timeout, the 2917 implementation MUST refrain from sending the same I1 packet to 2918 multiple addresses. These limitations are placed order to avoid 2919 congestion of the network, and potential DoS attacks that might 2920 happen, e.g., because someone claims to have hundreds or thousands of 2921 addresses. 2923 As the Responder is not guaranteed to distinguish the duplicate I1's 2924 it receives at several of its addresses (because it avoids to store 2925 states when it answers back an R1), the Initiator may receive several 2926 duplicate R1's. 2928 The Initiator SHOULD then select the initial preferred destination 2929 address using the source address of the selected received R1, and use 2930 the preferred address as a source address for the I2. Processing 2931 rules for received R1s are discussed in Section 6.8. 2933 6.6.2. Processing Incoming ICMP Protocol Unreachable Messages 2935 A host may receive an ICMP Destination Protocol Unreachable message 2936 as a response to sending a HIP I1 packet. Such a packet may be an 2937 indication that the peer does not support HIP, or it may be an 2938 attempt to launch an attack by making the Initiator believe that the 2939 Responder does not support HIP. 2941 When a system receives an ICMP Destination Protocol Unreachable 2942 message while it is waiting for an R1, it MUST NOT terminate the 2943 wait. It MAY continue as if it had not received the ICMP message, 2944 and send a few more I1s. Alternatively, it MAY take the ICMP message 2945 as a hint that the peer most probably does not support HIP, and 2946 return to state UNASSOCIATED earlier than otherwise. However, at 2947 minimum, it MUST continue waiting for an R1 for a reasonable time 2948 before returning to UNASSOCIATED. 2950 6.7. Processing Incoming I1 Packets 2952 An implementation SHOULD reply to an I1 with an R1 packet, unless the 2953 implementation is unable or unwilling to setup a HIP association. If 2954 the implementation is unable to setup a HIP association, the host 2955 SHOULD send an ICMP Destination Protocol Unreachable, 2956 Administratively Prohibited, message to the I1 source address. If 2957 the implementation is unwilling to setup a HIP association, the host 2958 MAY ignore the I1. This latter case may occur during a DoS attack 2959 such as an I1 flood. 2961 The implementation MUST be able to handle a storm of received I1 2962 packets, discarding those with common content that arrive within a 2963 small time delta. 2965 A spoofed I1 can result in an R1 attack on a system. An R1 sender 2966 MUST have a mechanism to rate limit R1s to an address. 2968 It is RECOMMENDED that the HIP state machine does not transition upon 2969 sending an R1. 2971 The following steps define the conceptual processing rules for 2972 responding to an I1 packet: 2974 1. The Responder MUST check that the Responder HIT in the received 2975 I1 is either one of its own HITs, or NULL. 2977 2. If the Responder is in ESTABLISHED state, the Responder MAY 2978 respond to this with an R1 packet, prepare to drop existing SAs 2979 and stay at ESTABLISHED state. 2981 3. If the Responder is in I1-SENT state, it must make a comparison 2982 between the sender's HIT and its own (i.e., the receiver's) HIT. 2983 If the sender's HIT is greater than its own HIT, it should drop 2984 the I1 and stay at I1-SENT. If the sender's HIT is smaller than 2985 its own HIT, it should send R1 and stay at I1-SENT. The HIT 2986 comparison goes similarly as in Section 6.5. 2988 4. If the implementation chooses to respond to the I1 with an R1 2989 packet, it creates a new R1 or selects a precomputed R1 according 2990 to the format described in Section 5.3.2. 2992 5. The R1 MUST contain the received Responder HIT, unless the 2993 received HIT is NULL, in which case the Responder SHOULD select a 2994 HIT that is constructed with the MUST algorithm in Section 3, 2995 which is currently RSA. Other than that, selecting the HIT is a 2996 local policy matter. 2998 6. The Responder sends the R1 to the source IP address of the I1 2999 packet. 3001 6.7.1. R1 Management 3003 All compliant implementations MUST produce R1 packets. An R1 packet 3004 MAY be precomputed. An R1 packet MAY be reused for time Delta T, 3005 which is implementation dependent, and SHOULD be deprecated and not 3006 used once a valid response I2 packet has been received from an 3007 Initiator. During I1 message storm, an R1 packet may be re-used 3008 beyond this limit. R1 information MUST not be discarded until Delta 3009 S after T. Time S is the delay needed for the last I2 to arrive back 3010 to the Responder. 3012 An implementation MAY keep state about received I1s and match the 3013 received I2s against the state, as discussed in Section 4.1.1. 3015 6.7.2. Handling Malformed Messages 3017 If an implementation receives a malformed I1 message, it SHOULD NOT 3018 respond with a NOTIFY message, as such practice could open up a 3019 potential denial-of-service danger. Instead, it MAY respond with an 3020 ICMP packet, as defined in Section 5.4. 3022 6.8. Processing Incoming R1 Packets 3024 A system receiving an R1 MUST first check to see if it has sent an I1 3025 to the originator of the R1 (i.e., it is in state I1-SENT). If so, 3026 it SHOULD process the R1 as described below, send an I2, and go to 3027 state I2-SENT, setting a timer to protect the I2. If the system is 3028 in state I2-SENT, it MAY respond to an R1 if the R1 has a larger R1 3029 generation counter; if so, it should drop its state due to processing 3030 the previous R1 and start over from state I1-SENT. If the system is 3031 in any other state with respect to that host, it SHOULD silently drop 3032 the R1. 3034 When sending multiple I1s, an Initiator SHOULD wait for a small 3035 amount of time after the first R1 reception to allow possibly 3036 multiple R1s to arrive, and it SHOULD respond to an R1 among the set 3037 with the largest R1 generation counter. 3039 The following steps define the conceptual processing rules for 3040 responding to an R1 packet: 3042 1. A system receiving an R1 MUST first check to see if it has sent 3043 an I1 to the originator of the R1 (i.e., it has a HIP 3044 association that is in state I1-SENT and that is associated with 3045 the HITs in the R1). Unless the I1 was sent in opportunistic 3046 mode (see also "HIP Opportunistic Mode" (Section 4.1.6) ), IP 3047 addresses in the received R1 packet SHOULD be ignored and the 3048 match SHOULD be based on HITs only. If a match exists, the 3049 system should process the R1 as described below. 3051 2. Otherwise, if the system is in any other state than I1-SENT or 3052 I2-SENT with respect to the HITs included in the R1, it SHOULD 3053 silently drop the R1 and remain in the current state. 3055 3. If the HIP association state is I1-SENT or I2-SENT, the received 3056 Initiator's HIT MUST correspond to the HIT used in the original, 3057 I1 and the Responder's HIT MUST correspond to the one used, 3058 unless the I1 contained a NULL HIT. 3060 4. The system SHOULD validate the R1 signature before applying 3061 further packet processing, according to Section 5.2.12. 3063 5. If the HIP association state is I1-SENT, and multiple valid R1s 3064 are present, the system SHOULD select from among the R1s with 3065 the largest R1 generation counter. 3067 6. If the HIP association state is I2-SENT, the system MAY reenter 3068 state I1-SENT and process the received R1 if it has a larger R1 3069 generation counter than the R1 responded to previously. 3071 7. The R1 packet may have the A bit set -- in this case, the system 3072 MAY choose to refuse it by dropping the R1 and returning to 3073 state UNASSOCIATED. The system SHOULD consider dropping the R1 3074 only if it used a NULL HIT in I1. If the A bit is set, the 3075 Responder's HIT is anonymous and should not be stored. 3077 8. The system SHOULD attempt to validate the HIT against the 3078 received Host Identity by using the received Host Identity to 3079 construct a HIT and verify that it matches the Sender's HIT. 3081 9. The system MUST store the received R1 generation counter for 3082 future reference. 3084 10. The system attempts to solve the puzzle in R1. The system MUST 3085 terminate the search after exceeding the remaining lifetime of 3086 the puzzle. If the puzzle is not successfully solved, the 3087 implementation may either resend I1 within the retry bounds or 3088 abandon the HIP exchange. 3090 11. The system computes standard Diffie-Hellman keying material 3091 according to the public value and Group ID provided in the 3092 DIFFIE_HELLMAN parameter. The Diffie-Hellman keying material 3093 Kij is used for key extraction as specified in Section 6.5. If 3094 the received Diffie-Hellman Group ID is not supported, the 3095 implementation may either resend I1 within the retry bounds or 3096 abandon the HIP exchange. 3098 12. The system selects the HIP transform from the choices presented 3099 in the R1 packet and uses the selected values subsequently when 3100 generating and using encryption keys, and when sending the I2. 3101 If the proposed alternatives are not acceptable to the system, 3102 it may either resend I1 within the retry bounds or abandon the 3103 HIP exchange. 3105 13. The system initializes the remaining variables in the associated 3106 state, including Update ID counters. 3108 14. The system prepares and sends an I2, as described in 3109 Section 5.3.3. 3111 15. The system SHOULD start a timer whose timeout value should be 3112 larger than the worst-case anticipated RTT, and MUST increment a 3113 timeout counter associated with the I2. The sender SHOULD 3114 retransmit the I2 upon a timeout and restart the timer, up to a 3115 maximum of I2_RETRIES_MAX tries. 3117 16. If the system is in state I1-SENT, it shall transition to state 3118 I2-SENT. If the system is in any other state, it remains in the 3119 current state. 3121 6.8.1. Handling Malformed Messages 3123 If an implementation receives a malformed R1 message, it MUST 3124 silently drop the packet. Sending a NOTIFY or ICMP would not help, 3125 as the sender of the R1 typically doesn't have any state. An 3126 implementation SHOULD wait for some more time for a possible good R1, 3127 after which it MAY try again by sending a new I1 packet. 3129 6.9. Processing Incoming I2 Packets 3131 Upon receipt of an I2, the system MAY perform initial checks to 3132 determine whether the I2 corresponds to a recent R1 that has been 3133 sent out, if the Responder keeps such state. For example, the sender 3134 could check whether the I2 is from an address or HIT that has 3135 recently received an R1 from it. The R1 may have had Opaque data 3136 included that was echoed back in the I2. If the I2 is considered to 3137 be suspect, it MAY be silently discarded by the system. 3139 Otherwise, the HIP implementation SHOULD process the I2. This 3140 includes validation of the puzzle solution, generating the Diffie- 3141 Hellman key, decrypting the Initiator's Host Identity, verifying the 3142 signature, creating state, and finally sending an R2. 3144 The following steps define the conceptual processing rules for 3145 responding to an I2 packet: 3147 1. The system MAY perform checks to verify that the I2 corresponds 3148 to a recently sent R1. Such checks are implementation 3149 dependent. See Appendix A for a description of an example 3150 implementation. 3152 2. The system MUST check that the Responder's HIT corresponds to 3153 one of its own HITs. 3155 3. If the system is in the R2-SENT state, it MAY check if the newly 3156 received I2 is similar to the one that triggered moving to R2- 3157 SENT. If so, it MAY retransmit a previously sent R2, reset the 3158 R2-SENT timer, and stay in R2-SENT. 3160 4. If the system is in the I2-SENT state, it makes a comparison 3161 between its local and sender's HITs (similarly as in 3162 Section 6.5). If the local HIT is smaller than the sender's 3163 HIT, it should drop the I2 packet, use peer Diffie-Hellman key 3164 and nonce I from the R1 packet received earlier, and get the 3165 local Diffie-Hellman key and nonce J from the I2 packet sent to 3166 the peer ealier. Otherwise, the system should process the 3167 received I2 packet and drop any previously derived Diffie- 3168 Hellman keying material Kij it might have formed upon sending 3169 the I2 previously. The peer Diffie-Hellman key and nonce J are 3170 taken from the just arrived I2 and local Diffie-Hellman key and 3171 nonce I are the ones that it sent earlier in the R1 packet. 3173 5. If the system is in the I1-SENT state, and the HITs in the I2 3174 match those used in the previously sent I1, the system uses this 3175 received I2 as the basis for the HIP assocation it was trying to 3176 form, and stops retransmitting I1 (provided that the I2 passes 3177 the below additional checks). 3179 6. If the system is in any other state than R2-SENT, it SHOULD 3180 check that the echoed R1 generation counter in I2 is within the 3181 acceptable range. Implementations MUST accept puzzles from the 3182 current generation and MAY accept puzzles from earlier 3183 generations. If the newly received I2 is outside the accepted 3184 range, the I2 is stale (perhaps replayed) and SHOULD be dropped. 3186 7. The system MUST validate the solution to the puzzle by computing 3187 the hash described in Section 5.3.3 using the same RHASH 3188 algorithm. 3190 8. The I2 MUST have a single value in the HIP_TRANSFORM parameter, 3191 which MUST match one of the values offered to the Initiator in 3192 the R1 packet. 3194 9. The system must derive Diffie-Hellman keying material Kij based 3195 on the public value and Group ID in the DIFFIE_HELLMAN 3196 parameter. This key is used to derive the HIP association keys, 3197 as described in Section 6.5. If the Diffie-Hellman Group ID is 3198 unsupported, the I2 packet is silently dropped. 3200 10. The encrypted HOST_ID decrypted by the Initiator encryption key 3201 defined in Section 6.5. If the decrypted data is not a HOST_ID 3202 parameter, the I2 packet is silently dropped. 3204 11. The implementation SHOULD also verify that the Initiator's HIT 3205 in the I2 corresponds to the Host Identity sent in the I2. 3207 12. The system MUST verify the HMAC according to the procedures in 3208 Section 5.2.9. 3210 13. The system MUST verify the HIP_SIGNATURE according to 3211 Section 5.2.11 and Section 5.3.3. 3213 14. If the checks above are valid, then the system proceeds with 3214 further I2 processing; otherwise, it discards the I2 and remains 3215 in the same state. 3217 15. The I2 packet may have the A bit set -- in this case, the system 3218 MAY choose to refuse it by dropping the I2 and returning to 3219 state UNASSOCIATED. If the A bit is set, the Initiator's HIT is 3220 anonymous and should not be stored. 3222 16. The system initializes the remaining variables in the associated 3223 state, including Update ID counters. 3225 17. Upon successful processing of an I2 in states UNASSOCIATED, I1- 3226 SENT, I2-SENT, and R2-SENT, an R2 is sent and the state machine 3227 transitions to state R2-SENT. 3229 18. Upon successful processing of an I2 in state ESTABLISHED, the 3230 old HIP association is dropped and a new one is installed, an R2 3231 is sent, and the state machine transitions to R2-SENT. 3233 19. Upon transitioning to R2-SENT, start a timer. Move to 3234 ESTABLISHED if some data has been received on the incoming HIP 3235 association, or an UPDATE packet has been received (or some 3236 other packet that indicates that the peer has moved to 3237 ESTABLISHED). If the timer expires (allowing for maximal 3238 retransmissions of I2s), move to UNASSOCIATED. 3240 6.9.1. Handling Malformed Messages 3242 If an implementation receives a malformed I2 message, the behavior 3243 SHOULD depend on how much checks the message has already passed. If 3244 the puzzle solution in the message has already been checked, the 3245 implementation SHOULD report the error by responding with a NOTIFY 3246 packet. Otherwise the implementation MAY respond with an ICMP 3247 message as defined in Section 5.4. 3249 6.10. Processing Incoming R2 Packets 3251 An R2 received in states UNASSOCIATED, I1-SENT, or ESTABLISHED 3252 results in the R2 being dropped and the state machine staying in the 3253 same state. If an R2 is received in state I2-SENT, it SHOULD be 3254 processed. 3256 The following steps define the conceptual processing rules for 3257 incoming R2 packet: 3259 1. The system MUST verify that the HITs in use correspond to the 3260 HITs that were received in R1. 3262 2. The system MUST verify the HMAC_2 according to the procedures in 3263 Section 5.2.10. 3265 3. The system MUST verify the HIP signature according to the 3266 procedures in Section 5.2.11. 3268 4. If any of the checks above fail, there is a high probability of 3269 an ongoing man-in-the-middle or other security attack. The 3270 system SHOULD act accordingly, based on its local policy. 3272 5. If the system is in any other state than I2-SENT, the R2 is 3273 silently dropped. 3275 6. Upon successful processing of the R2, the state machine moves to 3276 state ESTABLISHED. 3278 6.11. Sending UPDATE Packets 3280 A host sends an UPDATE packet when it wants to update some 3281 information related to a HIP association. There are a number of 3282 likely situations, e.g. mobility management and rekeying of an 3283 existing ESP Security Association. The following paragraphs define 3284 the conceptual rules for sending an UPDATE packet to the peer. 3285 Additional steps can be defined in other documents where the UPDATE 3286 packet is used. 3288 The system first determines whether there are any outstanding UPDATE 3289 messages that may conflict with the new UPDATE message under 3290 consideration. When multiple UPDATEs are outstanding (not yet 3291 acknowledged), the sender must assume that such UPDATEs may be 3292 processed in an arbitrary order. Therefore, any new UPDATEs that 3293 depend on a previous outstanding UPDATE being successfully received 3294 and acknowledged MUST be postponed until reception of the necessary 3295 ACK(s) occurs. One way to prevent any conflicts is to only allow one 3296 outstanding UPDATE at a time, but allowing multiple UPDATEs may 3297 improve the performance of mobility and multihoming protocols. 3299 1. The first UPDATE packet is sent with Update ID of zero. 3300 Otherwise, the system increments its own Update ID value by one 3301 before continuing the below steps. 3303 2. The system creates an UPDATE packet that contains a SEQ parameter 3304 with the current value of Update ID. The UPDATE packet may also 3305 include an ACK of the peer's Update ID found in a received UPDATE 3306 SEQ parameter, if any. 3308 3. The system sends the created UPDATE packet and starts an UPDATE 3309 timer. The default value for the timer is 2 * RTT estimate. If 3310 multiple UPDATEs are outstanding, multiple timers are in effect. 3312 4. If the UPDATE timer expires, the UPDATE is resent. The UPDATE 3313 can be resent UPDATE_RETRY_MAX times. The UPDATE timer SHOULD be 3314 exponentially backed off for subsequent retransmissions. If no 3315 acknowledgment is received from the peer after UPDATE_RETRY_MAX 3316 times, the HIP association is considered to be broken and the 3317 state machine should move from state ESTABLISHED to state CLOSING 3318 as depicted in Section 4.4.3. The UPDATE timer is cancelled upon 3319 receiving an ACK from the peer that acknowledges receipt of the 3320 UPDATE. 3322 6.12. Receiving UPDATE Packets 3324 When a system receives an UPDATE packet, its processing depends on 3325 the state of the HIP association and the presence of and values of 3326 the SEQ and ACK parameters. Typically, an UPDATE message also 3327 carries optional parameters whose handling is defined in separate 3328 documents. 3330 For each association, the peer's next expected in-sequence Update ID 3331 ("peer Update ID") is stored. Initially, this value is zero. Update 3332 ID comparisons of "less than" and "greater than" are performed with 3333 respect to a circular sequence number space. 3335 The sender may send multiple outstanding UPDATE messages. These 3336 messages are processed in the order in which they are received at the 3337 receiver (i.e., no resequencing is performed). When processing 3338 UPDATEs out-of-order, the receiver MUST keep track of which UPDATEs 3339 were previously processed, so that duplicates or retransmissions are 3340 ACKed and not reprocessed. A receiver MAY choose to define a receive 3341 window of Update IDs that it is willing to process at any given time, 3342 and discard received UPDATEs falling outside of that window. 3344 1. If there is no corresponding HIP association, the implementation 3345 MAY reply with an ICMP Parameter Problem, as specified in 3346 Section 5.4.4. 3348 2. If the association is in the ESTABLISHED state and the SEQ (but 3349 not ACK) parameter is present, the UPDATE is processed and 3350 replied as described in Section 6.12.1. 3352 3. If the association is in the ESTABLISHED state and the ACK (but 3353 not SEQ) parameter is present, the UPDATE is processed as 3354 described in Section 6.12.2. 3356 4. If the association is in the ESTABLISHED state and there is both 3357 an ACK and SEQ in the UPDATE, the ACK is first processed as 3358 described in Section 6.12.2 and then the rest of the UPDATE is 3359 processed as described in Section 6.12.1. 3361 6.12.1. Handling a SEQ parameter in a received UPDATE message 3363 1. If the Update ID in the received SEQ is not the next in sequence 3364 Update ID and is greater than the receiver's window for new 3365 UPDATEs, the packet MUST be dropped. 3367 2. If the Update ID in the received SEQ corresponds to an UPDATE 3368 that has recently been processed, the packet is treated as a 3369 retransmission. The HMAC verification (next step) MUST NOT be 3370 skipped. (A byte-by-byte comparison of the received and a stored 3371 packet would be OK, though.) It is recommended that a host cache 3372 UPDATE packets sent with ACKs to avoid the cost of generating a 3373 new ACK packet to respond to a replayed UPDATE. The system MUST 3374 acknowledge, again, such (apparent) UPDATE message 3375 retransmissions but SHOULD also consider rate-limiting such 3376 retransmission responses to guard against replay attacks. 3378 3. The system MUST verify the HMAC in the UPDATE packet. If the 3379 verification fails, the packet MUST be dropped. 3381 4. The system MAY verify the SIGNATURE in the UPDATE packet. If the 3382 verification fails, the packet SHOULD be dropped and an error 3383 message logged. 3385 5. If a new SEQ parameter is being processed, the parameters in the 3386 UPDATE are then processed. The system MUST record the Update ID 3387 in the received SEQ parameter, for replay protection. 3389 6. An UPDATE acknowledgement packet with ACK parameter is prepared 3390 and sent to the peer. This ACK parameter may be included in a 3391 separate UPDATE or piggybacked in an UPDATE with SEQ parameter, 3392 as described in Section Section 5.3.5. The ACK parameter MAY 3393 acknowledge more than one of the peer's Update IDs. 3395 6.12.2. Handling an ACK Parameter in a Received UPDATE Packet 3397 1. The sequence number reported in the ACK must match with an 3398 earlier sent UPDATE packet that has not already been 3399 acknowledged. If no match is found or if the ACK does not 3400 acknowledge a new UPDATE, the packet MUST either be dropped if no 3401 SEQ parameter is present, or the processing steps in 3402 Section 6.12.1 are followed. 3404 2. The system MUST verify the HMAC in the UPDATE packet. If the 3405 verification fails, the packet MUST be dropped. 3407 3. The system MAY verify the SIGNATURE in the UPDATE packet. If the 3408 verification fails, the packet SHOULD be dropped and an error 3409 message logged. 3411 4. The corresponding UPDATE timer is stopped (see Section 6.11) so 3412 that the now acknowledged UPDATE is no longer retransmitted. If 3413 multiple UPDATEs are newly acknowledged, multiple timers are 3414 stopped. 3416 6.13. Processing NOTIFY Packets 3418 Processing NOTIFY packets is OPTIONAL. If processed, any errors in a 3419 received NOTIFY parameter SHOULD be logged. Received errors MUST be 3420 considered only as informational and the receiver SHOULD NOT change 3421 state information purely based on the received NOTIFY message. 3423 6.14. Processing CLOSE Packets 3425 When the host receives a CLOSE message it responds with a CLOSE_ACK 3426 message and moves to CLOSED state. (The authenticity of the CLOSE 3427 message is verified using both HMAC and SIGNATURE). This processing 3428 applies whether or not the HIP association state is CLOSING in order 3429 to handle CLOSE messages from both ends crossing in flight. 3431 The HIP association is not discarded before the host moves from the 3432 UNASSOCIATED state. 3434 Once the closing process has started, any need to send data packets 3435 will trigger creating and establishing of a new HIP association, 3436 starting with sending an I1. 3438 If there is no corresponding HIP association, the CLOSE packet is 3439 dropped. 3441 6.15. Processing CLOSE_ACK Packets 3443 When a host receives a CLOSE_ACK message it verifies that it is in 3444 CLOSING or CLOSED state and that the CLOSE_ACK was in response to the 3445 CLOSE (using the included ECHO_REPLY in response to the sent 3446 ECHO_REQUEST). 3448 The CLOSE_ACK uses HMAC and SIGNATURE for verification. The state is 3449 discarded when the state changes to UNASSOCIATED and, after that, the 3450 host MAY respond with an ICMP Parameter Problem to an incoming CLOSE 3451 message (See Section 5.4.4). 3453 6.16. Dropping HIP Associations 3455 A HIP implementation is free to drop a HIP association at any time, 3456 based on its own policy. If a HIP host decides to drop a HIP 3457 association, it deletes the corresponding HIP state, including the 3458 keying material. The implementation MUST also drop the peer's R1 3459 generation counter value, unless a local policy explicitly defines 3460 that the value of that particular host is stored. An implementation 3461 MUST NOT store R1 generation counters by default, but storing R1 3462 generation counter values, if done, MUST be configured by explicit 3463 HITs. 3465 7. HIP Policies 3467 There are a number of variables that will influence the HIP exchanges 3468 that each host must support. All HIP implementations MUST support 3469 more than one simultaneous HIs, at least one of which SHOULD be 3470 reserved for anonymous usage. Although anonymous HIs will be rarely 3471 used as Responder HIs, they will be common for Initiators. Support 3472 for more than two HIs is RECOMMENDED. 3474 Many Initiators would want to use a different HI for different 3475 Responders. The implementations SHOULD provide for an ACL of 3476 Initiator HIT to Responder HIT. This ACL SHOULD also include 3477 preferred transform and local lifetimes. 3479 The value of K used in the HIP R1 packet can also vary by policy. K 3480 should never be greater than 20, but for trusted partners it could be 3481 as low as 0. 3483 Responders would need a similar ACL, representing which hosts they 3484 accept HIP exchanges, and the preferred transform and local 3485 lifetimes. Wildcarding SHOULD be supported for this ACL also. 3487 8. Security Considerations 3489 HIP is designed to provide secure authentication of hosts. HIP also 3490 attempts to limit the exposure of the host to various denial-of- 3491 service and man-in-the-middle (MitM) attacks. In so doing, HIP 3492 itself is subject to its own DoS and MitM attacks that potentially 3493 could be more damaging to a host's ability to conduct business as 3494 usual. 3496 Denial-of-service attacks take advantage of the cost of start of 3497 state for a protocol on the Responder compared to the 'cheapness' on 3498 the Initiator. HIP makes no attempt to increase the cost of the 3499 start of state on the Initiator, but makes an effort to reduce the 3500 cost to the Responder. This is done by having the Responder start 3501 the 3-way exchange instead of the Initiator, making the HIP protocol 3502 4 packets long. In doing this, packet 2 becomes a 'stock' packet 3503 that the Responder MAY use many times, until some Initiator has 3504 provided a valid response to such and R1 packet. During an I1 storm 3505 the host may re-use the same D-H value also beyond that point. Using 3506 the same Diffie-Hellman values and random puzzle #I value has some 3507 risks. This risk needs to be balanced against a potential storm of 3508 HIP I1 packets. 3510 This shifting of the start of state cost to the Initiator in creating 3511 the I2 HIP packet, presents another DoS attack. The attacker spoofs 3512 the I1 HIP packet and the Responder sends out the R1 HIP packet. 3513 This could conceivably tie up the 'Initiator' with evaluating the R1 3514 HIP packet, and creating the I2 HIP packet. The defense against this 3515 attack is to simply ignore any R1 packet where a corresponding I1 was 3516 not sent. 3518 A second form of DoS attack arrives in the I2 HIP packet. Once the 3519 attacking Initiator has solved the puzzle, it can send packets with 3520 spoofed IP source addresses with either invalid encrypted HIP payload 3521 component or a bad HIP signature. This would take resources in the 3522 Responder's part to reach the point to discover that the I2 packet 3523 cannot be completely processed. The defense against this attack is 3524 after N bad I2 packets, the Responder would discard any I2s that 3525 contain the given Initiator HIT. Thus will shut down the attack. 3526 The attacker would have to request another R1 and use that to launch 3527 a new attack. The Responder could up the value of K while under 3528 attack. On the downside, valid I2s might get dropped too. 3530 A third form of DoS attack is emulating the restart of state after a 3531 reboot of one of the partners. A host restarting would send an I1 to 3532 a peer, which would respond with an R1 even if it were in the 3533 ESTABLISHED state. If the I1 were spoofed, the resulting R1 would be 3534 received unexpectedly by the spoofed host and would be dropped, as in 3535 the first case above. 3537 A fourth form of DoS attack is emulating the end of state. HIP 3538 relies on timers plus a CLOSE/CLOSE_ACK handshake to explicitly 3539 signals the end of a state. Because both CLOSE and CLOSE_ACK 3540 messages contain an HMAC, an outsider cannot close a connection. The 3541 presence of an additional SIGNATURE allows middle-boxes to inspect 3542 these messages and discard the associated state (for e.g., 3543 firewalling, SPI-based NATing, etc.). However, the optional behavior 3544 of replying to CLOSE with an ICMP Parameter Problem packet (as 3545 described in Section 5.4.4) might allow an IP spoofer sending CLOSE 3546 messages to launch reflection attacks. 3548 A fifth form of DoS attack is replaying R1s to cause the Initiator to 3549 solve stale puzzles and become out of synchronization with the 3550 Responder. The R1 generation counter is a monotonically increasing 3551 counter designed to protect against this attack, as described in 3552 section Section 4.1.4. 3554 Man-in-the-middle attacks are difficult to defend against, without 3555 third-party authentication. A skillful MitM could easily handle all 3556 parts of HIP; but HIP indirectly provides the following protection 3557 from a MitM attack. If the Responder's HI is retrieved from a signed 3558 DNS zone, a certificate, or through some other secure means, the 3559 Initiator can use this to validate the R1 HIP packet. 3561 Likewise, if the Initiator's HI is in a secure DNS zone, a trusted 3562 certificate, or otherwise securely available, the Responder can 3563 retrieve it after it gets the I2 HIP packet and validate that. 3564 However, since an Initiator may choose to use an anonymous HI, it 3565 knowingly risks a MitM attack. The Responder may choose not to 3566 accept a HIP exchange with an anonymous Initiator. 3568 The HIP Opportunistic Mode concept has been introduced in this 3569 document, but this document does not specify the details of such a 3570 connection set up (Section 4.1.6). There are certain security 3571 concerns with opportunistic mode, and they must be addressed in a 3572 separate document if such a mode will be used. 3574 NOTIFY messages are used only for informational purposes and they are 3575 unacknowledged. A HIP implementation cannot rely solely on the 3576 information received in a NOTIFY message because the packet may have 3577 been replayed. It SHOULD NOT change any state information based 3578 purely on a received NOTIFY message. 3580 Since not all hosts will ever support HIP, ICMP 'Destination Protocol 3581 Unreachable' are to be expected and present a DoS attack. Against an 3582 Initiator, the attack would look like the Responder does not support 3583 HIP, but shortly after receiving the ICMP message, the Initiator 3584 would receive a valid R1 HIP packet. Thus to protect from this 3585 attack, an Initiator should not react to an ICMP message until a 3586 reasonable delta time to get the real Responder's R1 HIP packet. A 3587 similar attack against the Responder is more involved. First an ICMP 3588 message is expected if the I1 was a DoS attack and the real owner of 3589 the spoofed IP address does not support HIP. The Responder SHOULD 3590 NOT act on this ICMP message to remove the minimal state from the R1 3591 HIP packet (if it has one), but wait for either a valid I2 HIP packet 3592 or the natural timeout of the R1 HIP packet. This is to allow for a 3593 sophisticated attacker that is trying to break up the HIP exchange. 3594 Likewise, the Initiator should ignore any ICMP message while waiting 3595 for an R2 HIP packet, deleting state only after a natural timeout. 3597 9. IANA Considerations 3599 This document specifies the IP protocol number 253 to be used with 3600 Host Identity Protocol during the experimental phase. This number 3601 has been reserved by IANA for experimental use (see [19]. 3603 This document defines a new 128-bit value under the CGA Message Type 3604 namespace [20], 0xF0EF F02F BFF4 3D0F E793 0C3C 6E61 74EA. 3606 This document also creates a set of new name spaces. These are 3607 described below. 3609 Packet Type 3611 The 7-bit Packet Type field in a HIP protocol packet describes the 3612 type of a HIP protocol message. It is defined in Section 5.1. 3613 The current values are defined in Section 5.3.1 through 3614 Section 5.3.8 and are listed below: 3616 * I1 is 1. 3618 * R1 is 2. 3620 * I2 is 3. 3622 * R2 is 4. 3624 * UPDATE is 16. 3626 * NOTIFY is 17. 3628 * CLOSE is 18. 3630 * CLOSE_ACK is 19. 3632 New values are assigned through IETF Consensus [9]. 3634 HIP Version 3636 The four bit Version field in a HIP protocol packet describes the 3637 version of the HIP protocol. It is defined in Section 5.1. The 3638 only currently defined value is 1. New values are assigned 3639 through IETF Consensus. 3641 Parameter Type 3643 The 16 bit Type field in a HIP parameters describes the type of 3644 the parameter. It is defined in Section 5.2.1. The current 3645 values are defined in Section 5.2.3 through Section 5.2.18 and are 3646 listed below: 3648 * R1_COUNTER is 128. 3650 * PUZZLE is 257. 3652 * SOLUTION is 321. 3654 * SEQ is 385. 3656 * ACK is 449. 3658 * DIFFIE_HELLMAN is 513. 3660 * HIP_TRANSFORM is 577. 3662 * ENCRYPTED is 641. 3664 * HOST_ID is 705. 3666 * CERT is 768. 3668 * NOTIFY is 832. 3670 * ECHO_REQUEST is 897. 3672 * ECHO_RESPONSE is 961. 3674 * HMAC is 61505. 3676 * HMAC_2 is 61569. 3678 * HIP_SIGNATURE_2 is 61633. 3680 * HIP_SIGNATURE is 61697. 3682 * ECHO_REQUEST is 63661. 3684 * ECHO_RESPONSE is 63425. 3686 The type codes 0 through 1023 and 61440 through 65535 are reserved 3687 for future base protocol extensions, and are assigned through IETF 3688 Consensus. 3690 The type codes 32768 through 49141 are reserved for 3691 experimentation and private use. Types SHOULD be selected in a 3692 random fashion from this range, thereby reducing the probability 3693 of collisions. A method employing genuine randomness (such as 3694 flipping a coin) SHOULD be used. 3696 All other type codes are assigned through First Come First Served, 3697 with Specification Required [9]. 3699 Group ID 3701 The eight bit Group ID values appear in the DIFFIE_HELLMAN 3702 parameter, defined in Section 5.2.6. The currently defined values 3703 are listed below: 3705 * 384-bit group is 1. 3707 * OAKLEY well known group 1 is 2. 3709 * 1536-bit MODP group is 3. 3711 * 3072-bit MODP group is 4. 3713 * 6144-bit MODP group is 5. 3715 * 8192-bit MODP group is 6. 3717 * Value 0 is reserved. 3719 New values either from the reserved or unassigned space are 3720 assigned through IETF Consensus. 3722 Suite ID 3724 The 16 bit Suite ID values in a HIP_TRANSFORM parameter are 3725 defined in Section 5.2.7. The currently defined values are listed 3726 below: 3728 * AES-CBC with HMAC-SHA1 is 1. 3730 * 3DES-CBC with HMAC-SHA1 is 2. 3732 * 3DES-CBC with HMAC-MD5 is 3. 3734 * BLOWFISH-CBC with HMAC-SHA1 is 4. 3736 * NULL-ENCRYPT with HMAC-SHA1 is 5. 3738 * NULL-ENCRYPT with HMAC-MD5 is 6. 3740 * Value 0 is reserved. 3742 New values either from the reserved or unassigned space are 3743 assigned through IETF Consensus. 3745 DI-Type 3747 The four bit DI-Type values in a HOST_ID parameter are defined in 3748 Section 5.2.8. The currently defined values are listed below: 3750 * None included is 0. 3752 * FQDN is 1. 3754 * NAI is 2. 3756 New values are assigned through IETF Consensus. 3758 Notify Message Type 3760 The 16 bit Notify Message Type field in a NOTIFY parameter is 3761 defined in Section 5.2.16. The currently defined values are 3762 listed below: 3764 * UNSUPPORTED_CRITICAL_PARAMETER_TYPE is 1. 3766 * INVALID_SYNTAX is 7. 3768 * NO_DH_PROPOSAL_CHOSEN is 14. 3770 * INVALID_DH_CHOSEN is 15. 3772 * NO_HIP_PROPOSAL_CHOSEN is 16. 3774 * INVALID_HIP_TRANSFORM_CHOSEN is 17. 3776 * AUTHENTICATION_FAILED is 24. 3778 * CHECKSUM_FAILED is 26. 3780 * HMAC_FAILED is 28. 3782 * ENCRYPTION_FAILED is 32. 3784 * INVALID_HIT is 40. 3786 * BLOCKED_BY_POLICY is 42. 3788 * SERVER_BUSY_PLEASE_RETRY is 44. 3790 New values are assigned through First Come First Served, with 3791 Specification Required. 3793 10. Acknowledgments 3795 The drive to create HIP came to being after attending the MALLOC 3796 meeting at the 43rd IETF meeting. Baiju Patel and Hilarie Orman 3797 really gave the original author, Bob Moskowitz, the assist to get HIP 3798 beyond 5 paragraphs of ideas. It has matured considerably since the 3799 early drafts thanks to extensive input from IETFers. Most 3800 importantly, its design goals are articulated and are different from 3801 other efforts in this direction. Particular mention goes to the 3802 members of the NameSpace Research Group of the IRTF. Noel Chiappa 3803 provided the framework for LSIs and Keith Moore the impetus to 3804 provide resolvability. Steve Deering provided encouragement to keep 3805 working, as a solid proposal can act as a proof of ideas for a 3806 research group. 3808 Many others contributed; extensive security tips were provided by 3809 Steve Bellovin. Rob Austein kept the DNS parts on track. Paul 3810 Kocher taught Bob Moskowitz how to make the puzzle exchange expensive 3811 for the Initiator to respond, but easy for the Responder to validate. 3812 Bill Sommerfeld supplied the Birthday concept, which later evolved 3813 into the R1 generation counter, to simplify reboot management. Erik 3814 Nordmark supplied CLOSE-mechanism for closing connections. Rodney 3815 Thayer and Hugh Daniels provide extensive feedback. In the early 3816 times of this draft, John Gilmore kept Bob Moskowitz challenged to 3817 provide something of value. 3819 During the later stages of this document, when the editing baton was 3820 transfered to Pekka Nikander, the input from the early implementors 3821 were invaluable. Without having actual implementations, this 3822 document would not be on the level it is now. 3824 In the usual IETF fashion, a large number of people have contributed 3825 to the actual text or ideas. The list of these people include Jeff 3826 Ahrenholz, Francis Dupont, Derek Fawcus, George Gross, Andrew 3827 McGregor, Julien Laganier, Miika Komu, Mika Kousa, Jan Melen, Henrik 3828 Petander, Michael Richardson, Tim Shepard, Jorma Wall, and Jukka 3829 Ylitalo. Our apologies to anyone whose name is missing. 3831 Once the HIP Working Group was founded in early 2004, a number of 3832 changes were introduced through the working group process. Most 3833 notably, the original draft was split in two, one containing the base 3834 exchange and the other one defining how to use ESP. Some 3835 modifications to the protocol proposed by Aura et al. [29] were added 3836 at a later stage. 3838 11. References 3840 11.1. Normative References 3842 [1] Postel, J., "User Datagram Protocol", STD 6, RFC 768, 3843 August 1980. 3845 [2] Postel, J., "Internet Control Message Protocol", STD 5, 3846 RFC 792, September 1981. 3848 [3] Mockapetris, P., "Domain names - implementation and 3849 specification", STD 13, RFC 1035, November 1987. 3851 [4] Conta, A. and S. Deering, "Internet Control Message Protocol 3852 (ICMPv6) for the Internet Protocol Version 6 (IPv6)", RFC 1885, 3853 December 1995. 3855 [5] Bradner, S., "Key words for use in RFCs to Indicate Requirement 3856 Levels", BCP 14, RFC 2119, March 1997. 3858 [6] Madson, C. and R. Glenn, "The Use of HMAC-SHA-1-96 within ESP 3859 and AH", RFC 2404, November 1998. 3861 [7] Harkins, D. and D. Carrel, "The Internet Key Exchange (IKE)", 3862 RFC 2409, November 1998. 3864 [8] Orman, H., "The OAKLEY Key Determination Protocol", RFC 2412, 3865 November 1998. 3867 [9] Narten, T. and H. Alvestrand, "Guidelines for Writing an IANA 3868 Considerations Section in RFCs", BCP 26, RFC 2434, 3869 October 1998. 3871 [10] Pereira, R. and R. Adams, "The ESP CBC-Mode Cipher Algorithms", 3872 RFC 2451, November 1998. 3874 [11] Deering, S. and R. Hinden, "Internet Protocol, Version 6 (IPv6) 3875 Specification", RFC 2460, December 1998. 3877 [12] Eastlake, D., "Domain Name System Security Extensions", 3878 RFC 2535, March 1999. 3880 [13] Eastlake, D., "DSA KEYs and SIGs in the Domain Name System 3881 (DNS)", RFC 2536, March 1999. 3883 [14] Kaliski, B., "PKCS #5: Password-Based Cryptography 3884 Specification Version 2.0", RFC 2898, September 2000. 3886 [15] Eastlake, D., "RSA/SHA-1 SIGs and RSA KEYs in the Domain Name 3887 System (DNS)", RFC 3110, May 2001. 3889 [16] Draves, R., "Default Address Selection for Internet Protocol 3890 version 6 (IPv6)", RFC 3484, February 2003. 3892 [17] Kivinen, T. and M. Kojo, "More Modular Exponential (MODP) 3893 Diffie-Hellman groups for Internet Key Exchange (IKE)", 3894 RFC 3526, May 2003. 3896 [18] Frankel, S., Glenn, R., and S. Kelly, "The AES-CBC Cipher 3897 Algorithm and Its Use with IPsec", RFC 3602, September 2003. 3899 [19] Narten, T., "Assigning Experimental and Testing Numbers 3900 Considered Useful", BCP 82, RFC 3692, January 2004. 3902 [20] Aura, T., "Cryptographically Generated Addresses (CGA)", 3903 RFC 3972, March 2005. 3905 [21] Schiller, J., "Cryptographic Algorithms for Use in the Internet 3906 Key Exchange Version 2 (IKEv2)", RFC 4307, December 2005. 3908 [22] Nikander, P., "An IPv6 Prefix for Overlay Routable 3909 Cryptographic Hash Identifiers (ORCHID)", 3910 draft-laganier-ipv6-khi-01 (work in progress), March 2006. 3912 [23] Aboba, B., "The Network Access Identifier", 3913 draft-ietf-radext-rfc2486bis-06 (work in progress), July 2005. 3915 [24] Jokela, P., "Using ESP transport format with HIP", 3916 draft-ietf-hip-esp-02 (work in progress), March 2006. 3918 [25] NIST, "FIPS PUB 180-1: Secure Hash Standard", April 1995. 3920 11.2. Informative References 3922 [26] Moskowitz, R. and P. Nikander, "Host Identity Protocol 3923 Architecture", draft-ietf-hip-arch-03 (work in progress), 3924 August 2005. 3926 [27] Bagnulo, M. and E. Nordmark, "Level 3 multihoming shim 3927 protocol", draft-ietf-shim6-proto-05 (work in progress), 3928 May 2006. 3930 [28] Henderson, T. and P. Nikander, "Using HIP with Legacy 3931 Applications", draft-henderson-hip-applications-03 (work in 3932 progress), May 2006. 3934 [29] Aura, T., Nagarajan, A., and A. Gurtov, "Analysis of the HIP 3935 Base Exchange Protocol", in Proceedings of 10th Australasian 3936 Conference on Information Security and Privacy, July 2003. 3938 [30] Krawczyk, H., "SIGMA: The 'SIGn-and-MAc' Approach to 3939 Authenticated Diffie-Hellman and Its Use in the IKE-Protocols", 3940 in Proceedings of CRYPTO 2003, pages 400-425, August 2003. 3942 [31] Crosby, SA. and DS. Wallach, "Denial of Service via Algorithmic 3943 Complexity Attacks", in Proceedings of Usenix Security 3944 Symposium 2003, Washington, DC., August 2003. 3946 [32] NIST, "FIPS PUB 197: Advanced Encryption Standard", Nov 2001. 3948 Appendix A. Using Responder Puzzles 3950 As mentioned in Section 4.1.1, the Responder may delay state creation 3951 and still reject most spoofed I2s by using a number of pre-calculated 3952 R1s and a local selection function. This appendix defines one 3953 possible implementation in detail. The purpose of this appendix is 3954 to give the implementors an idea on how to implement the mechanism. 3955 If the implementation is based on this appendix, it MAY contain some 3956 local modification that makes an attacker's task harder. 3958 The Responder creates a secret value S, that it regenerates 3959 periodically. The Responder needs to remember two latest values of 3960 S. Each time the S is regenerated, R1 generation counter value is 3961 incremented by one. 3963 The Responder generates a pre-signed R1 packet. The signature for 3964 pre-generated R1s must be recalculated when the Diffie-Hellman key is 3965 recomputed or when the R1_COUNTER value changes due to S value 3966 regeneration. 3968 When the Initiator sends the I1 packet for initializing a connection, 3969 the Responder gets the HIT and IP address from the packet, and 3970 generates an I-value for the puzzle. The I value is set to the pre- 3971 signed R1 packet. 3973 I value calculation: 3974 I = Ltrunc( RHASH ( S | HIT-I | HIT-R | IP-I | IP-R ), 64) 3976 The RHASH algorithm is the same that is used to generate the 3977 Responder's HIT value. 3979 From an incoming I2 packet, the Responder gets the required 3980 information to validate the puzzle: HITs, IP addresses, and the 3981 information of the used S value from the R1_COUNTER. Using these 3982 values, the Responder can regenerate the I, and verify it against the 3983 I received in the I2 packet. If the I values match, it can verify 3984 the solution using I, J, and difficulty K. If the I values do not 3985 match, the I2 is dropped. 3987 puzzle_check: 3988 V := Ltrunc( RHASH( I2.I | I2.hit_i | I2.hit_r | I2.J ), K ) 3989 if V != 0, drop the packet 3991 If the puzzle solution is correct, the I and J values are stored for 3992 later use. They are used as input material when keying material is 3993 generated. 3995 The Responder SHOULD NOT keep state about failed puzzle solutions. 3997 Appendix B. Generating a Public Key Encoding from a HI 3999 The following pseudo-codes illustrate the process to generate a 4000 public key encoding from a HI for both RSA and DSA. 4002 The symbol := denotes assignment; the symbol += denotes appending. 4003 The pseudo-function encode_in_network_byte_order takes two 4004 parameters, an integer (bignum) and a length in bytes, and returns 4005 the integer encoded into a byte string of the given length. 4007 switch ( HI.algorithm ) 4008 { 4010 case RSA: 4011 buffer := encode_in_network_byte_order ( HI.RSA.e_len, 4012 ( HI.RSA.e_len > 255 ) ? 3 : 1 ) 4013 buffer += encode_in_network_byte_order ( HI.RSA.e, HI.RSA.e_len ) 4014 buffer += encode_in_network_byte_order ( HI.RSA.n, HI.RSA.n_len ) 4015 break; 4017 case DSA: 4018 buffer := encode_in_network_byte_order ( HI.DSA.T , 1 ) 4019 buffer += encode_in_network_byte_order ( HI.DSA.Q , 20 ) 4020 buffer += encode_in_network_byte_order ( HI.DSA.P , 64 + 4021 8 * HI.DSA.T ) 4022 buffer += encode_in_network_byte_order ( HI.DSA.G , 64 + 4023 8 * HI.DSA.T ) 4024 buffer += encode_in_network_byte_order ( HI.DSA.Y , 64 + 4025 8 * HI.DSA.T ) 4026 break; 4028 } 4030 Appendix C. Example Checksums for HIP Packets 4032 The HIP checksum for HIP packets is specified in Section 6.1.2. 4033 Checksums for TCP and UDP packets running over HIP-enabled security 4034 associations are specified in Section 3.5. The examples below use IP 4035 addresses of 192.168.0.1 and 192.168.0.2 (and their respective IPv4- 4036 compatible IPv6 formats), and HITs with the first two bits "01" 4037 followed by 124 zeroes followed by a decimal 1 or 2, respectively. 4039 C.1. IPv6 HIP Example (I1) 4041 Source Address: ::192.168.0.1 4042 Destination Address: ::192.168.0.2 4043 Upper-Layer Packet Length: 40 0x28 4044 Next Header: 253 0xfd 4045 Payload Protocol: 59 0x3b 4046 Header Length: 4 0x4 4047 Packet Type: 1 0x1 4048 Version: 1 0x1 4049 Reserved: 1 0x1 4050 Control: 0 0x0 4051 Checksum: 8046 0x1f6e 4052 Sender's HIT : 1100::1 4053 Receiver's HIT: 1100::2 4055 C.2. IPv4 HIP Packet (I1) 4057 The IPv4 checksum value for the same example I1 packet is the same as 4058 the IPv6 checksum (since the checksums due to the IPv4 and IPv6 4059 pseudo-header components are the same). 4061 C.3. TCP Segment 4063 Regardless of whether IPv6 or IPv4 is used, the TCP and UDP sockets 4064 use the IPv6 pseudo-header format [11], with the HITs used in place 4065 of the IPv6 addresses. 4067 Sender's HIT: 1100::0001 4068 Receiver's HIT: 1100::0002 4069 Upper-Layer Packet Length: 20 0x14 4070 Next Header: 6 0x06 4071 Source port: 65500 0xffdc 4072 Destination port: 22 0x0016 4073 Sequence number: 1 0x00000001 4074 Acknowledgment number: 0 0x00000000 4075 Header length: 20 0x14 4076 Flags: SYN 0x02 4077 Window size: 65535 0xffff 4078 Checksum: 60301 0xeb8d 4079 Urgent pointer: 0 0x0000 4081 0x0000: 6000 0000 0014 0640 1100 0000 0000 0000 4082 0x0010: 0000 0000 0000 0002 1100 0000 0000 0000 4083 0x0020: 0000 0000 0000 0002 ffdc 0016 0000 0001 4084 0x0030: 0000 0000 5002 ffff 8deb 0000 4086 Appendix D. 384-bit Group 4088 This 384-bit group is defined only to be used with HIP. NOTE: The 4089 security level of this group is very low! The encryption may be 4090 broken in a very short time, even real-time. It should be used only 4091 when the host is not powerful enough (e.g. some PDAs) and when 4092 security requirements are low (e.g. during normal web surfing). 4094 This prime is: 2^384 - 2^320 - 1 + 2^64 * { [ 2^254 pi] + 5857 } 4096 Its hexadecimal value is: 4098 FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 4099 29024E08 8A67CC74 020BBEA6 3B13B202 FFFFFFFF FFFFFFFF 4101 The generator is: 2. 4103 Authors' Addresses 4105 Robert Moskowitz 4106 ICSAlabs, a Division of TruSecure Corporation 4107 1000 Bent Creek Blvd, Suite 200 4108 Mechanicsburg, PA 4109 USA 4111 Email: rgm@icsalabs.com 4113 Pekka Nikander 4114 Ericsson Research NomadicLab 4115 JORVAS FIN-02420 4116 FINLAND 4118 Phone: +358 9 299 1 4119 Email: pekka.nikander@nomadiclab.com 4121 Petri Jokela 4122 Ericsson Research NomadicLab 4123 JORVAS FIN-02420 4124 FINLAND 4126 Phone: +358 9 299 1 4127 Email: petri.jokela@nomadiclab.com 4129 Thomas R. Henderson 4130 The Boeing Company 4131 P.O. Box 3707 4132 Seattle, WA 4133 USA 4135 Email: thomas.r.henderson@boeing.com 4137 Intellectual Property Statement 4139 The IETF takes no position regarding the validity or scope of any 4140 Intellectual Property Rights or other rights that might be claimed to 4141 pertain to the implementation or use of the technology described in 4142 this document or the extent to which any license under such rights 4143 might or might not be available; nor does it represent that it has 4144 made any independent effort to identify any such rights. Information 4145 on the procedures with respect to rights in RFC documents can be 4146 found in BCP 78 and BCP 79. 4148 Copies of IPR disclosures made to the IETF Secretariat and any 4149 assurances of licenses to be made available, or the result of an 4150 attempt made to obtain a general license or permission for the use of 4151 such proprietary rights by implementers or users of this 4152 specification can be obtained from the IETF on-line IPR repository at 4153 http://www.ietf.org/ipr. 4155 The IETF invites any interested party to bring to its attention any 4156 copyrights, patents or patent applications, or other proprietary 4157 rights that may cover technology that may be required to implement 4158 this standard. Please address the information to the IETF at 4159 ietf-ipr@ietf.org. 4161 Disclaimer of Validity 4163 This document and the information contained herein are provided on an 4164 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 4165 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET 4166 ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, 4167 INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE 4168 INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 4169 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 4171 Copyright Statement 4173 Copyright (C) The Internet Society (2006). This document is subject 4174 to the rights, licenses and restrictions contained in BCP 78, and 4175 except as set forth therein, the authors retain all their rights. 4177 Acknowledgment 4179 Funding for the RFC Editor function is currently provided by the 4180 Internet Society.