idnits 2.17.1 draft-ietf-hip-base-10.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, updated by RFC 4748 on line 4452. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 4463. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 4470. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 4476. 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 IETF Trust Copyright Line does not match the current year == Line 1111 has weird spacing: '...ciation has n...' == Line 1160 has weird spacing: '... failed to es...' == Line 1732 has weird spacing: '...c Value leng...' == Line 1734 has weird spacing: '...c Value the ...' -- 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 (October 30, 2007) is 6023 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) ** Obsolete normative reference: RFC 1885 (Obsoleted by RFC 2463) ** Obsolete normative reference: RFC 2460 (Obsoleted by RFC 8200) ** Obsolete normative reference: RFC 2535 (Obsoleted by RFC 4033, RFC 4034, RFC 4035) ** Obsolete normative reference: RFC 2898 (Obsoleted by RFC 8018) ** Obsolete normative reference: RFC 3484 (Obsoleted by RFC 6724) ** Obsolete normative reference: RFC 4307 (Obsoleted by RFC 8247) ** Obsolete normative reference: RFC 4843 (Obsoleted by RFC 7343) ** Downref: Normative reference to an Experimental draft: draft-ietf-hip-esp (ref. 'I-D.ietf-hip-esp') -- Possible downref: Non-RFC (?) normative reference: ref. 'FIPS95' -- Obsolete informational reference (is this intentional?): RFC 2409 (Obsoleted by RFC 4306) -- Obsolete informational reference (is this intentional?): RFC 2434 (Obsoleted by RFC 5226) == Outdated reference: A later version (-12) exists of draft-ietf-shim6-proto-08 == Outdated reference: A later version (-04) exists of draft-ietf-btns-c-api-01 Summary: 9 errors (**), 0 flaws (~~), 9 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: May 2, 2008 Corporation 5 P. Nikander 6 P. Jokela (editor) 7 Ericsson Research NomadicLab 8 T. Henderson 9 The Boeing Company 10 October 30, 2007 12 Host Identity Protocol 13 draft-ietf-hip-base-10 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 May 2, 2008. 40 Copyright Notice 42 Copyright (C) The IETF Trust (2007). 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, such as TCP and UDP. 59 Table of Contents 61 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 5 62 1.1. A New Name Space and Identifiers . . . . . . . . . . . . 5 63 1.2. The HIP Base Exchange . . . . . . . . . . . . . . . . . . 6 64 1.3. Memo structure . . . . . . . . . . . . . . . . . . . . . 7 65 2. Terms and Definitions . . . . . . . . . . . . . . . . . . . . 8 66 2.1. Requirements Terminology . . . . . . . . . . . . . . . . 8 67 2.2. Notation . . . . . . . . . . . . . . . . . . . . . . . . 8 68 2.3. Definitions . . . . . . . . . . . . . . . . . . . . . . . 8 69 3. Host Identifier (HI) and its Representations . . . . . . . . 10 70 3.1. Host Identity Tag (HIT) . . . . . . . . . . . . . . . . . 10 71 3.2. Generating a HIT from a HI . . . . . . . . . . . . . . . 11 72 4. Protocol Overview . . . . . . . . . . . . . . . . . . . . . . 12 73 4.1. Creating a HIP Association . . . . . . . . . . . . . . . 12 74 4.1.1. HIP Puzzle Mechanism . . . . . . . . . . . . . . . . 13 75 4.1.2. Puzzle exchange . . . . . . . . . . . . . . . . . . . 14 76 4.1.3. Authenticated Diffie-Hellman Protocol . . . . . . . . 15 77 4.1.4. HIP Replay Protection . . . . . . . . . . . . . . . . 16 78 4.1.5. Refusing a HIP Exchange . . . . . . . . . . . . . . . 17 79 4.1.6. HIP Opportunistic Mode . . . . . . . . . . . . . . . 17 80 4.2. Updating a HIP Association . . . . . . . . . . . . . . . 19 81 4.3. Error Processing . . . . . . . . . . . . . . . . . . . . 20 82 4.4. HIP State Machine . . . . . . . . . . . . . . . . . . . . 21 83 4.4.1. HIP States . . . . . . . . . . . . . . . . . . . . . 22 84 4.4.2. HIP State Processes . . . . . . . . . . . . . . . . . 22 85 4.4.3. Simplified HIP State Diagram . . . . . . . . . . . . 29 86 4.5. User Data Considerations . . . . . . . . . . . . . . . . 31 87 4.5.1. TCP and UDP Pseudo-header Computation for User Data . 31 88 4.5.2. Sending Data on HIP Packets . . . . . . . . . . . . . 31 89 4.5.3. Transport Formats . . . . . . . . . . . . . . . . . . 31 90 4.5.4. Reboot and SA Timeout Restart of HIP . . . . . . . . 31 92 4.6. Certificate Distribution . . . . . . . . . . . . . . . . 32 93 5. Packet Formats . . . . . . . . . . . . . . . . . . . . . . . 33 94 5.1. Payload Format . . . . . . . . . . . . . . . . . . . . . 33 95 5.1.1. Checksum . . . . . . . . . . . . . . . . . . . . . . 34 96 5.1.2. HIP Controls . . . . . . . . . . . . . . . . . . . . 34 97 5.1.3. HIP Fragmentation Support . . . . . . . . . . . . . . 35 98 5.2. HIP Parameters . . . . . . . . . . . . . . . . . . . . . 36 99 5.2.1. TLV Format . . . . . . . . . . . . . . . . . . . . . 38 100 5.2.2. Defining New Parameters . . . . . . . . . . . . . . . 40 101 5.2.3. R1_COUNTER . . . . . . . . . . . . . . . . . . . . . 41 102 5.2.4. PUZZLE . . . . . . . . . . . . . . . . . . . . . . . 42 103 5.2.5. SOLUTION . . . . . . . . . . . . . . . . . . . . . . 43 104 5.2.6. DIFFIE_HELLMAN . . . . . . . . . . . . . . . . . . . 44 105 5.2.7. HIP_TRANSFORM . . . . . . . . . . . . . . . . . . . . 45 106 5.2.8. HOST_ID . . . . . . . . . . . . . . . . . . . . . . . 46 107 5.2.9. HMAC . . . . . . . . . . . . . . . . . . . . . . . . 47 108 5.2.10. HMAC_2 . . . . . . . . . . . . . . . . . . . . . . . 48 109 5.2.11. HIP_SIGNATURE . . . . . . . . . . . . . . . . . . . . 48 110 5.2.12. HIP_SIGNATURE_2 . . . . . . . . . . . . . . . . . . . 49 111 5.2.13. SEQ . . . . . . . . . . . . . . . . . . . . . . . . . 49 112 5.2.14. ACK . . . . . . . . . . . . . . . . . . . . . . . . . 50 113 5.2.15. ENCRYPTED . . . . . . . . . . . . . . . . . . . . . . 51 114 5.2.16. NOTIFICATION . . . . . . . . . . . . . . . . . . . . 52 115 5.2.17. ECHO_REQUEST_SIGNED . . . . . . . . . . . . . . . . . 55 116 5.2.18. ECHO_REQUEST_UNSIGNED . . . . . . . . . . . . . . . . 56 117 5.2.19. ECHO_RESPONSE_SIGNED . . . . . . . . . . . . . . . . 56 118 5.2.20. ECHO_RESPONSE_UNSIGNED . . . . . . . . . . . . . . . 57 119 5.3. HIP Packets . . . . . . . . . . . . . . . . . . . . . . . 57 120 5.3.1. I1 - the HIP Initiator Packet . . . . . . . . . . . . 58 121 5.3.2. R1 - the HIP Responder Packet . . . . . . . . . . . . 59 122 5.3.3. I2 - the Second HIP Initiator Packet . . . . . . . . 61 123 5.3.4. R2 - the Second HIP Responder Packet . . . . . . . . 62 124 5.3.5. UPDATE - the HIP Update Packet . . . . . . . . . . . 63 125 5.3.6. NOTIFY - the HIP Notify Packet . . . . . . . . . . . 64 126 5.3.7. CLOSE - the HIP Association Closing Packet . . . . . 64 127 5.3.8. CLOSE_ACK - the HIP Closing Acknowledgment Packet . . 65 128 5.4. ICMP Messages . . . . . . . . . . . . . . . . . . . . . . 65 129 5.4.1. Invalid Version . . . . . . . . . . . . . . . . . . . 66 130 5.4.2. Other Problems with the HIP Header and Packet 131 Structure . . . . . . . . . . . . . . . . . . . . . . 66 132 5.4.3. Invalid Puzzle Solution . . . . . . . . . . . . . . . 66 133 5.4.4. Non-existing HIP Association . . . . . . . . . . . . 66 134 6. Packet Processing . . . . . . . . . . . . . . . . . . . . . . 67 135 6.1. Processing Outgoing Application Data . . . . . . . . . . 67 136 6.2. Processing Incoming Application Data . . . . . . . . . . 68 137 6.3. Solving the Puzzle . . . . . . . . . . . . . . . . . . . 69 138 6.4. HMAC and SIGNATURE Calculation and Verification . . . . . 70 139 6.4.1. HMAC Calculation . . . . . . . . . . . . . . . . . . 70 140 6.4.2. Signature Calculation . . . . . . . . . . . . . . . . 72 141 6.5. HIP KEYMAT Generation . . . . . . . . . . . . . . . . . . 74 142 6.6. Initiation of a HIP Exchange . . . . . . . . . . . . . . 76 143 6.6.1. Sending Multiple I1s in Parallel . . . . . . . . . . 77 144 6.6.2. Processing Incoming ICMP Protocol Unreachable 145 Messages . . . . . . . . . . . . . . . . . . . . . . 77 146 6.7. Processing Incoming I1 Packets . . . . . . . . . . . . . 77 147 6.7.1. R1 Management . . . . . . . . . . . . . . . . . . . . 79 148 6.7.2. Handling Malformed Messages . . . . . . . . . . . . . 79 149 6.8. Processing Incoming R1 Packets . . . . . . . . . . . . . 79 150 6.8.1. Handling Malformed Messages . . . . . . . . . . . . . 81 151 6.9. Processing Incoming I2 Packets . . . . . . . . . . . . . 81 152 6.9.1. Handling Malformed Messages . . . . . . . . . . . . . 84 153 6.10. Processing Incoming R2 Packets . . . . . . . . . . . . . 84 154 6.11. Sending UPDATE Packets . . . . . . . . . . . . . . . . . 84 155 6.12. Receiving UPDATE Packets . . . . . . . . . . . . . . . . 85 156 6.12.1. Handling a SEQ parameter in a received UPDATE 157 message . . . . . . . . . . . . . . . . . . . . . . . 86 158 6.12.2. Handling an ACK Parameter in a Received UPDATE 159 Packet . . . . . . . . . . . . . . . . . . . . . . . 87 160 6.13. Processing NOTIFY Packets . . . . . . . . . . . . . . . . 87 161 6.14. Processing CLOSE Packets . . . . . . . . . . . . . . . . 87 162 6.15. Processing CLOSE_ACK Packets . . . . . . . . . . . . . . 88 163 6.16. Handling State Loss . . . . . . . . . . . . . . . . . . . 88 164 7. HIP Policies . . . . . . . . . . . . . . . . . . . . . . . . 89 165 8. Security Considerations . . . . . . . . . . . . . . . . . . . 90 166 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 93 167 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 95 168 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 96 169 11.1. Normative References . . . . . . . . . . . . . . . . . . 96 170 11.2. Informative References . . . . . . . . . . . . . . . . . 97 171 Appendix A. Using Responder Puzzles . . . . . . . . . . . . . . 100 172 Appendix B. Generating a Public Key Encoding from a HI . . . . . 102 173 Appendix C. Example Checksums for HIP Packets . . . . . . . . . 103 174 C.1. IPv6 HIP Example (I1) . . . . . . . . . . . . . . . . . . 103 175 C.2. IPv4 HIP Packet (I1) . . . . . . . . . . . . . . . . . . 103 176 C.3. TCP Segment . . . . . . . . . . . . . . . . . . . . . . . 103 177 Appendix D. 384-bit Group . . . . . . . . . . . . . . . . . . . 105 178 Appendix E. OAKLEY Well-known group 1 . . . . . . . . . . . . . 106 179 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 107 180 Intellectual Property and Copyright Statements . . . . . . . . . 108 182 1. Introduction 184 This memo specifies the details of the Host Identity Protocol (HIP). 185 A high-level description of the protocol and the underlying 186 architectural thinking is available in the separate HIP architecture 187 description [I-D.ietf-hip-arch]. Briefly, the HIP architecture 188 proposes an alternative to the dual use of IP addresses as "locators" 189 (routing labels) and "identifiers" (endpoint, or host, identifiers). 190 In HIP, public cryptographic keys, of a public/private key pair, are 191 used as Host Identifiers, to which higher layer protocols are bound 192 instead of an IP address. By using public keys (and their 193 representations) as host identifiers, dynamic changes to IP address 194 sets can be directly authenticated between hosts and if desired, 195 strong authentication between hosts at the TCP/IP stack level can be 196 obtained. 198 This memo specifies the base HIP protocol ("base exchange") used 199 between hosts to establish an IP-layer communications context, called 200 HIP association, prior to communications. It also defines a packet 201 format and procedures for updating an active HIP association. Other 202 elements of the HIP architecture are specified in other documents, 203 such as. 205 o "Using ESP transport format with HIP" [I-D.ietf-hip-esp]: how to 206 use Encapsulating Security Payload (ESP) for integrity protection 207 and optional encryption 209 o "End-Host Mobility and Multihoming with the Host Identity 210 Protocol" [I-D.ietf-hip-mm]: how to support mobility and 211 multihoming in HIP 213 o "Host Identity Protocol (HIP) Domain Name System (DNS) Extensions" 214 [I-D.ietf-hip-dns]: how to extend DNS to contain Host Identity 215 information 217 o "Host Identity Protocol (HIP) Rendezvous Extension" 218 [I-D.ietf-hip-rvs]: using a rendezvous mechanism to contact mobile 219 HIP hosts 221 1.1. A New Name Space and Identifiers 223 The Host Identity Protocol introduces a new name space, the Host 224 Identity name space. Some ramifications of this new namespace are 225 explained in the HIP architecture description [I-D.ietf-hip-arch]. 227 There are two main representations of the Host Identity, the full 228 Host Identifier (HI) and the Host Identity Tag (HIT). The HI is a 229 public key and directly represents the Identity. Since there are 230 different public key algorithms that can be used with different key 231 lengths, the HI is not good for use as a packet identifier, or as an 232 index into the various operational tables needed to support HIP. 233 Consequently, a hash of the HI, the Host Identity Tag (HIT), becomes 234 the operational representation. It is 128 bits long and is used in 235 the HIP payloads and to index the corresponding state in the end 236 hosts. The HIT has an important security property in that it is 237 self-certifying (see Section 3). 239 1.2. The HIP Base Exchange 241 The HIP base exchange is a two-party cryptographic protocol used to 242 establish communications context between hosts. The base exchange is 243 a Sigma-compliant [KRA03] four packet exchange. The first party is 244 called the Initiator and the second party the Responder. The four- 245 packet design helps to make HIP DoS resilient. The protocol 246 exchanges Diffie-Hellman keys in the 2nd and 3rd packets, and 247 authenticates the parties in the 3rd and 4th packets. Additionally, 248 the Responder starts a puzzle exchange in the 2nd packet, with the 249 Initiator completing it in the 3rd packet before the Responder stores 250 any state from the exchange. 252 The exchange can use the Diffie-Hellman output to encrypt the Host 253 Identity of the Initiator in packet 3 (although Aura et al. [AUR03] 254 notes that such operation may interfere with packet-inspecting 255 middle-boxes), or the Host Identity may instead be sent unencrypted. 256 The Responder's Host Identity is not protected. It should be noted, 257 however, that both the Initiator's and the Responder's HITs are 258 transported as such (in cleartext) in the packets, allowing an 259 eavesdropper with a priori knowledge about the parties to verify 260 their identities. 262 Data packets start to flow after the 4th packet. The 3rd and 4th HIP 263 packets may carry a data payload in the future. However, the details 264 of this are to be defined later as more implementation experience is 265 gained. 267 An existing HIP association can be updated using the update mechanism 268 defined in this document, and when the association is no longer 269 needed, it can be closed using the defined closing mechanism. 271 Finally, HIP is designed as an end-to-end authentication and key 272 establishment protocol, to be used with Encapsulated Security Payload 273 (ESP) [I-D.ietf-hip-esp] and other end-to-end security protocols. 274 The base protocol does not cover all the fine-grained policy control 275 found in Internet Key Exchange IKE RFC2409 [RFC2409] that allows IKE 276 to support complex gateway policies. Thus, HIP is not a replacement 277 for IKE. 279 1.3. Memo structure 281 The rest of this memo is structured as follows. Section 2 defines 282 the central keywords, notation, and terms used throughout the rest of 283 the document. Section 3 defines the structure of the Host Identity 284 and its various representations. Section 4 gives an overview of the 285 HIP base exchange protocol. Section 5 and Section 6 define the 286 detail packet formats and rules for packet processing. Finally, 287 Section 7, Section 8, and Section 9 discuss policy, security, and 288 IANA considerations, respectively. 290 2. Terms and Definitions 292 2.1. Requirements Terminology 294 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 295 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 296 document are to be interpreted as described in RFC2119 [RFC2119]. 298 2.2. Notation 300 [x] indicates that x is optional. 302 {x} indicates that x is encrypted. 304 X(y) indicates that y is a parameter of X. 306 i indicates that x exists i times. 308 --> signifies "Initiator to Responder" communication (requests). 310 <-- signifies "Responder to Initiator" communication (replies). 312 | signifies concatenation of information-- e.g. X | Y is the 313 concatenation of X with Y. 315 Ltrunc (SHA-1(), K) denotes the lowest order K bits of the SHA-1 316 result. 318 2.3. Definitions 320 Unused Association Lifetime (UAL): Implementation-specific time for 321 which, if no packet is sent or received for this time interval, a 322 host MAY begin to tear down an active association. 324 Maximum Segment Lifetime (MSL): Maximum time that a TCP segment is 325 expected to spend in the network. 327 Exchange Complete (EC): Time that the host spends at the R2-SENT 328 before it moves to ESTABLISHED state. The time is n * I2 329 retransmission timeout, where n is about I2_RETRIES_MAX. 331 HIT Hash Algorithm: hash algorithm used to generate a Host Identity 332 Tag (HIT) from the Host Identity public key. Currently SHA-1 333 [FIPS95] is used. 335 Responder's HIT Hash Algorithm (RHASH): hash algorithm used for 336 various hash calculations in this document. The algorithm is the 337 same as is used to generate the Responder's HIT. RHASH can be 338 determined by inspecting the Prefix of the ORCHID (HIT). The 339 Prefix value has a one-to-one mapping to a hash function. 341 Opportunistic mode: HIP base exchange where the Responder's HIT is 342 not a priori known to the Initiator. 344 3. Host Identifier (HI) and its Representations 346 In this section, the properties of the Host Identifier and Host 347 Identifier Tag are discussed, and the exact format for them is 348 defined. In HIP, public key of an asymmetric key pair is used as the 349 Host Identifier (HI). Correspondingly, the host itself is defined as 350 the entity that holds the private key from the key pair. See the HIP 351 architecture specification [I-D.ietf-hip-arch] for more details about 352 the difference between an identity and the corresponding identifier. 354 HIP implementations MUST support the Rivest Shamir Adelman (RSA/SHA1) 355 [RFC3110] public key algorithm, and SHOULD support the Digital 356 Signature Algorithm (DSA) [RFC2536] algorithm; other algorithms MAY 357 be supported. 359 A hashed encoding of the HI, the Host Identity Tag (HIT), is used in 360 protocols to represent the Host Identity. The HIT is 128 bits long 361 and has the following three key properties: i) it is the same length 362 as an IPv6 address and can be used in address-sized fields in APIs 363 and protocols, ii) it is self-certifying (i.e., given a HIT, it is 364 computationally hard to find a Host Identity key that matches the 365 HIT), and iii) the probability of HIT collision between two hosts is 366 very low. 368 Carrying HIs and HITs in the header of user data packets would 369 increase the overhead of packets. Thus, it is not expected that they 370 are carried in every packet, but other methods are used to map the 371 data packets to the corresponding HIs. In some cases, this makes it 372 possible to use HIP without any additional headers in the user data 373 packets. For example, if ESP is used to protect data traffic, the 374 Security Parameter Index (SPI) carried in the ESP header can be used 375 to map the encrypted data packet to the correct HIP association. 377 3.1. Host Identity Tag (HIT) 379 The Host Identity Tag is a 128 bits long value -- a hashed encoding 380 of the Host Identifier. There are two advantages of using a hashed 381 encoding over the actual Host Identity public key in protocols. 382 Firstly, its fixed length makes for easier protocol coding and also 383 better manages the packet size cost of this technology. Secondly, it 384 presents a consistent format to the protocol whatever underlying 385 identity technology is used. 387 "An IPv6 Prefix for Overlay Routable Cryptographic Hash Identifiers 388 (ORCHID)" [RFC4843] has been specified to store 128-bit hash based 389 identifier called Overlay Routable Cryptographic Hash Identifiers 390 (ORCHID) under a prefix, proposed to be allocated from the IPv6 391 address block as defined in [RFC4843]. The Host Identity Tag is a 392 type of ORCHID, based on a SHA-1 hash of the host identity (Section 2 393 of [RFC4843]). 395 3.2. Generating a HIT from a HI 397 The HIT MUST be generated according to the ORCHID generation method 398 described in [RFC4843] using a context ID value of 0xF0EF F02F BFF4 399 3D0F E793 0C3C 6E61 74EA (this tag value has been generated randomly 400 by the editor of this specification), and an input encoding the Host 401 Identity field (see Section 5.2.8) present in a HIP payload packet. 402 The hash algorithm SHA-1 has to be used when generating HITs with 403 this context ID. If a new ORCHID hash algorithm is needed in the 404 future for HIT generation, a new version of HIP has to be specified 405 with a new ORCHID context ID associated with the new hash algorithm. 407 For Identities that are either RSA or DSA public keys, this input 408 consists of the public key encoding as specified in the corresponding 409 DNSSEC document, taking the algorithm specific portion of the RDATA 410 part of the KEY RR. There is currently only two defined public key 411 algorithms: RSA/SHA1 and DSA. Hence, either of the following 412 applies: 414 The RSA public key is encoded as defined in RFC3110 [RFC3110] 415 Section 2, taking the exponent length (e_len), exponent (e) and 416 modulus (n) fields concatenated. The length (n_len) of the 417 modulus (n) can be determined from the total HI Length and the 418 preceding HI fields including the exponent (e). Thus, the data to 419 be hashed has the same length as the HI. The fields MUST be 420 encoded in network byte order, as defined in RFC3110 [RFC3110]. 422 The DSA public key is encoded as defined in RFC2536 [RFC2536] 423 Section 2, taking the fields T, Q, P, G, and Y, concatenated. 424 Thus, the data to be hashed is 1 + 20 + 3 * 64 + 3 * 8 * T octets 425 long, where T is the size parameter as defined in RFC2536 426 [RFC2536]. The size parameter T, affecting the field lengths, 427 MUST be selected as the minimum value that is long enough to 428 accommodate P, G, and Y. The fields MUST be encoded in network 429 byte order, as defined in RFC2536 [RFC2536]. 431 In Appendix B the public key encoding generation process is 432 illustrated using pseudo-code. 434 4. Protocol Overview 436 The following material is an overview of the HIP protocol operation, 437 and does not contain all details of the packet formats or the packet 438 processing steps. Section 5 and Section 6 describe in more detail 439 the packet formats and packet processing steps, respectively, and are 440 normative in case of any conflicts with this section. 442 The protocol number for Host Identity Protocol will be assigned by 443 IANA. For testing purposes, the protocol number 253 is currently 444 used. This number has been reserved by IANA for experimental use 445 (see [RFC3692]). 447 The HIP payload (Section 5.1) header could be carried in every IP 448 datagram. However, since HIP headers are relatively large (40 449 bytes), it is desirable to 'compress' the HIP header so that the HIP 450 header only occurs in control packets used to establish or change HIP 451 association state. The actual method for header 'compression' and 452 for matching data packets with existing HIP associations (if any) is 453 defined in separate documents, describing transport formats and 454 methods. All HIP implementations MUST implement, at minimum, the ESP 455 transport format for HIP [I-D.ietf-hip-esp]. 457 4.1. Creating a HIP Association 459 By definition, the system initiating a HIP exchange is the Initiator, 460 and the peer is the Responder. This distinction is forgotten once 461 the base exchange completes, and either party can become the 462 Initiator in future communications. 464 The HIP base exchange serves to manage the establishment of state 465 between an Initiator and a Responder. The first packet, I1, 466 initiates the exchange, and the last three packets, R1, I2, and R2, 467 constitute an authenticated Diffie-Hellman [DIF76] key exchange for 468 session key generation. During the Diffie-Hellman key exchange, a 469 piece of keying material is generated. The HIP association keys are 470 drawn from this keying material. If other cryptographic keys are 471 needed, e.g., to be used with ESP, they are expected to be drawn from 472 the same keying material. 474 The Initiator first sends a trigger packet, I1, to the Responder. 475 The packet contains only the HIT of the Initiator and possibly the 476 HIT of the Responder, if it is known. Note that in some cases it may 477 be possible to replace this trigger packet by some other form of a 478 trigger, in which case the protocol starts with the Responder sending 479 the R1 packet. 481 The second packet, R1, starts the actual exchange. It contains a 482 puzzle-- a cryptographic challenge that the Initiator must solve 483 before continuing the exchange. The level of difficulty of the 484 puzzle can be adjusted based on level of trust with the Initiator, 485 current load, or other factors. In addition, the R1 contains the 486 initial Diffie-Hellman parameters and a signature, covering part of 487 the message. Some fields are left outside the signature to support 488 pre-created R1s. 490 In the I2 packet, the Initiator must display the solution to the 491 received puzzle. Without a correct solution, the I2 message is 492 discarded. The I2 also contains a Diffie-Hellman parameter that 493 carries needed information for the Responder. The packet is signed 494 by the sender. 496 The R2 packet finalizes the base exchange. The packet is signed. 498 The base exchange is illustrated below. The term "key" refers to the 499 host identity public key, and "sig" represents a signature using such 500 a key. The packets contain other parameters not shown in this 501 figure. 503 Initiator Responder 505 I1: trigger exchange 506 --------------------------> 507 select pre-computed R1 508 R1: puzzle, D-H, key, sig 509 <------------------------- 510 check sig remain stateless 511 solve puzzle 512 I2: solution, D-H, {key}, sig 513 --------------------------> 514 compute D-H check puzzle 515 check sig 516 R2: sig 517 <-------------------------- 518 check sig compute D-H 520 4.1.1. HIP Puzzle Mechanism 522 The purpose of the HIP puzzle mechanism is to protect the Responder 523 from a number of denial-of-service threats. It allows the Responder 524 to delay state creation until receiving I2. Furthermore, the puzzle 525 allows the Responder to use a fairly cheap calculation to check that 526 the Initiator is "sincere" in the sense that it has churned CPU 527 cycles in solving the puzzle. 529 The Puzzle mechanism has been explicitly designed to give space for 530 various implementation options. It allows a Responder implementation 531 to completely delay session specific state creation until a valid I2 532 is received. In such a case a correctly formatted I2 can be rejected 533 only once the Responder has checked its validity by computing one 534 hash function. On the other hand, the design also allows a Responder 535 implementation to keep state about received I1s, and match the 536 received I2s against the state, thereby allowing the implementation 537 to avoid the computational cost of the hash function. The drawback 538 of this latter approach is the requirement of creating state. 539 Finally, it also allows an implementation to use other combinations 540 of the space-saving and computation-saving mechanisms. 542 One possible way for a Responder to remain stateless but drop most 543 spoofed I2s is to base the selection of the puzzle on some function 544 over the Initiator's Host Identity. The idea is that the Responder 545 has a (perhaps varying) number of pre-calculated R1 packets, and it 546 selects one of these based on the information carried in I1. When 547 the Responder then later receives I2, it checks that the puzzle in 548 the I2 matches with the puzzle sent in the R1, thereby making it 549 impractical for the attacker to first exchange one I1/R1, and then 550 generate a large number of spoofed I2s that seemingly come from 551 different IP addresses or use different HITs. The method does not 552 protect from an attacker that uses fixed IP addresses and HITs, 553 though. Against such an attacker a viable approach may be to create 554 a piece of local state, and remember that the puzzle check has 555 previously failed. See Appendix A for one possible implementation. 556 Implementations SHOULD include sufficient randomness to the algorithm 557 so that algorithmic complexity attacks become impossible [CRO03]. 559 The Responder can set the puzzle difficulty for Initiator, based on 560 its level of trust of the Initiator. Because the puzzle is not 561 included in the signature calculation, the Responder can use pre- 562 calculated R1 packets and include the puzzle just before sending the 563 R1 to the Initiator. The Responder SHOULD use heuristics to 564 determine when it is under a denial-of-service attack, and set the 565 puzzle difficulty value K appropriately; see below. 567 4.1.2. Puzzle exchange 569 The Responder starts the puzzle exchange when it receives an I1. The 570 Responder supplies a random number I, and requires the Initiator to 571 find a number J. To select a proper J, the Initiator must create the 572 concatenation of I, the HITs of the parties, and J, and take a hash 573 over this concatenation using RHASH algorithm. The lowest order K 574 bits of the result MUST be zeros. The value K sets the difficulty of 575 the puzzle. 577 To generate a proper number J, the Initiator will have to generate a 578 number of Js until one produces the hash target of zero. The 579 Initiator SHOULD give up after exceeding the puzzle lifetime in the 580 PUZZLE parameter (Section 5.2.4). The Responder needs to re-create 581 the concatenation of I, the HITs, and the provided J, and compute the 582 hash once to prove that the Initiator did its assigned task. 584 To prevent pre-computation attacks, the Responder MUST select the 585 number I in such a way that the Initiator cannot guess it. 586 Furthermore, the construction MUST allow the Responder to verify that 587 the value was indeed selected by it and not by the Initiator. See 588 Appendix A for an example on how to implement this. 590 Using the Opaque data field in an ECHO_REQUEST_SIGNED 591 (Section 5.2.17) or in an ECHO_REQUEST_UNSIGNED parameters 592 (Section 5.2.18), the Responder can include some data in R1 that the 593 Initiator must copy unmodified in the corresponding I2 packet. The 594 Responder can generate the Opaque data in various ways; e.g. using 595 the sent I, some secret, and possibly other related data. Using this 596 same secret, received I in I2 packet and possible other data, the 597 Receiver can verify that it has itself sent the I to the Initiator. 598 The Responder MUST change such a secret periodically. 600 It is RECOMMENDED that the Responder generates a new puzzle and a new 601 R1 once every few minutes. Furthermore, it is RECOMMENDED that the 602 Responder remembers an old puzzle at least 2*Lifetime seconds after 603 it has been deprecated. These time values allow a slower Initiator 604 to solve the puzzle while limiting the usability that an old, solved 605 puzzle has to an attacker. 607 NOTE: The protocol developers explicitly considered whether R1 should 608 include a timestamp in order to protect the Initiator from replay 609 attacks. The decision was to NOT include a timestamp. 611 NOTE: The protocol developers explicitly considered whether a memory 612 bound function should be used for the puzzle instead of a CPU bound 613 function. The decision was not to use memory bound functions. At 614 the time of the decision the idea of memory bound functions was 615 relatively new and their IPR status were unknown. Once there is more 616 experience about memory bound functions and once their IPR status is 617 better known, it may be reasonable to reconsider this decision. 619 4.1.3. Authenticated Diffie-Hellman Protocol 621 The packets R1, I2, and R2 implement a standard authenticated Diffie- 622 Hellman exchange. The Responder sends one or two public Diffie- 623 Hellman keys and its public authentication key, i.e., its host 624 identity, in R1. The signature in R1 allows the Initiator to verify 625 that the R1 has been once generated by the Responder. However, since 626 it is precomputed and therefore does not cover all of the packet, it 627 does not protect from replay attacks. 629 When the Initiator receives an R1, it gets one or two public Diffie- 630 Hellman values from the Responder. If there are two values, it 631 selects the value corresponding to the strongest supported Group ID 632 and computes the Diffie-Hellman session key (Kij). It creates a HIP 633 association using keying material from the session key (see 634 Section 6.5), and may use the association to encrypt its public 635 authentication key, i.e., host identity. The resulting I2 contains 636 the Initiator's Diffie-Hellman key and its (optionally encrypted) 637 public authentication key. The signature in I2 covers all of the 638 packet. 640 The Responder extracts the Initiator Diffie-Hellman public key from 641 the I2, computes the Diffie-Hellman session key, creates a 642 corresponding HIP association, and decrypts the Initiator's public 643 authentication key. It can then verify the signature using the 644 authentication key. 646 The final message, R2, is needed to protect the Initiator from replay 647 attacks. 649 4.1.4. HIP Replay Protection 651 The HIP protocol includes the following mechanisms to protect against 652 malicious replays. Responders are protected against replays of I1 653 packets by virtue of the stateless response to I1s with presigned R1 654 messages. Initiators are protected against R1 replays by a 655 monotonically increasing "R1 generation counter" included in the R1. 656 Responders are protected against replays or false I2s by the puzzle 657 mechanism (Section 4.1.1 above), and optional use of opaque data. 658 Hosts are protected against replays to R2s and UPDATEs by use of a 659 less expensive HMAC verification preceding HIP signature 660 verification. 662 The R1 generation counter is a monotonically increasing 64-bit 663 counter that may be initialized to any value. The scope of the 664 counter MAY be system-wide but SHOULD be per host identity, if there 665 is more than one local host identity. The value of this counter 666 SHOULD be kept across system reboots and invocations of the HIP base 667 exchange. This counter indicates the current generation of puzzles. 668 Implementations MUST accept puzzles from the current generation and 669 MAY accept puzzles from earlier generations. A system's local 670 counter MUST be incremented at least as often as every time old R1s 671 cease to be valid, and SHOULD never be decremented, lest the host 672 expose its peers to the replay of previously generated, higher 673 numbered R1s. The R1 counter SHOULD NOT roll over. 675 A host may receive more than one R1, either due to sending multiple 676 I1s (Section 6.6.1) or due to a replay of an old R1. When sending 677 multiple I1s, an initiator SHOULD wait for a small amount of time (a 678 reasonable time may be 2 * expected RTT) after the first R1 reception 679 to allow possibly multiple R1s to arrive, and it SHOULD respond to an 680 R1 among the set with the largest R1 generation counter. If an 681 Initiator is processing an R1 or has already sent an I2 (still 682 waiting for R2) and it receives another R1 with a larger R1 683 generation counter, it MAY elect to restart R1 processing with the 684 fresher R1, as if it were the first R1 to arrive. 686 Upon conclusion of an active HIP association with another host, the 687 R1 generation counter associated with the peer host SHOULD be 688 flushed. A local policy MAY override the default flushing of R1 689 counters on a per-HIT basis. The reason for recommending the 690 flushing of this counter is that there may be hosts where the R1 691 generation counter (occasionally) decreases; e.g., due to hardware 692 failure. 694 4.1.5. Refusing a HIP Exchange 696 A HIP aware host may choose not to accept a HIP exchange. If the 697 host's policy is to only be an Initiator, it should begin its own HIP 698 exchange. A host MAY choose to have such a policy since only the 699 Initiator HI is protected in the exchange. There is a risk of a race 700 condition if each host's policy is to only be an Initiator, at which 701 point the HIP exchange will fail. 703 If the host's policy does not permit it to enter into a HIP exchange 704 with the Initiator, it should send an ICMP 'Destination Unreachable, 705 Administratively Prohibited' message. A more complex HIP packet is 706 not used here as it actually opens up more potential DoS attacks than 707 a simple ICMP message. 709 4.1.6. HIP Opportunistic Mode 711 It is possible to initiate a HIP negotiation even if the responder's 712 HI (and HIT) is unknown. In this case the connection initializing I1 713 packet contains NULL (all zeros) as the destination HIT. This kind 714 of connection setup is called opportunistic mode. 716 There are both security and API issues involved with the 717 opportunistic mode. 719 Given that the responder's HI is not known by the initiator, there 720 must be suitable API calls that allow the initiator to request, 721 directly or indirectly, the underlying kernel to initiate the HIP 722 base exchange solely based on locators. The responder's HI will be 723 tentatively available in the R1 packet, and in an authenticated form 724 once the R2 packet has been received and verified. Hence, it could 725 be communicated to the application via new API mechanisms. However, 726 with a backwards compatible API the application sees only the 727 locators used for the initial contact. Depending on the desired 728 semantics of the API, this can raise the following issues: 730 o The actual locators may later change if an UPDATE message is used, 731 even if from the API perspective the session still appears to be 732 between specific locators. The locator update is still secure, 733 however, and the session is still between the same nodes. 735 o Different sessions between the same locators may result in 736 connections to different nodes, if the implementation no longer 737 remembers which identifier the peer had in another session. This 738 is possible when the peer's locator has changed for legitimate 739 reasons or when an attacker pretends to be a node that has the 740 peer's locator. Therefore, when using opportunistic mode, HIP 741 MUST NOT place any expectation that the peer's HI returned in the 742 R1 message matches any HI previously seen from that address. 744 If the HIP implementation and application do not have the same 745 understanding of what constitutes a session, this may even happen 746 within the same session. For instance, an implementation may not 747 know when HIP state can be purged for UDP based applications. 749 o As with all HIP exchanges, the handling of locator-based or 750 interface-based policy is unclear for opportunistic mode HIP. An 751 application may make a connection to a specific locator because 752 the application has knowledge of the security properties along the 753 network to that locator. If one of the nodes moves and the 754 locators are updated, these security properties may not be 755 maintained. Depending on the security policy of the application, 756 this may be a problem. This is an area of ongoing study. As an 757 example, there is work to create an API that applications can use 758 to specify their security requirements in a similar context 759 [I-D.ietf-btns-c-api]. 761 In addition, the following security considerations apply. The 762 generation counter mechanism will be less efficient in protecting 763 against replays of the R1 packet, given that the responder can choose 764 a replay that uses any HI, not just the one given in the I1 packet. 766 More importantly, the opportunistic exchange is vulnerable to man-in- 767 the-middle attacks, because the initiator does not have any public 768 key information about the peer. To assess the impacts of this 769 vulnerability, we compare it to vulnerabilities in current, non-HIP 770 capable communications. 772 An attacker on the path between the two peers can insert itself as a 773 man-in the middle by providing its own identifier to the initiator 774 and then initiating another HIP session towards the responder. For 775 this to be possible, the initiator must employ opportunistic mode, 776 and the responder must be configured to accept a connection from any 777 HIP enabled node. 779 An attacker outside the path will be unable to do so, given that it 780 cannot respond to the messages in the base exchange. 782 These properties are characteristic also of communications in the 783 current Internet. A client contacting a server without employing 784 end-to-end security may find itself talking to the server via a man- 785 in-the-middle. Assuming again that the server is willing to talk to 786 anyone. 788 If end-to-end security is in place, then the worst that can happen in 789 both the opportunistic HIP and normal IP cases is denial-of-service; 790 an entity on the path can disrupt communications, but will be unable 791 to insert itself as a man-in-the-middle. 793 However, once the opportunistic exchange has successfully completed, 794 HIP provides integrity protection and confidentiality for the 795 communications, and can securely change the locators of the 796 endpoints. 798 As a result, it is believed that the HIP opportunistic mode is at 799 least as secure as current IP. 801 4.2. Updating a HIP Association 803 A HIP association between two hosts may need to be updated over time. 804 Examples include the need to rekey expiring user data security 805 associations, add new security associations, or change IP addresses 806 associated with hosts. The UPDATE packet is used for those and other 807 similar purposes. This document only specifies the UPDATE packet 808 format and basic processing rules, with mandatory parameters. The 809 actual usage is defined in separate specifications. 811 HIP provides a general purpose UPDATE packet, which can carry 812 multiple HIP parameters, for updating the HIP state between two 813 peers. The UPDATE mechanism has the following properties: 815 UPDATE messages carry a monotonically increasing sequence number 816 and are explicitly acknowledged by the peer. Lost UPDATEs or 817 acknowledgments may be recovered via retransmission. Multiple 818 UPDATE messages may be outstanding under certain circumstances. 820 UPDATE is protected by both HMAC and HIP_SIGNATURE parameters, 821 since processing UPDATE signatures alone is a potential DoS attack 822 against intermediate systems. 824 UPDATE packets are explicitly acknowledged by the use of an 825 acknowledgment parameter that echoes an individual sequence number 826 received from the peer. A single UPDATE packet may contain both a 827 sequence number and one or more acknowledgment numbers (i.e., 828 piggybacked acknowledgment(s) for the peer's UPDATE). 830 The UPDATE packet is defined in Section 5.3.5. 832 4.3. Error Processing 834 HIP error processing behavior depends on whether there exists an 835 active HIP association or not. In general, if a HIP association 836 exists between the sender and receiver of a packet causing an error 837 condition, the receiver SHOULD respond with a NOTIFY packet. On the 838 other hand, if there are no existing HIP associations between the 839 sender and receiver, or the receiver cannot reasonably determine the 840 identity of the sender, the receiver MAY respond with a suitable ICMP 841 message; see Section 5.4 for more details. 843 The HIP protocol and state machine is designed to recover from one of 844 the parties crashing and losing its state. The following scenarios 845 describe the main use cases covered by the design. 847 No prior state between the two systems. 849 The system with data to send is the Initiator. The process 850 follows the standard four packet base exchange, establishing 851 the HIP association. 853 The system with data to send has no state with the receiver, but 854 the receiver has a residual HIP association. 856 The system with data to send is the Initiator. The Initiator 857 acts as in no prior state, sending I1 and getting R1. When the 858 Responder receives a valid I2, the old association is 859 'discovered' and deleted, and the new association is 860 established. 862 The system with data to send has a HIP association, but the 863 receiver does not. 865 The system sends data on the outbound user data security 866 association. The receiver 'detects' the situation when it 867 receives a user data packet that it cannot match to any HIP 868 association. The receiving host MUST discard this packet. 869 Optionally, the receiving host MAY send an ICMP packet with the 870 Parameter Problem type to inform about non-existing HIP 871 association (see Section 5.4), and it MAY initiate a new HIP 872 negotiation. However, responding with these optional 873 mechanisms is implementation or policy dependent. 875 4.4. HIP State Machine 877 The HIP protocol itself has little state. In the HIP base exchange, 878 there is an Initiator and a Responder. Once the SAs are established, 879 this distinction is lost. If the HIP state needs to be re- 880 established, the controlling parameters are which peer still has 881 state and which has a datagram to send to its peer. The following 882 state machine attempts to capture these processes. 884 The state machine is presented in a single system view, representing 885 either an Initiator or a Responder. There is not a complete overlap 886 of processing logic here and in the packet definitions. Both are 887 needed to completely implement HIP. 889 Implementors must understand that the state machine, as described 890 here, is informational. Specific implementations are free to 891 implement the actual functions differently. Section 6 describes the 892 packet processing rules in more detail. This state machine focuses 893 on the HIP I1, R1, I2, and R2 packets only. Other states may be 894 introduced by mechanisms in other specifications (such as mobility 895 and multihoming). 897 4.4.1. HIP States 899 +---------------------+---------------------------------------------+ 900 | State | Explanation | 901 +---------------------+---------------------------------------------+ 902 | UNASSOCIATED | State machine start | 903 | | | 904 | I1-SENT | Initiating base exchange | 905 | | | 906 | I2-SENT | Waiting to complete base exchange | 907 | | | 908 | R2-SENT | Waiting to complete base exchange | 909 | | | 910 | ESTABLISHED | HIP association established | 911 | | | 912 | CLOSING | HIP association closing, no data can be | 913 | | sent | 914 | | | 915 | CLOSED | HIP association closed, no data can be sent | 916 | | | 917 | E-FAILED | HIP exchange failed | 918 +---------------------+---------------------------------------------+ 920 4.4.2. HIP State Processes 922 System behaviour in state UNASSOCIATED, Table 2. 924 +---------------------+---------------------------------------------+ 925 | Trigger | Action | 926 +---------------------+---------------------------------------------+ 927 | User data to send, | Send I1 and go to I1-SENT | 928 | requiring a new HIP | | 929 | association | | 930 | | | 931 | Receive I1 | Send R1 and stay at UNASSOCIATED | 932 | | | 933 | Receive I2, process | If successful, send R2 and go to R2-SENT | 934 | | | 935 | | If fail, stay at UNASSOCIATED | 936 | | | 937 | Receive user data | Optionally send ICMP as defined in | 938 | for unknown HIP | Section 5.4 and stay at UNASSOCIATED | 939 | association | | 940 | | | 941 | Receive CLOSE | Optionally send ICMP Parameter Problem and | 942 | | stay at UNASSOCIATED | 943 | | | 944 | Receive ANYOTHER | Drop and stay at UNASSOCIATED | 945 +---------------------+---------------------------------------------+ 947 Table 2: UNASSOCIATED - Start state 949 System behaviour in state I1-SENT, Table 3. 951 +---------------------+---------------------------------------------+ 952 | Trigger | Action | 953 +---------------------+---------------------------------------------+ 954 | Receive I1 | If the local HIT is smaller than the peer | 955 | | HIT, drop I1 and stay at I1-SENT | 956 | | | 957 | | If the local HIT is greater than the peer | 958 | | HIT, send R1 and stay at I1_SENT | 959 | | | 960 | Receive I2, process | If successful, send R2 and go to R2-SENT | 961 | | | 962 | | If fail, stay at I1-SENT | 963 | | | 964 | Receive R1, process | If successful, send I2 and go to I2-SENT | 965 | | | 966 | | If fail, stay at I1-SENT | 967 | | | 968 | Receive ANYOTHER | Drop and stay at I1-SENT | 969 | | | 970 | Timeout, increment | If counter is less than I1_RETRIES_MAX, | 971 | timeout counter | send I1 and stay at I1-SENT | 972 | | | 973 | | If counter is greater than I1_RETRIES_MAX, | 974 | | go to E-FAILED | 975 +---------------------+---------------------------------------------+ 977 Table 3: I1-SENT - Initiating HIP 979 System behaviour in state I2-SENT, Table 4. 981 +---------------------+---------------------------------------------+ 982 | Trigger | Action | 983 +---------------------+---------------------------------------------+ 984 | Receive I1 | Send R1 and stay at I2-SENT | 985 | | | 986 | Receive R1, process | If successful, send I2 and cycle at I2-SENT | 987 | | | 988 | | If fail, stay at I2-SENT | 989 | | | 990 | Receive I2, process | If successful and local HIT is smaller than | 991 | | the peer HIT, drop I2 and stay at I2-SENT | 992 | | | 993 | | If successful and local HIT is greater than | 994 | | the peer HIT, send R2 and go to R2-SENT | 995 | | | 996 | | If fail, stay at I2-SENT | 997 | | | 998 | Receive R2, process | If successful, go to ESTABLISHED | 999 | | | 1000 | | If fail, stay at I2-SENT | 1001 | | | 1002 | Receive ANYOTHER | Drop and stay at I2-SENT | 1003 | | | 1004 | Timeout, increment | If counter is less than I2_RETRIES_MAX, | 1005 | timeout counter | send I2 and stay at I2-SENT | 1006 | | | 1007 | | If counter is greater than I2_RETRIES_MAX, | 1008 | | go to E-FAILED | 1009 +---------------------+---------------------------------------------+ 1011 Table 4: I2-SENT - Waiting to finish HIP 1013 System behaviour in state R2-SENT, Table 5. 1015 +---------------------+---------------------------------------------+ 1016 | Trigger | Action | 1017 +---------------------+---------------------------------------------+ 1018 | Receive I1 | Send R1 and stay at R2-SENT | 1019 | | | 1020 | Receive I2, process | If successful, send R2 and cycle at R2-SENT | 1021 | | | 1022 | | If fail, stay at R2-SENT | 1023 | | | 1024 | Receive R1 | Drop and stay at R2-SENT | 1025 | | | 1026 | Receive R2 | Drop and stay at R2-SENT | 1027 | | | 1028 | Receive data or | Move to ESTABLISHED | 1029 | UPDATE | | 1030 | | | 1031 | Exchange Complete | Move to ESTABLISHED | 1032 | Timeout | | 1033 +---------------------+---------------------------------------------+ 1035 Table 5: R2-SENT - Waiting to finish HIP 1037 System behaviour in state ESTABLISHED, Table 6. 1039 +---------------------+---------------------------------------------+ 1040 | Trigger | Action | 1041 +---------------------+---------------------------------------------+ 1042 | Receive I1 | Send R1 and stay at ESTABLISHED | 1043 | | | 1044 | Receive I2, process | If successful, send R2, drop old HIP | 1045 | with puzzle and | association, establish a new HIP | 1046 | possible Opaque | association, go to R2-SENT | 1047 | data verification | | 1048 | | | 1049 | | If fail, stay at ESTABLISHED | 1050 | | | 1051 | Receive R1 | Drop and stay at ESTABLISHED | 1052 | | | 1053 | Receive R2 | Drop and stay at ESTABLISHED | 1054 | | | 1055 | Receive user data | Process and stay at ESTABLISHED | 1056 | for HIP association | | 1057 | | | 1058 | No packet | Send CLOSE and go to CLOSING | 1059 | sent/received | | 1060 | during UAL minutes | | 1061 | | | 1062 | Receive CLOSE, | If successful, send CLOSE_ACK and go to | 1063 | process | CLOSED | 1064 | | | 1065 | | If fail, stay at ESTABLISHED | 1066 +---------------------+---------------------------------------------+ 1068 Table 6: ESTABLISHED - HIP association established 1070 System behaviour in state CLOSING, Table 7. 1072 +---------------------+---------------------------------------------+ 1073 | Trigger | Action | 1074 +---------------------+---------------------------------------------+ 1075 | User data to send, | Send I1 and stay at CLOSING | 1076 | requires the | | 1077 | creation of another | | 1078 | incarnation of the | | 1079 | HIP association | | 1080 | | | 1081 | Receive I1 | Send R1 and stay at CLOSING | 1082 | | | 1083 | Receive I2, process | If successful, send R2 and go to R2-SENT | 1084 | | | 1085 | | If fail, stay at CLOSING | 1086 | | | 1087 | Receive R1, process | If successful, send I2 and go to I2-SENT | 1088 | | | 1089 | | If fail, stay at CLOSING | 1090 | | | 1091 | Receive CLOSE, | If successful, send CLOSE_ACK, discard | 1092 | process | state and go to CLOSED | 1093 | | | 1094 | | If fail, stay at CLOSING | 1095 | | | 1096 | Receive CLOSE_ACK, | If successful, discard state and go to | 1097 | process | UNASSOCIATED | 1098 | | | 1099 | | If fail, stay at CLOSING | 1100 | | | 1101 | Receive ANYOTHER | Drop and stay at CLOSING | 1102 | | | 1103 | Timeout, increment | If timeout sum is less than UAL+MSL | 1104 | timeout sum, reset | minutes, retransmit CLOSE and stay at | 1105 | timer | CLOSING | 1106 | | | 1107 | | If timeout sum is greater than UAL+MSL | 1108 | | minutes, go to UNASSOCIATED | 1109 +---------------------+---------------------------------------------+ 1111 Table 7: CLOSING - HIP association has not been used for UAL minutes 1112 System behaviour in state CLOSED, Table 8. 1114 +---------------------+---------------------------------------------+ 1115 | Trigger | Action | 1116 +---------------------+---------------------------------------------+ 1117 | Datagram to send, | Send I1, and stay at CLOSED | 1118 | requires the | | 1119 | creation of another | | 1120 | incarnation of the | | 1121 | HIP association | | 1122 | | | 1123 | Receive I1 | Send R1 and stay at CLOSED | 1124 | | | 1125 | Receive I2, process | If successful, send R2 and go to R2-SENT | 1126 | | | 1127 | | If fail, stay at CLOSED | 1128 | | | 1129 | Receive R1, process | If successful, send I2 and go to I2-SENT | 1130 | | | 1131 | | If fail, stay at CLOSED | 1132 | | | 1133 | Receive CLOSE, | If successful, send CLOSE_ACK, stay at | 1134 | process | CLOSED | 1135 | | | 1136 | | If fail, stay at CLOSED | 1137 | | | 1138 | Receive CLOSE_ACK, | If successful, discard state and go to | 1139 | process | UNASSOCIATED | 1140 | | | 1141 | | If fail, stay at CLOSED | 1142 | | | 1143 | Receive ANYOTHER | Drop and stay at CLOSED | 1144 | | | 1145 | Timeout (UAL+2MSL) | Discard state and go to UNASSOCIATED | 1146 +---------------------+---------------------------------------------+ 1148 Table 8: CLOSED - CLOSE_ACK sent, resending CLOSE_ACK if necessary 1150 System behaviour in state E-FAILED, Table 9. 1152 +---------------------+---------------------------------------------+ 1153 | Trigger | Action | 1154 +---------------------+---------------------------------------------+ 1155 | Wait for | Go to UNASSOCIATED. Re-negotiation is | 1156 | implementation | possible after moving to UNASSOCIATED | 1157 | specific time | state. | 1158 +---------------------+---------------------------------------------+ 1160 Table 9: E-FAILED - HIP failed to establish association with peer 1162 4.4.3. Simplified HIP State Diagram 1164 The following diagram shows the major state transitions. Transitions 1165 based on received packets implicitly assume that the packets are 1166 successfully authenticated or processed. 1168 +-+ +---------------------------+ 1169 I1 received, send R1 | | | | 1170 | v v | 1171 Datagram to send +--------------+ I2 received, send R2 | 1172 +---------------| UNASSOCIATED |---------------+ | 1173 Send I1 | +--------------+ | | 1174 v | | 1175 +---------+ I2 received, send R2 | | 1176 +---->| I1-SENT |---------------------------------------+ | | 1177 | +---------+ | | | 1178 | | +------------------------+ | | | 1179 | | R1 received, | I2 received, send R2 | | | | 1180 | v send I2 | v v v | 1181 | +---------+ | +---------+ | 1182 | +->| I2-SENT |------------+ | R2-SENT |<----+ | 1183 | | +---------+ +---------+ | | 1184 | | | | | | 1185 | | | data| | | 1186 | |receive | or| | | 1187 | |R1, send | EC timeout| receive I2,| | 1188 | |I2 |R2 received +--------------+ | send R2| | 1189 | | +----------->| ESTABLISHED |<-------+| | | 1190 | | +--------------+ | | 1191 | | | | | receive I2, send R2 | | 1192 | | recv+------------+ | +------------------------+ | 1193 | | CLOSE,| | | | 1194 | | send| No packet sent| | | 1195 | | CLOSE_ACK| /received for | timeout | | 1196 | | | UAL min, send | +---------+<-+ (UAL+MSL) | | 1197 | | | CLOSE +--->| CLOSING |--+ retransmit | | 1198 | | | +---------+ CLOSE | | 1199 +--|------------|----------------------+ | | | | | | 1200 +------------|------------------------+ | | +----------------+ | 1201 | | +-----------+ +------------------|--+ 1202 | +------------+ | receive CLOSE, CLOSE_ACK | | 1203 | | | send CLOSE_ACK received or | | 1204 | | | timeout | | 1205 | | | (UAL+MSL) | | 1206 | v v | | 1207 | +--------+ receive I2, send R2 | | 1208 +------------------------| CLOSED |---------------------------+ | 1209 +--------+ /----------------------+ 1210 ^ | \-------/ timeout (UAL+2MSL), 1211 +-+ move to UNASSOCIATED 1212 CLOSE received, send CLOSE_ACK 1214 4.5. User Data Considerations 1216 4.5.1. TCP and UDP Pseudo-header Computation for User Data 1218 When computing TCP and UDP checksums on user data packets that flow 1219 through sockets bound to HITs, the IPv6 pseudo-header format 1220 [RFC2460] MUST be used, even if the actual addresses on the packet 1221 are IPv4 addresses. Additionally, the HITs MUST be used in the place 1222 of the IPv6 addresses in the IPv6 pseudo-header. Note that the 1223 pseudo-header for actual HIP payloads is computed differently; see 1224 Section 5.1.1. 1226 4.5.2. Sending Data on HIP Packets 1228 A future version of this document may define how to include user data 1229 on various HIP packets. However, currently the HIP header is a 1230 terminal header, and not followed by any other headers. 1232 4.5.3. Transport Formats 1234 The actual data transmission format, used for user data after the HIP 1235 base exchange, is not defined in this document. Such transport 1236 formats and methods are described in separate specifications. All 1237 HIP implementations MUST implement, at minimum, the ESP transport 1238 format for HIP [I-D.ietf-hip-esp]. 1240 When new transport formats are defined, they get the type value from 1241 the HIP Transform type value space 2048 - 4095. The order in which 1242 the transport formats are presented in the R1 packet, is the 1243 preferred order. The last of the transport formats MUST be ESP 1244 transport format, represented by the ESP_TRANSFORM parameter. 1246 4.5.4. Reboot and SA Timeout Restart of HIP 1248 Simulating a loss of state is a potential DoS attack. The following 1249 process has been crafted to manage state recovery without presenting 1250 a DoS opportunity. 1252 If a host reboots or the HIP association times out, it has lost its 1253 HIP state. If the host that lost state has a datagram to send to the 1254 peer, it simply restarts the HIP base exchange. After the base 1255 exchange has completed, the Initiator can create a new SA and start 1256 sending data. The peer does not reset its state until it receives a 1257 valid I2 HIP packet. 1259 If a system receives a user data packet that cannot be matched to any 1260 existing HIP association, it is possible that it has lost the state 1261 and its peer has not. It MAY send an ICMP packet with the Parameter 1262 Problem type, the Pointer pointing to the referred HIP-related 1263 association information. Reacting to such traffic depends on the 1264 implementation and the environment where the implementation is used. 1266 If the host, that apparently has lost its state, decides to restart 1267 the HIP base exchange, it sends an I1 packet to the peer. After the 1268 base exchange has been completed successfully, the Initiator can 1269 create a new HIP association and the peer drops its OLD SA and 1270 creates a new one. 1272 4.6. Certificate Distribution 1274 HIP base specification does not define how to use certificates or how 1275 to transfer them between hosts. These functions are defined in a 1276 separate specification. A parameter type value, meant to be used for 1277 carrying certificates, is reserved, though: CERT, Type 768; see 1278 Section 5.2. 1280 5. Packet Formats 1282 5.1. Payload Format 1284 All HIP packets start with a fixed header. 1286 0 1 2 3 1287 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 1288 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1289 | Next Header | Header Length |0| Packet Type | VER. | RES.|1| 1290 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1291 | Checksum | Controls | 1292 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1293 | Sender's Host Identity Tag (HIT) | 1294 | | 1295 | | 1296 | | 1297 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1298 | Receiver's Host Identity Tag (HIT) | 1299 | | 1300 | | 1301 | | 1302 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1303 | | 1304 / HIP Parameters / 1305 / / 1306 | | 1307 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1309 The HIP header is logically an IPv6 extension header. However, this 1310 document does not describe processing for Next Header values other 1311 than decimal 59, IPPROTO_NONE, the IPv6 no next header value. Future 1312 documents MAY do so. However, current implementations MUST ignore 1313 trailing data if an unimplemented Next Header value is received. 1315 The Header Length field contains the length of the HIP Header and HIP 1316 parameters in 8 bytes units, excluding the first 8 bytes. Since all 1317 HIP headers MUST contain the sender's and receiver's HIT fields, the 1318 minimum value for this field is 4, and conversely, the maximum length 1319 of the HIP Parameters field is (255*8)-32 = 2008 bytes. Note: this 1320 sets an additional limit for sizes of parameters included in the 1321 Parameters field, independent of the individual parameter maximum 1322 lengths. 1324 The Packet Type indicates the HIP packet type. The individual packet 1325 types are defined in the relevant sections. If a HIP host receives a 1326 HIP packet that contains an unknown packet type, it MUST drop the 1327 packet. 1329 The HIP Version is four bits. The current version is 1. The version 1330 number is expected to be incremented only if there are incompatible 1331 changes to the protocol. Most extensions can be handled by defining 1332 new packet types, new parameter types, or new controls. 1334 The following three bits are reserved for future use. They MUST be 1335 zero when sent, and they SHOULD be ignored when handling a received 1336 packet. 1338 The two fixed bits in the header are reserved for potential SHIM6 1339 compatibility [I-D.ietf-shim6-proto]. For implementations adhering 1340 (only) to this specification, they MUST be set as shown when sending 1341 and MUST be ignored when receiving. This is to ensure optimal 1342 forward compatibility. Note that implementations that implement 1343 other compatible specifications in addition to this specification, 1344 the corresponding rules may well be different. For example, in the 1345 case that the forthcoming SHIM6 protocol happens to be compatible 1346 with this specification, an implementation that implements both this 1347 specification and the SHIM6 protocol may need to check these bits in 1348 order to determine how to handle the packet. 1350 The HIT fields are always 128 bits (16 bytes) long. 1352 5.1.1. Checksum 1354 Since the checksum covers the source and destination addresses in the 1355 IP header, it must be recomputed on HIP-aware NAT devices. 1357 If IPv6 is used to carry the HIP packet, the pseudo-header [RFC2460] 1358 contains the source and destination IPv6 addresses, HIP packet length 1359 in the pseudo-header length field, a zero field, and the HIP protocol 1360 number (see Section 4) in the Next Header field. The length field is 1361 in bytes and can be calculated from the HIP header length field: (HIP 1362 Header Length + 1) * 8. 1364 In case of using IPv4, the IPv4 UDP pseudo header format [RFC0768] is 1365 used. In the pseudo header, the source and destination addresses are 1366 those used in the IP header, the zero field is obviously zero, the 1367 protocol is the HIP protocol number (see Section 4), and the length 1368 is calculated as in the IPv6 case. 1370 5.1.2. HIP Controls 1372 The HIP Controls section conveys information about the structure of 1373 the packet and capabilities of the host. 1375 The following fields have been defined: 1377 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1378 | | | | | | | | | | | | | | | |A| 1379 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1381 A - Anonymous: If this is set, the sender's HI in this packet is 1382 anonymous, i.e., one not listed in a directory. Anonymous HIs 1383 SHOULD NOT be stored. This control is set in packets R1 and/or 1384 I2. The peer receiving an anonymous HI may choose to refuse it. 1386 The rest of the fields are reserved for future use and MUST be set to 1387 zero on sent packets and ignored on received packets. 1389 5.1.3. HIP Fragmentation Support 1391 A HIP implementation must support IP fragmentation / reassembly. 1392 Fragment reassembly MUST be implemented in both IPv4 and IPv6, but 1393 fragment generation is REQUIRED to be implemented in IPv4 (IPv4 1394 stacks and networks will usually do this by default) and RECOMMENDED 1395 to be implemented in IPv6. In IPv6 networks, the minimum MTU is 1396 larger, 1280 bytes, than in IPv4 networks. The larger MTU size is 1397 usually sufficient for most HIP packets, and therefore fragment 1398 generation may not be needed. If a host expects to send HIP packets 1399 that are larger than the minimum IPv6 MTU, it MUST implement fragment 1400 generation even for IPv6. 1402 In IPv4 networks, HIP packets may encounter low MTUs along their 1403 routed path. Since HIP does not provide a mechanism to use multiple 1404 IP datagrams for a single HIP packet, support for path MTU discovery 1405 does not bring any value to HIP in IPv4 networks. HIP-aware NAT 1406 devices MUST perform any IPv4 reassembly/fragmentation. 1408 All HIP implementations have to be careful while employing a 1409 reassembly algorithm so that the algorithm is sufficiently resistant 1410 to DoS attacks. 1412 Because certificate chains can cause the packet to be fragmented and 1413 fragmentation can open implementation to denial of service attacks 1414 [KAU03], it is strongly recommended that the separate document 1415 specifying the certificate usage in HIP Base Exchange defines the 1416 usage of "Hash and URL" formats rather than including certificates in 1417 exchanges. With this, most problems related to DoS attacks with 1418 fragmentation can be avoided. 1420 5.2. HIP Parameters 1422 The HIP Parameters are used to carry the public key associated with 1423 the sender's HIT, together with related security and other 1424 information. They consist of ordered parameters, encoded in TLV 1425 format. 1427 The following parameter types are currently defined. 1429 +------------------------+-------+----------+-----------------------+ 1430 | TLV | Type | Length | Data | 1431 +------------------------+-------+----------+-----------------------+ 1432 | R1_COUNTER | 128 | 12 | System Boot Counter | 1433 | | | | | 1434 | PUZZLE | 257 | 12 | K and Random #I | 1435 | | | | | 1436 | SOLUTION | 321 | 20 | K, Random #I and | 1437 | | | | puzzle solution J | 1438 | | | | | 1439 | SEQ | 385 | 4 | Update packet ID | 1440 | | | | number | 1441 | | | | | 1442 | ACK | 449 | variable | Update packet ID | 1443 | | | | number | 1444 | | | | | 1445 | DIFFIE_HELLMAN | 513 | variable | public key | 1446 | | | | | 1447 | HIP_TRANSFORM | 577 | variable | HIP Encryption and | 1448 | | | | Integrity Transform | 1449 | | | | | 1450 | ENCRYPTED | 641 | variable | Encrypted part of I2 | 1451 | | | | packet | 1452 | | | | | 1453 | HOST_ID | 705 | variable | Host Identity with | 1454 | | | | Fully Qualified | 1455 | | | | Domain Name or NAI | 1456 | | | | | 1457 | CERT | 768 | variable | HI Certificate; used | 1458 | | | | to transfer | 1459 | | | | certificates. Usage | 1460 | | | | defined in a separate | 1461 | | | | document. | 1462 | | | | | 1463 | NOTIFICATION | 832 | variable | Informational data | 1464 | | | | | 1465 | ECHO_REQUEST_SIGNED | 897 | variable | Opaque data to be | 1466 | | | | echoed back; under | 1467 | | | | signature | 1468 | | | | | 1469 | ECHO_RESPONSE_SIGNED | 961 | variable | Opaque data echoed | 1470 | | | | back; under signature | 1471 | | | | | 1472 | HMAC | 61505 | variable | HMAC based message | 1473 | | | | authentication code, | 1474 | | | | with key material | 1475 | | | | from HIP_TRANSFORM | 1476 | | | | | 1477 | HMAC_2 | 61569 | variable | HMAC based message | 1478 | | | | authentication code, | 1479 | | | | with key material | 1480 | | | | from HIP_TRANSFORM. | 1481 | | | | Compared to HMAC, the | 1482 | | | | HOST_ID parameter is | 1483 | | | | included in HMAC_2 | 1484 | | | | calculation. | 1485 | | | | | 1486 | HIP_SIGNATURE_2 | 61633 | variable | Signature of the R1 | 1487 | | | | packet | 1488 | | | | | 1489 | HIP_SIGNATURE | 61697 | variable | Signature of the | 1490 | | | | packet | 1491 | | | | | 1492 | ECHO_REQUEST_UNSIGNED | 63661 | variable | Opaque data to be | 1493 | | | | echoed back; after | 1494 | | | | signature | 1495 | | | | | 1496 | ECHO_RESPONSE_UNSIGNED | 63425 | variable | Opaque data echoed | 1497 | | | | back; after signature | 1498 +------------------------+-------+----------+-----------------------+ 1500 Because the ordering (from lowest to highest) of HIP parameters is 1501 strictly enforced (see Section 5.2.1), the parameter type values for 1502 existing parameters have been spaced to allow for future protocol 1503 extensions. Parameters numbered between 0-1023 are used in HIP 1504 handshake and update procedures and are covered by signatures. 1505 Parameters numbered between 1024-2047 are reserved. Parameters 1506 numbered between 2048-4095 are used for parameters related to HIP 1507 transform types. Parameters numbered between 4096 and (2^16 - 2^12) 1508 61439 are reserved. Parameters numbered between 61440-62463 are used 1509 for signatures and signed MACs. Parameters numbered between 62464- 1510 63487 are used for parameters that fall outside of the signed area of 1511 the packet. Parameters numbered between 63488-64511 are used for 1512 rendezvous and other relaying services. Parameters numbered between 1513 64512-65535 are reserved. 1515 5.2.1. TLV Format 1517 The TLV-encoded parameters are described in the following 1518 subsections. The type-field value also describes the order of these 1519 fields in the packet, except for type values from 2048 to 4095 which 1520 are reserved for new transport forms. The parameters MUST be 1521 included in the packet such that their types form an increasing 1522 order. If the parameter can exist multiple times in the packet, the 1523 type value may be the same in consecutive parameters. If the order 1524 does not follow this rule, the packet is considered to be malformed 1525 and it MUST be discarded. 1527 Parameters using type values from 2048 up to 4095 are transport 1528 formats. Currently, one transport format is defined: the ESP 1529 transport format [I-D.ietf-hip-esp]. The order of these parameters 1530 does not follow the order of their type value, but they are put in 1531 the packet in order of preference. The first of the transport 1532 formats it the most preferred, and so on. 1534 All of the TLV parameters have a length (including Type and Length 1535 fields) which is a multiple of 8 bytes. When needed, padding MUST be 1536 added to the end of the parameter so that the total length becomes a 1537 multiple of 8 bytes. This rule ensures proper alignment of data. 1538 Any added padding bytes MUST be zeroed by the sender, and their 1539 values SHOULD NOT be checked by the receiver. 1541 Consequently, the Length field indicates the length of the Contents 1542 field (in bytes). The total length of the TLV parameter (including 1543 Type, Length, Contents, and Padding) is related to the Length field 1544 according to the following formula: 1546 Total Length = 11 + Length - (Length + 3) % 8; 1548 0 1 2 3 1549 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 1550 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1551 | Type |C| Length | 1552 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1553 | | 1554 / Contents / 1555 / +-+-+-+-+-+-+-+-+ 1556 | | Padding | 1557 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1559 Type Type code for the parameter. 16 bits long, C-bit 1560 being part of the Type code. 1561 C Critical. One if this parameter is critical, and 1562 MUST be recognized by the recipient, zero otherwise. 1563 The C bit is considered to be a part of the Type 1564 field. Consequently, critical parameters are always 1565 odd and non-critical ones have an even value. 1566 Length Length of the Contents, in bytes. 1567 Contents Parameter specific, defined by Type 1568 Padding Padding, 0-7 bytes, added if needed 1570 Critical parameters MUST be recognized by the recipient. If a 1571 recipient encounters a critical parameter that it does not recognize, 1572 it MUST NOT process the packet any further. It MAY send an ICMP or 1573 NOTIFY, as defined in Section 4.3. 1575 Non-critical parameters MAY be safely ignored. If a recipient 1576 encounters a non-critical parameter that it does not recognize, it 1577 SHOULD proceed as if the parameter was not present in the received 1578 packet. 1580 5.2.2. Defining New Parameters 1582 Future specifications may define new parameters as needed. When 1583 defining new parameters, care must be taken to ensure that the 1584 parameter type values are appropriate and leave suitable space for 1585 other future extensions. One must remember that the parameters MUST 1586 always be arranged in the increasing order by type code, thereby 1587 limiting the order of parameters (see Section 5.2.1). 1589 The following rules must be followed when defining new parameters. 1591 1. The low order bit C of the Type code is used to distinguish 1592 between critical and non-critical parameters. 1594 2. A new parameter may be critical only if an old recipient ignoring 1595 it would cause security problems. In general, new parameters 1596 SHOULD be defined as non-critical, and expect a reply from the 1597 recipient. 1599 3. If a system implements a new critical parameter, it MUST provide 1600 the ability to configure the associated feature off, such that 1601 the critical parameter is not sent at all. The configuration 1602 option must be well documented. Implementations operating in a 1603 mode adhering to this specification MUST disable the sending of 1604 new critical parameters. In other words, the management 1605 interface MUST allow vanilla standards-only mode as a default 1606 configuration setting, and MAY allow new critical payloads to be 1607 configured on (and off). 1609 4. See section Section 9 for allocation rules regarding type codes. 1611 5.2.3. R1_COUNTER 1613 0 1 2 3 1614 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 1615 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1616 | Type | Length | 1617 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1618 | Reserved, 4 bytes | 1619 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1620 | R1 generation counter, 8 bytes | 1621 | | 1622 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1624 Type 128 1625 Length 12 1626 R1 generation 1627 counter The current generation of valid puzzles 1629 The R1_COUNTER parameter contains an 64-bit unsigned integer in 1630 network byte order, indicating the current generation of valid 1631 puzzles. The sender is supposed to increment this counter 1632 periodically. It is RECOMMENDED that the counter value is 1633 incremented at least as often as old PUZZLE values are deprecated so 1634 that SOLUTIONs to them are no longer accepted. 1636 The R1_COUNTER parameter is optional. It SHOULD be included in the 1637 R1 (in which case it is covered by the signature), and if present in 1638 the R1, it MAY be echoed (including the Reserved field verbatim) by 1639 the Initiator in the I2. 1641 5.2.4. PUZZLE 1643 0 1 2 3 1644 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 1645 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1646 | Type | Length | 1647 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1648 | K, 1 byte | Lifetime | Opaque, 2 bytes | 1649 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1650 | Random # I, 8 bytes | 1651 | | 1652 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1654 Type 257 1655 Length 12 1656 K K is the number of verified bits 1657 Lifetime Puzzle lifetime 2^(value-32) seconds 1658 Opaque Data set by the Responder, indexing the puzzle 1659 Random #I random number 1661 Random #I is represented as 64-bit integer, K and Lifetime as 8-bit 1662 integer, all in network byte order. 1664 The PUZZLE parameter contains the puzzle difficulty K and a 64-bit 1665 puzzle random integer #I. The Puzzle Lifetime indicates the time 1666 during which the puzzle solution is valid, and sets a time limit 1667 which should not be exceeded by the Initiator while it attempts to 1668 solve the puzzle. The lifetime is indicated as a power of 2 using 1669 the formula 2^(Lifetime-32) seconds. A puzzle MAY be augmented with 1670 an ECHO_REQUEST_SIGNED or an ECHO_REQUEST_UNSIGNED parameter included 1671 in the R1; the contents of the echo request are then echoed back in 1672 the ECHO_RESPONSE_SIGNED or in the ECHO_RESPONSE_UNSIGNED, allowing 1673 the Responder to use the included information as a part of its puzzle 1674 processing. 1676 The Opaque and Random #I field are not covered by the HIP_SIGNATURE_2 1677 parameter. 1679 5.2.5. SOLUTION 1681 0 1 2 3 1682 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1683 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1684 | Type | Length | 1685 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1686 | K, 1 byte | Reserved | Opaque, 2 bytes | 1687 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1688 | Random #I, 8 bytes | 1689 | | 1690 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1691 | Puzzle solution #J, 8 bytes | 1692 | | 1693 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1695 Type 321 1696 Length 20 1697 K K is the number of verified bits 1698 Reserved zero when sent, ignored when received 1699 Opaque copied unmodified from the received PUZZLE 1700 parameter 1701 Random #I random number 1702 Puzzle solution 1703 #J random number 1705 Random #I, and Random #J are represented as 64-bit integers, K as an 1706 8-bit integer, all in network byte order. 1708 The SOLUTION parameter contains a solution to a puzzle. It also 1709 echoes back the random difficulty K, the Opaque field, and the puzzle 1710 integer #I. 1712 5.2.6. DIFFIE_HELLMAN 1714 0 1 2 3 1715 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 1716 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1717 | Type | Length | 1718 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1719 | Group ID | Public Value Length | Public Value / 1720 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1721 / | 1722 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1723 | Group ID | Public Value Length | Public Value / 1724 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1725 / | padding | 1726 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1728 Type 513 1729 Length length in octets, excluding Type, Length, and 1730 padding 1731 Group ID defines values for p and g 1732 Public Value length of the following Public Value in octets 1733 Length 1734 Public Value the sender's public Diffie-Hellman key 1736 The following Group IDs have been defined: 1738 Group Value 1739 Reserved 0 1740 384-bit group 1 1741 OAKLEY well known group 1 2 1742 1536-bit MODP group 3 1743 3072-bit MODP group 4 1744 6144-bit MODP group 5 1745 8192-bit MODP group 6 1747 The MODP Diffie-Hellman groups are defined in [RFC3526]. The OAKLEY 1748 well known group 1 is defined in Appendix E. 1750 The sender can include at most two different Diffie-Hellman public 1751 values in the DIFFIE_HELLMAN parameter. This gives the possibility 1752 e.g. for a server to provide a weaker encryption possibility for a 1753 PDA host that is not powerful enough. It is RECOMMENDED that the 1754 Initiator, receiving more than one public values selects the stronger 1755 one, if it supports it. 1757 A HIP implementation MUST implement Group IDs 1 and 3. The 384-bit 1758 group can be used when lower security is enough (e.g. web surfing) 1759 and when the equipment is not powerful enough (e.g. some PDAs). It 1760 is REQUIRED that the default configuration allows Group ID 1 usage, 1761 but it is RECOMMENDED that applications that need stronger security 1762 turn Group ID 1 support off. Equipment powerful enough SHOULD 1763 implement also group ID 5. The 384-bit group is defined in 1764 Appendix D. 1766 To avoid unnecessary failures during the base exchange, the rest of 1767 the groups SHOULD be implemented in hosts where resources are 1768 adequate. 1770 5.2.7. HIP_TRANSFORM 1772 0 1 2 3 1773 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1774 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1775 | Type | Length | 1776 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1777 | Suite-ID #1 | Suite-ID #2 | 1778 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1779 | Suite-ID #n | Padding | 1780 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1782 Type 577 1783 Length length in octets, excluding Type, Length, and 1784 padding 1785 Suite-ID Defines the HIP Suite to be used 1787 The following Suite-IDs are defined ([RFC4307],[RFC2451]): 1789 Suite-ID Value 1791 RESERVED 0 1792 AES-CBC with HMAC-SHA1 1 1793 3DES-CBC with HMAC-SHA1 2 1794 3DES-CBC with HMAC-MD5 3 1795 BLOWFISH-CBC with HMAC-SHA1 4 1796 NULL-ENCRYPT with HMAC-SHA1 5 1797 NULL-ENCRYPT with HMAC-MD5 6 1799 The sender of a HIP transform parameter MUST make sure that there are 1800 no more than six (6) HIP Suite-IDs in one HIP transform parameter. 1801 Conversely, a recipient MUST be prepared to handle received transport 1802 parameters that contain more than six Suite-IDs by accepting the 1803 first six Suite-IDs and dropping the rest. The limited number of 1804 transforms sets the maximum size of HIP_TRANSFORM parameter. As the 1805 default configuration, the HIP_TRANSFORM parameter MUST contain at 1806 least one of the mandatory Suite-IDs. There MAY be a configuration 1807 option that allows the administrator to override this default. 1809 The Responder lists supported and desired Suite-IDs in order of 1810 preference in the R1, up to the maximum of six Suite-IDs. The 1811 Initiator MUST choose only one of the corresponding Suite-IDs. That 1812 Suite-ID will be used for generating the I2. 1814 Mandatory implementations: AES-CBC with HMAC-SHA1 and NULL-ENCRYPTION 1815 with HMAC-SHA1. 1817 5.2.8. HOST_ID 1819 0 1 2 3 1820 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 1821 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1822 | Type | Length | 1823 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1824 | HI Length |DI-type| DI Length | 1825 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1826 | Host Identity / 1827 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1828 / | Domain Identifier / 1829 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1830 / | Padding | 1831 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1833 Type 705 1834 Length length in octets, excluding Type, Length, and 1835 Padding 1836 HI Length Length of the Host Identity in octets 1837 DI-type type of the following Domain Identifier field 1838 DI Length length of the FQDN or NAI in octets 1839 Host Identity actual host identity 1840 Domain Identifier the identifier of the sender 1842 The Host Identity is represented in RFC2535 [RFC2535] format. The 1843 algorithms used in RDATA format are the following: 1845 Algorithms Values 1847 RESERVED 0 1848 DSA 3 [RFC2536] (RECOMMENDED) 1849 RSA/SHA1 5 [RFC3110] (REQUIRED) 1851 The following DI-types have been defined: 1853 Type Value 1854 none included 0 1855 FQDN 1 1856 NAI 2 1858 FQDN Fully Qualified Domain Name, in binary format. 1859 NAI Network Access Identifier 1861 The format for the FQDN is defined in RFC1035 [RFC1035] Section 3.1. 1862 The format for Network Access Identifier is defined in 1863 [I-D.ietf-radext-rfc2486bis] 1865 If there is no Domain Identifier, i.e. the DI-type field is zero, 1866 also the DI Length field is set to zero. 1868 5.2.9. HMAC 1870 0 1 2 3 1871 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 1872 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1873 | Type | Length | 1874 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1875 | | 1876 | HMAC | 1877 / / 1878 / +-------------------------------+ 1879 | | Padding | 1880 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1882 Type 61505 1883 Length length in octets, excluding Type, Length, and 1884 Padding 1885 HMAC HMAC computed over the HIP packet, excluding the 1886 HMAC parameter and any following parameters, such 1887 as HIP_SIGNATURE, HIP_SIGNATURE_2, 1888 ECHO_REQUEST_UNSIGNED, or ECHO_RESPONSE_UNSIGNED. 1889 The checksum field MUST be set to zero and the HIP 1890 header length in the HIP common header MUST be 1891 calculated not to cover any excluded parameters 1892 when the HMAC is calculated. The size of the 1893 HMAC is the natural size of the hash computation 1894 output depending on the used hash function. 1896 The HMAC calculation and verification process is presented in 1897 Section 6.4.1 1899 5.2.10. HMAC_2 1901 The parameter structure is the same as in Section 5.2.9. The fields 1902 are: 1904 Type 61569 1905 Length length in octets, excluding Type, Length, and 1906 Padding 1907 HMAC HMAC computed over the HIP packet, excluding the 1908 HMAC parameter and any following parameters such 1909 as HIP_SIGNATURE, HIP_SIGNATURE_2, 1910 ECHO_REQUEST_UNSIGNED, or ECHO_RESPONSE_UNSIGNED, 1911 and including an additional sender's HOST_ID 1912 parameter during the HMAC calculation. The 1913 checksum field MUST be set to zero and the HIP 1914 header length in the HIP common header MUST be 1915 calculated not to cover any excluded parameters 1916 when the HMAC is calculated. The size of the 1917 HMAC is the natural size of the hash computation 1918 output depending on the used hash function. 1920 The HMAC calculation and verification process is presented in 1921 Section 6.4.1 1923 5.2.11. HIP_SIGNATURE 1925 0 1 2 3 1926 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1927 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1928 | Type | Length | 1929 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1930 | SIG alg | Signature / 1931 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1932 / | Padding | 1933 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1935 Type 61697 1936 Length length in octets, excluding Type, Length, and 1937 Padding 1938 SIG alg Signature algorithm 1939 Signature the signature is calculated over the HIP packet, 1940 excluding the HIP_SIGNATURE parameter and any 1941 parameters that follow the HIP_SIGNATURE parameter. 1942 The checksum field MUST be set to zero, and the HIP 1943 header length in the HIP common header MUST be 1944 calculated only to the beginning of the 1945 HIP_SIGNATURE parameter when the signature is 1946 calculated. 1948 The signature algorithms are defined in Section 5.2.8. The signature 1949 in the Signature field is encoded using the proper method depending 1950 on the signature algorithm (e.g. according to [RFC3110] in case of 1951 RSA/SHA1, or according to [RFC2536] in case of DSA). 1953 The HIP_SIGNATURE calculation and verification process is presented 1954 in Section 6.4.2 1956 5.2.12. HIP_SIGNATURE_2 1958 The parameter structure is the same as in Section 5.2.11. The fields 1959 are: 1961 Type 61633 1962 Length length in octets, excluding Type, Length, and 1963 Padding 1964 SIG alg Signature algorithm 1965 Signature the signature is calculated over the HIP R1 packet, 1966 excluding the HIP_SIGNATURE_2 parameter and any 1967 parameters that follow. Initiator's HIT, checksum 1968 field, and the Opaque and Random #I fields in the 1969 PUZZLE parameter MUST be set to zero while 1970 computing the HIP_SIGNATURE_2 signature. Further, 1971 the HIP packet length in the HIP header MUST be 1972 calculated to the beginning of the HIP_SIGNATURE_2 1973 parameter when the signature is calculated. 1975 Zeroing the Initiator's HIT makes it possible to create R1 packets 1976 beforehand to minimize the effects of possible DoS attacks. Zeroing 1977 the I and Opaque fields allows these fields to be populated 1978 dynamically on precomputed R1s. 1980 Signature calculation and verification follows the process in 1981 Section 6.4.2. 1983 5.2.13. SEQ 1985 0 1 2 3 1986 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 1987 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1988 | Type | Length | 1989 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1990 | Update ID | 1991 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1993 Type 385 1994 Length 4 1995 Update ID 32-bit sequence number 1997 The Update ID is an unsigned quantity, initialized by a host to zero 1998 upon moving to ESTABLISHED state. The Update ID has scope within a 1999 single HIP association, and not across multiple associations or 2000 multiple hosts. The Update ID is incremented by one before each new 2001 UPDATE that is sent by the host; the first UPDATE packet originated 2002 by a host has an Update ID of 0. 2004 5.2.14. ACK 2006 0 1 2 3 2007 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 2008 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2009 | Type | Length | 2010 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2011 | peer Update ID | 2012 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2014 Type 449 2015 Length variable (multiple of 4) 2016 peer Update ID 32-bit sequence number corresponding to the 2017 Update ID being ACKed. 2019 The ACK parameter includes one or more Update IDs that have been 2020 received from the peer. The Length field identifies the number of 2021 peer Update IDs that are present in the parameter. 2023 5.2.15. ENCRYPTED 2025 0 1 2 3 2026 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 2027 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2028 | Type | Length | 2029 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2030 | Reserved | 2031 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2032 | IV / 2033 / / 2034 / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2035 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / 2036 / Encrypted data / 2037 / / 2038 / +-------------------------------+ 2039 / | Padding | 2040 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2042 Type 641 2043 Length length in octets, excluding Type, Length, and 2044 Padding 2045 Reserved zero when sent, ignored when received 2046 IV Initialization vector, if needed, otherwise 2047 nonexistent. The length of the IV is inferred from 2048 the HIP transform. 2049 Encrypted The data is encrypted using an encryption algorithm 2050 data as defined in HIP transform. 2051 Padding Any Padding, if necessary, to make the parameter a 2052 multiple of 8 bytes. 2054 The ENCRYPTED parameter encapsulates another parameter, the encrypted 2055 data, which is also in TLV format. Consequently, the first fields in 2056 the encapsulated parameter(s) are Type and Length, allowing the 2057 contents to be easily parsed after decryption. 2059 Both the ENCRYPTED parameter and the encapsulated parameter(s) MUST 2060 be padded. The padding needed for the ENCRYPTED parameter is 2061 referred as the "outer" padding. Correspondingly, the padding for 2062 the parameter(s) encapsulated within the ENCRYPTED parameter is 2063 referred as the "inner" padding. 2065 The inner padding follows exactly the rules of Section 5.2.1. The 2066 outer padding also follows the same rules but with an exception. 2067 Namely, some algorithms require that the data to be encrypted must be 2068 a multiple of the cipher algorithm block size. In this case, the 2069 outer padding MUST include extra padding, as specified by the 2070 encryption algorithm. The size of the extra padding is selected so 2071 that the length of the ENCRYPTED is the minimum value that is both 2072 multiple of eight and the cipher block size. The encryption 2073 algorithm may specify padding bytes other than zero; for example, AES 2074 [FIPS01] uses the PKCS5 padding scheme [RFC2898] (see section 6.1.1) 2075 where the remaining n bytes to fill the block each have the value n. 2077 Note that the length of the cipher suite output may be smaller or 2078 larger than the length of the data to be encrypted, since the 2079 encryption process may compress the data or add additional padding to 2080 the data. 2082 5.2.16. NOTIFICATION 2084 The NOTIFICATION parameter is used to transmit informational data, 2085 such as error conditions and state transitions, to a HIP peer. A 2086 NOTIFICATION parameter may appear in the NOTIFY packet type. The use 2087 of the NOTIFICATION parameter in other packet types is for further 2088 study. 2090 0 1 2 3 2091 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2092 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2093 | Type | Length | 2094 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2095 | Reserved | Notify Message Type | 2096 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2097 | / 2098 / Notification data / 2099 / +---------------+ 2100 / | Padding | 2101 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2103 Type 832 2104 Length length in octets, excluding Type, Length, and 2105 Padding 2106 Reserved zero when sent, ignored when received 2107 Notify Message Specifies the type of notification 2108 Type 2109 Notification Informational or error data transmitted in addition 2110 Data to the Notify Message Type. Values for this field 2111 are type specific (see below). 2112 Padding Any Padding, if necessary, to make the parameter a 2113 multiple of 8 bytes. 2115 Notification information can be error messages specifying why an SA 2116 could not be established. It can also be status data that a process 2117 managing an SA database wishes to communicate with a peer process. 2118 The table below lists the Notification messages and their 2119 corresponding values. 2121 To avoid certain types of attacks, a Responder SHOULD avoid sending a 2122 NOTIFICATION to any host with which it has not successfully verified 2123 a puzzle solution. 2125 Types in the range 0 - 16383 are intended for reporting errors and in 2126 the range 16384 - 65535 for other status information. An 2127 implementation that receives a NOTIFY packet with an NOTIFICATION 2128 error parameter in response to a request packet (e.g., I1, I2, 2129 UPDATE), SHOULD assume that the corresponding request has failed 2130 entirely. Unrecognized error types MUST be ignored except that they 2131 SHOULD be logged. 2133 Notify payloads with status types MUST be ignored if not recognized. 2135 NOTIFICATION PARAMETER - ERROR TYPES Value 2136 ------------------------------------ ----- 2138 UNSUPPORTED_CRITICAL_PARAMETER_TYPE 1 2140 Sent if the parameter type has the "critical" bit set and the 2141 parameter type is not recognized. Notification Data contains 2142 the two octet parameter type. 2144 INVALID_SYNTAX 7 2146 Indicates that the HIP message received was invalid because 2147 some type, length, or value was out of range or because the 2148 request was rejected for policy reasons. To avoid a denial of 2149 service attack using forged messages, this status may only be 2150 returned for packets whose HMAC (if present) and SIGNATURE have 2151 been verified. This status MUST be sent in response to any 2152 error not covered by one of the other status types, and should 2153 not contain details to avoid leaking information to someone 2154 probing a node. To aid debugging, more detailed error 2155 information SHOULD be written to a console or log. 2157 NO_DH_PROPOSAL_CHOSEN 14 2159 None of the proposed group IDs was acceptable. 2161 INVALID_DH_CHOSEN 15 2163 The D-H Group ID field does not correspond to one offered 2164 by the Responder. 2166 NO_HIP_PROPOSAL_CHOSEN 16 2167 None of the proposed HIP Transform crypto suites was 2168 acceptable. 2170 INVALID_HIP_TRANSFORM_CHOSEN 17 2172 The HIP Transform crypto suite does not correspond to 2173 one offered by the Responder. 2175 AUTHENTICATION_FAILED 24 2177 Sent in response to a HIP signature failure, except when 2178 the signature verification fails in a NOTIFY message. 2180 CHECKSUM_FAILED 26 2182 Sent in response to a HIP checksum failure. 2184 HMAC_FAILED 28 2186 Sent in response to a HIP HMAC failure. 2188 ENCRYPTION_FAILED 32 2190 The Responder could not successfully decrypt the 2191 ENCRYPTED parameter. 2193 INVALID_HIT 40 2195 Sent in response to a failure to validate the peer's 2196 HIT from the corresponding HI. 2198 BLOCKED_BY_POLICY 42 2200 The Responder is unwilling to set up an association 2201 for some policy reason (e.g. received HIT is NULL 2202 and policy does not allow opportunistic mode). 2204 SERVER_BUSY_PLEASE_RETRY 44 2206 The Responder is unwilling to set up an association 2207 as it is suffering under some kind of overload and 2208 has chosen to shed load by rejecting your request. 2209 You may retry if you wish, however you MUST find 2210 another (different) puzzle solution for any such 2211 retries. Note that you may need to obtain a new 2212 puzzle with a new I1/R1 exchange. 2214 NOTIFY MESSAGES - STATUS TYPES Value 2215 ------------------------------ ----- 2217 I2_ACKNOWLEDGEMENT 16384 2219 The Responder has received your I2 but had to queue 2220 the I2 for processing. The puzzle was correctly solved 2221 and the Responder is willing to set up an association 2222 but has currently a number of I2s in processing queue. 2223 R2 will be sent after the I2 has been processed. 2225 5.2.17. ECHO_REQUEST_SIGNED 2227 0 1 2 3 2228 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 2229 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2230 | Type | Length | 2231 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2232 | Opaque data (variable length) | 2233 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2235 Type 897 2236 Length variable 2237 Opaque data Opaque data, supposed to be meaningful only to the 2238 node that sends ECHO_REQUEST_SIGNED and receives a 2239 corresponding ECHO_RESPONSE_SIGNED or 2240 ECHO_RESPONSE_UNSIGNED. 2242 The ECHO_REQUEST_SIGNED parameter contains an opaque blob of data 2243 that the sender wants to get echoed back in the corresponding reply 2244 packet. 2246 The ECHO_REQUEST_SIGNED and corresponding echo response parameters 2247 MAY be used for any purpose where a node wants to carry some state in 2248 a request packet and get it back in a response packet. The 2249 ECHO_REQUEST_SIGNED is covered by the HMAC and SIGNATURE. A HIP 2250 packet can contain only one ECHO_REQUEST_SIGNED or 2251 ECHO_REQUEST_UNSIGNED parameter. The ECHO_REQUEST_SIGNED parameter 2252 MUST be responded with a corresponding echo response. 2253 ECHO_RESPONSE_SIGNED SHOULD be used, but if it is not possible, e.g. 2254 due to a middle-box provided response, it MAY be responded with an 2255 ECHO_RESPONSE_UNSIGNED. 2257 5.2.18. ECHO_REQUEST_UNSIGNED 2259 0 1 2 3 2260 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 2261 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2262 | Type | Length | 2263 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2264 | Opaque data (variable length) | 2265 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2267 Type 63661 2268 Length variable 2269 Opaque data Opaque data, supposed to be meaningful only to the 2270 node that sends ECHO_REQUEST_UNSIGNED and receives a 2271 corresponding ECHO_RESPONSE_UNSIGNED. 2273 The ECHO_REQUEST_UNSIGNED parameter contains an opaque blob of data 2274 that the sender wants to get echoed back in the corresponding reply 2275 packet. 2277 The ECHO_REQUEST_UNSIGNED and corresponding echo response parameters 2278 MAY be used for any purpose where a node wants to carry some state in 2279 a request packet and get it back in a response packet. The 2280 ECHO_REQUEST_UNSIGNED is not covered by the HMAC and SIGNATURE. A 2281 HIP packet can contain one or more ECHO_REQUEST_UNSIGNED parameters. 2282 It is possible that middle-boxes add ECHO_REQUEST_UNSIGNED parameters 2283 in HIP packets passing by. The sender has to create the Opaque field 2284 so that it can later identify and remove the corresponding 2285 ECHO_RESPONSE_UNSIGNED parameter. 2287 The ECHO_REQUEST_UNSIGNED parameter MUST be responded with an 2288 ECHO_RESPONSE_UNSIGNED parameter. 2290 5.2.19. ECHO_RESPONSE_SIGNED 2292 0 1 2 3 2293 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 2294 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2295 | Type | Length | 2296 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2297 | Opaque data (variable length) | 2298 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2300 Type 961 2301 Length variable 2302 Opaque data Opaque data, copied unmodified from the 2303 ECHO_REQUEST_SIGNED or ECHO_REQUEST_UNSIGNED 2304 parameter that triggered this response. 2306 The ECHO_RESPONSE_SIGNED parameter contains an opaque blob of data 2307 that the sender of the ECHO_REQUEST_SIGNED wants to get echoed back. 2308 The opaque data is copied unmodified from the ECHO_REQUEST_SIGNED 2309 parameter. 2311 The ECHO_REQUEST_SIGNED and ECHO_RESPONSE_SIGNED parameters MAY be 2312 used for any purpose where a node wants to carry some state in a 2313 request packet and get it back in a response packet. The 2314 ECHO_RESPONSE_SIGNED is covered by the HMAC and SIGNATURE. 2316 5.2.20. ECHO_RESPONSE_UNSIGNED 2318 0 1 2 3 2319 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 2320 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2321 | Type | Length | 2322 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2323 | Opaque data (variable length) | 2324 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2326 Type 63425 2327 Length variable 2328 Opaque data Opaque data, copied unmodified from the 2329 ECHO_REQUEST_SIGNED or ECHO_REQUEST_UNSIGNED 2330 parameter that triggered this response. 2332 The ECHO_RESPONSE_UNSIGNED parameter contains an opaque blob of data 2333 that the sender of the ECHO_REQUEST_SIGNED or ECHO_REQUEST_UNSIGNED 2334 wants to get echoed back. The opaque data is copied unmodified from 2335 the corresponding echo request parameter. 2337 The echo request and ECHO_RESPONSE_UNSIGNED parameters MAY be used 2338 for any purpose where a node wants to carry some state in a request 2339 packet and get it back in a response packet. The 2340 ECHO_RESPONSE_UNSIGNED is not covered by the HMAC and SIGNATURE. 2342 5.3. HIP Packets 2344 There are eight basic HIP packets (see Table 11). Four are for the 2345 HIP base exchange, one is for updating, one is for sending 2346 notifications, and two for closing a HIP association. 2348 +------------------+------------------------------------------------+ 2349 | Packet type | Packet name | 2350 +------------------+------------------------------------------------+ 2351 | 1 | I1 - the HIP Initiator Packet | 2352 | | | 2353 | 2 | R1 - the HIP Responder Packet | 2354 | | | 2355 | 3 | I2 - the Second HIP Initiator Packet | 2356 | | | 2357 | 4 | R2 - the Second HIP Responder Packet | 2358 | | | 2359 | 16 | UPDATE - the HIP Update Packet | 2360 | | | 2361 | 17 | NOTIFY - the HIP Notify Packet | 2362 | | | 2363 | 18 | CLOSE - the HIP Association Closing Packet | 2364 | | | 2365 | 19 | CLOSE_ACK - the HIP Closing Acknowledgment | 2366 | | Packet | 2367 +------------------+------------------------------------------------+ 2369 Table 11: HIP packets and packet type numbers 2371 Packets consist of the fixed header as described in Section 5.1, 2372 followed by the parameters. The parameter part, in turn, consists of 2373 zero or more TLV coded parameters. 2375 In addition to the base packets, other packets types will be defined 2376 later in separate specifications. For example, support for mobility 2377 and multi-homing is not included in this specification. 2379 See Notation (Section 2.2) for used operations. 2381 In the future, an OPTIONAL upper layer payload MAY follow the HIP 2382 header. The Next Header field in the header indicates if there is 2383 additional data following the HIP header. The HIP packet, however, 2384 MUST NOT be fragmented. This limits the size of the possible 2385 additional data in the packet. 2387 5.3.1. I1 - the HIP Initiator Packet 2389 The HIP header values for the I1 packet: 2391 Header: 2392 Packet Type = 1 2393 SRC HIT = Initiator's HIT 2394 DST HIT = Responder's HIT, or NULL 2396 IP ( HIP () ) 2398 The I1 packet contains only the fixed HIP header. 2400 Valid control bits: none 2402 The Initiator gets the Responder's HIT either from a DNS lookup of 2403 the Responder's FQDN, from some other repository, or from a local 2404 table. If the Initiator does not know the Responder's HIT, it may 2405 attempt opportunistic mode by using NULL (all zeros) as the 2406 Responder's HIT. See also "HIP Opportunistic Mode" (Section 4.1.6)). 2408 Since this packet is so easy to spoof even if it were signed, no 2409 attempt is made to add to its generation or processing cost. 2411 Implementations MUST be able to handle a storm of received I1 2412 packets, discarding those with common content that arrive within a 2413 small time delta. 2415 5.3.2. R1 - the HIP Responder Packet 2417 The HIP header values for the R1 packet: 2419 Header: 2420 Packet Type = 2 2421 SRC HIT = Responder's HIT 2422 DST HIT = Initiator's HIT 2424 IP ( HIP ( [ R1_COUNTER, ] 2425 PUZZLE, 2426 DIFFIE_HELLMAN, 2427 HIP_TRANSFORM, 2428 HOST_ID, 2429 [ ECHO_REQUEST_SIGNED, ] 2430 HIP_SIGNATURE_2 ) 2431 <, ECHO_REQUEST_UNSIGNED >i) 2433 Valid control bits: A 2435 If the Responder HI is an anonymous one, the A control MUST be set. 2437 The Initiator HIT MUST match the one received in I1. If the 2438 Responder has multiple HIs, the Responder HIT used MUST match 2439 Initiator's request. If the Initiator used opportunistic mode, the 2440 Responder may select freely among its HIs. See also "HIP 2441 Opportunistic Mode" (Section 4.1.6)). 2443 The R1 generation counter is used to determine the currently valid 2444 generation of puzzles. The value is increased periodically, and it 2445 is RECOMMENDED that it is increased at least as often as solutions to 2446 old puzzles are no longer accepted. 2448 The Puzzle contains a random #I and the difficulty K. The difficulty 2449 K is the number of bits that the Initiator must get zero in the 2450 puzzle. The random #I is not covered by the signature and must be 2451 zeroed during the signature calculation, allowing the sender to 2452 select and set the #I into a pre-computed R1 just prior sending it to 2453 the peer. 2455 The Diffie-Hellman value is ephemeral, and one value SHOULD be used 2456 only for one connection. Once the Responder has received a valid 2457 response to an R1 packet, that Diffie-Hellman value SHOULD be 2458 deprecated. Because it is possible that the Responder has sent the 2459 same Diffie-Hellman value to different hosts simultaneously in 2460 corresponding R1 packets also those responses should be accepted. 2461 However, as a defense against I1 storms, an implementation MAY 2462 propose, and re-use if not avoidable, the same Diffie-Hellman value 2463 for a period of time, for example, 15 minutes. By using a small 2464 number of different puzzles for a given Diffie-Hellman value, the R1 2465 packets can be pre-computed and delivered as quickly as I1 packets 2466 arrive. A scavenger process should clean up unused DHs and puzzles. 2468 Re-using Diffie-Hellman public keys opens up the potential security 2469 risks of more than one Initiators ending up with the same keying 2470 material (due to faulty random number generators), and more than one 2471 Initiators using the same Responder public key half, thereby leading 2472 to potentially easier cryptographic attacks and the risk of not 2473 having perfect forward security. 2475 However, these risks involved in re-using the same key are 2476 statistical; that is, authors are not aware of any mechanism that 2477 would allow manipulation of the protocol so that the risk of the re- 2478 use of a any given Responder Diffie-Hellman public key would differ 2479 from the base probability. Consequently, it is RECOMMENDED that 2480 implementations avoid re-using the same D-H key with multiple 2481 Initiators, but because the risk is considered statistical and not 2482 known to be manipulable, the implementations MAY re-use a key in 2483 order to ease resource constraint implementations and to increase the 2484 probability of successful communication with legitimate clients even 2485 under an I1 storm. In particular, when it is too expensive to 2486 generate enough of pre-computed R1 packets to supply each potential 2487 Initiator with a different Diffie-Hellman key, the Responder MAY send 2488 the same Diffie-Hellman key to several Initiators, thereby creating 2489 the possibility of multiple legitimate Initiators ending up using the 2490 same Responder-side public key. However, as soon as the Responder 2491 knows that it will use a particular Diffie-Hellman key, it SHOULD 2492 stop offering it. This design is aimed to allow resource-constrained 2493 Responders to offer services under I1 storms and to simultaneously 2494 make the probability of Diffie-Hellman key re-use both statistical 2495 and as low as possible. 2497 If a future version of this protocol is considered, we strongly 2498 recommend that these issues shall be studied again. Especially, the 2499 current design allows hosts to become potentially more vulnerable to 2500 a statistical, low-probability problem during I1 storm attacks than 2501 what they are if no attack is taking place; whether this is 2502 acceptable or not should be reconsidered in the light of any new 2503 experience gained. 2505 The HIP_TRANSFORM contains the encryption and integrity algorithms 2506 supported by the Responder to protect the HI exchange, in the order 2507 of preference. All implementations MUST support the AES [RFC3602] 2508 with HMAC-SHA-1-96 [RFC2404]. 2510 The ECHO_REQUEST_SIGNED and ECHO_REQUEST_UNSIGNED contains data that 2511 the sender wants to receive unmodified in the corresponding response 2512 packet in the ECHO_RESPONSE_SIGNED or ECHO_RESPONSE_UNSIGNED 2513 parameter. 2515 The signature is calculated over the whole HIP envelope, after 2516 setting the Initiator HIT, header checksum as well as the Opaque 2517 field and the Random #I in the PUZZLE parameter temporarily to zero, 2518 and excluding any parameters that follow the signature, as described 2519 in Section 5.2.12. This allows the Responder to use precomputed R1s. 2520 The Initiator SHOULD validate this signature. It SHOULD check that 2521 the Responder HI received matches with the one expected, if any. 2523 5.3.3. I2 - the Second HIP Initiator Packet 2525 The HIP header values for the I2 packet: 2527 Header: 2528 Type = 3 2529 SRC HIT = Initiator's HIT 2530 DST HIT = Responder's HIT 2532 IP ( HIP ( [R1_COUNTER,] 2533 SOLUTION, 2534 DIFFIE_HELLMAN, 2535 HIP_TRANSFORM, 2536 ENCRYPTED { HOST_ID } or HOST_ID, 2537 [ ECHO_RESPONSE_SIGNED ,] 2538 HMAC, 2539 HIP_SIGNATURE 2540 <, ECHO_RESPONSE_UNSIGNED>i ) ) 2542 Valid control bits: A 2544 The HITs used MUST match the ones used previously. 2546 If the Initiator HI is an anonymous one, the A control MUST be set. 2548 The Initiator MAY include an unmodified copy of the R1_COUNTER 2549 parameter received in the corresponding R1 packet into the I2 packet. 2551 The Solution contains the random # I from R1 and the computed # J. 2552 The low order K bits of the RHASH(I | ... | J) MUST be zero. 2554 The Diffie-Hellman value is ephemeral. If precomputed, a scavenger 2555 process should clean up unused DHs. The Responder may re-use Diffie- 2556 Hellman values under some conditions as specified in Section 5.3.2. 2558 The HIP_TRANSFORM contains the single encryption and integrity 2559 transform selected by the Initiator, that will be used to protect the 2560 HI exchange. The chosen transform MUST correspond to one offered by 2561 the Responder in the R1. All implementations MUST support the AES 2562 transform [RFC3602]. 2564 The Initiator's HI MAY be encrypted using the HIP_TRANSFORM 2565 encryption algorithm. The keying material is derived from the 2566 Diffie-Hellman exchanged as defined in Section 6.5. 2568 The ECHO_RESPONSE_SIGNED and ECHO_RESPONSE_UNSIGNED contains the 2569 unmodified Opaque data copied from the corresponding echo request 2570 parameter. 2572 The HMAC is calculated over whole HIP envelope, excluding any 2573 parameters after the HMAC, as described in Section 6.4.1. The 2574 Responder MUST validate the HMAC. 2576 The signature is calculated over whole HIP envelope, excluding any 2577 parameters after the HIP_SIGNATURE, as described in Section 5.2.11. 2578 The Responder MUST validate this signature. It MAY use either the HI 2579 in the packet or the HI acquired by some other means. 2581 5.3.4. R2 - the Second HIP Responder Packet 2583 The HIP header values for the R2 packet: 2585 Header: 2586 Packet Type = 4 2587 SRC HIT = Responder's HIT 2588 DST HIT = Initiator's HIT 2590 IP ( HIP ( HMAC_2, HIP_SIGNATURE ) ) 2592 Valid control bits: none 2594 The HMAC_2 is calculated over whole HIP envelope, with Responder's 2595 HOST_ID parameter concatenated with the HIP envelope. The HOST_ID 2596 parameter is removed after the HMAC calculation. The procedure is 2597 described in Section 6.4.1. 2599 The signature is calculated over whole HIP envelope. 2601 The Initiator MUST validate both the HMAC and the signature. 2603 5.3.5. UPDATE - the HIP Update Packet 2605 Support for the UPDATE packet is MANDATORY. 2607 The HIP header values for the UPDATE packet: 2609 Header: 2610 Packet Type = 16 2611 SRC HIT = Sender's HIT 2612 DST HIT = Recipient's HIT 2614 IP ( HIP ( [SEQ, ACK, ] HMAC, HIP_SIGNATURE ) ) 2616 Valid control bits: None 2618 The UPDATE packet contains mandatory HMAC and HIP_SIGNATURE 2619 parameters, and other optional parameters. 2621 The UPDATE packet contains zero or one SEQ parameter. The presence 2622 of a SEQ parameter indicates that the receiver MUST ACK the UPDATE. 2623 An UPDATE that does not contain a SEQ parameter is simply an ACK of a 2624 previous UPDATE and itself MUST NOT be ACKed. 2626 An UPDATE packet contains zero or one ACK parameters. The ACK 2627 parameter echoes the SEQ sequence number of the UPDATE packet being 2628 ACKed. A host MAY choose to ACK more than one UPDATE packet at a 2629 time; e.g., the ACK may contain the last two SEQ values received, for 2630 robustness to ACK loss. ACK values are not cumulative; each received 2631 unique SEQ value requires at least one corresponding ACK value in 2632 reply. Received ACKs that are redundant are ignored. 2634 The UPDATE packet may contain both a SEQ and an ACK parameter. In 2635 this case, the ACK is being piggybacked on an outgoing UPDATE. In 2636 general, UPDATEs carrying SEQ SHOULD be ACKed upon completion of the 2637 processing of the UPDATE. A host MAY choose to hold the UPDATE 2638 carrying ACK for a short period of time to allow for the possibility 2639 of piggybacking the ACK parameter, in a manner similar to TCP delayed 2640 acknowledgments. 2642 A sender MAY choose to forgo reliable transmission of a particular 2643 UPDATE (e.g., it becomes overcome by events). The semantics are such 2644 that the receiver MUST acknowledge the UPDATE but the sender MAY 2645 choose to not care about receiving the ACK. 2647 UPDATEs MAY be retransmitted without incrementing SEQ. If the same 2648 subset of parameters is included in multiple UPDATEs with different 2649 SEQs, the host MUST ensure that receiver processing of the parameters 2650 multiple times will not result in a protocol error. 2652 5.3.6. NOTIFY - the HIP Notify Packet 2654 The NOTIFY packet is OPTIONAL. The NOTIFY packet MAY be used to 2655 provide information to a peer. Typically, NOTIFY is used to indicate 2656 some type of protocol error or negotiation failure. NOTIFY packets 2657 are unacknowledged. The receiver can handle the packet only as 2658 informational, and SHOULD NOT change its HIP state (Section 4.4.1) 2659 based purely on a received NOTIFY packet. 2661 The HIP header values for the NOTIFY packet: 2663 Header: 2664 Packet Type = 17 2665 SRC HIT = Sender's HIT 2666 DST HIT = Recipient's HIT, or zero if unknown 2668 IP ( HIP (i, [HOST_ID, ] HIP_SIGNATURE) ) 2670 Valid control bits: None 2672 The NOTIFY packet is used to carry one or more NOTIFICATION 2673 parameters. 2675 5.3.7. CLOSE - the HIP Association Closing Packet 2677 The HIP header values for the CLOSE packet: 2679 Header: 2680 Packet Type = 18 2681 SRC HIT = Sender's HIT 2682 DST HIT = Recipient's HIT 2684 IP ( HIP ( ECHO_REQUEST_SIGNED, HMAC, HIP_SIGNATURE ) ) 2686 Valid control bits: none 2688 The sender MUST include an ECHO_REQUEST_SIGNED used to validate 2689 CLOSE_ACK received in response, and both an HMAC and a signature 2690 (calculated over the whole HIP envelope). 2692 The receiver peer MUST validate both the HMAC and the signature if it 2693 has a HIP association state, and MUST reply with a CLOSE_ACK 2694 containing an ECHO_RESPONSE_SIGNED corresponding to the received 2695 ECHO_REQUEST_SIGNED. 2697 5.3.8. CLOSE_ACK - the HIP Closing Acknowledgment Packet 2699 The HIP header values for the CLOSE_ACK packet: 2701 Header: 2702 Packet Type = 19 2703 SRC HIT = Sender's HIT 2704 DST HIT = Recipient's HIT 2706 IP ( HIP ( ECHO_RESPONSE_SIGNED, HMAC, HIP_SIGNATURE ) ) 2708 Valid control bits: none 2710 The sender MUST include both an HMAC and signature (calculated over 2711 the whole HIP envelope). 2713 The receiver peer MUST validate both the HMAC and the signature. 2715 5.4. ICMP Messages 2717 When a HIP implementation detects a problem with an incoming packet, 2718 and it either cannot determine the identity of the sender of the 2719 packet or does not have any existing HIP association with the sender 2720 of the packet, it MAY respond with an ICMP packet. Any such replies 2721 MUST be rate limited as described in [RFC1885]. In most cases, the 2722 ICMP packet will have the Parameter Problem type (12 for ICMPv4, 4 2723 for ICMPv6), with the Pointer field pointing to the field that caused 2724 the ICMP message to be generated. 2726 5.4.1. Invalid Version 2728 If a HIP implementation receives a HIP packet that has an 2729 unrecognized HIP version number, it SHOULD respond, rate limited, 2730 with an ICMP packet with type Parameter Problem, the Pointer pointing 2731 to the VER./RES. byte in the HIP header. 2733 5.4.2. Other Problems with the HIP Header and Packet Structure 2735 If a HIP implementation receives a HIP packet that has other 2736 unrecoverable problems in the header or packet format, it MAY 2737 respond, rate limited, with an ICMP packet with type Parameter 2738 Problem, the Pointer pointing to the field that failed to pass the 2739 format checks. However, an implementation MUST NOT send an ICMP 2740 message if the Checksum fails; instead, it MUST silently drop the 2741 packet. 2743 5.4.3. Invalid Puzzle Solution 2745 If a HIP implementation receives an I2 packet that has an invalid 2746 puzzle solution, the behavior depends on the underlying version of 2747 IP. If IPv6 is used, the implementation SHOULD respond with an ICMP 2748 packet with type Parameter Problem, the Pointer pointing to the 2749 beginning of the Puzzle solution #J field in the SOLUTION payload in 2750 the HIP message. 2752 If IPv4 is used, the implementation MAY respond with an ICMP packet 2753 with the type Parameter Problem, copying enough of bytes from the I2 2754 message so that the SOLUTION parameter fits into the ICMP message, 2755 the Pointer pointing to the beginning of the Puzzle solution #J 2756 field, as in the IPv6 case. Note, however, that the resulting ICMPv4 2757 message exceeds the typical ICMPv4 message size as defined in 2758 [RFC0792]. 2760 5.4.4. Non-existing HIP Association 2762 If a HIP implementation receives a CLOSE, or UPDATE packet, or any 2763 other packet whose handling requires an existing association, that 2764 has either a Receiver or Sender HIT that does not match with any 2765 existing HIP association, the implementation MAY respond, rate 2766 limited, with an ICMP packet with the type Parameter Problem, the 2767 Pointer pointing to the beginning of the first HIT that does not 2768 match. 2770 A host MUST NOT reply with such an ICMP if it receives any of the 2771 following messages: I1, R2, I2, R2, and NOTIFY. When introducing new 2772 packet types, a specification SHOULD define the appropriate rules for 2773 sending or not sending this kind of ICMP replies. 2775 6. Packet Processing 2777 Each host is assumed to have a single HIP protocol implementation 2778 that manages the host's HIP associations and handles requests for new 2779 ones. Each HIP association is governed by a conceptual state 2780 machine, with states defined above in Section 4.4. The HIP 2781 implementation can simultaneously maintain HIP associations with more 2782 than one host. Furthermore, the HIP implementation may have more 2783 than one active HIP association with another host; in this case, HIP 2784 associations are distinguished by their respective HITs. It is not 2785 possible to have more than one HIP association between any given pair 2786 of HITs. Consequently, the only way for two hosts to have more than 2787 one parallel association is to use different HITs, at least at one 2788 end. 2790 The processing of packets depends on the state of the HIP 2791 association(s) with respect to the authenticated or apparent 2792 originator of the packet. A HIP implementation determines whether it 2793 has an active association with the originator of the packet based on 2794 the HITs. In the case of user data carried in a specific transport 2795 format, the transport format document specifies how the incoming 2796 packets are matched with the active associations. 2798 6.1. Processing Outgoing Application Data 2800 In a HIP host, an application can send application level data using 2801 an identifier specified via the underlying API. The API can be a 2802 backwards compatible API (see [I-D.henderson-hip-applications]), 2803 using identifiers that look similar to IP addresses, or a completely 2804 new API, providing enhanced services related to Host Identities. 2805 Depending on the HIP implementation, the identifier provided to the 2806 application may be different; it can be e.g. a HIT or an IP address. 2808 The exact format and method for transferring the data from the source 2809 HIP host to the destination HIP host is defined in the corresponding 2810 transport format document. The actual data is transferred in the 2811 network using the appropriate source and destination IP addresses. 2813 In this document, conceptual processing rules are defined only for 2814 the base case where both hosts have only single usable IP addresses; 2815 the multi-address multi-homing case will be specified separately. 2817 The following conceptual algorithm describes the steps that are 2818 required for handling outgoing datagrams destined to a HIT. 2820 1. If the datagram has a specified source address, it MUST be a HIT. 2821 If it is not, the implementation MAY replace the source address 2822 with a HIT. Otherwise it MUST drop the packet. 2824 2. If the datagram has an unspecified source address, the 2825 implementation must choose a suitable source HIT for the 2826 datagram. 2828 3. If there is no active HIP association with the given < source, 2829 destination > HIT pair, one must be created by running the base 2830 exchange. While waiting for the base exchange to complete, the 2831 implementation SHOULD queue at least one packet per HIP 2832 association to be formed, and it MAY queue more than one. 2834 4. Once there is an active HIP association for the given < source, 2835 destination > HIT pair, the outgoing datagram is passed to 2836 transport handling. The possible transport formats are defined 2837 in separate documents, of which the ESP transport format for HIP 2838 is mandatory for all HIP implementations. 2840 5. Before sending the packet, the HITs in the datagram are replaced 2841 with suitable IP addresses. For IPv6, the rules defined in 2842 [RFC3484] SHOULD be followed. Note that this HIT-to-IP-address 2843 conversion step MAY also be performed at some other point in the 2844 stack, e.g., before wrapping the packet into the output format. 2846 6.2. Processing Incoming Application Data 2848 The following conceptual algorithm describes the incoming datagram 2849 handling when HITs are used at the receiving host as application 2850 level identifiers. More detailed steps for processing packets are 2851 defined in corresponding transport format documents. 2853 1. The incoming datagram is mapped to an existing HIP association, 2854 typically using some information from the packet. For example, 2855 such mapping may be based on ESP Security Parameter Index (SPI). 2857 2. The specific transport format is unwrapped, in a way depending on 2858 the transport format, yielding a packet that looks like a 2859 standard (unencrypted) IP packet. If possible, this step SHOULD 2860 also verify that the packet was indeed (once) sent by the remote 2861 HIP host, as identified by the HIP association. 2863 Depending on the used transport mode, the verification method can 2864 vary. While the HI (as well as HIT) is used as the higher layer 2865 identifier, the verification method has to verify that the data 2866 packet was sent by a node identity and that the actual identity 2867 maps to this particular HIT. When using ESP transport format 2868 [I-D.ietf-hip-esp], the verification is done using the SPI value 2869 in the data packet to find the corresponding SA with associated 2870 HIT and key, and decrypting the packet with that associated key. 2872 3. The IP addresses in the datagram are replaced with the HITs 2873 associated with the HIP association. Note that this IP-address- 2874 to-HIT conversion step MAY also be performed at some other point 2875 in the stack. 2877 4. The datagram is delivered to the upper layer. Demultiplexing the 2878 datagram the right upper layer socket is based on the HITs. 2880 6.3. Solving the Puzzle 2882 This subsection describes the puzzle solving details. 2884 In R1, the values I and K are sent in network byte order. Similarly, 2885 in I2 the values I and J are sent in network byte order. The hash is 2886 created by concatenating, in network byte order, the following data, 2887 in the following order and using the RHASH algorithm: 2889 64-bit random value I, in network byte order, as appearing in R1 2890 and I2. 2892 128-bit Initiator HIT, in network byte order, as appearing in the 2893 HIP Payload in R1 and I2. 2895 128-bit Responder HIT, in network byte order, as appearing in the 2896 HIP Payload in R1 and I2. 2898 64-bit random value J, in network byte order, as appearing in I2. 2900 In order to be a valid response puzzle, the K low-order bits of the 2901 resulting RHASH digest must be zero. 2903 Notes: 2905 i) The length of the data to be hashed is 48 bytes. 2907 ii) All the data in the hash input MUST be in network byte order. 2909 iii) The order of the Initiator and Responder HITs are different 2910 in the R1 and I2 packets, see Section 5.1. Care must be taken to 2911 copy the values in right order to the hash input. 2913 The following procedure describes the processing steps involved, 2914 assuming that the Responder chooses to precompute the R1 packets: 2916 Precomputation by the Responder: 2917 Sets up the puzzle difficulty K. 2918 Creates a signed R1 and caches it. 2920 Responder: 2921 Selects a suitable cached R1. 2922 Generates a random number I. 2923 Sends I and K in an R1. 2924 Saves I and K for a Delta time. 2926 Initiator: 2927 Generates repeated attempts to solve the puzzle until a matching J 2928 is found: 2929 Ltrunc( RHASH( I | HIT-I | HIT-R | J ), K ) == 0 2930 Sends I and J in an I2. 2932 Responder: 2933 Verifies that the received I is a saved one. 2934 Finds the right K based on I. 2935 Computes V := Ltrunc( RHASH( I | HIT-I | HIT-R | J ), K ) 2936 Rejects if V != 0 2937 Accept if V == 0 2939 6.4. HMAC and SIGNATURE Calculation and Verification 2941 The following subsections define the actions for processing HMAC, 2942 HIP_SIGNATURE and HIP_SIGNATURE_2 parameters. 2944 6.4.1. HMAC Calculation 2946 The following process applies both to the HMAC and HMAC_2 parameters. 2947 When processing HMAC_2, the difference is that the HMAC calculation 2948 includes a pseudo HOST_ID field containing the Responder's 2949 information as sent in the R1 packet earlier. 2951 Both the Initiator and the Responder should take some care when 2952 verifying or calculating the HMAC_2. Specifically, the Responder 2953 should preserve other parameters than the HOST_ID when sending the 2954 R2. Also, the Initiator has to preserve the HOST_ID exactly as it 2955 was received in the R1 packet. 2957 The scope of the calculation for HMAC and HMAC_2 is: 2959 HMAC: { HIP header | [ Parameters ] } 2961 where Parameters include all HIP parameters of the packet that is 2962 being calculated with Type values from 1 to (HMAC's Type value - 1) 2963 and exclude parameters with Type values greater or equal to HMAC's 2964 Type value. 2966 During HMAC calculation, the following applies: 2968 o In HIP header, Checksum field is set to zero. 2970 o In HIP header, the Header Length field value is calculated to the 2971 beginning of the HMAC parameter. 2973 Parameter order is described in Section 5.2.1. 2975 HMAC_2: { HIP header | [ Parameters ] | HOST_ID } 2977 where Parameters include all HIP parameters for the packet that is 2978 being calculated with Type values from 1 to (HMAC_2's Type value - 1) 2979 and exclude parameters with Type values greater or equal to HMAC_2's 2980 Type value. 2982 During HMAC_2 calculation, the following applies: 2984 o In HIP header, Checksum field is set to zero. 2986 o In HIP header, the Header Length field value is calculated to the 2987 beginning of the HMAC_2 parameter and added with the length of the 2988 concatenated HOST_ID parameter length. 2990 o HOST_ID parameter is exactly in the form it was received in the R1 2991 packet from the Responder. 2993 Parameter order is described in Section 5.2.1, except that HOST_ID 2994 parameter in this calculation is added to the end. 2996 The HMAC parameter is defined in Section 5.2.9 and HMAC_2 parameter 2997 in Section 5.2.10. HMAC calculation and verification process (the 2998 process applies both to HMAC and HMAC_2 except where HMAC_2 is 2999 mentioned separately) : 3001 Packet sender: 3003 1. Create the HIP packet, without the HMAC, HIP_SIGNATURE, 3004 HIP_SIGNATURE_2, or any other parameter with greater Type value 3005 than the HMAC parameter has. 3007 2. In case of HMAC_2 calculation, add a HOST_ID (Responder) 3008 parameter to the end of the packet. 3010 3. Calculate the Header Length field in the HIP header including the 3011 added HOST_ID parameter in case of HMAC_2. 3013 4. Compute the HMAC using either HIP-gl or HIP-lg integrity key 3014 retrieved from KEYMAT as defined in Section 6.5. 3016 5. In case of HMAC_2, remove the HOST_ID parameter from the packet. 3018 6. Add the HMAC parameter to the packet and any parameter with 3019 greater Type value than the HMAC's (HMAC_2's) that may follow, 3020 including possible HIP_SIGNATURE or HIP_SIGNATURE_2 parameters 3022 7. Recalculate the Length field in the HIP header. 3024 Packet receiver: 3026 1. Verify the HIP header Length field. 3028 2. Remove the HMAC or HMAC_2 parameter, as well as all other 3029 parameters that follow it with greater Type value including 3030 possible HIP_SIGNATURE or HIP_SIGNATURE_2 fields, saving the 3031 contents if they will be needed later. 3033 3. In case of HMAC_2, build and add a HOST_ID parameter (with 3034 Responder information) to the packet. The HOST_ID parameter 3035 should be identical to the one previously received from the 3036 Responder. 3038 4. Recalculate the HIP packet length in the HIP header and clear the 3039 Checksum field (set it to all zeros). In case of HMAC_2, the 3040 length is calculated with the added HOST_ID parameter. 3042 5. Compute the HMAC using either HIP-gl or HIP-lg integrity key as 3043 defined in Section 6.5 and verify it against the received HMAC. 3045 6. Set Checksum and Header Length field in HIP header to original 3046 values. 3048 7. In case of HMAC_2, remove the HOST_ID parameter from the packet 3049 before further processing. 3051 6.4.2. Signature Calculation 3053 The following process applies both to the HIP_SIGNATURE and 3054 HIP_SIGNATURE_2 parameters. When processing HIP_SIGNATURE_2, the 3055 only difference is that instead of HIP_SIGNATURE parameter, the 3056 HIP_SIGNATURE_2 parameter is used, and the Initiator's HIT and PUZZLE 3057 Opaque and Random #I fields are cleared (set to all zeros) before 3058 computing the signature. The HIP_SIGNATURE parameter is defined in 3059 Section 5.2.11 and the HIP_SIGNATURE_2 parameter in Section 5.2.12. 3061 The scope of the calculation for HIP_SIGNATURE and HIP_SIGNATURE_2 3062 is: 3064 HIP_SIGNATURE: { HIP header | [ Parameters ] } 3066 where Parameters include all HIP parameters for the packet that is 3067 being calculated with Type values from 1 to (HIP_SIGNATURE's Type 3068 value - 1). 3070 During signature calculation, the following apply: 3072 o In HIP header, Checksum field is set to zero. 3074 o In HIP header, the Header Length field value is calculated to the 3075 beginning of the HIP_SIGNATURE parameter. 3077 Parameter order is described in Section 5.2.1. 3079 HIP_SIGNATURE_2: { HIP header | [ Parameters ] } 3081 where Parameters include all HIP parameters for the packet that is 3082 being calculated with Type values from 1 to (HIP_SIGNATURE_2's Type 3083 value - 1). 3085 During signature calculation, the following apply: 3087 o In HIP header, Initiator's HIT field and Checksum fields are set 3088 to zero. 3090 o In HIP header, the Header Length field value is calculated to the 3091 beginning of the HIP_SIGNATURE_2 parameter. 3093 o PUZZLE parameter's Opaque and Random #I fields are set to zero. 3095 Parameter order is described in Section 5.2.1. 3097 Signature calculation and verification process (the process applies 3098 both to HIP_SIGNATURE and HIP_SIGNATURE_2 except in case where 3099 HIP_SIGNATURE_2 is separately mentioned): 3101 Packet sender: 3103 1. Create the HIP packet without the HIP_SIGNATURE parameter or any 3104 parameters that follow the HIP_SIGNATURE parameter. 3106 2. Calculate the Length field and zero the Checksum field in the HIP 3107 header. In case of HIP_SIGNATURE_2, set Initiator's HIT field in 3108 HIP header as well as PUZZLE parameter's Opaque and Random #I 3109 fields to zero. 3111 3. Compute the signature using the private key corresponding to the 3112 Host Identifier (public key). 3114 4. Add the HIP_SIGNATURE parameter to the packet. 3116 5. Add any parameters that follow the HIP_SIGNATURE parameter. 3118 6. Recalculate the Length field in the HIP header, and calculate the 3119 Checksum field. 3121 Packet receiver: 3123 1. Verify the HIP header Length field. 3125 2. Save the contents of the HIP_SIGNATURE parameter and any 3126 parameters following the HIP_SIGNATURE parameter and remove them 3127 from the packet. 3129 3. Recalculate the HIP packet Length in the HIP header and clear the 3130 Checksum field (set it to all zeros). In case of 3131 HIP_SIGNATURE_2, set Initiator's HIT field in HIP header as well 3132 as PUZZLE parameter's Opaque and Random #I fields to zero. 3134 4. Compute the signature and verify it against the received 3135 signature using the packet sender's Host Identifier (public key). 3137 5. Restore the original packet by adding removed parameters (in step 3138 2) and resetting the values that were set to zero (in step 3). 3140 The verification can use either the HI received from a HIP packet, 3141 the HI from a DNS query, if the FQDN has been received in the HOST_ID 3142 packet, or one received by some other means. 3144 6.5. HIP KEYMAT Generation 3146 HIP keying material is derived from the Diffie-Hellman session key, 3147 Kij, produced during the HIP base exchange (Section 4.1.3). The 3148 Initiator has Kij during the creation of the I2 packet, and the 3149 Responder has Kij once it receives the I2 packet. This is why I2 can 3150 already contain encrypted information. 3152 The KEYMAT is derived by feeding Kij and the HITs into the following 3153 operation; the | operation denotes concatenation. 3155 KEYMAT = K1 | K2 | K3 | ... 3156 where 3158 K1 = RHASH( Kij | sort(HIT-I | HIT-R) | I | J | 0x01 ) 3159 K2 = RHASH( Kij | K1 | 0x02 ) 3160 K3 = RHASH( Kij | K2 | 0x03 ) 3161 ... 3162 K255 = RHASH( Kij | K254 | 0xff ) 3163 K256 = RHASH( Kij | K255 | 0x00 ) 3164 etc. 3166 Sort(HIT-I | HIT-R) is defined as the network byte order 3167 concatenation of the two HITs, with the smaller HIT preceding the 3168 larger HIT, resulting from the numeric comparison of the two HITs 3169 interpreted as positive (unsigned) 128-bit integers in network byte 3170 order. 3172 I and J values are from the puzzle and its solution that were 3173 exchanged in R1 and I2 messages when this HIP association was set up. 3174 Both hosts have to store I and J values for the HIP association for 3175 future use. 3177 The initial keys are drawn sequentially in the order that is 3178 determined by the numeric comparison of the two HITs, with comparison 3179 method described in the previous paragraph. HOST_g denotes the host 3180 with the greater HIT value, and HOST_l the host with the lower HIT 3181 value. 3183 The drawing order for initial keys: 3185 HIP-gl encryption key for HOST_g's outgoing HIP packets 3187 HIP-gl integrity (HMAC) key for HOST_g's outgoing HIP packets 3189 HIP-lg encryption key (currently unused) for HOST_l's outgoing HIP 3190 packets 3192 HIP-lg integrity (HMAC) key for HOST_l's outgoing HIP packets 3194 The number of bits drawn for a given algorithm is the "natural" size 3195 of the keys. For the mandatory algorithms, the following sizes 3196 apply: 3198 AES 128 bits 3199 SHA-1 160 bits 3201 NULL 0 bits 3203 If other key sizes are used, they must be treated as different 3204 encryption algorithms and defined separately. 3206 6.6. Initiation of a HIP Exchange 3208 An implementation may originate a HIP exchange to another host based 3209 on a local policy decision, usually triggered by an application 3210 datagram, in much the same way that an IPsec IKE key exchange can 3211 dynamically create a Security Association. Alternatively, a system 3212 may initiate a HIP exchange if it has rebooted or timed out, or 3213 otherwise lost its HIP state, as described in Section 4.5.4. 3215 The implementation prepares an I1 packet and sends it to the IP 3216 address that corresponds to the peer host. The IP address of the 3217 peer host may be obtained via conventional mechanisms, such as DNS 3218 lookup. The I1 contents are specified in Section 5.3.1. The 3219 selection of which host identity to use, if a host has more than one 3220 to choose from, is typically a policy decision. 3222 The following steps define the conceptual processing rules for 3223 initiating a HIP exchange: 3225 1. The Initiator gets the Responder's HIT and one or more addresses 3226 either from a DNS lookup of the Responder's FQDN, from some other 3227 repository, or from a local table. If the Initiator does not 3228 know the Responder's HIT, it may attempt opportunistic mode by 3229 using NULL (all zeros) as the Responder's HIT. See also "HIP 3230 Opportunistic Mode" (Section 4.1.6). 3232 2. The Initiator sends an I1 to one of the Responder's addresses. 3233 The selection of which address to use is a local policy decision. 3235 3. Upon sending an I1, the sender shall transition to state I1-SENT, 3236 start a timer whose timeout value should be larger than the 3237 worst-case anticipated RTT, and shall increment a timeout counter 3238 associated with the I1. 3240 4. Upon timeout, the sender SHOULD retransmit the I1 and restart the 3241 timer, up to a maximum of I1_RETRIES_MAX tries. 3243 6.6.1. Sending Multiple I1s in Parallel 3245 For the sake of minimizing the session establishment latency, an 3246 implementation MAY send the same I1 to more than one of the 3247 Responder's addresses. However, it MUST NOT send to more than three 3248 (3) addresses in parallel. Furthermore, upon timeout, the 3249 implementation MUST refrain from sending the same I1 packet to 3250 multiple addresses. I.e. if it retries to initialize the connection 3251 after timeout, it MUST NOT send the I1 packet to more than one 3252 destination address. These limitations are placed in order to avoid 3253 congestion of the network, and potential DoS attacks that might 3254 happen, e.g., because someone claims to have hundreds or thousands of 3255 addresses which possibly could generate a huge number of I1 messages 3256 from the Initiator. 3258 As the Responder is not guaranteed to distinguish the duplicate I1's 3259 it receives at several of its addresses (because it avoids to store 3260 states when it answers back an R1), the Initiator may receive several 3261 duplicate R1's. 3263 The Initiator SHOULD then select the initial preferred destination 3264 address using the source address of the selected received R1, and use 3265 the preferred address as a source address for the I2. Processing 3266 rules for received R1s are discussed in Section 6.8. 3268 6.6.2. Processing Incoming ICMP Protocol Unreachable Messages 3270 A host may receive an ICMP Destination Protocol Unreachable message 3271 as a response to sending a HIP I1 packet. Such a packet may be an 3272 indication that the peer does not support HIP, or it may be an 3273 attempt to launch an attack by making the Initiator believe that the 3274 Responder does not support HIP. 3276 When a system receives an ICMP Destination Protocol Unreachable 3277 message while it is waiting for an R1, it MUST NOT terminate the 3278 wait. It MAY continue as if it had not received the ICMP message, 3279 and send a few more I1s. Alternatively, it MAY take the ICMP message 3280 as a hint that the peer most probably does not support HIP, and 3281 return to state UNASSOCIATED earlier than otherwise. However, at 3282 minimum, it MUST continue waiting for an R1 for a reasonable time 3283 before returning to UNASSOCIATED. 3285 6.7. Processing Incoming I1 Packets 3287 An implementation SHOULD reply to an I1 with an R1 packet, unless the 3288 implementation is unable or unwilling to setup a HIP association. If 3289 the implementation is unable to setup a HIP association, the host 3290 SHOULD send an ICMP Destination Protocol Unreachable, 3291 Administratively Prohibited, message to the I1 source address. If 3292 the implementation is unwilling to setup a HIP association, the host 3293 MAY ignore the I1. This latter case may occur during a DoS attack 3294 such as an I1 flood. 3296 The implementation MUST be able to handle a storm of received I1 3297 packets, discarding those with common content that arrive within a 3298 small time delta. 3300 A spoofed I1 can result in an R1 attack on a system. An R1 sender 3301 MUST have a mechanism to rate limit R1s to an address. 3303 It is RECOMMENDED that the HIP state machine does not transition upon 3304 sending an R1. 3306 The following steps define the conceptual processing rules for 3307 responding to an I1 packet: 3309 1. The Responder MUST check that the Responder HIT in the received 3310 I1 is either one of its own HITs, or NULL. 3312 2. If the Responder is in ESTABLISHED state, the Responder MAY 3313 respond to this with an R1 packet, prepare to drop existing SAs 3314 and stay at ESTABLISHED state. 3316 3. If the Responder is in I1-SENT state, it must make a comparison 3317 between the sender's HIT and its own (i.e., the receiver's) HIT. 3318 If the sender's HIT is greater than its own HIT, it should drop 3319 the I1 and stay at I1-SENT. If the sender's HIT is smaller than 3320 its own HIT, it should send R1 and stay at I1-SENT. The HIT 3321 comparison goes similarly as in Section 6.5. 3323 4. If the implementation chooses to respond to the I1 with an R1 3324 packet, it creates a new R1 or selects a precomputed R1 according 3325 to the format described in Section 5.3.2. 3327 5. The R1 MUST contain the received Responder HIT, unless the 3328 received HIT is NULL, in which case the Responder SHOULD select a 3329 HIT that is constructed with the MUST algorithm in Section 3, 3330 which is currently RSA. Other than that, selecting the HIT is a 3331 local policy matter. 3333 6. The Responder sends the R1 to the source IP address of the I1 3334 packet. 3336 6.7.1. R1 Management 3338 All compliant implementations MUST produce R1 packets. An R1 packet 3339 MAY be precomputed. An R1 packet MAY be reused for time Delta T, 3340 which is implementation dependent, and SHOULD be deprecated and not 3341 used once a valid response I2 packet has been received from an 3342 Initiator. During I1 message storm, an R1 packet may be re-used 3343 beyond this limit. R1 information MUST NOT be discarded until Delta 3344 S after T. Time S is the delay needed for the last I2 to arrive back 3345 to the Responder. 3347 An implementation MAY keep state about received I1s and match the 3348 received I2s against the state, as discussed in Section 4.1.1. 3350 6.7.2. Handling Malformed Messages 3352 If an implementation receives a malformed I1 message, it SHOULD NOT 3353 respond with a NOTIFY message, as such practice could open up a 3354 potential denial-of-service danger. Instead, it MAY respond with an 3355 ICMP packet, as defined in Section 5.4. 3357 6.8. Processing Incoming R1 Packets 3359 A system receiving an R1 MUST first check to see if it has sent an I1 3360 to the originator of the R1 (i.e., it is in state I1-SENT). If so, 3361 it SHOULD process the R1 as described below, send an I2, and go to 3362 state I2-SENT, setting a timer to protect the I2. If the system is 3363 in state I2-SENT, it MAY respond to an R1 if the R1 has a larger R1 3364 generation counter; if so, it should drop its state due to processing 3365 the previous R1 and start over from state I1-SENT. If the system is 3366 in any other state with respect to that host, it SHOULD silently drop 3367 the R1. 3369 When sending multiple I1s, an Initiator SHOULD wait for a small 3370 amount of time after the first R1 reception to allow possibly 3371 multiple R1s to arrive, and it SHOULD respond to an R1 among the set 3372 with the largest R1 generation counter. 3374 The following steps define the conceptual processing rules for 3375 responding to an R1 packet: 3377 1. A system receiving an R1 MUST first check to see if it has sent 3378 an I1 to the originator of the R1 (i.e., it has a HIP 3379 association that is in state I1-SENT and that is associated with 3380 the HITs in the R1). Unless the I1 was sent in opportunistic 3381 mode (see also "HIP Opportunistic Mode" (Section 4.1.6) ), IP 3382 addresses in the received R1 packet SHOULD be ignored and the 3383 match SHOULD be based on HITs only. If a match exists, the 3384 system should process the R1 as described below. 3386 2. Otherwise, if the system is in any other state than I1-SENT or 3387 I2-SENT with respect to the HITs included in the R1, it SHOULD 3388 silently drop the R1 and remain in the current state. 3390 3. If the HIP association state is I1-SENT or I2-SENT, the received 3391 Initiator's HIT MUST correspond to the HIT used in the original, 3392 I1 and the Responder's HIT MUST correspond to the one used, 3393 unless the I1 contained a NULL HIT. 3395 4. The system SHOULD validate the R1 signature before applying 3396 further packet processing, according to Section 5.2.12. 3398 5. If the HIP association state is I1-SENT, and multiple valid R1s 3399 are present, the system SHOULD select from among the R1s with 3400 the largest R1 generation counter. 3402 6. If the HIP association state is I2-SENT, the system MAY reenter 3403 state I1-SENT and process the received R1 if it has a larger R1 3404 generation counter than the R1 responded to previously. 3406 7. The R1 packet may have the A bit set -- in this case, the system 3407 MAY choose to refuse it by dropping the R1 and returning to 3408 state UNASSOCIATED. The system SHOULD consider dropping the R1 3409 only if it used a NULL HIT in I1. If the A bit is set, the 3410 Responder's HIT is anonymous and should not be stored. 3412 8. The system SHOULD attempt to validate the HIT against the 3413 received Host Identity by using the received Host Identity to 3414 construct a HIT and verify that it matches the Sender's HIT. 3416 9. The system MUST store the received R1 generation counter for 3417 future reference. 3419 10. The system attempts to solve the puzzle in R1. The system MUST 3420 terminate the search after exceeding the remaining lifetime of 3421 the puzzle. If the puzzle is not successfully solved, the 3422 implementation may either resend I1 within the retry bounds or 3423 abandon the HIP exchange. 3425 11. The system computes standard Diffie-Hellman keying material 3426 according to the public value and Group ID provided in the 3427 DIFFIE_HELLMAN parameter. The Diffie-Hellman keying material 3428 Kij is used for key extraction as specified in Section 6.5. If 3429 the received Diffie-Hellman Group ID is not supported, the 3430 implementation may either resend I1 within the retry bounds or 3431 abandon the HIP exchange. 3433 12. The system selects the HIP transform from the choices presented 3434 in the R1 packet and uses the selected values subsequently when 3435 generating and using encryption keys, and when sending the I2. 3436 If the proposed alternatives are not acceptable to the system, 3437 it may either resend I1 within the retry bounds or abandon the 3438 HIP exchange. 3440 13. The system initializes the remaining variables in the associated 3441 state, including Update ID counters. 3443 14. The system prepares and sends an I2, as described in 3444 Section 5.3.3. 3446 15. The system SHOULD start a timer whose timeout value should be 3447 larger than the worst-case anticipated RTT, and MUST increment a 3448 timeout counter associated with the I2. The sender SHOULD 3449 retransmit the I2 upon a timeout and restart the timer, up to a 3450 maximum of I2_RETRIES_MAX tries. 3452 16. If the system is in state I1-SENT, it shall transition to state 3453 I2-SENT. If the system is in any other state, it remains in the 3454 current state. 3456 6.8.1. Handling Malformed Messages 3458 If an implementation receives a malformed R1 message, it MUST 3459 silently drop the packet. Sending a NOTIFY or ICMP would not help, 3460 as the sender of the R1 typically doesn't have any state. An 3461 implementation SHOULD wait for some more time for a possible good R1, 3462 after which it MAY try again by sending a new I1 packet. 3464 6.9. Processing Incoming I2 Packets 3466 Upon receipt of an I2, the system MAY perform initial checks to 3467 determine whether the I2 corresponds to a recent R1 that has been 3468 sent out, if the Responder keeps such state. For example, the sender 3469 could check whether the I2 is from an address or HIT that has 3470 recently received an R1 from it. The R1 may have had Opaque data 3471 included that was echoed back in the I2. If the I2 is considered to 3472 be suspect, it MAY be silently discarded by the system. 3474 Otherwise, the HIP implementation SHOULD process the I2. This 3475 includes validation of the puzzle solution, generating the Diffie- 3476 Hellman key, decrypting the Initiator's Host Identity, verifying the 3477 signature, creating state, and finally sending an R2. 3479 The following steps define the conceptual processing rules for 3480 responding to an I2 packet: 3482 1. The system MAY perform checks to verify that the I2 corresponds 3483 to a recently sent R1. Such checks are implementation 3484 dependent. See Appendix A for a description of an example 3485 implementation. 3487 2. The system MUST check that the Responder's HIT corresponds to 3488 one of its own HITs. 3490 3. If the system is in the R2-SENT state, it MAY check if the newly 3491 received I2 is similar to the one that triggered moving to R2- 3492 SENT. If so, it MAY retransmit a previously sent R2, reset the 3493 R2-SENT timer, and stay in R2-SENT. 3495 4. If the system is in the I2-SENT state, it makes a comparison 3496 between its local and sender's HITs (similarly as in 3497 Section 6.5). If the local HIT is smaller than the sender's 3498 HIT, it should drop the I2 packet, use peer Diffie-Hellman key 3499 and nonce I from the R1 packet received earlier, and get the 3500 local Diffie-Hellman key and nonce J from the I2 packet sent to 3501 the peer earlier. Otherwise, the system should process the 3502 received I2 packet and drop any previously derived Diffie- 3503 Hellman keying material Kij it might have formed upon sending 3504 the I2 previously. The peer Diffie-Hellman key and nonce J are 3505 taken from the just arrived I2 and local Diffie-Hellman key and 3506 nonce I are the ones that it sent earlier in the R1 packet. 3508 5. If the system is in the I1-SENT state, and the HITs in the I2 3509 match those used in the previously sent I1, the system uses this 3510 received I2 as the basis for the HIP association it was trying 3511 to form, and stops retransmitting I1 (provided that the I2 3512 passes the below additional checks). 3514 6. If the system is in any other state than R2-SENT, it SHOULD 3515 check that the echoed R1 generation counter in I2 is within the 3516 acceptable range. Implementations MUST accept puzzles from the 3517 current generation and MAY accept puzzles from earlier 3518 generations. If the newly received I2 is outside the accepted 3519 range, the I2 is stale (perhaps replayed) and SHOULD be dropped. 3521 7. The system MUST validate the solution to the puzzle by computing 3522 the hash described in Section 5.3.3 using the same RHASH 3523 algorithm. 3525 8. The I2 MUST have a single value in the HIP_TRANSFORM parameter, 3526 which MUST match one of the values offered to the Initiator in 3527 the R1 packet. 3529 9. The system must derive Diffie-Hellman keying material Kij based 3530 on the public value and Group ID in the DIFFIE_HELLMAN 3531 parameter. This key is used to derive the HIP association keys, 3532 as described in Section 6.5. If the Diffie-Hellman Group ID is 3533 unsupported, the I2 packet is silently dropped. 3535 10. The encrypted HOST_ID decrypted by the Initiator encryption key 3536 defined in Section 6.5. If the decrypted data is not a HOST_ID 3537 parameter, the I2 packet is silently dropped. 3539 11. The implementation SHOULD also verify that the Initiator's HIT 3540 in the I2 corresponds to the Host Identity sent in the I2. 3541 (Note: some middle-boxes may not able to make this 3542 verification.) 3544 12. The system MUST verify the HMAC according to the procedures in 3545 Section 5.2.9. 3547 13. The system MUST verify the HIP_SIGNATURE according to 3548 Section 5.2.11 and Section 5.3.3. 3550 14. If the checks above are valid, then the system proceeds with 3551 further I2 processing; otherwise, it discards the I2 and remains 3552 in the same state. 3554 15. The I2 packet may have the A bit set -- in this case, the system 3555 MAY choose to refuse it by dropping the I2 and returning to 3556 state UNASSOCIATED. If the A bit is set, the Initiator's HIT is 3557 anonymous and should not be stored. 3559 16. The system initializes the remaining variables in the associated 3560 state, including Update ID counters. 3562 17. Upon successful processing of an I2 in states UNASSOCIATED, I1- 3563 SENT, I2-SENT, and R2-SENT, an R2 is sent and the state machine 3564 transitions to state R2-SENT. 3566 18. Upon successful processing of an I2 in state ESTABLISHED, the 3567 old HIP association is dropped and a new one is installed, an R2 3568 is sent, and the state machine transitions to R2-SENT. 3570 19. Upon transitioning to R2-SENT, start a timer. Move to 3571 ESTABLISHED if some data has been received on the incoming HIP 3572 association, or an UPDATE packet has been received (or some 3573 other packet that indicates that the peer has moved to 3574 ESTABLISHED). If the timer expires (allowing for maximal 3575 retransmissions of I2s), move to ESTABLISHED. 3577 6.9.1. Handling Malformed Messages 3579 If an implementation receives a malformed I2 message, the behavior 3580 SHOULD depend on how much checks the message has already passed. If 3581 the puzzle solution in the message has already been checked, the 3582 implementation SHOULD report the error by responding with a NOTIFY 3583 packet. Otherwise the implementation MAY respond with an ICMP 3584 message as defined in Section 5.4. 3586 6.10. Processing Incoming R2 Packets 3588 An R2 received in states UNASSOCIATED, I1-SENT, or ESTABLISHED 3589 results in the R2 being dropped and the state machine staying in the 3590 same state. If an R2 is received in state I2-SENT, it SHOULD be 3591 processed. 3593 The following steps define the conceptual processing rules for 3594 incoming R2 packet: 3596 1. The system MUST verify that the HITs in use correspond to the 3597 HITs that were received in R1. 3599 2. The system MUST verify the HMAC_2 according to the procedures in 3600 Section 5.2.10. 3602 3. The system MUST verify the HIP signature according to the 3603 procedures in Section 5.2.11. 3605 4. If any of the checks above fail, there is a high probability of 3606 an ongoing man-in-the-middle or other security attack. The 3607 system SHOULD act accordingly, based on its local policy. 3609 5. If the system is in any other state than I2-SENT, the R2 is 3610 silently dropped. 3612 6. Upon successful processing of the R2, the state machine moves to 3613 state ESTABLISHED. 3615 6.11. Sending UPDATE Packets 3617 A host sends an UPDATE packet when it wants to update some 3618 information related to a HIP association. There are a number of 3619 likely situations, e.g. mobility management and rekeying of an 3620 existing ESP Security Association. The following paragraphs define 3621 the conceptual rules for sending an UPDATE packet to the peer. 3622 Additional steps can be defined in other documents where the UPDATE 3623 packet is used. 3625 The system first determines whether there are any outstanding UPDATE 3626 messages that may conflict with the new UPDATE message under 3627 consideration. When multiple UPDATEs are outstanding (not yet 3628 acknowledged), the sender must assume that such UPDATEs may be 3629 processed in an arbitrary order. Therefore, any new UPDATEs that 3630 depend on a previous outstanding UPDATE being successfully received 3631 and acknowledged MUST be postponed until reception of the necessary 3632 ACK(s) occurs. One way to prevent any conflicts is to only allow one 3633 outstanding UPDATE at a time, but allowing multiple UPDATEs may 3634 improve the performance of mobility and multihoming protocols. 3636 1. The first UPDATE packet is sent with Update ID of zero. 3637 Otherwise, the system increments its own Update ID value by one 3638 before continuing the below steps. 3640 2. The system creates an UPDATE packet that contains a SEQ parameter 3641 with the current value of Update ID. The UPDATE packet may also 3642 include an ACK of the peer's Update ID found in a received UPDATE 3643 SEQ parameter, if any. 3645 3. The system sends the created UPDATE packet and starts an UPDATE 3646 timer. The default value for the timer is 2 * RTT estimate. If 3647 multiple UPDATEs are outstanding, multiple timers are in effect. 3649 4. If the UPDATE timer expires, the UPDATE is resent. The UPDATE 3650 can be resent UPDATE_RETRY_MAX times. The UPDATE timer SHOULD be 3651 exponentially backed off for subsequent retransmissions. If no 3652 acknowledgment is received from the peer after UPDATE_RETRY_MAX 3653 times, the HIP association is considered to be broken and the 3654 state machine should move from state ESTABLISHED to state CLOSING 3655 as depicted in Section 4.4.3. The UPDATE timer is cancelled upon 3656 receiving an ACK from the peer that acknowledges receipt of the 3657 UPDATE. 3659 6.12. Receiving UPDATE Packets 3661 When a system receives an UPDATE packet, its processing depends on 3662 the state of the HIP association and the presence of and values of 3663 the SEQ and ACK parameters. Typically, an UPDATE message also 3664 carries optional parameters whose handling is defined in separate 3665 documents. 3667 For each association, the peer's next expected in-sequence Update ID 3668 ("peer Update ID") is stored. Initially, this value is zero. Update 3669 ID comparisons of "less than" and "greater than" are performed with 3670 respect to a circular sequence number space. 3672 The sender may send multiple outstanding UPDATE messages. These 3673 messages are processed in the order in which they are received at the 3674 receiver (i.e., no resequencing is performed). When processing 3675 UPDATEs out-of-order, the receiver MUST keep track of which UPDATEs 3676 were previously processed, so that duplicates or retransmissions are 3677 ACKed and not reprocessed. A receiver MAY choose to define a receive 3678 window of Update IDs that it is willing to process at any given time, 3679 and discard received UPDATEs falling outside of that window. 3681 1. If there is no corresponding HIP association, the implementation 3682 MAY reply with an ICMP Parameter Problem, as specified in 3683 Section 5.4.4. 3685 2. If the association is in the ESTABLISHED state and the SEQ (but 3686 not ACK) parameter is present, the UPDATE is processed and 3687 replied as described in Section 6.12.1. 3689 3. If the association is in the ESTABLISHED state and the ACK (but 3690 not SEQ) parameter is present, the UPDATE is processed as 3691 described in Section 6.12.2. 3693 4. If the association is in the ESTABLISHED state and there is both 3694 an ACK and SEQ in the UPDATE, the ACK is first processed as 3695 described in Section 6.12.2 and then the rest of the UPDATE is 3696 processed as described in Section 6.12.1. 3698 6.12.1. Handling a SEQ parameter in a received UPDATE message 3700 1. If the Update ID in the received SEQ is not the next in sequence 3701 Update ID and is greater than the receiver's window for new 3702 UPDATEs, the packet MUST be dropped. 3704 2. If the Update ID in the received SEQ corresponds to an UPDATE 3705 that has recently been processed, the packet is treated as a 3706 retransmission. The HMAC verification (next step) MUST NOT be 3707 skipped. (A byte-by-byte comparison of the received and a stored 3708 packet would be OK, though.) It is recommended that a host cache 3709 UPDATE packets sent with ACKs to avoid the cost of generating a 3710 new ACK packet to respond to a replayed UPDATE. The system MUST 3711 acknowledge, again, such (apparent) UPDATE message 3712 retransmissions but SHOULD also consider rate-limiting such 3713 retransmission responses to guard against replay attacks. 3715 3. The system MUST verify the HMAC in the UPDATE packet. If the 3716 verification fails, the packet MUST be dropped. 3718 4. The system MAY verify the SIGNATURE in the UPDATE packet. If the 3719 verification fails, the packet SHOULD be dropped and an error 3720 message logged. 3722 5. If a new SEQ parameter is being processed, the parameters in the 3723 UPDATE are then processed. The system MUST record the Update ID 3724 in the received SEQ parameter, for replay protection. 3726 6. An UPDATE acknowledgement packet with ACK parameter is prepared 3727 and sent to the peer. This ACK parameter may be included in a 3728 separate UPDATE or piggybacked in an UPDATE with SEQ parameter, 3729 as described in Section Section 5.3.5. The ACK parameter MAY 3730 acknowledge more than one of the peer's Update IDs. 3732 6.12.2. Handling an ACK Parameter in a Received UPDATE Packet 3734 1. The sequence number reported in the ACK must match with an 3735 earlier sent UPDATE packet that has not already been 3736 acknowledged. If no match is found or if the ACK does not 3737 acknowledge a new UPDATE, the packet MUST either be dropped if no 3738 SEQ parameter is present, or the processing steps in 3739 Section 6.12.1 are followed. 3741 2. The system MUST verify the HMAC in the UPDATE packet. If the 3742 verification fails, the packet MUST be dropped. 3744 3. The system MAY verify the SIGNATURE in the UPDATE packet. If the 3745 verification fails, the packet SHOULD be dropped and an error 3746 message logged. 3748 4. The corresponding UPDATE timer is stopped (see Section 6.11) so 3749 that the now acknowledged UPDATE is no longer retransmitted. If 3750 multiple UPDATEs are newly acknowledged, multiple timers are 3751 stopped. 3753 6.13. Processing NOTIFY Packets 3755 Processing NOTIFY packets is OPTIONAL. If processed, any errors in a 3756 received NOTIFICATION parameter SHOULD be logged. Received errors 3757 MUST be considered only as informational and the receiver SHOULD NOT 3758 change its HIP state Section 4.4.1 purely based on the received 3759 NOTIFY message. 3761 6.14. Processing CLOSE Packets 3763 When the host receives a CLOSE message it responds with a CLOSE_ACK 3764 message and moves to CLOSED state. (The authenticity of the CLOSE 3765 message is verified using both HMAC and SIGNATURE). This processing 3766 applies whether or not the HIP association state is CLOSING in order 3767 to handle CLOSE messages from both ends crossing in flight. 3769 The HIP association is not discarded before the host moves from the 3770 UNASSOCIATED state. 3772 Once the closing process has started, any need to send data packets 3773 will trigger creating and establishing of a new HIP association, 3774 starting with sending an I1. 3776 If there is no corresponding HIP association, the CLOSE packet is 3777 dropped. 3779 6.15. Processing CLOSE_ACK Packets 3781 When a host receives a CLOSE_ACK message it verifies that it is in 3782 CLOSING or CLOSED state and that the CLOSE_ACK was in response to the 3783 CLOSE (using the included ECHO_RESPONSE_SIGNED in response to the 3784 sent ECHO_REQUEST_SIGNED). 3786 The CLOSE_ACK uses HMAC and SIGNATURE for verification. The state is 3787 discarded when the state changes to UNASSOCIATED and, after that, the 3788 host MAY respond with an ICMP Parameter Problem to an incoming CLOSE 3789 message (See Section 5.4.4). 3791 6.16. Handling State Loss 3793 In the case of system crash and unanticipated state loss, the system 3794 SHOULD delete the corresponding HIP state, including the keying 3795 material. That is, the state SHOULD NOT be stored on stable storage. 3796 If the implementation does drop the state (as RECOMMENDED), it MUST 3797 also drop the peer's R1 generation counter value, unless a local 3798 policy explicitly defines that the value of that particular host is 3799 stored. An implementation MUST NOT store R1 generation counters by 3800 default, but storing R1 generation counter values, if done, MUST be 3801 configured by explicit HITs. 3803 7. HIP Policies 3805 There are a number of variables that will influence the HIP exchanges 3806 that each host must support. All HIP implementations MUST support 3807 more than one simultaneous HIs, at least one of which SHOULD be 3808 reserved for anonymous usage. Although anonymous HIs will be rarely 3809 used as Responder HIs, they will be common for Initiators. Support 3810 for more than two HIs is RECOMMENDED. 3812 Many Initiators would want to use a different HI for different 3813 Responders. The implementations SHOULD provide for an ACL of 3814 Initiator HIT to Responder HIT. This ACL SHOULD also include 3815 preferred transform and local lifetimes. 3817 The value of K used in the HIP R1 packet can also vary by policy. K 3818 should never be greater than 20, but for trusted partners it could be 3819 as low as 0. 3821 Responders would need a similar ACL, representing which hosts they 3822 accept HIP exchanges, and the preferred transform and local 3823 lifetimes. Wildcarding SHOULD be supported for this ACL also. 3825 8. Security Considerations 3827 HIP is designed to provide secure authentication of hosts. HIP also 3828 attempts to limit the exposure of the host to various denial-of- 3829 service and man-in-the-middle (MitM) attacks. In so doing, HIP 3830 itself is subject to its own DoS and MitM attacks that potentially 3831 could be more damaging to a host's ability to conduct business as 3832 usual. 3834 The 384-bit Diffie-Hellman Group is targeted to be used in hosts that 3835 either do not require or that are not powerful enough for handling 3836 strong cryptography. Although there is a risk that with suitable 3837 equipment the encryption can be broken in real time, the 384-bit 3838 group can provide some protection for end-hosts that are not able to 3839 handle any stronger cryptography. When the security provided by the 3840 384-bit group is not enough for applications on a host, the support 3841 for this group should be turned off in the configuration. 3843 Denial-of-service attacks often take advantage of the cost of start 3844 of state for a protocol on the Responder compared to the 'cheapness' 3845 on the Initiator. HIP makes no attempt to increase the cost of the 3846 start of state on the Initiator, but makes an effort to reduce the 3847 cost to the Responder. This is done by having the Responder start 3848 the 3-way exchange instead of the Initiator, making the HIP protocol 3849 4 packets long. In doing this, packet 2 becomes a 'stock' packet 3850 that the Responder MAY use many times, until some Initiator has 3851 provided a valid response to such and R1 packet. During an I1 storm 3852 the host may re-use the same D-H value also beyond that point. Using 3853 the same Diffie-Hellman values and random puzzle #I value has some 3854 risks. This risk needs to be balanced against a potential storm of 3855 HIP I1 packets. 3857 This shifting of the start of state cost to the Initiator in creating 3858 the I2 HIP packet, presents another DoS attack. The attacker spoofs 3859 the I1 HIP packet and the Responder sends out the R1 HIP packet. 3860 This could conceivably tie up the 'Initiator' with evaluating the R1 3861 HIP packet, and creating the I2 HIP packet. The defense against this 3862 attack is to simply ignore any R1 packet where a corresponding I1 was 3863 not sent. 3865 A second form of DoS attack arrives in the I2 HIP packet. Once the 3866 attacking Initiator has solved the puzzle, it can send packets with 3867 spoofed IP source addresses with either invalid encrypted HIP payload 3868 component or a bad HIP signature. This would take resources in the 3869 Responder's part to reach the point to discover that the I2 packet 3870 cannot be completely processed. The defense against this attack is 3871 after N bad I2 packets, the Responder would discard any I2s that 3872 contain the given Initiator HIT. Thus will shut down the attack. 3874 The attacker would have to request another R1 and use that to launch 3875 a new attack. The Responder could up the value of K while under 3876 attack. On the downside, valid I2s might get dropped too. 3878 A third form of DoS attack is emulating the restart of state after a 3879 reboot of one of the partners. A host restarting would send an I1 to 3880 a peer, which would respond with an R1 even if it were in the 3881 ESTABLISHED state. If the I1 were spoofed, the resulting R1 would be 3882 received unexpectedly by the spoofed host and would be dropped, as in 3883 the first case above. 3885 A fourth form of DoS attack is emulating the end of state. HIP 3886 relies on timers plus a CLOSE/CLOSE_ACK handshake to explicitly 3887 signals the end of a state. Because both CLOSE and CLOSE_ACK 3888 messages contain an HMAC, an outsider cannot close a connection. The 3889 presence of an additional SIGNATURE allows middle-boxes to inspect 3890 these messages and discard the associated state (for e.g., 3891 firewalling, SPI-based NATing, etc.). However, the optional behavior 3892 of replying to CLOSE with an ICMP Parameter Problem packet (as 3893 described in Section 5.4.4) might allow an IP spoofer sending CLOSE 3894 messages to launch reflection attacks. 3896 A fifth form of DoS attack is replaying R1s to cause the Initiator to 3897 solve stale puzzles and become out of synchronization with the 3898 Responder. The R1 generation counter is a monotonically increasing 3899 counter designed to protect against this attack, as described in 3900 section Section 4.1.4. 3902 Man-in-the-middle attacks are difficult to defend against, without 3903 third-party authentication. A skillful MitM could easily handle all 3904 parts of HIP; but HIP indirectly provides the following protection 3905 from a MitM attack. If the Responder's HI is retrieved from a signed 3906 DNS zone, a certificate, or through some other secure means, the 3907 Initiator can use this to validate the R1 HIP packet. 3909 Likewise, if the Initiator's HI is in a secure DNS zone, a trusted 3910 certificate, or otherwise securely available, the Responder can 3911 retrieve it after it gets the I2 HIP packet and validate that. 3912 However, since an Initiator may choose to use an anonymous HI, it 3913 knowingly risks a MitM attack. The Responder may choose not to 3914 accept a HIP exchange with an anonymous Initiator. 3916 The HIP Opportunistic Mode concept has been introduced in this 3917 document, but this document does not specify what the semantics of 3918 such connection set up are for applications. There are certain 3919 concerns with opportunistic mode, as discussed in Section 4.1.6. 3921 NOTIFY messages are used only for informational purposes and they are 3922 unacknowledged. A HIP implementation cannot rely solely on the 3923 information received in a NOTIFY message because the packet may have 3924 been replayed. It SHOULD NOT change any state information based 3925 purely on a received NOTIFY message. 3927 Since not all hosts will ever support HIP, ICMP 'Destination Protocol 3928 Unreachable' are to be expected and present a DoS attack. Against an 3929 Initiator, the attack would look like the Responder does not support 3930 HIP, but shortly after receiving the ICMP message, the Initiator 3931 would receive a valid R1 HIP packet. Thus to protect from this 3932 attack, an Initiator should not react to an ICMP message until a 3933 reasonable delta time to get the real Responder's R1 HIP packet. A 3934 similar attack against the Responder is more involved. First an ICMP 3935 message is expected if the I1 was a DoS attack and the real owner of 3936 the spoofed IP address does not support HIP. The Responder SHOULD 3937 NOT act on this ICMP message to remove the minimal state from the R1 3938 HIP packet (if it has one), but wait for either a valid I2 HIP packet 3939 or the natural timeout of the R1 HIP packet. This is to allow for a 3940 sophisticated attacker that is trying to break up the HIP exchange. 3941 Likewise, the Initiator should ignore any ICMP message while waiting 3942 for an R2 HIP packet, deleting state only after a natural timeout. 3944 9. IANA Considerations 3946 IANA has reserved protocol number 253 to be used for experimental 3947 purposes (see [RFC3692]). In HIP, this value is used until a 3948 permanent protocol number has been assigned by IANA. 3950 This document defines a new 128-bit value under the CGA Message Type 3951 namespace [RFC3972], 0xF0EF F02F BFF4 3D0F E793 0C3C 6E61 74EA, to be 3952 used for HIT generation as specified in ORCHID [RFC4843]. 3954 This document also creates a set of new name spaces. These are 3955 described below. 3957 Packet Type 3959 The 7-bit Packet Type field in a HIP protocol packet describes the 3960 type of a HIP protocol message. It is defined in Section 5.1. 3961 The current values are defined in Section 5.3.1 through 3962 Section 5.3.8. 3964 New values are assigned through IETF Consensus [RFC2434]. 3966 HIP Version 3968 The four bit Version field in a HIP protocol packet describes the 3969 version of the HIP protocol. It is defined in Section 5.1. The 3970 only currently defined value is 1. New values are assigned 3971 through IETF Consensus. 3973 Parameter Type 3975 The 16 bit Type field in a HIP parameter describes the type of the 3976 parameter. It is defined in Section 5.2.1. The current values 3977 are defined in Section 5.2.3 through Section 5.2.20. 3979 With the exception of the assigned type codes, the type codes 0 3980 through 1023 and 61440 through 65535 are reserved for future base 3981 protocol extensions, and are assigned through IETF Consensus. 3983 The type codes 32768 through 49141 are reserved for 3984 experimentation and private use. Types SHOULD be selected in a 3985 random fashion from this range, thereby reducing the probability 3986 of collisions. A method employing genuine randomness (such as 3987 flipping a coin) SHOULD be used. 3989 All other type codes are assigned through First Come First Served, 3990 with Specification Required [RFC2434]. 3992 Group ID 3994 The eight bit Group ID values appear in the DIFFIE_HELLMAN 3995 parameter and are defined in Section 5.2.6. New values either 3996 from the reserved or unassigned space are assigned through IETF 3997 Consensus. 3999 Suite ID 4001 The 16 bit Suite ID values in a HIP_TRANSFORM parameter are 4002 defined in Section 5.2.7. New values either from the reserved or 4003 unassigned space are assigned through IETF Consensus. 4005 DI-Type 4007 The four bit DI-Type values in a HOST_ID parameter are defined in 4008 Section 5.2.8. New values are assigned through IETF Consensus. 4010 Notify Message Type 4012 The 16 bit Notify Message Type values in a NOTIFICATION parameter 4013 are defined in Section 5.2.16. New values are assigned through 4014 First Come First Served, with Specification Required. 4016 Notify Message Type values 1 through 10 are used for informing 4017 about errors in packet structures, values 11 through 20 for 4018 informing about problems in parameters containing cryptographic 4019 related material, values 21 through 30 for informing about 4020 problems in authentication or packet integrity verification. 4021 Parameter numbers above 30 can be used for informing about other 4022 types of errors or events. Values 51 - 8191 are error types 4023 reserved to be allocated by IANA. Values 8192 - 16383 are error 4024 types for private use. Values 16385 - 40959 are status types to 4025 be allocated by IANA and values 40960 - 65535 are status types for 4026 private use. 4028 10. Acknowledgments 4030 The drive to create HIP came to being after attending the MALLOC 4031 meeting at the 43rd IETF meeting. Baiju Patel and Hilarie Orman 4032 really gave the original author, Bob Moskowitz, the assist to get HIP 4033 beyond 5 paragraphs of ideas. It has matured considerably since the 4034 early drafts thanks to extensive input from IETFers. Most 4035 importantly, its design goals are articulated and are different from 4036 other efforts in this direction. Particular mention goes to the 4037 members of the NameSpace Research Group of the IRTF. Noel Chiappa 4038 provided the framework for LSIs and Keith Moore the impetus to 4039 provide resolvability. Steve Deering provided encouragement to keep 4040 working, as a solid proposal can act as a proof of ideas for a 4041 research group. 4043 Many others contributed; extensive security tips were provided by 4044 Steve Bellovin. Rob Austein kept the DNS parts on track. Paul 4045 Kocher taught Bob Moskowitz how to make the puzzle exchange expensive 4046 for the Initiator to respond, but easy for the Responder to validate. 4047 Bill Sommerfeld supplied the Birthday concept, which later evolved 4048 into the R1 generation counter, to simplify reboot management. Erik 4049 Nordmark supplied CLOSE-mechanism for closing connections. Rodney 4050 Thayer and Hugh Daniels provide extensive feedback. In the early 4051 times of this document, John Gilmore kept Bob Moskowitz challenged to 4052 provide something of value. 4054 During the later stages of this document, when the editing baton was 4055 transferred to Pekka Nikander, the input from the early implementors 4056 were invaluable. Without having actual implementations, this 4057 document would not be on the level it is now. 4059 In the usual IETF fashion, a large number of people have contributed 4060 to the actual text or ideas. The list of these people include Jeff 4061 Ahrenholz, Francis Dupont, Derek Fawcus, George Gross, Andrew 4062 McGregor, Julien Laganier, Miika Komu, Mika Kousa, Jan Melen, Henrik 4063 Petander, Michael Richardson, Tim Shepard, Jorma Wall, and Jukka 4064 Ylitalo. Our apologies to anyone whose name is missing. 4066 Once the HIP Working Group was founded in early 2004, a number of 4067 changes were introduced through the working group process. Most 4068 notably, the original draft was split in two, one containing the base 4069 exchange and the other one defining how to use ESP. Some 4070 modifications to the protocol proposed by Aura et al. [AUR03] were 4071 added at a later stage. 4073 11. References 4075 11.1. Normative References 4077 [RFC0768] Postel, J., "User Datagram Protocol", STD 6, RFC 768, 4078 August 1980. 4080 [RFC1035] Mockapetris, P., "Domain names - implementation and 4081 specification", STD 13, RFC 1035, November 1987. 4083 [RFC1885] Conta, A. and S. Deering, "Internet Control Message 4084 Protocol (ICMPv6) for the Internet Protocol Version 6 4085 (IPv6)", RFC 1885, December 1995. 4087 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 4088 Requirement Levels", BCP 14, RFC 2119, March 1997. 4090 [RFC2404] Madson, C. and R. Glenn, "The Use of HMAC-SHA-1-96 within 4091 ESP and AH", RFC 2404, November 1998. 4093 [RFC2451] Pereira, R. and R. Adams, "The ESP CBC-Mode Cipher 4094 Algorithms", RFC 2451, November 1998. 4096 [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6 4097 (IPv6) Specification", RFC 2460, December 1998. 4099 [RFC2535] Eastlake, D., "Domain Name System Security Extensions", 4100 RFC 2535, March 1999. 4102 [RFC2536] Eastlake, D., "DSA KEYs and SIGs in the Domain Name System 4103 (DNS)", RFC 2536, March 1999. 4105 [RFC2898] Kaliski, B., "PKCS #5: Password-Based Cryptography 4106 Specification Version 2.0", RFC 2898, September 2000. 4108 [RFC3110] Eastlake, D., "RSA/SHA-1 SIGs and RSA KEYs in the Domain 4109 Name System (DNS)", RFC 3110, May 2001. 4111 [RFC3484] Draves, R., "Default Address Selection for Internet 4112 Protocol version 6 (IPv6)", RFC 3484, February 2003. 4114 [RFC3526] Kivinen, T. and M. Kojo, "More Modular Exponential (MODP) 4115 Diffie-Hellman groups for Internet Key Exchange (IKE)", 4116 RFC 3526, May 2003. 4118 [RFC3602] Frankel, S., Glenn, R., and S. Kelly, "The AES-CBC Cipher 4119 Algorithm and Its Use with IPsec", RFC 3602, 4120 September 2003. 4122 [RFC3972] Aura, T., "Cryptographically Generated Addresses (CGA)", 4123 RFC 3972, March 2005. 4125 [RFC4307] Schiller, J., "Cryptographic Algorithms for Use in the 4126 Internet Key Exchange Version 2 (IKEv2)", RFC 4307, 4127 December 2005. 4129 [RFC4843] Nikander, P., Laganier, J., and F. Dupont, "An IPv6 Prefix 4130 for Overlay Routable Cryptographic Hash Identifiers 4131 (ORCHID)", RFC 4843, April 2007. 4133 [I-D.ietf-radext-rfc2486bis] 4134 Aboba, B., "The Network Access Identifier", 4135 draft-ietf-radext-rfc2486bis-06 (work in progress), 4136 July 2005. 4138 [I-D.ietf-hip-esp] 4139 Jokela, P., "Using ESP transport format with HIP", 4140 draft-ietf-hip-esp-06 (work in progress), June 2007. 4142 [FIPS95] NIST, "FIPS PUB 180-1: Secure Hash Standard", April 1995. 4144 11.2. Informative References 4146 [RFC0792] Postel, J., "Internet Control Message Protocol", STD 5, 4147 RFC 792, September 1981. 4149 [RFC2409] Harkins, D. and D. Carrel, "The Internet Key Exchange 4150 (IKE)", RFC 2409, November 1998. 4152 [RFC2412] Orman, H., "The OAKLEY Key Determination Protocol", 4153 RFC 2412, November 1998. 4155 [RFC2434] Narten, T. and H. Alvestrand, "Guidelines for Writing an 4156 IANA Considerations Section in RFCs", BCP 26, RFC 2434, 4157 October 1998. 4159 [RFC3692] Narten, T., "Assigning Experimental and Testing Numbers 4160 Considered Useful", BCP 82, RFC 3692, January 2004. 4162 [I-D.ietf-hip-arch] 4163 Moskowitz, R. and P. Nikander, "Host Identity Protocol 4164 Architecture", draft-ietf-hip-arch-03 (work in progress), 4165 August 2005. 4167 [I-D.ietf-shim6-proto] 4168 Bagnulo, M. and E. Nordmark, "Shim6: Level 3 Multihoming 4169 Shim Protocol for IPv6", draft-ietf-shim6-proto-08 (work 4170 in progress), April 2007. 4172 [I-D.henderson-hip-applications] 4173 Henderson, T. and P. Nikander, "Using HIP with Legacy 4174 Applications", draft-henderson-hip-applications-03 (work 4175 in progress), May 2006. 4177 [I-D.ietf-hip-mm] 4178 Henderson, T., "End-Host Mobility and Multihoming with the 4179 Host Identity Protocol", draft-ietf-hip-mm-05 (work in 4180 progress), March 2007. 4182 [I-D.ietf-btns-c-api] 4183 Komu, M., "IPsec Application Programming Interfaces", 4184 draft-ietf-btns-c-api-01 (work in progress), July 2007. 4186 [I-D.ietf-hip-dns] 4187 Nikander, P. and J. Laganier, "Host Identity Protocol 4188 (HIP) Domain Name System (DNS) Extensions", 4189 draft-ietf-hip-dns-09 (work in progress), April 2007. 4191 [I-D.ietf-hip-rvs] 4192 Laganier, J. and L. Eggert, "Host Identity Protocol (HIP) 4193 Rendezvous Extension", draft-ietf-hip-rvs-05 (work in 4194 progress), June 2006. 4196 [AUR03] Aura, T., Nagarajan, A., and A. Gurtov, "Analysis of the 4197 HIP Base Exchange Protocol", in Proceedings of 10th 4198 Australasian Conference on Information Security and 4199 Privacy, July 2003. 4201 [KRA03] Krawczyk, H., "SIGMA: The 'SIGn-and-MAc' Approach to 4202 Authenticated Diffie-Hellman and Its Use in the IKE- 4203 Protocols", in Proceedings of CRYPTO 2003, pages 400-425, 4204 August 2003. 4206 [CRO03] Crosby, SA. and DS. Wallach, "Denial of Service via 4207 Algorithmic Complexity Attacks", in Proceedings of Usenix 4208 Security Symposium 2003, Washington, DC., August 2003. 4210 [FIPS01] NIST, "FIPS PUB 197: Advanced Encryption Standard", 4211 Nov 2001. 4213 [DIF76] Diffie, W. and M. Hellman, "New Directions in 4214 Cryptography", IEEE Transactions on Information 4215 Theory vol. IT-22, number 6, pages 644-654, Nov 1976. 4217 [KAU03] Kaufman, C., Perlman, R., and B. Sommerfeld, "DoS 4218 protection for UDP-based protocols", ACM Conference on 4219 Computer and Communications Security , Oct 2003. 4221 Appendix A. Using Responder Puzzles 4223 As mentioned in Section 4.1.1, the Responder may delay state creation 4224 and still reject most spoofed I2s by using a number of pre-calculated 4225 R1s and a local selection function. This appendix defines one 4226 possible implementation in detail. The purpose of this appendix is 4227 to give the implementors an idea on how to implement the mechanism. 4228 If the implementation is based on this appendix, it MAY contain some 4229 local modification that makes an attacker's task harder. 4231 The Responder creates a secret value S, that it regenerates 4232 periodically. The Responder needs to remember two latest values of 4233 S. Each time the S is regenerated, R1 generation counter value is 4234 incremented by one. 4236 The Responder generates a pre-signed R1 packet. The signature for 4237 pre-generated R1s must be recalculated when the Diffie-Hellman key is 4238 recomputed or when the R1_COUNTER value changes due to S value 4239 regeneration. 4241 When the Initiator sends the I1 packet for initializing a connection, 4242 the Responder gets the HIT and IP address from the packet, and 4243 generates an I-value for the puzzle. The I value is set to the pre- 4244 signed R1 packet. 4246 I value calculation: 4247 I = Ltrunc( RHASH ( S | HIT-I | HIT-R | IP-I | IP-R ), 64) 4249 The RHASH algorithm is the same that is used to generate the 4250 Responder's HIT value. 4252 From an incoming I2 packet, the Responder gets the required 4253 information to validate the puzzle: HITs, IP addresses, and the 4254 information of the used S value from the R1_COUNTER. Using these 4255 values, the Responder can regenerate the I, and verify it against the 4256 I received in the I2 packet. If the I values match, it can verify 4257 the solution using I, J, and difficulty K. If the I values do not 4258 match, the I2 is dropped. 4260 puzzle_check: 4261 V := Ltrunc( RHASH( I2.I | I2.hit_i | I2.hit_r | I2.J ), K ) 4262 if V != 0, drop the packet 4264 If the puzzle solution is correct, the I and J values are stored for 4265 later use. They are used as input material when keying material is 4266 generated. 4268 Keeping state about failed puzzle solutions depends on the 4269 implementation. Although it is possible that the Responder doesn't 4270 keep any state information, it still may do so to protect itself 4271 against certain attacks (see Section 4.1.1). 4273 Appendix B. Generating a Public Key Encoding from a HI 4275 The following pseudo-codes illustrate the process to generate a 4276 public key encoding from a HI for both RSA and DSA. 4278 The symbol := denotes assignment; the symbol += denotes appending. 4279 The pseudo-function encode_in_network_byte_order takes two 4280 parameters, an integer (bignum) and a length in bytes, and returns 4281 the integer encoded into a byte string of the given length. 4283 switch ( HI.algorithm ) 4284 { 4286 case RSA: 4287 buffer := encode_in_network_byte_order ( HI.RSA.e_len, 4288 ( HI.RSA.e_len > 255 ) ? 3 : 1 ) 4289 buffer += encode_in_network_byte_order ( HI.RSA.e, HI.RSA.e_len ) 4290 buffer += encode_in_network_byte_order ( HI.RSA.n, HI.RSA.n_len ) 4291 break; 4293 case DSA: 4294 buffer := encode_in_network_byte_order ( HI.DSA.T , 1 ) 4295 buffer += encode_in_network_byte_order ( HI.DSA.Q , 20 ) 4296 buffer += encode_in_network_byte_order ( HI.DSA.P , 64 + 4297 8 * HI.DSA.T ) 4298 buffer += encode_in_network_byte_order ( HI.DSA.G , 64 + 4299 8 * HI.DSA.T ) 4300 buffer += encode_in_network_byte_order ( HI.DSA.Y , 64 + 4301 8 * HI.DSA.T ) 4302 break; 4304 } 4306 Appendix C. Example Checksums for HIP Packets 4308 The HIP checksum for HIP packets is specified in Section 5.1.1. 4309 Checksums for TCP and UDP packets running over HIP-enabled security 4310 associations are specified in Section 3.5. The examples below use IP 4311 addresses of 192.168.0.1 and 192.168.0.2 (and their respective IPv4- 4312 compatible IPv6 formats), and HITs with the first two bits "01" 4313 followed by 124 zeroes followed by a decimal 1 or 2, respectively. 4315 The following example is defined only for testing a checksum 4316 calculation. The address format for IPv4-compatible IPv6 address is 4317 not a valid one, but using these IPv6 addresses when testing an IPv6 4318 implementation gives the same checksum output as an IPv4 4319 implementation with the corresponding IPv4 addresses. 4321 C.1. IPv6 HIP Example (I1) 4323 Source Address: ::192.168.0.1 4324 Destination Address: ::192.168.0.2 4325 Upper-Layer Packet Length: 40 0x28 4326 Next Header: 253 0xfd 4327 Payload Protocol: 59 0x3b 4328 Header Length: 4 0x4 4329 Packet Type: 1 0x1 4330 Version: 1 0x1 4331 Reserved: 1 0x1 4332 Control: 0 0x0 4333 Checksum: 8046 0x1f6e 4334 Sender's HIT : 1100::1 4335 Receiver's HIT: 1100::2 4337 C.2. IPv4 HIP Packet (I1) 4339 The IPv4 checksum value for the same example I1 packet is the same as 4340 the IPv6 checksum (since the checksums due to the IPv4 and IPv6 4341 pseudo-header components are the same). 4343 C.3. TCP Segment 4345 Regardless of whether IPv6 or IPv4 is used, the TCP and UDP sockets 4346 use the IPv6 pseudo-header format [RFC2460], with the HITs used in 4347 place of the IPv6 addresses. 4349 Sender's HIT: 1100::0001 4350 Receiver's HIT: 1100::0002 4351 Upper-Layer Packet Length: 20 0x14 4352 Next Header: 6 0x06 4353 Source port: 65500 0xffdc 4354 Destination port: 22 0x0016 4355 Sequence number: 1 0x00000001 4356 Acknowledgment number: 0 0x00000000 4357 Header length: 20 0x14 4358 Flags: SYN 0x02 4359 Window size: 65535 0xffff 4360 Checksum: 60301 0xeb8d 4361 Urgent pointer: 0 0x0000 4363 0x0000: 6000 0000 0014 0640 1100 0000 0000 0000 4364 0x0010: 0000 0000 0000 0002 1100 0000 0000 0000 4365 0x0020: 0000 0000 0000 0002 ffdc 0016 0000 0001 4366 0x0030: 0000 0000 5002 ffff 8deb 0000 4368 Appendix D. 384-bit Group 4370 This 384-bit group is defined only to be used with HIP. NOTE: The 4371 security level of this group is very low! The encryption may be 4372 broken in a very short time, even real-time. It should be used only 4373 when the host is not powerful enough (e.g. some PDAs) and when 4374 security requirements are low (e.g. during normal web surfing). 4376 This prime is: 2^384 - 2^320 - 1 + 2^64 * { [ 2^254 pi] + 5857 } 4378 Its hexadecimal value is: 4380 FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 4381 29024E08 8A67CC74 020BBEA6 3B13B202 FFFFFFFF FFFFFFFF 4383 The generator is: 2. 4385 Appendix E. OAKLEY Well-known group 1 4387 See also [RFC2412] for definition of OAKLEY Well-known group 1. 4389 OAKLEY Well-Known Group 1: A 768 bit prime 4391 The prime is 2^768 - 2^704 - 1 + 2^64 * { [2^638 pi] + 149686 }. 4393 The hexadecimal value is: 4395 FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 4396 29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD 4397 EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245 4398 E485B576 625E7EC6 F44C42E9 A63A3620 FFFFFFFF FFFFFFFF 4400 This has been rigorously verified as a prime. 4402 The generator is: 22 (decimal) 4404 Authors' Addresses 4406 Robert Moskowitz 4407 ICSAlabs, a Division of TruSecure Corporation 4408 1000 Bent Creek Blvd, Suite 200 4409 Mechanicsburg, PA 4410 USA 4412 Email: rgm@icsalabs.com 4414 Pekka Nikander 4415 Ericsson Research NomadicLab 4416 JORVAS FIN-02420 4417 FINLAND 4419 Phone: +358 9 299 1 4420 Email: pekka.nikander@nomadiclab.com 4422 Petri Jokela 4423 Ericsson Research NomadicLab 4424 JORVAS FIN-02420 4425 FINLAND 4427 Phone: +358 9 299 1 4428 Email: petri.jokela@nomadiclab.com 4430 Thomas R. Henderson 4431 The Boeing Company 4432 P.O. Box 3707 4433 Seattle, WA 4434 USA 4436 Email: thomas.r.henderson@boeing.com 4438 Full Copyright Statement 4440 Copyright (C) The IETF Trust (2007). 4442 This document is subject to the rights, licenses and restrictions 4443 contained in BCP 78, and except as set forth therein, the authors 4444 retain all their rights. 4446 This document and the information contained herein are provided on an 4447 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 4448 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND 4449 THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS 4450 OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF 4451 THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 4452 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 4454 Intellectual Property 4456 The IETF takes no position regarding the validity or scope of any 4457 Intellectual Property Rights or other rights that might be claimed to 4458 pertain to the implementation or use of the technology described in 4459 this document or the extent to which any license under such rights 4460 might or might not be available; nor does it represent that it has 4461 made any independent effort to identify any such rights. Information 4462 on the procedures with respect to rights in RFC documents can be 4463 found in BCP 78 and BCP 79. 4465 Copies of IPR disclosures made to the IETF Secretariat and any 4466 assurances of licenses to be made available, or the result of an 4467 attempt made to obtain a general license or permission for the use of 4468 such proprietary rights by implementers or users of this 4469 specification can be obtained from the IETF on-line IPR repository at 4470 http://www.ietf.org/ipr. 4472 The IETF invites any interested party to bring to its attention any 4473 copyrights, patents or patent applications, or other proprietary 4474 rights that may cover technology that may be required to implement 4475 this standard. Please address the information to the IETF at 4476 ietf-ipr@ietf.org. 4478 Acknowledgment 4480 Funding for the RFC Editor function is provided by the IETF 4481 Administrative Support Activity (IASA).