idnits 2.17.1 draft-ietf-hip-base-08.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 4379. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 4390. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 4397. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 4403. 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 1043 has weird spacing: '...ciation has n...' == Line 1092 has weird spacing: '... failed to es...' == Line 1664 has weird spacing: '...c Value leng...' == Line 1666 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 (June 11, 2007) is 6161 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) == Outdated reference: A later version (-06) exists of draft-ietf-hip-esp-05 ** 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 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: December 13, 2007 Corporation 5 P. Nikander 6 P. Jokela (editor) 7 Ericsson Research NomadicLab 8 T. Henderson 9 The Boeing Company 10 June 11, 2007 12 Host Identity Protocol 13 draft-ietf-hip-base-08 15 Status of this Memo 17 By submitting this Internet-Draft, each author represents that any 18 applicable patent or other IPR claims of which he or she is aware 19 have been or will be disclosed, and any of which he or she becomes 20 aware will be disclosed, in accordance with Section 6 of BCP 79. 22 Internet-Drafts are working documents of the Internet Engineering 23 Task Force (IETF), its areas, and its working groups. Note that 24 other groups may also distribute working documents as Internet- 25 Drafts. 27 Internet-Drafts are draft documents valid for a maximum of six months 28 and may be updated, replaced, or obsoleted by other documents at any 29 time. It is inappropriate to use Internet-Drafts as reference 30 material or to cite them other than as "work in progress." 32 The list of current Internet-Drafts can be accessed at 33 http://www.ietf.org/ietf/1id-abstracts.txt. 35 The list of Internet-Draft Shadow Directories can be accessed at 36 http://www.ietf.org/shadow.html. 38 This Internet-Draft will expire on December 13, 2007. 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 . . . . . . . . . . . . . . . 18 81 4.3. Error Processing . . . . . . . . . . . . . . . . . . . . 18 82 4.4. HIP State Machine . . . . . . . . . . . . . . . . . . . . 19 83 4.4.1. HIP States . . . . . . . . . . . . . . . . . . . . . 20 84 4.4.2. HIP State Processes . . . . . . . . . . . . . . . . . 21 85 4.4.3. Simplified HIP State Diagram . . . . . . . . . . . . 28 86 4.5. User Data Considerations . . . . . . . . . . . . . . . . 30 87 4.5.1. TCP and UDP Pseudo-header Computation for User Data . 30 88 4.5.2. Sending Data on HIP Packets . . . . . . . . . . . . . 30 89 4.5.3. Transport Formats . . . . . . . . . . . . . . . . . . 30 90 4.5.4. Reboot and SA Timeout Restart of HIP . . . . . . . . 30 92 4.6. Certificate Distribution . . . . . . . . . . . . . . . . 31 93 5. Packet Formats . . . . . . . . . . . . . . . . . . . . . . . 32 94 5.1. Payload Format . . . . . . . . . . . . . . . . . . . . . 32 95 5.1.1. Checksum . . . . . . . . . . . . . . . . . . . . . . 33 96 5.1.2. HIP Controls . . . . . . . . . . . . . . . . . . . . 33 97 5.1.3. HIP Fragmentation Support . . . . . . . . . . . . . . 34 98 5.2. HIP Parameters . . . . . . . . . . . . . . . . . . . . . 35 99 5.2.1. TLV Format . . . . . . . . . . . . . . . . . . . . . 37 100 5.2.2. Defining New Parameters . . . . . . . . . . . . . . . 39 101 5.2.3. R1_COUNTER . . . . . . . . . . . . . . . . . . . . . 40 102 5.2.4. PUZZLE . . . . . . . . . . . . . . . . . . . . . . . 41 103 5.2.5. SOLUTION . . . . . . . . . . . . . . . . . . . . . . 42 104 5.2.6. DIFFIE_HELLMAN . . . . . . . . . . . . . . . . . . . 43 105 5.2.7. HIP_TRANSFORM . . . . . . . . . . . . . . . . . . . . 44 106 5.2.8. HOST_ID . . . . . . . . . . . . . . . . . . . . . . . 45 107 5.2.9. HMAC . . . . . . . . . . . . . . . . . . . . . . . . 46 108 5.2.10. HMAC_2 . . . . . . . . . . . . . . . . . . . . . . . 47 109 5.2.11. HIP_SIGNATURE . . . . . . . . . . . . . . . . . . . . 47 110 5.2.12. HIP_SIGNATURE_2 . . . . . . . . . . . . . . . . . . . 48 111 5.2.13. SEQ . . . . . . . . . . . . . . . . . . . . . . . . . 48 112 5.2.14. ACK . . . . . . . . . . . . . . . . . . . . . . . . . 49 113 5.2.15. ENCRYPTED . . . . . . . . . . . . . . . . . . . . . . 50 114 5.2.16. NOTIFICATION . . . . . . . . . . . . . . . . . . . . 51 115 5.2.17. ECHO_REQUEST_SIGNED . . . . . . . . . . . . . . . . . 54 116 5.2.18. ECHO_REQUEST_UNSIGNED . . . . . . . . . . . . . . . . 55 117 5.2.19. ECHO_RESPONSE_SIGNED . . . . . . . . . . . . . . . . 55 118 5.2.20. ECHO_RESPONSE_UNSIGNED . . . . . . . . . . . . . . . 56 119 5.3. HIP Packets . . . . . . . . . . . . . . . . . . . . . . . 56 120 5.3.1. I1 - the HIP Initiator Packet . . . . . . . . . . . . 57 121 5.3.2. R1 - the HIP Responder Packet . . . . . . . . . . . . 58 122 5.3.3. I2 - the Second HIP Initiator Packet . . . . . . . . 60 123 5.3.4. R2 - the Second HIP Responder Packet . . . . . . . . 61 124 5.3.5. UPDATE - the HIP Update Packet . . . . . . . . . . . 62 125 5.3.6. NOTIFY - the HIP Notify Packet . . . . . . . . . . . 63 126 5.3.7. CLOSE - the HIP Association Closing Packet . . . . . 63 127 5.3.8. CLOSE_ACK - the HIP Closing Acknowledgment Packet . . 64 128 5.4. ICMP Messages . . . . . . . . . . . . . . . . . . . . . . 64 129 5.4.1. Invalid Version . . . . . . . . . . . . . . . . . . . 65 130 5.4.2. Other Problems with the HIP Header and Packet 131 Structure . . . . . . . . . . . . . . . . . . . . . . 65 132 5.4.3. Invalid Puzzle Solution . . . . . . . . . . . . . . . 65 133 5.4.4. Non-existing HIP Association . . . . . . . . . . . . 65 134 6. Packet Processing . . . . . . . . . . . . . . . . . . . . . . 66 135 6.1. Processing Outgoing Application Data . . . . . . . . . . 66 136 6.2. Processing Incoming Application Data . . . . . . . . . . 67 137 6.3. Solving the Puzzle . . . . . . . . . . . . . . . . . . . 68 138 6.4. HMAC and SIGNATURE Calculation and Verification . . . . . 69 139 6.4.1. HMAC Calculation . . . . . . . . . . . . . . . . . . 69 140 6.4.2. Signature Calculation . . . . . . . . . . . . . . . . 71 141 6.5. HIP KEYMAT Generation . . . . . . . . . . . . . . . . . . 73 142 6.6. Initiation of a HIP Exchange . . . . . . . . . . . . . . 75 143 6.6.1. Sending Multiple I1s in Parallel . . . . . . . . . . 76 144 6.6.2. Processing Incoming ICMP Protocol Unreachable 145 Messages . . . . . . . . . . . . . . . . . . . . . . 76 146 6.7. Processing Incoming I1 Packets . . . . . . . . . . . . . 76 147 6.7.1. R1 Management . . . . . . . . . . . . . . . . . . . . 78 148 6.7.2. Handling Malformed Messages . . . . . . . . . . . . . 78 149 6.8. Processing Incoming R1 Packets . . . . . . . . . . . . . 78 150 6.8.1. Handling Malformed Messages . . . . . . . . . . . . . 80 151 6.9. Processing Incoming I2 Packets . . . . . . . . . . . . . 80 152 6.9.1. Handling Malformed Messages . . . . . . . . . . . . . 83 153 6.10. Processing Incoming R2 Packets . . . . . . . . . . . . . 83 154 6.11. Sending UPDATE Packets . . . . . . . . . . . . . . . . . 83 155 6.12. Receiving UPDATE Packets . . . . . . . . . . . . . . . . 84 156 6.12.1. Handling a SEQ parameter in a received UPDATE 157 message . . . . . . . . . . . . . . . . . . . . . . . 85 158 6.12.2. Handling an ACK Parameter in a Received UPDATE 159 Packet . . . . . . . . . . . . . . . . . . . . . . . 86 160 6.13. Processing NOTIFY Packets . . . . . . . . . . . . . . . . 86 161 6.14. Processing CLOSE Packets . . . . . . . . . . . . . . . . 86 162 6.15. Processing CLOSE_ACK Packets . . . . . . . . . . . . . . 87 163 6.16. Handling State Loss . . . . . . . . . . . . . . . . . . . 87 164 7. HIP Policies . . . . . . . . . . . . . . . . . . . . . . . . 88 165 8. Security Considerations . . . . . . . . . . . . . . . . . . . 89 166 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 92 167 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 94 168 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 95 169 11.1. Normative References . . . . . . . . . . . . . . . . . . 95 170 11.2. Informative References . . . . . . . . . . . . . . . . . 96 171 Appendix A. Using Responder Puzzles . . . . . . . . . . . . . . 98 172 Appendix B. Generating a Public Key Encoding from a HI . . . . . 100 173 Appendix C. Example Checksums for HIP Packets . . . . . . . . . 101 174 C.1. IPv6 HIP Example (I1) . . . . . . . . . . . . . . . . . . 101 175 C.2. IPv4 HIP Packet (I1) . . . . . . . . . . . . . . . . . . 101 176 C.3. TCP Segment . . . . . . . . . . . . . . . . . . . . . . . 101 177 Appendix D. 384-bit Group . . . . . . . . . . . . . . . . . . . 103 178 Appendix E. OAKLEY Well-known group 1 . . . . . . . . . . . . . 104 179 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 105 180 Intellectual Property and Copyright Statements . . . . . . . . . 106 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 middleboxes), 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 multiple security issues involved with opportunistic mode 717 that must be carefully addressed in the implementation. Such a set 718 up is vulnerable to, e.g., man-in-the-middle attacks, because the 719 initializing node does not have any public key information about the 720 peer. 722 While this document defines the concept of the opportunistic mode, 723 and outlines the basic signalling mechanism to trigger it; i.e., send 724 an I1 with a NULL destination HIT, this document does not specify the 725 details of the opportunistic mode. Especially, its security 726 properties are not discussed beyond the warning above. However, the 727 authors believe that using the opportunistic mode is no less secure 728 than communicating, without any cryptographic protection, over the 729 current Internet. It is expected that a separate document will 730 describe the opportunistic mode in more detail, including its 731 security properties. 733 4.2. Updating a HIP Association 735 A HIP association between two hosts may need to be updated over time. 736 Examples include the need to rekey expiring user data security 737 associations, add new security associations, or change IP addresses 738 associated with hosts. The UPDATE packet is used for those and other 739 similar purposes. This document only specifies the UPDATE packet 740 format and basic processing rules, with mandatory parameters. The 741 actual usage is defined in separate specifications. 743 HIP provides a general purpose UPDATE packet, which can carry 744 multiple HIP parameters, for updating the HIP state between two 745 peers. The UPDATE mechanism has the following properties: 747 UPDATE messages carry a monotonically increasing sequence number 748 and are explicitly acknowledged by the peer. Lost UPDATEs or 749 acknowledgments may be recovered via retransmission. Multiple 750 UPDATE messages may be outstanding under certain circumstances. 752 UPDATE is protected by both HMAC and HIP_SIGNATURE parameters, 753 since processing UPDATE signatures alone is a potential DoS attack 754 against intermediate systems. 756 UPDATE packets are explicitly acknowledged by the use of an 757 acknowledgment parameter that echoes an individual sequence number 758 received from the peer. A single UPDATE packet may contain both a 759 sequence number and one or more acknowledgment numbers (i.e., 760 piggybacked acknowledgment(s) for the peer's UPDATE). 762 The UPDATE packet is defined in Section 5.3.5. 764 4.3. Error Processing 766 HIP error processing behavior depends on whether there exists an 767 active HIP association or not. In general, if a HIP association 768 exists between the sender and receiver of a packet causing an error 769 condition, the receiver SHOULD respond with a NOTIFY packet. On the 770 other hand, if there are no existing HIP associations between the 771 sender and receiver, or the receiver cannot reasonably determine the 772 identity of the sender, the receiver MAY respond with a suitable ICMP 773 message; see Section 5.4 for more details. 775 The HIP protocol and state machine is designed to recover from one of 776 the parties crashing and losing its state. The following scenarios 777 describe the main use cases covered by the design. 779 No prior state between the two systems. 781 The system with data to send is the Initiator. The process 782 follows the standard four packet base exchange, establishing 783 the HIP association. 785 The system with data to send has no state with the receiver, but 786 the receiver has a residual HIP association. 788 The system with data to send is the Initiator. The Initiator 789 acts as in no prior state, sending I1 and getting R1. When the 790 Responder receives a valid I2, the old association is 791 'discovered' and deleted, and the new association is 792 established. 794 The system with data to send has a HIP association, but the 795 receiver does not. 797 The system sends data on the outbound user data security 798 association. The receiver 'detects' the situation when it 799 receives a user data packet that it cannot match to any HIP 800 association. The receiving host MUST discard this packet. 801 Optionally, the receiving host MAY send an ICMP packet with the 802 Parameter Problem type to inform about non-existing HIP 803 association (see Section 5.4), and it MAY initiate a new HIP 804 negotiation. However, responding with these optional 805 mechanisms is implementation or policy dependent. 807 4.4. HIP State Machine 809 The HIP protocol itself has little state. In the HIP base exchange, 810 there is an Initiator and a Responder. Once the SAs are established, 811 this distinction is lost. If the HIP state needs to be re- 812 established, the controlling parameters are which peer still has 813 state and which has a datagram to send to its peer. The following 814 state machine attempts to capture these processes. 816 The state machine is presented in a single system view, representing 817 either an Initiator or a Responder. There is not a complete overlap 818 of processing logic here and in the packet definitions. Both are 819 needed to completely implement HIP. 821 Implementors must understand that the state machine, as described 822 here, is informational. Specific implementations are free to 823 implement the actual functions differently. Section 6 describes the 824 packet processing rules in more detail. This state machine focuses 825 on the HIP I1, R1, I2, and R2 packets only. Other states may be 826 introduced by mechanisms in other specifications (such as mobility 827 and multihoming). 829 4.4.1. HIP States 831 +---------------------+---------------------------------------------+ 832 | State | Explanation | 833 +---------------------+---------------------------------------------+ 834 | UNASSOCIATED | State machine start | 835 | | | 836 | I1-SENT | Initiating base exchange | 837 | | | 838 | I2-SENT | Waiting to complete base exchange | 839 | | | 840 | R2-SENT | Waiting to complete base exchange | 841 | | | 842 | ESTABLISHED | HIP association established | 843 | | | 844 | CLOSING | HIP association closing, no data can be | 845 | | sent | 846 | | | 847 | CLOSED | HIP association closed, no data can be sent | 848 | | | 849 | E-FAILED | HIP exchange failed | 850 +---------------------+---------------------------------------------+ 852 4.4.2. HIP State Processes 854 System behaviour in state UNASSOCIATED, Table 2. 856 +---------------------+---------------------------------------------+ 857 | Trigger | Action | 858 +---------------------+---------------------------------------------+ 859 | User data to send, | Send I1 and go to I1-SENT | 860 | requiring a new HIP | | 861 | association | | 862 | | | 863 | Receive I1 | Send R1 and stay at UNASSOCIATED | 864 | | | 865 | Receive I2, process | If successful, send R2 and go to R2-SENT | 866 | | | 867 | | If fail, stay at UNASSOCIATED | 868 | | | 869 | Receive user data | Optionally send ICMP as defined in | 870 | for unknown HIP | Section 5.4 and stay at UNASSOCIATED | 871 | association | | 872 | | | 873 | Receive CLOSE | Optionally send ICMP Parameter Problem and | 874 | | stay at UNASSOCIATED | 875 | | | 876 | Receive ANYOTHER | Drop and stay at UNASSOCIATED | 877 +---------------------+---------------------------------------------+ 879 Table 2: UNASSOCIATED - Start state 881 System behaviour in state I1-SENT, Table 3. 883 +---------------------+---------------------------------------------+ 884 | Trigger | Action | 885 +---------------------+---------------------------------------------+ 886 | Receive I1 | If the local HIT is smaller than the peer | 887 | | HIT, drop I1 and stay at I1-SENT | 888 | | | 889 | | If the local HIT is greater than the peer | 890 | | HIT, send R1 and stay at I1_SENT | 891 | | | 892 | Receive I2, process | If successful, send R2 and go to R2-SENT | 893 | | | 894 | | If fail, stay at I1-SENT | 895 | | | 896 | Receive R1, process | If successful, send I2 and go to I2-SENT | 897 | | | 898 | | If fail, stay at I1-SENT | 899 | | | 900 | Receive ANYOTHER | Drop and stay at I1-SENT | 901 | | | 902 | Timeout, increment | If counter is less than I1_RETRIES_MAX, | 903 | timeout counter | send I1 and stay at I1-SENT | 904 | | | 905 | | If counter is greater than I1_RETRIES_MAX, | 906 | | go to E-FAILED | 907 +---------------------+---------------------------------------------+ 909 Table 3: I1-SENT - Initiating HIP 911 System behaviour in state I2-SENT, Table 4. 913 +---------------------+---------------------------------------------+ 914 | Trigger | Action | 915 +---------------------+---------------------------------------------+ 916 | Receive I1 | Send R1 and stay at I2-SENT | 917 | | | 918 | Receive R1, process | If successful, send I2 and cycle at I2-SENT | 919 | | | 920 | | If fail, stay at I2-SENT | 921 | | | 922 | Receive I2, process | If successful and local HIT is smaller than | 923 | | the peer HIT, drop I2 and stay at I2-SENT | 924 | | | 925 | | If successful and local HIT is greater than | 926 | | the peer HIT, send R2 and go to R2-SENT | 927 | | | 928 | | If fail, stay at I2-SENT | 929 | | | 930 | Receive R2, process | If successful, go to ESTABLISHED | 931 | | | 932 | | If fail, stay at I2-SENT | 933 | | | 934 | Receive ANYOTHER | Drop and stay at I2-SENT | 935 | | | 936 | Timeout, increment | If counter is less than I2_RETRIES_MAX, | 937 | timeout counter | send I2 and stay at I2-SENT | 938 | | | 939 | | If counter is greater than I2_RETRIES_MAX, | 940 | | go to E-FAILED | 941 +---------------------+---------------------------------------------+ 943 Table 4: I2-SENT - Waiting to finish HIP 945 System behaviour in state R2-SENT, Table 5. 947 +---------------------+---------------------------------------------+ 948 | Trigger | Action | 949 +---------------------+---------------------------------------------+ 950 | Receive I1 | Send R1 and stay at R2-SENT | 951 | | | 952 | Receive I2, process | If successful, send R2 and cycle at R2-SENT | 953 | | | 954 | | If fail, stay at R2-SENT | 955 | | | 956 | Receive R1 | Drop and stay at R2-SENT | 957 | | | 958 | Receive R2 | Drop and stay at R2-SENT | 959 | | | 960 | Receive data or | Move to ESTABLISHED | 961 | UPDATE | | 962 | | | 963 | Exchange Complete | Move to ESTABLISHED | 964 | Timeout | | 965 +---------------------+---------------------------------------------+ 967 Table 5: R2-SENT - Waiting to finish HIP 969 System behaviour in state ESTABLISHED, Table 6. 971 +---------------------+---------------------------------------------+ 972 | Trigger | Action | 973 +---------------------+---------------------------------------------+ 974 | Receive I1 | Send R1 and stay at ESTABLISHED | 975 | | | 976 | Receive I2, process | If successful, send R2, drop old HIP | 977 | with puzzle and | association, establish a new HIP | 978 | possible Opaque | association, go to R2-SENT | 979 | data verification | | 980 | | | 981 | | If fail, stay at ESTABLISHED | 982 | | | 983 | Receive R1 | Drop and stay at ESTABLISHED | 984 | | | 985 | Receive R2 | Drop and stay at ESTABLISHED | 986 | | | 987 | Receive user data | Process and stay at ESTABLISHED | 988 | for HIP association | | 989 | | | 990 | No packet | Send CLOSE and go to CLOSING | 991 | sent/received | | 992 | during UAL minutes | | 993 | | | 994 | Receive CLOSE, | If successful, send CLOSE_ACK and go to | 995 | process | CLOSED | 996 | | | 997 | | If fail, stay at ESTABLISHED | 998 +---------------------+---------------------------------------------+ 1000 Table 6: ESTABLISHED - HIP association established 1002 System behaviour in state CLOSING, Table 7. 1004 +---------------------+---------------------------------------------+ 1005 | Trigger | Action | 1006 +---------------------+---------------------------------------------+ 1007 | User data to send, | Send I1 and stay at CLOSING | 1008 | requires the | | 1009 | creation of another | | 1010 | incarnation of the | | 1011 | HIP association | | 1012 | | | 1013 | Receive I1 | Send R1 and stay at CLOSING | 1014 | | | 1015 | Receive I2, process | If successful, send R2 and go to R2-SENT | 1016 | | | 1017 | | If fail, stay at CLOSING | 1018 | | | 1019 | Receive R1, process | If successful, send I2 and go to I2-SENT | 1020 | | | 1021 | | If fail, stay at CLOSING | 1022 | | | 1023 | Receive CLOSE, | If successful, send CLOSE_ACK, discard | 1024 | process | state and go to CLOSED | 1025 | | | 1026 | | If fail, stay at CLOSING | 1027 | | | 1028 | Receive CLOSE_ACK, | If successful, discard state and go to | 1029 | process | UNASSOCIATED | 1030 | | | 1031 | | If fail, stay at CLOSING | 1032 | | | 1033 | Receive ANYOTHER | Drop and stay at CLOSING | 1034 | | | 1035 | Timeout, increment | If timeout sum is less than UAL+MSL | 1036 | timeout sum, reset | minutes, retransmit CLOSE and stay at | 1037 | timer | CLOSING | 1038 | | | 1039 | | If timeout sum is greater than UAL+MSL | 1040 | | minutes, go to UNASSOCIATED | 1041 +---------------------+---------------------------------------------+ 1043 Table 7: CLOSING - HIP association has not been used for UAL minutes 1044 System behaviour in state CLOSED, Table 8. 1046 +---------------------+---------------------------------------------+ 1047 | Trigger | Action | 1048 +---------------------+---------------------------------------------+ 1049 | Datagram to send, | Send I1, and stay at CLOSED | 1050 | requires the | | 1051 | creation of another | | 1052 | incarnation of the | | 1053 | HIP association | | 1054 | | | 1055 | Receive I1 | Send R1 and stay at CLOSED | 1056 | | | 1057 | Receive I2, process | If successful, send R2 and go to R2-SENT | 1058 | | | 1059 | | If fail, stay at CLOSED | 1060 | | | 1061 | Receive R1, process | If successful, send I2 and go to I2-SENT | 1062 | | | 1063 | | If fail, stay at CLOSED | 1064 | | | 1065 | Receive CLOSE, | If successful, send CLOSE_ACK, stay at | 1066 | process | CLOSED | 1067 | | | 1068 | | If fail, stay at CLOSED | 1069 | | | 1070 | Receive CLOSE_ACK, | If successful, discard state and go to | 1071 | process | UNASSOCIATED | 1072 | | | 1073 | | If fail, stay at CLOSED | 1074 | | | 1075 | Receive ANYOTHER | Drop and stay at CLOSED | 1076 | | | 1077 | Timeout (UAL+2MSL) | Discard state and go to UNASSOCIATED | 1078 +---------------------+---------------------------------------------+ 1080 Table 8: CLOSED - CLOSE_ACK sent, resending CLOSE_ACK if necessary 1082 System behaviour in state E-FAILED, Table 9. 1084 +---------------------+---------------------------------------------+ 1085 | Trigger | Action | 1086 +---------------------+---------------------------------------------+ 1087 | Wait for | Go to UNASSOCIATED. Re-negotiation is | 1088 | implementation | possible after moving to UNASSOCIATED | 1089 | specific time | state. | 1090 +---------------------+---------------------------------------------+ 1092 Table 9: E-FAILED - HIP failed to establish association with peer 1094 4.4.3. Simplified HIP State Diagram 1096 The following diagram shows the major state transitions. Transitions 1097 based on received packets implicitly assume that the packets are 1098 successfully authenticated or processed. 1100 +-+ +---------------------------+ 1101 I1 received, send R1 | | | | 1102 | v v | 1103 Datagram to send +--------------+ I2 received, send R2 | 1104 +---------------| UNASSOCIATED |---------------+ | 1105 Send I1 | +--------------+ | | 1106 v | | 1107 +---------+ I2 received, send R2 | | 1108 +---->| I1-SENT |---------------------------------------+ | | 1109 | +---------+ | | | 1110 | | +------------------------+ | | | 1111 | | R1 received, | I2 received, send R2 | | | | 1112 | v send I2 | v v v | 1113 | +---------+ | +---------+ | 1114 | +->| I2-SENT |------------+ | R2-SENT |<----+ | 1115 | | +---------+ +---------+ | | 1116 | | | | | | 1117 | | | data| | | 1118 | |receive | or| | | 1119 | |R1, send | EC timeout| receive I2,| | 1120 | |I2 |R2 received +--------------+ | send R2| | 1121 | | +----------->| ESTABLISHED |<-------+| | | 1122 | | +--------------+ | | 1123 | | | | | receive I2, send R2 | | 1124 | | recv+------------+ | +------------------------+ | 1125 | | CLOSE,| | | | 1126 | | send| No packet sent| | | 1127 | | CLOSE_ACK| /received for | timeout | | 1128 | | | UAL min, send | +---------+<-+ (UAL+MSL) | | 1129 | | | CLOSE +--->| CLOSING |--+ retransmit | | 1130 | | | +---------+ CLOSE | | 1131 +--|------------|----------------------+ | | | | | | 1132 | +------------|------------------------+ | | +----------------+ | 1133 | | | +-----------+ +------------------|--+ 1134 | | +------------+ | receive CLOSE, CLOSE_ACK | | 1135 | | | | send CLOSE_ACK received or | | 1136 | | | | timeout | | 1137 | | | | (UAL+MSL) | | 1138 | | v v | | 1139 | | +--------+ receive I2, send R2 | | 1140 | +------------------------| CLOSED |---------------------------+ | 1141 +---------------------------+--------+ /----------------------+ 1142 Datagram to send, send I1 ^ | \-------/ timeout (UAL+2MSL), 1143 +-+ move to UNASSOCIATED 1144 CLOSE received, send CLOSE_ACK 1146 4.5. User Data Considerations 1148 4.5.1. TCP and UDP Pseudo-header Computation for User Data 1150 When computing TCP and UDP checksums on user data packets that flow 1151 through sockets bound to HITs, the IPv6 pseudo-header format 1152 [RFC2460] MUST be used, even if the actual addresses on the packet 1153 are IPv4 addresses. Additionally, the HITs MUST be used in the place 1154 of the IPv6 addresses in the IPv6 pseudo-header. Note that the 1155 pseudo-header for actual HIP payloads is computed differently; see 1156 Section 5.1.1. 1158 4.5.2. Sending Data on HIP Packets 1160 A future version of this document may define how to include user data 1161 on various HIP packets. However, currently the HIP header is a 1162 terminal header, and not followed by any other headers. 1164 4.5.3. Transport Formats 1166 The actual data transmission format, used for user data after the HIP 1167 base exchange, is not defined in this document. Such transport 1168 formats and methods are described in separate specifications. All 1169 HIP implementations MUST implement, at minimum, the ESP transport 1170 format for HIP [I-D.ietf-hip-esp]. 1172 When new transport formats are defined, they get the type value from 1173 the HIP Transform type value space 2048 - 4095. The order in which 1174 the transport formats are presented in the R1 packet, is the 1175 preferred order. The last of the transport formats MUST be ESP 1176 transport format, represented by the ESP_TRANSFORM parameter. 1178 4.5.4. Reboot and SA Timeout Restart of HIP 1180 Simulating a loss of state is a potential DoS attack. The following 1181 process has been crafted to manage state recovery without presenting 1182 a DoS opportunity. 1184 If a host reboots or the HIP association times out, it has lost its 1185 HIP state. If the host that lost state has a datagram to send to the 1186 peer, it simply restarts the HIP base exchange. After the base 1187 exchange has completed, the Initiator can create a new SA and start 1188 sending data. The peer does not reset its state until it receives a 1189 valid I2 HIP packet. 1191 If a system receives a user data packet that cannot be matched to any 1192 existing HIP association, it is possible that it has lost the state 1193 and its peer has not. It MAY send an ICMP packet with the Parameter 1194 Problem type, the Pointer pointing to the referred HIP-related 1195 association information. Reacting to such traffic depends on the 1196 implementation and the environment where the implementation is used. 1198 If the host, that apparently has lost its state, decides to restart 1199 the HIP base exchange, it sends an I1 packet to the peer. After the 1200 base exchange has been completed successfully, the Initiator can 1201 create a new HIP association and the peer drops its OLD SA and 1202 creates a new one. 1204 4.6. Certificate Distribution 1206 HIP base specification does not define how to use certificates or how 1207 to transfer them between hosts. These functions are defined in a 1208 separate specification. A parameter type value, meant to be used for 1209 carrying certificates, is reserved, though: CERT, Type 768; see 1210 Section 5.2. 1212 5. Packet Formats 1214 5.1. Payload Format 1216 All HIP packets start with a fixed header. 1218 0 1 2 3 1219 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 1220 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1221 | Next Header | Header Length |0| Packet Type | VER. | RES.|1| 1222 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1223 | Checksum | Controls | 1224 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1225 | Sender's Host Identity Tag (HIT) | 1226 | | 1227 | | 1228 | | 1229 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1230 | Receiver's Host Identity Tag (HIT) | 1231 | | 1232 | | 1233 | | 1234 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1235 | | 1236 / HIP Parameters / 1237 / / 1238 | | 1239 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1241 The HIP header is logically an IPv6 extension header. However, this 1242 document does not describe processing for Next Header values other 1243 than decimal 59, IPPROTO_NONE, the IPv6 no next header value. Future 1244 documents MAY do so. However, current implementations MUST ignore 1245 trailing data if an unimplemented Next Header value is received. 1247 The Header Length field contains the length of the HIP Header and HIP 1248 parameters in 8 bytes units, excluding the first 8 bytes. Since all 1249 HIP headers MUST contain the sender's and receiver's HIT fields, the 1250 minimum value for this field is 4, and conversely, the maximum length 1251 of the HIP Parameters field is (255*8)-32 = 2008 bytes. Note: this 1252 sets an additional limit for sizes of parameters included in the 1253 Parameters field, independent of the individual parameter maximum 1254 lengths. 1256 The Packet Type indicates the HIP packet type. The individual packet 1257 types are defined in the relevant sections. If a HIP host receives a 1258 HIP packet that contains an unknown packet type, it MUST drop the 1259 packet. 1261 The HIP Version is four bits. The current version is 1. The version 1262 number is expected to be incremented only if there are incompatible 1263 changes to the protocol. Most extensions can be handled by defining 1264 new packet types, new parameter types, or new controls. 1266 The following three bits are reserved for future use. They MUST be 1267 zero when sent, and they SHOULD be ignored when handling a received 1268 packet. 1270 The two fixed bits in the header are reserved for potential SHIM6 1271 compatibility [I-D.ietf-shim6-proto]. For implementations adhering 1272 (only) to this specification, they MUST be set as shown when sending 1273 and MUST be ignored when receiving. This is to ensure optimal 1274 forward compatibility. Note that implementations that implement 1275 other compatible specifications in addition to this specification, 1276 the corresponding rules may well be different. For example, in the 1277 case that the forthcoming SHIM6 protocol happens to be compatible 1278 with this specification, an implementation that implements both this 1279 specification and the SHIM6 protocol may need to check these bits in 1280 order to determine how to handle the packet. 1282 The HIT fields are always 128 bits (16 bytes) long. 1284 5.1.1. Checksum 1286 Since the checksum covers the source and destination addresses in the 1287 IP header, it must be recomputed on HIP-aware NAT devices. 1289 If IPv6 is used to carry the HIP packet, the pseudo-header [RFC2460] 1290 contains the source and destination IPv6 addresses, HIP packet length 1291 in the pseudo-header length field, a zero field, and the HIP protocol 1292 number (see Section 4) in the Next Header field. The length field is 1293 in bytes and can be calculated from the HIP header length field: (HIP 1294 Header Length + 1) * 8. 1296 In case of using IPv4, the IPv4 UDP pseudo header format [RFC0768] is 1297 used. In the pseudo header, the source and destination addresses are 1298 those used in the IP header, the zero field is obviously zero, the 1299 protocol is the HIP protocol number (see Section 4), and the length 1300 is calculated as in the IPv6 case. 1302 5.1.2. HIP Controls 1304 The HIP Controls section conveys information about the structure of 1305 the packet and capabilities of the host. 1307 The following fields have been defined: 1309 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1310 | | | | | | | | | | | | | | | |A| 1311 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1313 A - Anonymous: If this is set, the sender's HI in this packet is 1314 anonymous, i.e., one not listed in a directory. Anonymous HIs 1315 SHOULD NOT be stored. This control is set in packets R1 and/or 1316 I2. The peer receiving an anonymous HI may choose to refuse it. 1318 The rest of the fields are reserved for future use and MUST be set to 1319 zero on sent packets and ignored on received packets. 1321 5.1.3. HIP Fragmentation Support 1323 A HIP implementation must support IP fragmentation / reassembly. 1324 Fragment reassembly MUST be implemented in both IPv4 and IPv6, but 1325 fragment generation is REQUIRED to be implemented in IPv4 (IPv4 1326 stacks and networks will usually do this by default) and RECOMMENDED 1327 to be implemented in IPv6. In IPv6 networks, the minimum MTU is 1328 larger, 1280 bytes, than in IPv4 networks. The larger MTU size is 1329 usually sufficient for most HIP packets, and therefore fragment 1330 generation may not be needed. If a host expects to send HIP packets 1331 that are larger than the minimum IPv6 MTU, it MUST implement fragment 1332 generation even for IPv6. 1334 In IPv4 networks, HIP packets may encounter low MTUs along their 1335 routed path. Since HIP does not provide a mechanism to use multiple 1336 IP datagrams for a single HIP packet, support for path MTU discovery 1337 does not bring any value to HIP in IPv4 networks. HIP-aware NAT 1338 devices MUST perform any IPv4 reassembly/fragmentation. 1340 All HIP implementations have to be careful while employing a 1341 reassembly algorithm so that the algorithm is sufficiently resistant 1342 to DoS attacks. 1344 Because certificate chains can cause the packet to be fragmented and 1345 fragmentation can open implementation to denial of service attacks 1346 [KAU03], it is strongly recommended that the separate document 1347 specifying the certificate usage in HIP Base Exchange defines the 1348 usage of "Hash and URL" formats rather than including certificates in 1349 exchanges. With this, most problems related to DoS attacks with 1350 fragmentation can be avoided. 1352 5.2. HIP Parameters 1354 The HIP Parameters are used to carry the public key associated with 1355 the sender's HIT, together with related security and other 1356 information. They consist of ordered parameters, encoded in TLV 1357 format. 1359 The following parameter types are currently defined. 1361 +------------------------+-------+----------+-----------------------+ 1362 | TLV | Type | Length | Data | 1363 +------------------------+-------+----------+-----------------------+ 1364 | R1_COUNTER | 128 | 12 | System Boot Counter | 1365 | | | | | 1366 | PUZZLE | 257 | 12 | K and Random #I | 1367 | | | | | 1368 | SOLUTION | 321 | 20 | K, Random #I and | 1369 | | | | puzzle solution J | 1370 | | | | | 1371 | SEQ | 385 | 4 | Update packet ID | 1372 | | | | number | 1373 | | | | | 1374 | ACK | 449 | variable | Update packet ID | 1375 | | | | number | 1376 | | | | | 1377 | DIFFIE_HELLMAN | 513 | variable | public key | 1378 | | | | | 1379 | HIP_TRANSFORM | 577 | variable | HIP Encryption and | 1380 | | | | Integrity Transform | 1381 | | | | | 1382 | ENCRYPTED | 641 | variable | Encrypted part of I2 | 1383 | | | | packet | 1384 | | | | | 1385 | HOST_ID | 705 | variable | Host Identity with | 1386 | | | | Fully Qualified | 1387 | | | | Domain Name or NAI | 1388 | | | | | 1389 | CERT | 768 | variable | HI Certificate; used | 1390 | | | | to transfer | 1391 | | | | certificates. Usage | 1392 | | | | defined in a separate | 1393 | | | | document. | 1394 | | | | | 1395 | NOTIFICATION | 832 | variable | Informational data | 1396 | | | | | 1397 | ECHO_REQUEST_SIGNED | 897 | variable | Opaque data to be | 1398 | | | | echoed back; under | 1399 | | | | signature | 1400 | | | | | 1401 | ECHO_RESPONSE_SIGNED | 961 | variable | Opaque data echoed | 1402 | | | | back; under signature | 1403 | | | | | 1404 | HMAC | 61505 | variable | HMAC based message | 1405 | | | | authentication code, | 1406 | | | | with key material | 1407 | | | | from HIP_TRANSFORM | 1408 | | | | | 1409 | HMAC_2 | 61569 | variable | HMAC based message | 1410 | | | | authentication code, | 1411 | | | | with key material | 1412 | | | | from HIP_TRANSFORM. | 1413 | | | | Compared to HMAC, the | 1414 | | | | HOST_ID parameter is | 1415 | | | | included in HMAC_2 | 1416 | | | | calculation. | 1417 | | | | | 1418 | HIP_SIGNATURE_2 | 61633 | variable | Signature of the R1 | 1419 | | | | packet | 1420 | | | | | 1421 | HIP_SIGNATURE | 61697 | variable | Signature of the | 1422 | | | | packet | 1423 | | | | | 1424 | ECHO_REQUEST_UNSIGNED | 63661 | variable | Opaque data to be | 1425 | | | | echoed back; after | 1426 | | | | signature | 1427 | | | | | 1428 | ECHO_RESPONSE_UNSIGNED | 63425 | variable | Opaque data echoed | 1429 | | | | back; after signature | 1430 +------------------------+-------+----------+-----------------------+ 1432 Because the ordering (from lowest to highest) of HIP parameters is 1433 strictly enforced (see Section 5.2.1), the parameter type values for 1434 existing parameters have been spaced to allow for future protocol 1435 extensions. Parameters numbered between 0-1023 are used in HIP 1436 handshake and update procedures and are covered by signatures. 1437 Parameters numbered between 1024-2047 are reserved. Parameters 1438 numbered between 2048-4095 are used for parameters related to HIP 1439 transform types. Parameters numbered between 4096 and (2^16 - 2^12) 1440 61439 are reserved. Parameters numbered between 61440-62463 are used 1441 for signatures and signed MACs. Parameters numbered between 62464- 1442 63487 are used for parameters that fall outside of the signed area of 1443 the packet. Parameters numbered between 63488-64511 are used for 1444 rendezvous and other relaying services. Parameters numbered between 1445 64512-65535 are reserved. 1447 5.2.1. TLV Format 1449 The TLV-encoded parameters are described in the following 1450 subsections. The type-field value also describes the order of these 1451 fields in the packet, except for type values from 2048 to 4095 which 1452 are reserved for new transport forms. The parameters MUST be 1453 included in the packet such that their types form an increasing 1454 order. If the parameter can exist multiple times in the packet, the 1455 type value may be the same in consecutive parameters. If the order 1456 does not follow this rule, the packet is considered to be malformed 1457 and it MUST be discarded. 1459 Parameters using type values from 2048 up to 4095 are transport 1460 formats. Currently, one transport format is defined: the ESP 1461 transport format [I-D.ietf-hip-esp]. The order of these parameters 1462 does not follow the order of their type value, but they are put in 1463 the packet in order of preference. The first of the transport 1464 formats it the most preferred, and so on. 1466 All of the TLV parameters have a length (including Type and Length 1467 fields) which is a multiple of 8 bytes. When needed, padding MUST be 1468 added to the end of the parameter so that the total length becomes a 1469 multiple of 8 bytes. This rule ensures proper alignment of data. 1470 Any added padding bytes MUST be zeroed by the sender, and their 1471 values SHOULD NOT be checked by the receiver. 1473 Consequently, the Length field indicates the length of the Contents 1474 field (in bytes). The total length of the TLV parameter (including 1475 Type, Length, Contents, and Padding) is related to the Length field 1476 according to the following formula: 1478 Total Length = 11 + Length - (Length + 3) % 8; 1480 0 1 2 3 1481 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 1482 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1483 | Type |C| Length | 1484 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1485 | | 1486 / Contents / 1487 / +-+-+-+-+-+-+-+-+ 1488 | | Padding | 1489 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1491 Type Type code for the parameter. 16 bits long, C-bit 1492 being part of the Type code. 1493 C Critical. One if this parameter is critical, and 1494 MUST be recognized by the recipient, zero otherwise. 1495 The C bit is considered to be a part of the Type 1496 field. Consequently, critical parameters are always 1497 odd and non-critical ones have an even value. 1498 Length Length of the Contents, in bytes. 1499 Contents Parameter specific, defined by Type 1500 Padding Padding, 0-7 bytes, added if needed 1502 Critical parameters MUST be recognized by the recipient. If a 1503 recipient encounters a critical parameter that it does not recognize, 1504 it MUST NOT process the packet any further. It MAY send an ICMP or 1505 NOTIFY, as defined in Section 4.3. 1507 Non-critical parameters MAY be safely ignored. If a recipient 1508 encounters a non-critical parameter that it does not recognize, it 1509 SHOULD proceed as if the parameter was not present in the received 1510 packet. 1512 5.2.2. Defining New Parameters 1514 Future specifications may define new parameters as needed. When 1515 defining new parameters, care must be taken to ensure that the 1516 parameter type values are appropriate and leave suitable space for 1517 other future extensions. One must remember that the parameters MUST 1518 always be arranged in the increasing order by type code, thereby 1519 limiting the order of parameters (see Section 5.2.1). 1521 The following rules must be followed when defining new parameters. 1523 1. The low order bit C of the Type code is used to distinguish 1524 between critical and non-critical parameters. 1526 2. A new parameter may be critical only if an old recipient ignoring 1527 it would cause security problems. In general, new parameters 1528 SHOULD be defined as non-critical, and expect a reply from the 1529 recipient. 1531 3. If a system implements a new critical parameter, it MUST provide 1532 the ability to configure the associated feature off, such that 1533 the critical parameter is not sent at all. The configuration 1534 option must be well documented. Implementations operating in a 1535 mode adhering to this specification MUST disable the sending of 1536 new critical parameters. In other words, the management 1537 interface MUST allow vanilla standards-only mode as a default 1538 configuration setting, and MAY allow new critical payloads to be 1539 configured on (and off). 1541 4. See section Section 9 for allocation rules regarding type codes. 1543 5.2.3. R1_COUNTER 1545 0 1 2 3 1546 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 1547 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1548 | Type | Length | 1549 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1550 | Reserved, 4 bytes | 1551 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1552 | R1 generation counter, 8 bytes | 1553 | | 1554 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1556 Type 128 1557 Length 12 1558 R1 generation 1559 counter The current generation of valid puzzles 1561 The R1_COUNTER parameter contains an 64-bit unsigned integer in 1562 network byte order, indicating the current generation of valid 1563 puzzles. The sender is supposed to increment this counter 1564 periodically. It is RECOMMENDED that the counter value is 1565 incremented at least as often as old PUZZLE values are deprecated so 1566 that SOLUTIONs to them are no longer accepted. 1568 The R1_COUNTER parameter is optional. It SHOULD be included in the 1569 R1 (in which case it is covered by the signature), and if present in 1570 the R1, it MAY be echoed (including the Reserved field verbatim) by 1571 the Initiator in the I2. 1573 5.2.4. PUZZLE 1575 0 1 2 3 1576 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 1577 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1578 | Type | Length | 1579 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1580 | K, 1 byte | Lifetime | Opaque, 2 bytes | 1581 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1582 | Random # I, 8 bytes | 1583 | | 1584 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1586 Type 257 1587 Length 12 1588 K K is the number of verified bits 1589 Lifetime Puzzle lifetime 2^(value-32) seconds 1590 Opaque Data set by the Responder, indexing the puzzle 1591 Random #I random number 1593 Random #I is represented as 64-bit integer, K and Lifetime as 8-bit 1594 integer, all in network byte order. 1596 The PUZZLE parameter contains the puzzle difficulty K and a 64-bit 1597 puzzle random integer #I. The Puzzle Lifetime indicates the time 1598 during which the puzzle solution is valid, and sets a time limit 1599 which should not be exceeded by the Initiator while it attempts to 1600 solve the puzzle. The lifetime is indicated as a power of 2 using 1601 the formula 2^(Lifetime-32) seconds. A puzzle MAY be augmented with 1602 an ECHO_REQUEST_SIGNED or an ECHO_REQUEST_UNSIGNED parameter included 1603 in the R1; the contents of the echo request are then echoed back in 1604 the ECHO_RESPONSE_SIGNED or in the ECHO_RESPONSE_UNSIGNED, allowing 1605 the Responder to use the included information as a part of its puzzle 1606 processing. 1608 The Opaque and Random #I field are not covered by the HIP_SIGNATURE_2 1609 parameter. 1611 5.2.5. SOLUTION 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 | K, 1 byte | Reserved | Opaque, 2 bytes | 1619 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1620 | Random #I, 8 bytes | 1621 | | 1622 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1623 | Puzzle solution #J, 8 bytes | 1624 | | 1625 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1627 Type 321 1628 Length 20 1629 K K is the number of verified bits 1630 Reserved zero when sent, ignored when received 1631 Opaque copied unmodified from the received PUZZLE 1632 parameter 1633 Random #I random number 1634 Puzzle solution 1635 #J random number 1637 Random #I, and Random #J are represented as 64-bit integers, K as an 1638 8-bit integer, all in network byte order. 1640 The SOLUTION parameter contains a solution to a puzzle. It also 1641 echoes back the random difficulty K, the Opaque field, and the puzzle 1642 integer #I. 1644 5.2.6. DIFFIE_HELLMAN 1646 0 1 2 3 1647 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 1648 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1649 | Type | Length | 1650 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1651 | Group ID | Public Value Length | Public Value / 1652 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1653 / | 1654 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1655 | Group ID | Public Value Length | Public Value / 1656 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1657 / | padding | 1658 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1660 Type 513 1661 Length length in octets, excluding Type, Length, and 1662 padding 1663 Group ID defines values for p and g 1664 Public Value length of the following Public Value in octets 1665 Length 1666 Public Value the sender's public Diffie-Hellman key 1668 The following Group IDs have been defined: 1670 Group Value 1671 Reserved 0 1672 384-bit group 1 1673 OAKLEY well known group 1 2 1674 1536-bit MODP group 3 1675 3072-bit MODP group 4 1676 6144-bit MODP group 5 1677 8192-bit MODP group 6 1679 The MODP Diffie-Hellman groups are defined in [RFC3526]. The OAKLEY 1680 well known group 1 is defined in Appendix E. 1682 The sender can include at most two different Diffie-Hellman public 1683 values in the DIFFIE_HELLMAN parameter. This gives the possibility 1684 e.g. for a server to provide a weaker encryption possibility for a 1685 PDA host that is not powerful enough. It is RECOMMENDED that the 1686 Initiator, receiving more than one public values selects the stronger 1687 one, if it supports it. 1689 A HIP implementation MUST implement Group IDs 1 and 3. The 384-bit 1690 group can be used when lower security is enough (e.g. web surfing) 1691 and when the equipment is not powerful enough (e.g. some PDAs). It 1692 is REQUIRED that the default configuration allows Group ID 1 usage, 1693 but it is RECOMMENDED that applications that need stronger security 1694 turn Group ID 1 support off. Equipment powerful enough SHOULD 1695 implement also group ID 5. The 384-bit group is defined in 1696 Appendix D. 1698 To avoid unnecessary failures during the base exchange, the rest of 1699 the groups SHOULD be implemented in hosts where resources are 1700 adequate. 1702 5.2.7. HIP_TRANSFORM 1704 0 1 2 3 1705 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 1706 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1707 | Type | Length | 1708 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1709 | Suite-ID #1 | Suite-ID #2 | 1710 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1711 | Suite-ID #n | Padding | 1712 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1714 Type 577 1715 Length length in octets, excluding Type, Length, and 1716 padding 1717 Suite-ID Defines the HIP Suite to be used 1719 The following Suite-IDs are defined ([RFC4307],[RFC2451]): 1721 Suite-ID Value 1723 RESERVED 0 1724 AES-CBC with HMAC-SHA1 1 1725 3DES-CBC with HMAC-SHA1 2 1726 3DES-CBC with HMAC-MD5 3 1727 BLOWFISH-CBC with HMAC-SHA1 4 1728 NULL-ENCRYPT with HMAC-SHA1 5 1729 NULL-ENCRYPT with HMAC-MD5 6 1731 The sender of a HIP transform parameter MUST make sure that there are 1732 no more than six (6) HIP Suite-IDs in one HIP transform parameter. 1733 Conversely, a recipient MUST be prepared to handle received transport 1734 parameters that contain more than six Suite-IDs by accepting the 1735 first six Suite-IDs and dropping the rest. The limited number of 1736 transforms sets the maximum size of HIP_TRANSFORM parameter. As the 1737 default configuration, the HIP_TRANSFORM parameter MUST contain at 1738 least one of the mandatory Suite-IDs. There MAY be a configuration 1739 option that allows the administrator to override this default. 1741 The Responder lists supported and desired Suite-IDs in order of 1742 preference in the R1, up to the maximum of six Suite-IDs. The 1743 Initiator MUST choose only one of the corresponding Suite-IDs. That 1744 Suite-ID will be used for generating the I2. 1746 Mandatory implementations: AES-CBC with HMAC-SHA1 and NULL-ENCRYPTION 1747 with HMAC-SHA1. 1749 5.2.8. HOST_ID 1751 0 1 2 3 1752 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 1753 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1754 | Type | Length | 1755 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1756 | HI Length |DI-type| DI Length | 1757 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1758 | Host Identity / 1759 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1760 / | Domain Identifier / 1761 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1762 / | Padding | 1763 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1765 Type 705 1766 Length length in octets, excluding Type, Length, and 1767 Padding 1768 HI Length Length of the Host Identity in octets 1769 DI-type type of the following Domain Identifier field 1770 DI Length length of the FQDN or NAI in octets 1771 Host Identity actual host identity 1772 Domain Identifier the identifier of the sender 1774 The Host Identity is represented in RFC2535 [RFC2535] format. The 1775 algorithms used in RDATA format are the following: 1777 Algorithms Values 1779 RESERVED 0 1780 DSA 3 [RFC2536] (RECOMMENDED) 1781 RSA/SHA1 5 [RFC3110] (REQUIRED) 1783 The following DI-types have been defined: 1785 Type Value 1786 none included 0 1787 FQDN 1 1788 NAI 2 1790 FQDN Fully Qualified Domain Name, in binary format. 1791 NAI Network Access Identifier 1793 The format for the FQDN is defined in RFC1035 [RFC1035] Section 3.1. 1794 The format for Network Access Identifier is defined in 1795 [I-D.ietf-radext-rfc2486bis] 1797 If there is no Domain Identifier, i.e. the DI-type field is zero, 1798 also the DI Length field is set to zero. 1800 5.2.9. HMAC 1802 0 1 2 3 1803 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 1804 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1805 | Type | Length | 1806 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1807 | | 1808 | HMAC | 1809 / / 1810 / +-------------------------------+ 1811 | | Padding | 1812 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1814 Type 61505 1815 Length length in octets, excluding Type, Length, and 1816 Padding 1817 HMAC HMAC computed over the HIP packet, excluding the 1818 HMAC parameter and any following parameters, such 1819 as HIP_SIGNATURE, HIP_SIGNATURE_2, 1820 ECHO_REQUEST_UNSIGNED, or ECHO_RESPONSE_UNSIGNED. 1821 The checksum field MUST be set to zero and the HIP 1822 header length in the HIP common header MUST be 1823 calculated not to cover any excluded parameters 1824 when the HMAC is calculated. The size of the 1825 HMAC is the natural size of the hash computation 1826 output depending on the used hash function. 1828 The HMAC calculation and verification process is presented in 1829 Section 6.4.1 1831 5.2.10. HMAC_2 1833 The parameter structure is the same as in Section 5.2.9. The fields 1834 are: 1836 Type 61569 1837 Length length in octets, excluding Type, Length, and 1838 Padding 1839 HMAC HMAC computed over the HIP packet, excluding the 1840 HMAC parameter and any following parameters such 1841 as HIP_SIGNATURE, HIP_SIGNATURE_2, 1842 ECHO_REQUEST_UNSIGNED, or ECHO_RESPONSE_UNSIGNED, 1843 and including an additional sender's HOST_ID 1844 parameter during the HMAC calculation. The 1845 checksum field MUST be set to zero and the HIP 1846 header length in the HIP common header MUST be 1847 calculated not to cover any excluded parameters 1848 when the HMAC is calculated. The size of the 1849 HMAC is the natural size of the hash computation 1850 output depending on the used hash function. 1852 The HMAC calculation and verification process is presented in 1853 Section 6.4.1 1855 5.2.11. HIP_SIGNATURE 1857 0 1 2 3 1858 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1859 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1860 | Type | Length | 1861 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1862 | SIG alg | Signature / 1863 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1864 / | Padding | 1865 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1867 Type 61697 1868 Length length in octets, excluding Type, Length, and 1869 Padding 1870 SIG alg Signature algorithm 1871 Signature the signature is calculated over the HIP packet, 1872 excluding the HIP_SIGNATURE parameter and any 1873 parameters that follow the HIP_SIGNATURE parameter. 1874 The checksum field MUST be set to zero, and the HIP 1875 header length in the HIP common header MUST be 1876 calculated only to the beginning of the 1877 HIP_SIGNATURE parameter when the signature is 1878 calculated. 1880 The signature algorithms are defined in Section 5.2.8. The signature 1881 in the Signature field is encoded using the proper method depending 1882 on the signature algorithm (e.g. according to [RFC3110] in case of 1883 RSA/SHA1, or according to [RFC2536] in case of DSA). 1885 The HIP_SIGNATURE calculation and verification process is presented 1886 in Section 6.4.2 1888 5.2.12. HIP_SIGNATURE_2 1890 The parameter structure is the same as in Section 5.2.11. The fields 1891 are: 1893 Type 61633 1894 Length length in octets, excluding Type, Length, and 1895 Padding 1896 SIG alg Signature algorithm 1897 Signature the signature is calculated over the HIP R1 packet, 1898 excluding the HIP_SIGNATURE_2 parameter and any 1899 parameters that follow. Initiator's HIT, checksum 1900 field, and the Opaque and Random #I fields in the 1901 PUZZLE parameter MUST be set to zero while 1902 computing the HIP_SIGNATURE_2 signature. Further, 1903 the HIP packet length in the HIP header MUST be 1904 calculated to the beginning of the HIP_SIGNATURE_2 1905 parameter when the signature is calculated. 1907 Zeroing the Initiator's HIT makes it possible to create R1 packets 1908 beforehand to minimize the effects of possible DoS attacks. Zeroing 1909 the I and Opaque fields allows these fields to be populated 1910 dynamically on precomputed R1s. 1912 Signature calculation and verification follows the process in 1913 Section 6.4.2. 1915 5.2.13. SEQ 1917 0 1 2 3 1918 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 1919 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1920 | Type | Length | 1921 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1922 | Update ID | 1923 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1925 Type 385 1926 Length 4 1927 Update ID 32-bit sequence number 1929 The Update ID is an unsigned quantity, initialized by a host to zero 1930 upon moving to ESTABLISHED state. The Update ID has scope within a 1931 single HIP association, and not across multiple associations or 1932 multiple hosts. The Update ID is incremented by one before each new 1933 UPDATE that is sent by the host; the first UPDATE packet originated 1934 by a host has an Update ID of 0. 1936 5.2.14. ACK 1938 0 1 2 3 1939 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1940 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1941 | Type | Length | 1942 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1943 | peer Update ID | 1944 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1946 Type 449 1947 Length variable (multiple of 4) 1948 peer Update ID 32-bit sequence number corresponding to the 1949 Update ID being ACKed. 1951 The ACK parameter includes one or more Update IDs that have been 1952 received from the peer. The Length field identifies the number of 1953 peer Update IDs that are present in the parameter. 1955 5.2.15. ENCRYPTED 1957 0 1 2 3 1958 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1959 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1960 | Type | Length | 1961 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1962 | Reserved | 1963 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1964 | IV / 1965 / / 1966 / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1967 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / 1968 / Encrypted data / 1969 / / 1970 / +-------------------------------+ 1971 / | Padding | 1972 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1974 Type 641 1975 Length length in octets, excluding Type, Length, and 1976 Padding 1977 Reserved zero when sent, ignored when received 1978 IV Initialization vector, if needed, otherwise 1979 nonexistent. The length of the IV is inferred from 1980 the HIP transform. 1981 Encrypted The data is encrypted using an encryption algorithm 1982 data as defined in HIP transform. 1983 Padding Any Padding, if necessary, to make the parameter a 1984 multiple of 8 bytes. 1986 The ENCRYPTED parameter encapsulates another parameter, the encrypted 1987 data, which is also in TLV format. Consequently, the first fields in 1988 the encapsulated parameter(s) are Type and Length, allowing the 1989 contents to be easily parsed after decryption. 1991 Both the ENCRYPTED parameter and the encapsulated parameter(s) MUST 1992 be padded. The padding needed for the ENCRYPTED parameter is 1993 referred as the "outer" padding. Correspondingly, the padding for 1994 the parameter(s) encapsulated within the ENCRYPTED parameter is 1995 referred as the "inner" padding. 1997 The inner padding follows exactly the rules of Section 5.2.1. The 1998 outer padding also follows the same rules but with an exception. 1999 Namely, some algorithms require that the data to be encrypted must be 2000 a multiple of the cipher algorithm block size. In this case, the 2001 outer padding MUST include extra padding, as specified by the 2002 encryption algorithm. The size of the extra padding is selected so 2003 that the length of the ENCRYPTED is the minimum value that is both 2004 multiple of eight and the cipher block size. The encryption 2005 algorithm may specify padding bytes other than zero; for example, AES 2006 [FIPS01] uses the PKCS5 padding scheme [RFC2898] (see section 6.1.1) 2007 where the remaining n bytes to fill the block each have the value n. 2009 Note that the length of the cipher suite output may be smaller or 2010 larger than the length of the data to be encrypted, since the 2011 encryption process may compress the data or add additional padding to 2012 the data. 2014 5.2.16. NOTIFICATION 2016 The NOTIFICATION parameter is used to transmit informational data, 2017 such as error conditions and state transitions, to a HIP peer. A 2018 NOTIFICATION parameter may appear in the NOTIFY packet type. The use 2019 of the NOTIFICATION parameter in other packet types is for further 2020 study. 2022 0 1 2 3 2023 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 2024 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2025 | Type | Length | 2026 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2027 | Reserved | Notify Message Type | 2028 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2029 | / 2030 / Notification data / 2031 / +---------------+ 2032 / | Padding | 2033 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2035 Type 832 2036 Length length in octets, excluding Type, Length, and 2037 Padding 2038 Reserved zero when sent, ignored when received 2039 Notify Message Specifies the type of notification 2040 Type 2041 Notification Informational or error data transmitted in addition 2042 Data to the Notify Message Type. Values for this field 2043 are type specific (see below). 2044 Padding Any Padding, if necessary, to make the parameter a 2045 multiple of 8 bytes. 2047 Notification information can be error messages specifying why an SA 2048 could not be established. It can also be status data that a process 2049 managing an SA database wishes to communicate with a peer process. 2050 The table below lists the Notification messages and their 2051 corresponding values. 2053 To avoid certain types of attacks, a Responder SHOULD avoid sending a 2054 NOTIFICATION to any host with which it has not successfully verified 2055 a puzzle solution. 2057 Types in the range 0 - 16383 are intended for reporting errors and in 2058 the range 16384 - 65535 for other status information. An 2059 implementation that receives a NOTIFY packet with an NOTIFICATION 2060 error parameter in response to a request packet (e.g., I1, I2, 2061 UPDATE), SHOULD assume that the corresponding request has failed 2062 entirely. Unrecognized error types MUST be ignored except that they 2063 SHOULD be logged. 2065 Notify payloads with status types MUST be ignored if not recognized. 2067 NOTIFICATION PARAMETER - ERROR TYPES Value 2068 ------------------------------------ ----- 2070 UNSUPPORTED_CRITICAL_PARAMETER_TYPE 1 2072 Sent if the parameter type has the "critical" bit set and the 2073 parameter type is not recognized. Notification Data contains 2074 the two octet parameter type. 2076 INVALID_SYNTAX 7 2078 Indicates that the HIP message received was invalid because 2079 some type, length, or value was out of range or because the 2080 request was rejected for policy reasons. To avoid a denial of 2081 service attack using forged messages, this status may only be 2082 returned for packets whose HMAC (if present) and SIGNATURE have 2083 been verified. This status MUST be sent in response to any 2084 error not covered by one of the other status types, and should 2085 not contain details to avoid leaking information to someone 2086 probing a node. To aid debugging, more detailed error 2087 information SHOULD be written to a console or log. 2089 NO_DH_PROPOSAL_CHOSEN 14 2091 None of the proposed group IDs was acceptable. 2093 INVALID_DH_CHOSEN 15 2095 The D-H Group ID field does not correspond to one offered 2096 by the Responder. 2098 NO_HIP_PROPOSAL_CHOSEN 16 2099 None of the proposed HIP Transform crypto suites was 2100 acceptable. 2102 INVALID_HIP_TRANSFORM_CHOSEN 17 2104 The HIP Transform crypto suite does not correspond to 2105 one offered by the Responder. 2107 AUTHENTICATION_FAILED 24 2109 Sent in response to a HIP signature failure, except when 2110 the signature verification fails in a NOTIFY message. 2112 CHECKSUM_FAILED 26 2114 Sent in response to a HIP checksum failure. 2116 HMAC_FAILED 28 2118 Sent in response to a HIP HMAC failure. 2120 ENCRYPTION_FAILED 32 2122 The Responder could not successfully decrypt the 2123 ENCRYPTED parameter. 2125 INVALID_HIT 40 2127 Sent in response to a failure to validate the peer's 2128 HIT from the corresponding HI. 2130 BLOCKED_BY_POLICY 42 2132 The Responder is unwilling to set up an association 2133 for some policy reason (e.g. received HIT is NULL 2134 and policy does not allow opportunistic mode). 2136 SERVER_BUSY_PLEASE_RETRY 44 2138 The Responder is unwilling to set up an association 2139 as it is suffering under some kind of overload and 2140 has chosen to shed load by rejecting your request. 2141 You may retry if you wish, however you MUST find 2142 another (different) puzzle solution for any such 2143 retries. Note that you may need to obtain a new 2144 puzzle with a new I1/R1 exchange. 2146 NOTIFY MESSAGES - STATUS TYPES Value 2147 ------------------------------ ----- 2149 I2_ACKNOWLEDGEMENT 16384 2151 The Responder has received your I2 but had to queue 2152 the I2 for processing. The puzzle was correctly solved 2153 and the Responder is willing to set up an association 2154 but has currently a number of I2s in processing queue. 2155 R2 will be sent after the I2 has been processed. 2157 5.2.17. ECHO_REQUEST_SIGNED 2159 0 1 2 3 2160 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 2161 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2162 | Type | Length | 2163 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2164 | Opaque data (variable length) | 2165 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2167 Type 897 2168 Length variable 2169 Opaque data Opaque data, supposed to be meaningful only to the 2170 node that sends ECHO_REQUEST_SIGNED and receives a 2171 corresponding ECHO_RESPONSE_SIGNED or 2172 ECHO_RESPONSE_UNSIGNED. 2174 The ECHO_REQUEST_SIGNED parameter contains an opaque blob of data 2175 that the sender wants to get echoed back in the corresponding reply 2176 packet. 2178 The ECHO_REQUEST_SIGNED and corresponding echo response parameters 2179 MAY be used for any purpose where a node wants to carry some state in 2180 a request packet and get it back in a response packet. The 2181 ECHO_REQUEST_SIGNED is covered by the HMAC and SIGNATURE. A HIP 2182 packet can contain only one ECHO_REQUEST_SIGNED or 2183 ECHO_REQUEST_UNSIGNED parameter. The ECHO_REQUEST_SIGNED parameter 2184 MUST be responded with a corresponding echo response. 2185 ECHO_RESPONSE_SIGNED SHOULD be used, but if it is not possible, e.g. 2186 due to a middle-box provided response, it MAY be responded with an 2187 ECHO_RESPONSE_UNSIGNED. 2189 5.2.18. ECHO_REQUEST_UNSIGNED 2191 0 1 2 3 2192 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 2193 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2194 | Type | Length | 2195 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2196 | Opaque data (variable length) | 2197 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2199 Type 63661 2200 Length variable 2201 Opaque data Opaque data, supposed to be meaningful only to the 2202 node that sends ECHO_REQUEST_UNSIGNED and receives a 2203 corresponding ECHO_RESPONSE_UNSIGNED. 2205 The ECHO_REQUEST_UNSIGNED parameter contains an opaque blob of data 2206 that the sender wants to get echoed back in the corresponding reply 2207 packet. 2209 The ECHO_REQUEST_UNSIGNED and corresponding echo response parameters 2210 MAY be used for any purpose where a node wants to carry some state in 2211 a request packet and get it back in a response packet. The 2212 ECHO_REQUEST_UNSIGNED is not covered by the HMAC and SIGNATURE. A 2213 HIP packet can contain one or more ECHO_REQUEST_UNSIGNED parameters. 2214 It is possible that middle-boxes add ECHO_REQUEST_UNSIGNED parameters 2215 in HIP packets passing by. The sender has to create the Opaque field 2216 so that it can later identify the corresponding 2217 ECHO_RESPONSE_UNSIGNED parameter. 2219 The ECHO_REQUEST_UNSIGNED parameter MUST be responded with an 2220 ECHO_RESPONSE_UNSIGNED parameter. 2222 5.2.19. ECHO_RESPONSE_SIGNED 2224 0 1 2 3 2225 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 2226 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2227 | Type | Length | 2228 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2229 | Opaque data (variable length) | 2230 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2232 Type 961 2233 Length variable 2234 Opaque data Opaque data, copied unmodified from the 2235 ECHO_REQUEST_SIGNED or ECHO_REQUEST_UNSIGNED 2236 parameter that triggered this response. 2238 The ECHO_RESPONSE_SIGNED parameter contains an opaque blob of data 2239 that the sender of the ECHO_REQUEST_SIGNED wants to get echoed back. 2240 The opaque data is copied unmodified from the ECHO_REQUEST_SIGNED 2241 parameter. 2243 The ECHO_REQUEST_SIGNED and ECHO_RESPONSE_SIGNED parameters MAY be 2244 used for any purpose where a node wants to carry some state in a 2245 request packet and get it back in a response packet. The 2246 ECHO_RESPONSE_SIGNED is covered by the HMAC and SIGNATURE. 2248 5.2.20. ECHO_RESPONSE_UNSIGNED 2250 0 1 2 3 2251 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 2252 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2253 | Type | Length | 2254 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2255 | Opaque data (variable length) | 2256 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2258 Type 63425 2259 Length variable 2260 Opaque data Opaque data, copied unmodified from the 2261 ECHO_REQUEST_SIGNED or ECHO_REQUEST_UNSIGNED 2262 parameter that triggered this response. 2264 The ECHO_RESPONSE_UNSIGNED parameter contains an opaque blob of data 2265 that the sender of the ECHO_REQUEST_SIGNED or ECHO_REQUEST_UNSIGNED 2266 wants to get echoed back. The opaque data is copied unmodified from 2267 the corresponding echo request parameter. 2269 The echo request and ECHO_RESPONSE_UNSIGNED parameters MAY be used 2270 for any purpose where a node wants to carry some state in a request 2271 packet and get it back in a response packet. The 2272 ECHO_RESPONSE_UNSIGNED is not covered by the HMAC and SIGNATURE. 2274 5.3. HIP Packets 2276 There are eight basic HIP packets (see Table 11). Four are for the 2277 HIP base exchange, one is for updating, one is for sending 2278 notifications, and two for closing a HIP association. 2280 +------------------+------------------------------------------------+ 2281 | Packet type | Packet name | 2282 +------------------+------------------------------------------------+ 2283 | 1 | I1 - the HIP Initiator Packet | 2284 | | | 2285 | 2 | R1 - the HIP Responder Packet | 2286 | | | 2287 | 3 | I2 - the Second HIP Initiator Packet | 2288 | | | 2289 | 4 | R2 - the Second HIP Responder Packet | 2290 | | | 2291 | 16 | UPDATE - the HIP Update Packet | 2292 | | | 2293 | 17 | NOTIFY - the HIP Notify Packet | 2294 | | | 2295 | 18 | CLOSE - the HIP Association Closing Packet | 2296 | | | 2297 | 19 | CLOSE_ACK - the HIP Closing Acknowledgment | 2298 | | Packet | 2299 +------------------+------------------------------------------------+ 2301 Table 11: HIP packets and packet type numbers 2303 Packets consist of the fixed header as described in Section 5.1, 2304 followed by the parameters. The parameter part, in turn, consists of 2305 zero or more TLV coded parameters. 2307 In addition to the base packets, other packets types will be defined 2308 later in separate specifications. For example, support for mobility 2309 and multi-homing is not included in this specification. 2311 See Notation (Section 2.2) for used operations. 2313 In the future, an OPTIONAL upper layer payload MAY follow the HIP 2314 header. The Next Header field in the header indicates if there is 2315 additional data following the HIP header. The HIP packet, however, 2316 MUST NOT be fragmented. This limits the size of the possible 2317 additional data in the packet. 2319 5.3.1. I1 - the HIP Initiator Packet 2321 The HIP header values for the I1 packet: 2323 Header: 2324 Packet Type = 1 2325 SRC HIT = Initiator's HIT 2326 DST HIT = Responder's HIT, or NULL 2328 IP ( HIP () ) 2330 The I1 packet contains only the fixed HIP header. 2332 Valid control bits: none 2334 The Initiator gets the Responder's HIT either from a DNS lookup of 2335 the Responder's FQDN, from some other repository, or from a local 2336 table. If the Initiator does not know the Responder's HIT, it may 2337 attempt opportunistic mode by using NULL (all zeros) as the 2338 Responder's HIT. See also "HIP Opportunistic Mode" (Section 4.1.6)). 2340 Since this packet is so easy to spoof even if it were signed, no 2341 attempt is made to add to its generation or processing cost. 2343 Implementations MUST be able to handle a storm of received I1 2344 packets, discarding those with common content that arrive within a 2345 small time delta. 2347 5.3.2. R1 - the HIP Responder Packet 2349 The HIP header values for the R1 packet: 2351 Header: 2352 Packet Type = 2 2353 SRC HIT = Responder's HIT 2354 DST HIT = Initiator's HIT 2356 IP ( HIP ( [ R1_COUNTER, ] 2357 PUZZLE, 2358 DIFFIE_HELLMAN, 2359 HIP_TRANSFORM, 2360 HOST_ID, 2361 [ ECHO_REQUEST_SIGNED, ] 2362 HIP_SIGNATURE_2 ) 2363 <, ECHO_REQUEST_UNSIGNED >i) 2365 Valid control bits: A 2367 If the Responder HI is an anonymous one, the A control MUST be set. 2369 The Initiator HIT MUST match the one received in I1. If the 2370 Responder has multiple HIs, the Responder HIT used MUST match 2371 Initiator's request. If the Initiator used opportunistic mode, the 2372 Responder may select freely among its HIs. See also "HIP 2373 Opportunistic Mode" (Section 4.1.6)). 2375 The R1 generation counter is used to determine the currently valid 2376 generation of puzzles. The value is increased periodically, and it 2377 is RECOMMENDED that it is increased at least as often as solutions to 2378 old puzzles are no longer accepted. 2380 The Puzzle contains a random #I and the difficulty K. The difficulty 2381 K is the number of bits that the Initiator must get zero in the 2382 puzzle. The random #I is not covered by the signature and must be 2383 zeroed during the signature calculation, allowing the sender to 2384 select and set the #I into a pre-computed R1 just prior sending it to 2385 the peer. 2387 The Diffie-Hellman value is ephemeral, and one value SHOULD be used 2388 only for one connection. Once the Responder has received a valid 2389 response to an R1 packet, that Diffie-Hellman value SHOULD be 2390 deprecated. Because it is possible that the Responder has sent the 2391 same Diffie-Hellman value to different hosts simultaneously in 2392 corresponding R1 packets also those responses should be accepted. 2393 However, as a defense against I1 storms, an implementation MAY 2394 propose, and re-use if not avoidable, the same Diffie-Hellman value 2395 for a period of time, for example, 15 minutes. By using a small 2396 number of different puzzles for a given Diffie-Hellman value, the R1 2397 packets can be pre-computed and delivered as quickly as I1 packets 2398 arrive. A scavenger process should clean up unused DHs and puzzles. 2400 Re-using Diffie-Hellman public keys opens up the potential security 2401 risks of more than one Initiators ending up with the same keying 2402 material (due to faulty random number generators), and more than one 2403 Initiators using the same Responder public key half, thereby leading 2404 to potentially easier cryptographic attacks and the risk of not 2405 having perfect forward security. 2407 However, these risks involved in re-using the same key are 2408 statistical; that is, authors are not aware of any mechanism that 2409 would allow manipulation of the protocol so that the risk of the re- 2410 use of a any given Responder Diffie-Hellman public key would differ 2411 from the base probability. Consequently, it is RECOMMENDED that 2412 implementations avoid re-using the same D-H key with multiple 2413 Initiators, but because the risk is considered statistical and not 2414 known to be manipulable, the implementations MAY re-use a key in 2415 order to ease resource constraint implementations and to increase the 2416 probability of successful communication with legitimate clients even 2417 under an I1 storm. In particular, when it is too expensive to 2418 generate enough of pre-computed R1 packets to supply each potential 2419 Initiator with a different Diffie-Hellman key, the Responder MAY send 2420 the same Diffie-Hellman key to several Initiators, thereby creating 2421 the possibility of multiple legitimate Initiators ending up using the 2422 same Responder-side public key. However, as soon as the Responder 2423 knows that it will use a particular Diffie-Hellman key, it SHOULD 2424 stop offering it. This design is aimed to allow resource-constrained 2425 Responders to offer services under I1 storms and to simultaneously 2426 make the probability of Diffie-Hellman key re-use both statistical 2427 and as low as possible. 2429 If a future version of this protocol is considered, we strongly 2430 recommend that these issues shall be studied again. Especially, the 2431 current design allows hosts to become potentially more vulnerable to 2432 a statistical, low-probability problem during I1 storm attacks than 2433 what they are if no attack is taking place; whether this is 2434 acceptable or not should be reconsidered in the light of any new 2435 experience gained. 2437 The HIP_TRANSFORM contains the encryption and integrity algorithms 2438 supported by the Responder to protect the HI exchange, in the order 2439 of preference. All implementations MUST support the AES [RFC3602] 2440 with HMAC-SHA-1-96 [RFC2404]. 2442 The ECHO_REQUEST_SIGNED and ECHO_REQUEST_UNSIGNED contains data that 2443 the sender wants to receive unmodified in the corresponding response 2444 packet in the ECHO_RESPONSE_SIGNED or ECHO_RESPONSE_UNSIGNED 2445 parameter. 2447 The signature is calculated over the whole HIP envelope, after 2448 setting the Initiator HIT, header checksum as well as the Opaque 2449 field and the Random #I in the PUZZLE parameter temporarily to zero, 2450 and excluding any parameters that follow the signature, as described 2451 in Section 5.2.12. This allows the Responder to use precomputed R1s. 2452 The Initiator SHOULD validate this signature. It SHOULD check that 2453 the Responder HI received matches with the one expected, if any. 2455 5.3.3. I2 - the Second HIP Initiator Packet 2457 The HIP header values for the I2 packet: 2459 Header: 2460 Type = 3 2461 SRC HIT = Initiator's HIT 2462 DST HIT = Responder's HIT 2464 IP ( HIP ( [R1_COUNTER,] 2465 SOLUTION, 2466 DIFFIE_HELLMAN, 2467 HIP_TRANSFORM, 2468 ENCRYPTED { HOST_ID } or HOST_ID, 2469 [ ECHO_RESPONSE_SIGNED ,] 2470 HMAC, 2471 HIP_SIGNATURE 2472 <, ECHO_RESPONSE_UNSIGNED>i ) ) 2474 Valid control bits: A 2476 The HITs used MUST match the ones used previously. 2478 If the Initiator HI is an anonymous one, the A control MUST be set. 2480 The Initiator MAY include an unmodified copy of the R1_COUNTER 2481 parameter received in the corresponding R1 packet into the I2 packet. 2483 The Solution contains the random # I from R1 and the computed # J. 2484 The low order K bits of the RHASH(I | ... | J) MUST be zero. 2486 The Diffie-Hellman value is ephemeral. If precomputed, a scavenger 2487 process should clean up unused DHs. The Responder may re-use Diffie- 2488 Hellman values under some conditions as specified in Section 5.3.2. 2490 The HIP_TRANSFORM contains the single encryption and integrity 2491 transform selected by the Initiator, that will be used to protect the 2492 HI exchange. The chosen transform MUST correspond to one offered by 2493 the Responder in the R1. All implementations MUST support the AES 2494 transform [RFC3602]. 2496 The Initiator's HI MAY be encrypted using the HIP_TRANSFORM 2497 encryption algorithm. The keying material is derived from the 2498 Diffie-Hellman exchanged as defined in Section 6.5. 2500 The ECHO_RESPONSE_SIGNED and ECHO_RESPONSE_UNSIGNED contains the 2501 unmodified Opaque data copied from the corresponding echo request 2502 parameter. 2504 The HMAC is calculated over whole HIP envelope, excluding any 2505 parameters after the HMAC, as described in Section 6.4.1. The 2506 Responder MUST validate the HMAC. 2508 The signature is calculated over whole HIP envelope, excluding any 2509 parameters after the HIP_SIGNATURE, as described in Section 5.2.11. 2510 The Responder MUST validate this signature. It MAY use either the HI 2511 in the packet or the HI acquired by some other means. 2513 5.3.4. R2 - the Second HIP Responder Packet 2515 The HIP header values for the R2 packet: 2517 Header: 2518 Packet Type = 4 2519 SRC HIT = Responder's HIT 2520 DST HIT = Initiator's HIT 2522 IP ( HIP ( HMAC_2, HIP_SIGNATURE ) ) 2524 Valid control bits: none 2526 The HMAC_2 is calculated over whole HIP envelope, with Responder's 2527 HOST_ID parameter concatenated with the HIP envelope. The HOST_ID 2528 parameter is removed after the HMAC calculation. The procedure is 2529 described in Section 6.4.1. 2531 The signature is calculated over whole HIP envelope. 2533 The Initiator MUST validate both the HMAC and the signature. 2535 5.3.5. UPDATE - the HIP Update Packet 2537 Support for the UPDATE packet is MANDATORY. 2539 The HIP header values for the UPDATE packet: 2541 Header: 2542 Packet Type = 16 2543 SRC HIT = Sender's HIT 2544 DST HIT = Recipient's HIT 2546 IP ( HIP ( [SEQ, ACK, ] HMAC, HIP_SIGNATURE ) ) 2548 Valid control bits: None 2550 The UPDATE packet contains mandatory HMAC and HIP_SIGNATURE 2551 parameters, and other optional parameters. 2553 The UPDATE packet contains zero or one SEQ parameter. The presence 2554 of a SEQ parameter indicates that the receiver MUST ACK the UPDATE. 2555 An UPDATE that does not contain a SEQ parameter is simply an ACK of a 2556 previous UPDATE and itself MUST NOT be ACKed. 2558 An UPDATE packet contains zero or one ACK parameters. The ACK 2559 parameter echoes the SEQ sequence number of the UPDATE packet being 2560 ACKed. A host MAY choose to ACK more than one UPDATE packet at a 2561 time; e.g., the ACK may contain the last two SEQ values received, for 2562 robustness to ACK loss. ACK values are not cumulative; each received 2563 unique SEQ value requires at least one corresponding ACK value in 2564 reply. Received ACKs that are redundant are ignored. 2566 The UPDATE packet may contain both a SEQ and an ACK parameter. In 2567 this case, the ACK is being piggybacked on an outgoing UPDATE. In 2568 general, UPDATEs carrying SEQ SHOULD be ACKed upon completion of the 2569 processing of the UPDATE. A host MAY choose to hold the UPDATE 2570 carrying ACK for a short period of time to allow for the possibility 2571 of piggybacking the ACK parameter, in a manner similar to TCP delayed 2572 acknowledgments. 2574 A sender MAY choose to forgo reliable transmission of a particular 2575 UPDATE (e.g., it becomes overcome by events). The semantics are such 2576 that the receiver MUST acknowledge the UPDATE but the sender MAY 2577 choose to not care about receiving the ACK. 2579 UPDATEs MAY be retransmitted without incrementing SEQ. If the same 2580 subset of parameters is included in multiple UPDATEs with different 2581 SEQs, the host MUST ensure that receiver processing of the parameters 2582 multiple times will not result in a protocol error. 2584 5.3.6. NOTIFY - the HIP Notify Packet 2586 The NOTIFY packet is OPTIONAL. The NOTIFY packet MAY be used to 2587 provide information to a peer. Typically, NOTIFY is used to indicate 2588 some type of protocol error or negotiation failure. NOTIFY packets 2589 are unacknowledged. The receiver can handle the packet only as 2590 informational, and SHOULD NOT change its HIP state (Section 4.4.1) 2591 based purely on a received NOTIFY packet. 2593 The HIP header values for the NOTIFY packet: 2595 Header: 2596 Packet Type = 17 2597 SRC HIT = Sender's HIT 2598 DST HIT = Recipient's HIT, or zero if unknown 2600 IP ( HIP (i, [HOST_ID, ] HIP_SIGNATURE) ) 2602 Valid control bits: None 2604 The NOTIFY packet is used to carry one or more NOTIFICATION 2605 parameters. 2607 5.3.7. CLOSE - the HIP Association Closing Packet 2609 The HIP header values for the CLOSE packet: 2611 Header: 2612 Packet Type = 18 2613 SRC HIT = Sender's HIT 2614 DST HIT = Recipient's HIT 2616 IP ( HIP ( ECHO_REQUEST_SIGNED, HMAC, HIP_SIGNATURE ) ) 2618 Valid control bits: none 2620 The sender MUST include an ECHO_REQUEST_SIGNED used to validate 2621 CLOSE_ACK received in response, and both an HMAC and a signature 2622 (calculated over the whole HIP envelope). 2624 The receiver peer MUST validate both the HMAC and the signature if it 2625 has a HIP association state, and MUST reply with a CLOSE_ACK 2626 containing an ECHO_REPLY_SIGNED corresponding to the received 2627 ECHO_REQUEST_SIGNED. 2629 5.3.8. CLOSE_ACK - the HIP Closing Acknowledgment Packet 2631 The HIP header values for the CLOSE_ACK packet: 2633 Header: 2634 Packet Type = 19 2635 SRC HIT = Sender's HIT 2636 DST HIT = Recipient's HIT 2638 IP ( HIP ( ECHO_REPLY_SIGNED, HMAC, HIP_SIGNATURE ) ) 2640 Valid control bits: none 2642 The sender MUST include both an HMAC and signature (calculated over 2643 the whole HIP envelope). 2645 The receiver peer MUST validate both the HMAC and the signature. 2647 5.4. ICMP Messages 2649 When a HIP implementation detects a problem with an incoming packet, 2650 and it either cannot determine the identity of the sender of the 2651 packet or does not have any existing HIP association with the sender 2652 of the packet, it MAY respond with an ICMP packet. Any such replies 2653 MUST be rate limited as described in [RFC1885]. In most cases, the 2654 ICMP packet will have the Parameter Problem type (12 for ICMPv4, 4 2655 for ICMPv6), with the Pointer field pointing to the field that caused 2656 the ICMP message to be generated. 2658 5.4.1. Invalid Version 2660 If a HIP implementation receives a HIP packet that has an 2661 unrecognized HIP version number, it SHOULD respond, rate limited, 2662 with an ICMP packet with type Parameter Problem, the Pointer pointing 2663 to the VER./RES. byte in the HIP header. 2665 5.4.2. Other Problems with the HIP Header and Packet Structure 2667 If a HIP implementation receives a HIP packet that has other 2668 unrecoverable problems in the header or packet format, it MAY 2669 respond, rate limited, with an ICMP packet with type Parameter 2670 Problem, the Pointer pointing to the field that failed to pass the 2671 format checks. However, an implementation MUST NOT send an ICMP 2672 message if the Checksum fails; instead, it MUST silently drop the 2673 packet. 2675 5.4.3. Invalid Puzzle Solution 2677 If a HIP implementation receives an I2 packet that has an invalid 2678 puzzle solution, the behavior depends on the underlying version of 2679 IP. If IPv6 is used, the implementation SHOULD respond with an ICMP 2680 packet with type Parameter Problem, the Pointer pointing to the 2681 beginning of the Puzzle solution #J field in the SOLUTION payload in 2682 the HIP message. 2684 If IPv4 is used, the implementation MAY respond with an ICMP packet 2685 with the type Parameter Problem, copying enough of bytes from the I2 2686 message so that the SOLUTION parameter fits into the ICMP message, 2687 the Pointer pointing to the beginning of the Puzzle solution #J 2688 field, as in the IPv6 case. Note, however, that the resulting ICMPv4 2689 message exceeds the typical ICMPv4 message size as defined in 2690 [RFC0792]. 2692 5.4.4. Non-existing HIP Association 2694 If a HIP implementation receives a CLOSE, or UPDATE packet, or any 2695 other packet whose handling requires an existing association, that 2696 has either a Receiver or Sender HIT that does not match with any 2697 existing HIP association, the implementation MAY respond, rate 2698 limited, with an ICMP packet with the type Parameter Problem, the 2699 Pointer pointing to the beginning of the first HIT that does not 2700 match. 2702 A host MUST NOT reply with such an ICMP if it receives any of the 2703 following messages: I1, R2, I2, R2, and NOTIFY. When introducing new 2704 packet types, a specification SHOULD define the appropriate rules for 2705 sending or not sending this kind of ICMP replies. 2707 6. Packet Processing 2709 Each host is assumed to have a single HIP protocol implementation 2710 that manages the host's HIP associations and handles requests for new 2711 ones. Each HIP association is governed by a conceptual state 2712 machine, with states defined above in Section 4.4. The HIP 2713 implementation can simultaneously maintain HIP associations with more 2714 than one host. Furthermore, the HIP implementation may have more 2715 than one active HIP association with another host; in this case, HIP 2716 associations are distinguished by their respective HITs. It is not 2717 possible to have more than one HIP association between any given pair 2718 of HITs. Consequently, the only way for two hosts to have more than 2719 one parallel association is to use different HITs, at least at one 2720 end. 2722 The processing of packets depends on the state of the HIP 2723 association(s) with respect to the authenticated or apparent 2724 originator of the packet. A HIP implementation determines whether it 2725 has an active association with the originator of the packet based on 2726 the HITs. In the case of user data carried in a specific transport 2727 format, the transport format document specifies how the incoming 2728 packets are matched with the active associations. 2730 6.1. Processing Outgoing Application Data 2732 In a HIP host, an application can send application level data using 2733 an identifier specified via the underlying API. The API can be a 2734 backwards compatible API (see [I-D.henderson-hip-applications]), 2735 using identifiers that look similar to IP addresses, or a completely 2736 new API, providing enhanced services related to Host Identities. 2737 Depending on the HIP implementation, the identifier provided to the 2738 application may be different; it can be e.g. a HIT or an IP address. 2740 The exact format and method for transferring the data from the source 2741 HIP host to the destination HIP host is defined in the corresponding 2742 transport format document. The actual data is transferred in the 2743 network using the appropriate source and destination IP addresses. 2745 In this document, conceptual processing rules are defined only for 2746 the base case where both hosts have only single usable IP addresses; 2747 the multi-address multi-homing case will be specified separately. 2749 The following conceptual algorithm describes the steps that are 2750 required for handling outgoing datagrams destined to a HIT. 2752 1. If the datagram has a specified source address, it MUST be a HIT. 2753 If it is not, the implementation MAY replace the source address 2754 with a HIT. Otherwise it MUST drop the packet. 2756 2. If the datagram has an unspecified source address, the 2757 implementation must choose a suitable source HIT for the 2758 datagram. 2760 3. If there is no active HIP association with the given < source, 2761 destination > HIT pair, one must be created by running the base 2762 exchange. While waiting for the base exchange to complete, the 2763 implementation SHOULD queue at least one packet per HIP 2764 association to be formed, and it MAY queue more than one. 2766 4. Once there is an active HIP association for the given < source, 2767 destination > HIT pair, the outgoing datagram is passed to 2768 transport handling. The possible transport formats are defined 2769 in separate documents, of which the ESP transport format for HIP 2770 is mandatory for all HIP implementations. 2772 5. Before sending the packet, the HITs in the datagram are replaced 2773 with suitable IP addresses. For IPv6, the rules defined in 2774 [RFC3484] SHOULD be followed. Note that this HIT-to-IP-address 2775 conversion step MAY also be performed at some other point in the 2776 stack, e.g., before wrapping the packet into the output format. 2778 6.2. Processing Incoming Application Data 2780 The following conceptual algorithm describes the incoming datagram 2781 handling when HITs are used at the receiving host as application 2782 level identifiers. More detailed steps for processing packets are 2783 defined in corresponding transport format documents. 2785 1. The incoming datagram is mapped to an existing HIP association, 2786 typically using some information from the packet. For example, 2787 such mapping may be based on ESP Security Parameter Index (SPI). 2789 2. The specific transport format is unwrapped, in a way depending on 2790 the transport format, yielding a packet that looks like a 2791 standard (unencrypted) IP packet. If possible, this step SHOULD 2792 also verify that the packet was indeed (once) sent by the remote 2793 HIP host, as identified by the HIP association. 2795 Depending on the used transport mode, the verification method can 2796 vary. While the HI (as well as HIT) is used as the higher layer 2797 identifier, the verification method has to verify that the data 2798 packet was sent by a node identity and that the actual identity 2799 maps to this particular HIT. When using ESP transport format 2800 [I-D.ietf-hip-esp], the verification is done using the SPI value 2801 in the data packet to find the corresponding SA with associated 2802 HIT and key, and decrypting the packet with that associated key. 2804 3. The IP addresses in the datagram are replaced with the HITs 2805 associated with the HIP association. Note that this IP-address- 2806 to-HIT conversion step MAY also be performed at some other point 2807 in the stack. 2809 4. The datagram is delivered to the upper layer. Demultiplexing the 2810 datagram the right upper layer socket is based on the HITs. 2812 6.3. Solving the Puzzle 2814 This subsection describes the puzzle solving details. 2816 In R1, the values I and K are sent in network byte order. Similarly, 2817 in I2 the values I and J are sent in network byte order. The hash is 2818 created by concatenating, in network byte order, the following data, 2819 in the following order and using the RHASH algorithm: 2821 64-bit random value I, in network byte order, as appearing in R1 2822 and I2. 2824 128-bit Initiator HIT, in network byte order, as appearing in the 2825 HIP Payload in R1 and I2. 2827 128-bit Responder HIT, in network byte order, as appearing in the 2828 HIP Payload in R1 and I2. 2830 64-bit random value J, in network byte order, as appearing in I2. 2832 In order to be a valid response puzzle, the K low-order bits of the 2833 resulting RHASH digest must be zero. 2835 Notes: 2837 i) The length of the data to be hashed is 48 bytes. 2839 ii) All the data in the hash input MUST be in network byte order. 2841 iii) The order of the Initiator and Responder HITs are different 2842 in the R1 and I2 packets, see Section 5.1. Care must be taken to 2843 copy the values in right order to the hash input. 2845 The following procedure describes the processing steps involved, 2846 assuming that the Responder chooses to precompute the R1 packets: 2848 Precomputation by the Responder: 2849 Sets up the puzzle difficulty K. 2850 Creates a signed R1 and caches it. 2852 Responder: 2853 Selects a suitable cached R1. 2854 Generates a random number I. 2855 Sends I and K in an R1. 2856 Saves I and K for a Delta time. 2858 Initiator: 2859 Generates repeated attempts to solve the puzzle until a matching J 2860 is found: 2861 Ltrunc( RHASH( I | HIT-I | HIT-R | J ), K ) == 0 2862 Sends I and J in an I2. 2864 Responder: 2865 Verifies that the received I is a saved one. 2866 Finds the right K based on I. 2867 Computes V := Ltrunc( RHASH( I | HIT-I | HIT-R | J ), K ) 2868 Rejects if V != 0 2869 Accept if V == 0 2871 6.4. HMAC and SIGNATURE Calculation and Verification 2873 The following subsections define the actions for processing HMAC, 2874 HIP_SIGNATURE and HIP_SIGNATURE_2 parameters. 2876 6.4.1. HMAC Calculation 2878 The following process applies both to the HMAC and HMAC_2 parameters. 2879 When processing HMAC_2, the difference is that the HMAC calculation 2880 includes a pseudo HOST_ID field containing the Responder's 2881 information as sent in the R1 packet earlier. 2883 Both the Initiator and the Responder should take some care when 2884 verifying or calculating the HMAC_2. Specifically, the Responder 2885 should preserve other parameters than the HOST_ID when sending the 2886 R2. Also, the Initiator has to preserve the HOST_ID exactly as it 2887 was received in the R1 packet. 2889 The scope of the calculation for HMAC and HMAC_2 is: 2891 HMAC: { HIP header | [ Parameters ] } 2893 where Parameters include all HIP parameters of the packet that is 2894 being calculated with Type values from 1 to (HMAC's Type value - 1) 2895 and exclude parameters with Type values greater or equal to HMAC's 2896 Type value. 2898 During HMAC Calculation, the following applies: 2900 o In HIP header, Checksum field is set to zero. 2902 o In HIP header, the Header Length field value is calculated to the 2903 beginning of the HMAC parameter. 2905 Parameter order is described in Section 5.2.1. 2907 HMAC_2: { HIP header | [ Parameters ] | HOST_ID } 2909 where Parameters include all HIP parameters for the packet that is 2910 being calculated with Type values from 1 to (HMAC_2's Type value - 1) 2911 and exclude parameters with Type values greater or equal to HMAC_2's 2912 Type value. 2914 During HMAC calculation, the following applies: 2916 o In HIP header, Checksum field is set to zero. 2918 o In HIP header, the Header Length field value is calculated to the 2919 beginning of the HMAC_2 parameter and added with the length of the 2920 concatenated HOST_ID parameter length. 2922 o HOST_ID parameter is exactly in the form it was received in the R1 2923 packet from the Responder. 2925 Parameter order is described in Section 5.2.1, except that HOST_ID 2926 parameter in this calculation is added to the end. 2928 The HMAC parameter is defined in Section 5.2.9 and HMAC_2 parameter 2929 in Section 5.2.10. HMAC calculation and verification process (the 2930 process applies both to HMAC and HMAC_2 except where HMAC_2 is 2931 mentioned separately) : 2933 Packet sender: 2935 1. Create the HIP packet, without the HMAC, HIP_SIGNATURE, 2936 HIP_SIGNATURE_2, or any other parameter with greater Type value 2937 than the HMAC parameter has. 2939 2. In case of HMAC_2 calculation, add a HOST_ID (Responder) 2940 parameter to the end of the packet. 2942 3. Calculate the Header Length field in the HIP header including the 2943 added HOST_ID parameter in case of HMAC_2. 2945 4. Compute the HMAC using either HIP-gl or HIP-lg integrity key 2946 retrieved from KEYMAT as defined in Section 6.5. 2948 5. In case of HMAC_2, remove the HOST_ID parameter from the packet. 2950 6. Add the HMAC parameter to the packet and any parameter with 2951 greater Type value than the HMAC's (HMAC_2's) that may follow, 2952 including possible HIP_SIGNATURE or HIP_SIGNATURE_2 parameters 2954 7. Recalculate the Length field in the HIP header. 2956 Packet receiver: 2958 1. Verify the HIP header Length field. 2960 2. Remove the HMAC or HMAC_2 parameter, as well as all other 2961 parameters that follow it with greater Type value including 2962 possible HIP_SIGNATURE or HIP_SIGNATURE_2 fields, saving the 2963 contents if they will be needed later. 2965 3. In case of HMAC_2, build and add a HOST_ID parameter (with 2966 Responder information) to the packet. The HOST_ID parameter 2967 should be identical to the one previously received from the 2968 Responder. 2970 4. Recalculate the HIP packet length in the HIP header and clear the 2971 Checksum field (set it to all zeros). In case of HMAC_2, the 2972 length is calculated with the added HOST_ID parameter. 2974 5. Compute the HMAC using either HIP-gl or HIP-lg integrity key as 2975 defined in Section 6.5 and verify it against the received HMAC. 2977 6. Set Checksum and Header Length field in HIP header to original 2978 values. 2980 7. In case of HMAC_2, remove the HOST_ID parameter from the packet 2981 before further processing. 2983 6.4.2. Signature Calculation 2985 The following process applies both to the HIP_SIGNATURE and 2986 HIP_SIGNATURE_2 parameters. When processing HIP_SIGNATURE_2, the 2987 only difference is that instead of HIP_SIGNATURE parameter, the 2988 HIP_SIGNATURE_2 parameter is used, and the Initiator's HIT and PUZZLE 2989 Opaque and Random #I fields are cleared (set to all zeros) before 2990 computing the signature. The HIP_SIGNATURE parameter is defined in 2991 Section 5.2.11 and the HIP_SIGNATURE_2 parameter in Section 5.2.12. 2993 The scope of the calculation for HIP_SIGNATURE and HIP_SIGNATURE_2 2994 is: 2996 HIP_SIGNATURE: { HIP header | [ Parameters ] } 2998 where Parameters include all HIP parameters for the packet that is 2999 being calculated with Type values from 1 to (HIP_SIGNATURE's Type 3000 value - 1). 3002 During signature calculation, the following apply: 3004 o In HIP header, Checksum field is set to zero. 3006 o In HIP header, the Header Length field value is calculated to the 3007 beginning of the HIP_SIGNATURE parameter. 3009 Parameter order is described in Section 5.2.1. 3011 HIP_SIGNATURE_2: { HIP header | [ Parameters ] } 3013 where Parameters include all HIP parameters for the packet that is 3014 being calculated with Type values from 1 to (HIP_SIGNATURE_2's Type 3015 value - 1). 3017 During signature calculation, the following apply: 3019 o In HIP header, Initiator's HIT field and Checksum fields are set 3020 to zero. 3022 o In HIP header, the Header Length field value is calculated to the 3023 beginning of the HIP_SIGNATURE_2 parameter. 3025 o PUZZLE parameter's Opaque and Random #I fields are set to zero. 3027 Parameter order is described in Section 5.2.1. 3029 Signature calculation and verification process (the process applies 3030 both to HIP_SIGNATURE and HIP_SIGNATURE_2 except in case where 3031 HIP_SIGNATURE_2 is separately mentioned): 3033 Packet sender: 3035 1. Create the HIP packet without the HIP_SIGNATURE parameter or any 3036 parameters that follow the HIP_SIGNATURE parameter. 3038 2. Calculate the Length field and zero the Checksum field in the HIP 3039 header. In case of HIP_SIGNATURE_2, set Initiator's HIT field in 3040 HIP header as well as PUZZLE parameter's Opaque and Random #I 3041 fields to zero. 3043 3. Compute the signature using the private key corresponding to the 3044 Host Identifier (public key). 3046 4. Add the HIP_SIGNATURE parameter to the packet. 3048 5. Add any parameters that follow the HIP_SIGNATURE parameter. 3050 6. Recalculate the Length field in the HIP header, and calculate the 3051 Checksum field. 3053 Packet receiver: 3055 1. Verify the HIP header Length field. 3057 2. Save the contents of the HIP_SIGNATURE parameter and any 3058 parameters following the HIP_SIGNATURE parameter and remove them 3059 from the packet. 3061 3. Recalculate the HIP packet Length in the HIP header and clear the 3062 Checksum field (set it to all zeros). In case of 3063 HIP_SIGNATURE_2, set Initiator's HIT field in HIP header as well 3064 as PUZZLE parameter's Opaque and Random #I fields to zero. 3066 4. Compute the signature and verify it against the received 3067 signature using the packet sender's Host Identifier (public key). 3069 5. Restore the original packet by adding removed parameters (in step 3070 2) and resetting the values that were set to zero (in step 3). 3072 The verification can use either the HI received from a HIP packet, 3073 the HI from a DNS query, if the FQDN has been received in the HOST_ID 3074 packet, or one received by some other means. 3076 6.5. HIP KEYMAT Generation 3078 HIP keying material is derived from the Diffie-Hellman session key, 3079 Kij, produced during the HIP base exchange (Section 4.1.3). The 3080 Initiator has Kij during the creation of the I2 packet, and the 3081 Responder has Kij once it receives the I2 packet. This is why I2 can 3082 already contain encrypted information. 3084 The KEYMAT is derived by feeding Kij and the HITs into the following 3085 operation; the | operation denotes concatenation. 3087 KEYMAT = K1 | K2 | K3 | ... 3088 where 3090 K1 = RHASH( Kij | sort(HIT-I | HIT-R) | I | J | 0x01 ) 3091 K2 = RHASH( Kij | K1 | 0x02 ) 3092 K3 = RHASH( Kij | K2 | 0x03 ) 3093 ... 3094 K255 = RHASH( Kij | K254 | 0xff ) 3095 K256 = RHASH( Kij | K255 | 0x00 ) 3096 etc. 3098 Sort(HIT-I | HIT-R) is defined as the network byte order 3099 concatenation of the two HITs, with the smaller HIT preceding the 3100 larger HIT, resulting from the numeric comparison of the two HITs 3101 interpreted as positive (unsigned) 128-bit integers in network byte 3102 order. 3104 I and J values are from the puzzle and its solution that were 3105 exchanged in R1 and I2 messages when this HIP association was set up. 3106 Both hosts have to store I and J values for the HIP association for 3107 future use. 3109 The initial keys are drawn sequentially in the order that is 3110 determined by the numeric comparison of the two HITs, with comparison 3111 method described in the previous paragraph. HOST_g denotes the host 3112 with the greater HIT value, and HOST_l the host with the lower HIT 3113 value. 3115 The drawing order for initial keys: 3117 HIP-gl encryption key for HOST_g's outgoing HIP packets 3119 HIP-gl integrity (HMAC) key for HOST_g's outgoing HIP packets 3121 HIP-lg encryption key (currently unused) for HOST_l's outgoing HIP 3122 packets 3124 HIP-lg integrity (HMAC) key for HOST_l's outgoing HIP packets 3126 The number of bits drawn for a given algorithm is the "natural" size 3127 of the keys. For the mandatory algorithms, the following sizes 3128 apply: 3130 AES 128 bits 3131 SHA-1 160 bits 3133 NULL 0 bits 3135 If other key sizes are used, they must be treated as different 3136 encryption algorithms and defined separately. 3138 6.6. Initiation of a HIP Exchange 3140 An implementation may originate a HIP exchange to another host based 3141 on a local policy decision, usually triggered by an application 3142 datagram, in much the same way that an IPsec IKE key exchange can 3143 dynamically create a Security Association. Alternatively, a system 3144 may initiate a HIP exchange if it has rebooted or timed out, or 3145 otherwise lost its HIP state, as described in Section 4.5.4. 3147 The implementation prepares an I1 packet and sends it to the IP 3148 address that corresponds to the peer host. The IP address of the 3149 peer host may be obtained via conventional mechanisms, such as DNS 3150 lookup. The I1 contents are specified in Section 5.3.1. The 3151 selection of which host identity to use, if a host has more than one 3152 to choose from, is typically a policy decision. 3154 The following steps define the conceptual processing rules for 3155 initiating a HIP exchange: 3157 1. The Initiator gets the Responder's HIT and one or more addresses 3158 either from a DNS lookup of the Responder's FQDN, from some other 3159 repository, or from a local table. If the Initiator does not 3160 know the Responder's HIT, it may attempt opportunistic mode by 3161 using NULL (all zeros) as the Responder's HIT. See also "HIP 3162 Opportunistic Mode" (Section 4.1.6). 3164 2. The Initiator sends an I1 to one of the Responder's addresses. 3165 The selection of which address to use is a local policy decision. 3167 3. Upon sending an I1, the sender shall transition to state I1-SENT, 3168 start a timer whose timeout value should be larger than the 3169 worst-case anticipated RTT, and shall increment a timeout counter 3170 associated with the I1. 3172 4. Upon timeout, the sender SHOULD retransmit the I1 and restart the 3173 timer, up to a maximum of I1_RETRIES_MAX tries. 3175 6.6.1. Sending Multiple I1s in Parallel 3177 For the sake of minimizing the session establishment latency, an 3178 implementation MAY send the same I1 to more than one of the 3179 Responder's addresses. However, it MUST NOT send to more than three 3180 (3) addresses in parallel. Furthermore, upon timeout, the 3181 implementation MUST refrain from sending the same I1 packet to 3182 multiple addresses. I.e. if it retries to initialize the connection 3183 after timeout, it MUST NOT send the I1 packet to more than one 3184 destination address. These limitations are placed in order to avoid 3185 congestion of the network, and potential DoS attacks that might 3186 happen, e.g., because someone claims to have hundreds or thousands of 3187 addresses which possibly could generate a huge number of I1 messages 3188 from the Initiator. 3190 As the Responder is not guaranteed to distinguish the duplicate I1's 3191 it receives at several of its addresses (because it avoids to store 3192 states when it answers back an R1), the Initiator may receive several 3193 duplicate R1's. 3195 The Initiator SHOULD then select the initial preferred destination 3196 address using the source address of the selected received R1, and use 3197 the preferred address as a source address for the I2. Processing 3198 rules for received R1s are discussed in Section 6.8. 3200 6.6.2. Processing Incoming ICMP Protocol Unreachable Messages 3202 A host may receive an ICMP Destination Protocol Unreachable message 3203 as a response to sending a HIP I1 packet. Such a packet may be an 3204 indication that the peer does not support HIP, or it may be an 3205 attempt to launch an attack by making the Initiator believe that the 3206 Responder does not support HIP. 3208 When a system receives an ICMP Destination Protocol Unreachable 3209 message while it is waiting for an R1, it MUST NOT terminate the 3210 wait. It MAY continue as if it had not received the ICMP message, 3211 and send a few more I1s. Alternatively, it MAY take the ICMP message 3212 as a hint that the peer most probably does not support HIP, and 3213 return to state UNASSOCIATED earlier than otherwise. However, at 3214 minimum, it MUST continue waiting for an R1 for a reasonable time 3215 before returning to UNASSOCIATED. 3217 6.7. Processing Incoming I1 Packets 3219 An implementation SHOULD reply to an I1 with an R1 packet, unless the 3220 implementation is unable or unwilling to setup a HIP association. If 3221 the implementation is unable to setup a HIP association, the host 3222 SHOULD send an ICMP Destination Protocol Unreachable, 3223 Administratively Prohibited, message to the I1 source address. If 3224 the implementation is unwilling to setup a HIP association, the host 3225 MAY ignore the I1. This latter case may occur during a DoS attack 3226 such as an I1 flood. 3228 The implementation MUST be able to handle a storm of received I1 3229 packets, discarding those with common content that arrive within a 3230 small time delta. 3232 A spoofed I1 can result in an R1 attack on a system. An R1 sender 3233 MUST have a mechanism to rate limit R1s to an address. 3235 It is RECOMMENDED that the HIP state machine does not transition upon 3236 sending an R1. 3238 The following steps define the conceptual processing rules for 3239 responding to an I1 packet: 3241 1. The Responder MUST check that the Responder HIT in the received 3242 I1 is either one of its own HITs, or NULL. 3244 2. If the Responder is in ESTABLISHED state, the Responder MAY 3245 respond to this with an R1 packet, prepare to drop existing SAs 3246 and stay at ESTABLISHED state. 3248 3. If the Responder is in I1-SENT state, it must make a comparison 3249 between the sender's HIT and its own (i.e., the receiver's) HIT. 3250 If the sender's HIT is greater than its own HIT, it should drop 3251 the I1 and stay at I1-SENT. If the sender's HIT is smaller than 3252 its own HIT, it should send R1 and stay at I1-SENT. The HIT 3253 comparison goes similarly as in Section 6.5. 3255 4. If the implementation chooses to respond to the I1 with an R1 3256 packet, it creates a new R1 or selects a precomputed R1 according 3257 to the format described in Section 5.3.2. 3259 5. The R1 MUST contain the received Responder HIT, unless the 3260 received HIT is NULL, in which case the Responder SHOULD select a 3261 HIT that is constructed with the MUST algorithm in Section 3, 3262 which is currently RSA. Other than that, selecting the HIT is a 3263 local policy matter. 3265 6. The Responder sends the R1 to the source IP address of the I1 3266 packet. 3268 6.7.1. R1 Management 3270 All compliant implementations MUST produce R1 packets. An R1 packet 3271 MAY be precomputed. An R1 packet MAY be reused for time Delta T, 3272 which is implementation dependent, and SHOULD be deprecated and not 3273 used once a valid response I2 packet has been received from an 3274 Initiator. During I1 message storm, an R1 packet may be re-used 3275 beyond this limit. R1 information MUST NOT be discarded until Delta 3276 S after T. Time S is the delay needed for the last I2 to arrive back 3277 to the Responder. 3279 An implementation MAY keep state about received I1s and match the 3280 received I2s against the state, as discussed in Section 4.1.1. 3282 6.7.2. Handling Malformed Messages 3284 If an implementation receives a malformed I1 message, it SHOULD NOT 3285 respond with a NOTIFY message, as such practice could open up a 3286 potential denial-of-service danger. Instead, it MAY respond with an 3287 ICMP packet, as defined in Section 5.4. 3289 6.8. Processing Incoming R1 Packets 3291 A system receiving an R1 MUST first check to see if it has sent an I1 3292 to the originator of the R1 (i.e., it is in state I1-SENT). If so, 3293 it SHOULD process the R1 as described below, send an I2, and go to 3294 state I2-SENT, setting a timer to protect the I2. If the system is 3295 in state I2-SENT, it MAY respond to an R1 if the R1 has a larger R1 3296 generation counter; if so, it should drop its state due to processing 3297 the previous R1 and start over from state I1-SENT. If the system is 3298 in any other state with respect to that host, it SHOULD silently drop 3299 the R1. 3301 When sending multiple I1s, an Initiator SHOULD wait for a small 3302 amount of time after the first R1 reception to allow possibly 3303 multiple R1s to arrive, and it SHOULD respond to an R1 among the set 3304 with the largest R1 generation counter. 3306 The following steps define the conceptual processing rules for 3307 responding to an R1 packet: 3309 1. A system receiving an R1 MUST first check to see if it has sent 3310 an I1 to the originator of the R1 (i.e., it has a HIP 3311 association that is in state I1-SENT and that is associated with 3312 the HITs in the R1). Unless the I1 was sent in opportunistic 3313 mode (see also "HIP Opportunistic Mode" (Section 4.1.6) ), IP 3314 addresses in the received R1 packet SHOULD be ignored and the 3315 match SHOULD be based on HITs only. If a match exists, the 3316 system should process the R1 as described below. 3318 2. Otherwise, if the system is in any other state than I1-SENT or 3319 I2-SENT with respect to the HITs included in the R1, it SHOULD 3320 silently drop the R1 and remain in the current state. 3322 3. If the HIP association state is I1-SENT or I2-SENT, the received 3323 Initiator's HIT MUST correspond to the HIT used in the original, 3324 I1 and the Responder's HIT MUST correspond to the one used, 3325 unless the I1 contained a NULL HIT. 3327 4. The system SHOULD validate the R1 signature before applying 3328 further packet processing, according to Section 5.2.12. 3330 5. If the HIP association state is I1-SENT, and multiple valid R1s 3331 are present, the system SHOULD select from among the R1s with 3332 the largest R1 generation counter. 3334 6. If the HIP association state is I2-SENT, the system MAY reenter 3335 state I1-SENT and process the received R1 if it has a larger R1 3336 generation counter than the R1 responded to previously. 3338 7. The R1 packet may have the A bit set -- in this case, the system 3339 MAY choose to refuse it by dropping the R1 and returning to 3340 state UNASSOCIATED. The system SHOULD consider dropping the R1 3341 only if it used a NULL HIT in I1. If the A bit is set, the 3342 Responder's HIT is anonymous and should not be stored. 3344 8. The system SHOULD attempt to validate the HIT against the 3345 received Host Identity by using the received Host Identity to 3346 construct a HIT and verify that it matches the Sender's HIT. 3348 9. The system MUST store the received R1 generation counter for 3349 future reference. 3351 10. The system attempts to solve the puzzle in R1. The system MUST 3352 terminate the search after exceeding the remaining lifetime of 3353 the puzzle. If the puzzle is not successfully solved, the 3354 implementation may either resend I1 within the retry bounds or 3355 abandon the HIP exchange. 3357 11. The system computes standard Diffie-Hellman keying material 3358 according to the public value and Group ID provided in the 3359 DIFFIE_HELLMAN parameter. The Diffie-Hellman keying material 3360 Kij is used for key extraction as specified in Section 6.5. If 3361 the received Diffie-Hellman Group ID is not supported, the 3362 implementation may either resend I1 within the retry bounds or 3363 abandon the HIP exchange. 3365 12. The system selects the HIP transform from the choices presented 3366 in the R1 packet and uses the selected values subsequently when 3367 generating and using encryption keys, and when sending the I2. 3368 If the proposed alternatives are not acceptable to the system, 3369 it may either resend I1 within the retry bounds or abandon the 3370 HIP exchange. 3372 13. The system initializes the remaining variables in the associated 3373 state, including Update ID counters. 3375 14. The system prepares and sends an I2, as described in 3376 Section 5.3.3. 3378 15. The system SHOULD start a timer whose timeout value should be 3379 larger than the worst-case anticipated RTT, and MUST increment a 3380 timeout counter associated with the I2. The sender SHOULD 3381 retransmit the I2 upon a timeout and restart the timer, up to a 3382 maximum of I2_RETRIES_MAX tries. 3384 16. If the system is in state I1-SENT, it shall transition to state 3385 I2-SENT. If the system is in any other state, it remains in the 3386 current state. 3388 6.8.1. Handling Malformed Messages 3390 If an implementation receives a malformed R1 message, it MUST 3391 silently drop the packet. Sending a NOTIFY or ICMP would not help, 3392 as the sender of the R1 typically doesn't have any state. An 3393 implementation SHOULD wait for some more time for a possible good R1, 3394 after which it MAY try again by sending a new I1 packet. 3396 6.9. Processing Incoming I2 Packets 3398 Upon receipt of an I2, the system MAY perform initial checks to 3399 determine whether the I2 corresponds to a recent R1 that has been 3400 sent out, if the Responder keeps such state. For example, the sender 3401 could check whether the I2 is from an address or HIT that has 3402 recently received an R1 from it. The R1 may have had Opaque data 3403 included that was echoed back in the I2. If the I2 is considered to 3404 be suspect, it MAY be silently discarded by the system. 3406 Otherwise, the HIP implementation SHOULD process the I2. This 3407 includes validation of the puzzle solution, generating the Diffie- 3408 Hellman key, decrypting the Initiator's Host Identity, verifying the 3409 signature, creating state, and finally sending an R2. 3411 The following steps define the conceptual processing rules for 3412 responding to an I2 packet: 3414 1. The system MAY perform checks to verify that the I2 corresponds 3415 to a recently sent R1. Such checks are implementation 3416 dependent. See Appendix A for a description of an example 3417 implementation. 3419 2. The system MUST check that the Responder's HIT corresponds to 3420 one of its own HITs. 3422 3. If the system is in the R2-SENT state, it MAY check if the newly 3423 received I2 is similar to the one that triggered moving to R2- 3424 SENT. If so, it MAY retransmit a previously sent R2, reset the 3425 R2-SENT timer, and stay in R2-SENT. 3427 4. If the system is in the I2-SENT state, it makes a comparison 3428 between its local and sender's HITs (similarly as in 3429 Section 6.5). If the local HIT is smaller than the sender's 3430 HIT, it should drop the I2 packet, use peer Diffie-Hellman key 3431 and nonce I from the R1 packet received earlier, and get the 3432 local Diffie-Hellman key and nonce J from the I2 packet sent to 3433 the peer earlier. Otherwise, the system should process the 3434 received I2 packet and drop any previously derived Diffie- 3435 Hellman keying material Kij it might have formed upon sending 3436 the I2 previously. The peer Diffie-Hellman key and nonce J are 3437 taken from the just arrived I2 and local Diffie-Hellman key and 3438 nonce I are the ones that it sent earlier in the R1 packet. 3440 5. If the system is in the I1-SENT state, and the HITs in the I2 3441 match those used in the previously sent I1, the system uses this 3442 received I2 as the basis for the HIP association it was trying 3443 to form, and stops retransmitting I1 (provided that the I2 3444 passes the below additional checks). 3446 6. If the system is in any other state than R2-SENT, it SHOULD 3447 check that the echoed R1 generation counter in I2 is within the 3448 acceptable range. Implementations MUST accept puzzles from the 3449 current generation and MAY accept puzzles from earlier 3450 generations. If the newly received I2 is outside the accepted 3451 range, the I2 is stale (perhaps replayed) and SHOULD be dropped. 3453 7. The system MUST validate the solution to the puzzle by computing 3454 the hash described in Section 5.3.3 using the same RHASH 3455 algorithm. 3457 8. The I2 MUST have a single value in the HIP_TRANSFORM parameter, 3458 which MUST match one of the values offered to the Initiator in 3459 the R1 packet. 3461 9. The system must derive Diffie-Hellman keying material Kij based 3462 on the public value and Group ID in the DIFFIE_HELLMAN 3463 parameter. This key is used to derive the HIP association keys, 3464 as described in Section 6.5. If the Diffie-Hellman Group ID is 3465 unsupported, the I2 packet is silently dropped. 3467 10. The encrypted HOST_ID decrypted by the Initiator encryption key 3468 defined in Section 6.5. If the decrypted data is not a HOST_ID 3469 parameter, the I2 packet is silently dropped. 3471 11. The implementation MUST also verify that the Initiator's HIT in 3472 the I2 corresponds to the Host Identity sent in the I2. 3474 12. The system MUST verify the HMAC according to the procedures in 3475 Section 5.2.9. 3477 13. The system MUST verify the HIP_SIGNATURE according to 3478 Section 5.2.11 and Section 5.3.3. 3480 14. If the checks above are valid, then the system proceeds with 3481 further I2 processing; otherwise, it discards the I2 and remains 3482 in the same state. 3484 15. The I2 packet may have the A bit set -- in this case, the system 3485 MAY choose to refuse it by dropping the I2 and returning to 3486 state UNASSOCIATED. If the A bit is set, the Initiator's HIT is 3487 anonymous and should not be stored. 3489 16. The system initializes the remaining variables in the associated 3490 state, including Update ID counters. 3492 17. Upon successful processing of an I2 in states UNASSOCIATED, I1- 3493 SENT, I2-SENT, and R2-SENT, an R2 is sent and the state machine 3494 transitions to state R2-SENT. 3496 18. Upon successful processing of an I2 in state ESTABLISHED, the 3497 old HIP association is dropped and a new one is installed, an R2 3498 is sent, and the state machine transitions to R2-SENT. 3500 19. Upon transitioning to R2-SENT, start a timer. Move to 3501 ESTABLISHED if some data has been received on the incoming HIP 3502 association, or an UPDATE packet has been received (or some 3503 other packet that indicates that the peer has moved to 3504 ESTABLISHED). If the timer expires (allowing for maximal 3505 retransmissions of I2s), move to ESTABLISHED. 3507 6.9.1. Handling Malformed Messages 3509 If an implementation receives a malformed I2 message, the behavior 3510 SHOULD depend on how much checks the message has already passed. If 3511 the puzzle solution in the message has already been checked, the 3512 implementation SHOULD report the error by responding with a NOTIFY 3513 packet. Otherwise the implementation MAY respond with an ICMP 3514 message as defined in Section 5.4. 3516 6.10. Processing Incoming R2 Packets 3518 An R2 received in states UNASSOCIATED, I1-SENT, or ESTABLISHED 3519 results in the R2 being dropped and the state machine staying in the 3520 same state. If an R2 is received in state I2-SENT, it SHOULD be 3521 processed. 3523 The following steps define the conceptual processing rules for 3524 incoming R2 packet: 3526 1. The system MUST verify that the HITs in use correspond to the 3527 HITs that were received in R1. 3529 2. The system MUST verify the HMAC_2 according to the procedures in 3530 Section 5.2.10. 3532 3. The system MUST verify the HIP signature according to the 3533 procedures in Section 5.2.11. 3535 4. If any of the checks above fail, there is a high probability of 3536 an ongoing man-in-the-middle or other security attack. The 3537 system SHOULD act accordingly, based on its local policy. 3539 5. If the system is in any other state than I2-SENT, the R2 is 3540 silently dropped. 3542 6. Upon successful processing of the R2, the state machine moves to 3543 state ESTABLISHED. 3545 6.11. Sending UPDATE Packets 3547 A host sends an UPDATE packet when it wants to update some 3548 information related to a HIP association. There are a number of 3549 likely situations, e.g. mobility management and rekeying of an 3550 existing ESP Security Association. The following paragraphs define 3551 the conceptual rules for sending an UPDATE packet to the peer. 3552 Additional steps can be defined in other documents where the UPDATE 3553 packet is used. 3555 The system first determines whether there are any outstanding UPDATE 3556 messages that may conflict with the new UPDATE message under 3557 consideration. When multiple UPDATEs are outstanding (not yet 3558 acknowledged), the sender must assume that such UPDATEs may be 3559 processed in an arbitrary order. Therefore, any new UPDATEs that 3560 depend on a previous outstanding UPDATE being successfully received 3561 and acknowledged MUST be postponed until reception of the necessary 3562 ACK(s) occurs. One way to prevent any conflicts is to only allow one 3563 outstanding UPDATE at a time, but allowing multiple UPDATEs may 3564 improve the performance of mobility and multihoming protocols. 3566 1. The first UPDATE packet is sent with Update ID of zero. 3567 Otherwise, the system increments its own Update ID value by one 3568 before continuing the below steps. 3570 2. The system creates an UPDATE packet that contains a SEQ parameter 3571 with the current value of Update ID. The UPDATE packet may also 3572 include an ACK of the peer's Update ID found in a received UPDATE 3573 SEQ parameter, if any. 3575 3. The system sends the created UPDATE packet and starts an UPDATE 3576 timer. The default value for the timer is 2 * RTT estimate. If 3577 multiple UPDATEs are outstanding, multiple timers are in effect. 3579 4. If the UPDATE timer expires, the UPDATE is resent. The UPDATE 3580 can be resent UPDATE_RETRY_MAX times. The UPDATE timer SHOULD be 3581 exponentially backed off for subsequent retransmissions. If no 3582 acknowledgment is received from the peer after UPDATE_RETRY_MAX 3583 times, the HIP association is considered to be broken and the 3584 state machine should move from state ESTABLISHED to state CLOSING 3585 as depicted in Section 4.4.3. The UPDATE timer is cancelled upon 3586 receiving an ACK from the peer that acknowledges receipt of the 3587 UPDATE. 3589 6.12. Receiving UPDATE Packets 3591 When a system receives an UPDATE packet, its processing depends on 3592 the state of the HIP association and the presence of and values of 3593 the SEQ and ACK parameters. Typically, an UPDATE message also 3594 carries optional parameters whose handling is defined in separate 3595 documents. 3597 For each association, the peer's next expected in-sequence Update ID 3598 ("peer Update ID") is stored. Initially, this value is zero. Update 3599 ID comparisons of "less than" and "greater than" are performed with 3600 respect to a circular sequence number space. 3602 The sender may send multiple outstanding UPDATE messages. These 3603 messages are processed in the order in which they are received at the 3604 receiver (i.e., no resequencing is performed). When processing 3605 UPDATEs out-of-order, the receiver MUST keep track of which UPDATEs 3606 were previously processed, so that duplicates or retransmissions are 3607 ACKed and not reprocessed. A receiver MAY choose to define a receive 3608 window of Update IDs that it is willing to process at any given time, 3609 and discard received UPDATEs falling outside of that window. 3611 1. If there is no corresponding HIP association, the implementation 3612 MAY reply with an ICMP Parameter Problem, as specified in 3613 Section 5.4.4. 3615 2. If the association is in the ESTABLISHED state and the SEQ (but 3616 not ACK) parameter is present, the UPDATE is processed and 3617 replied as described in Section 6.12.1. 3619 3. If the association is in the ESTABLISHED state and the ACK (but 3620 not SEQ) parameter is present, the UPDATE is processed as 3621 described in Section 6.12.2. 3623 4. If the association is in the ESTABLISHED state and there is both 3624 an ACK and SEQ in the UPDATE, the ACK is first processed as 3625 described in Section 6.12.2 and then the rest of the UPDATE is 3626 processed as described in Section 6.12.1. 3628 6.12.1. Handling a SEQ parameter in a received UPDATE message 3630 1. If the Update ID in the received SEQ is not the next in sequence 3631 Update ID and is greater than the receiver's window for new 3632 UPDATEs, the packet MUST be dropped. 3634 2. If the Update ID in the received SEQ corresponds to an UPDATE 3635 that has recently been processed, the packet is treated as a 3636 retransmission. The HMAC verification (next step) MUST NOT be 3637 skipped. (A byte-by-byte comparison of the received and a stored 3638 packet would be OK, though.) It is recommended that a host cache 3639 UPDATE packets sent with ACKs to avoid the cost of generating a 3640 new ACK packet to respond to a replayed UPDATE. The system MUST 3641 acknowledge, again, such (apparent) UPDATE message 3642 retransmissions but SHOULD also consider rate-limiting such 3643 retransmission responses to guard against replay attacks. 3645 3. The system MUST verify the HMAC in the UPDATE packet. If the 3646 verification fails, the packet MUST be dropped. 3648 4. The system MAY verify the SIGNATURE in the UPDATE packet. If the 3649 verification fails, the packet SHOULD be dropped and an error 3650 message logged. 3652 5. If a new SEQ parameter is being processed, the parameters in the 3653 UPDATE are then processed. The system MUST record the Update ID 3654 in the received SEQ parameter, for replay protection. 3656 6. An UPDATE acknowledgement packet with ACK parameter is prepared 3657 and sent to the peer. This ACK parameter may be included in a 3658 separate UPDATE or piggybacked in an UPDATE with SEQ parameter, 3659 as described in Section Section 5.3.5. The ACK parameter MAY 3660 acknowledge more than one of the peer's Update IDs. 3662 6.12.2. Handling an ACK Parameter in a Received UPDATE Packet 3664 1. The sequence number reported in the ACK must match with an 3665 earlier sent UPDATE packet that has not already been 3666 acknowledged. If no match is found or if the ACK does not 3667 acknowledge a new UPDATE, the packet MUST either be dropped if no 3668 SEQ parameter is present, or the processing steps in 3669 Section 6.12.1 are followed. 3671 2. The system MUST verify the HMAC in the UPDATE packet. If the 3672 verification fails, the packet MUST be dropped. 3674 3. The system MAY verify the SIGNATURE in the UPDATE packet. If the 3675 verification fails, the packet SHOULD be dropped and an error 3676 message logged. 3678 4. The corresponding UPDATE timer is stopped (see Section 6.11) so 3679 that the now acknowledged UPDATE is no longer retransmitted. If 3680 multiple UPDATEs are newly acknowledged, multiple timers are 3681 stopped. 3683 6.13. Processing NOTIFY Packets 3685 Processing NOTIFY packets is OPTIONAL. If processed, any errors in a 3686 received NOTIFICATION parameter SHOULD be logged. Received errors 3687 MUST be considered only as informational and the receiver SHOULD NOT 3688 change its HIP state Section 4.4.1 purely based on the received 3689 NOTIFY message. 3691 6.14. Processing CLOSE Packets 3693 When the host receives a CLOSE message it responds with a CLOSE_ACK 3694 message and moves to CLOSED state. (The authenticity of the CLOSE 3695 message is verified using both HMAC and SIGNATURE). This processing 3696 applies whether or not the HIP association state is CLOSING in order 3697 to handle CLOSE messages from both ends crossing in flight. 3699 The HIP association is not discarded before the host moves from the 3700 UNASSOCIATED state. 3702 Once the closing process has started, any need to send data packets 3703 will trigger creating and establishing of a new HIP association, 3704 starting with sending an I1. 3706 If there is no corresponding HIP association, the CLOSE packet is 3707 dropped. 3709 6.15. Processing CLOSE_ACK Packets 3711 When a host receives a CLOSE_ACK message it verifies that it is in 3712 CLOSING or CLOSED state and that the CLOSE_ACK was in response to the 3713 CLOSE (using the included ECHO_REPLY_SIGNED in response to the sent 3714 ECHO_REQUEST_SIGNED). 3716 The CLOSE_ACK uses HMAC and SIGNATURE for verification. The state is 3717 discarded when the state changes to UNASSOCIATED and, after that, the 3718 host MAY respond with an ICMP Parameter Problem to an incoming CLOSE 3719 message (See Section 5.4.4). 3721 6.16. Handling State Loss 3723 In the case of system crash and unanticipated state loss, the system 3724 SHOULD delete the corresponding HIP state, including the keying 3725 material. That is, the state SHOULD NOT be stored on stable storage. 3726 If the implementation does drop the state (as RECOMMENDED), it MUST 3727 also drop the peer's R1 generation counter value, unless a local 3728 policy explicitly defines that the value of that particular host is 3729 stored. An implementation MUST NOT store R1 generation counters by 3730 default, but storing R1 generation counter values, if done, MUST be 3731 configured by explicit HITs. 3733 7. HIP Policies 3735 There are a number of variables that will influence the HIP exchanges 3736 that each host must support. All HIP implementations MUST support 3737 more than one simultaneous HIs, at least one of which SHOULD be 3738 reserved for anonymous usage. Although anonymous HIs will be rarely 3739 used as Responder HIs, they will be common for Initiators. Support 3740 for more than two HIs is RECOMMENDED. 3742 Many Initiators would want to use a different HI for different 3743 Responders. The implementations SHOULD provide for an ACL of 3744 Initiator HIT to Responder HIT. This ACL SHOULD also include 3745 preferred transform and local lifetimes. 3747 The value of K used in the HIP R1 packet can also vary by policy. K 3748 should never be greater than 20, but for trusted partners it could be 3749 as low as 0. 3751 Responders would need a similar ACL, representing which hosts they 3752 accept HIP exchanges, and the preferred transform and local 3753 lifetimes. Wildcarding SHOULD be supported for this ACL also. 3755 8. Security Considerations 3757 HIP is designed to provide secure authentication of hosts. HIP also 3758 attempts to limit the exposure of the host to various denial-of- 3759 service and man-in-the-middle (MitM) attacks. In so doing, HIP 3760 itself is subject to its own DoS and MitM attacks that potentially 3761 could be more damaging to a host's ability to conduct business as 3762 usual. 3764 The 384-bit Diffie-Hellman Group is targeted to be used in hosts that 3765 either do not require or that are not powerful enough for handling 3766 strong cryptography. Although there is a risk that with suitable 3767 equipment the encryption can be broken in real time, the 384-bit 3768 group can provide some protection for end-hosts that are not able to 3769 handle any stronger cryptography. When the security provided by the 3770 384-bit group is not enough for applications on a host, the support 3771 for this group should be turned off in the configuration. 3773 Denial-of-service attacks often take advantage of the cost of start 3774 of state for a protocol on the Responder compared to the 'cheapness' 3775 on the Initiator. HIP makes no attempt to increase the cost of the 3776 start of state on the Initiator, but makes an effort to reduce the 3777 cost to the Responder. This is done by having the Responder start 3778 the 3-way exchange instead of the Initiator, making the HIP protocol 3779 4 packets long. In doing this, packet 2 becomes a 'stock' packet 3780 that the Responder MAY use many times, until some Initiator has 3781 provided a valid response to such and R1 packet. During an I1 storm 3782 the host may re-use the same D-H value also beyond that point. Using 3783 the same Diffie-Hellman values and random puzzle #I value has some 3784 risks. This risk needs to be balanced against a potential storm of 3785 HIP I1 packets. 3787 This shifting of the start of state cost to the Initiator in creating 3788 the I2 HIP packet, presents another DoS attack. The attacker spoofs 3789 the I1 HIP packet and the Responder sends out the R1 HIP packet. 3790 This could conceivably tie up the 'Initiator' with evaluating the R1 3791 HIP packet, and creating the I2 HIP packet. The defense against this 3792 attack is to simply ignore any R1 packet where a corresponding I1 was 3793 not sent. 3795 A second form of DoS attack arrives in the I2 HIP packet. Once the 3796 attacking Initiator has solved the puzzle, it can send packets with 3797 spoofed IP source addresses with either invalid encrypted HIP payload 3798 component or a bad HIP signature. This would take resources in the 3799 Responder's part to reach the point to discover that the I2 packet 3800 cannot be completely processed. The defense against this attack is 3801 after N bad I2 packets, the Responder would discard any I2s that 3802 contain the given Initiator HIT. Thus will shut down the attack. 3804 The attacker would have to request another R1 and use that to launch 3805 a new attack. The Responder could up the value of K while under 3806 attack. On the downside, valid I2s might get dropped too. 3808 A third form of DoS attack is emulating the restart of state after a 3809 reboot of one of the partners. A host restarting would send an I1 to 3810 a peer, which would respond with an R1 even if it were in the 3811 ESTABLISHED state. If the I1 were spoofed, the resulting R1 would be 3812 received unexpectedly by the spoofed host and would be dropped, as in 3813 the first case above. 3815 A fourth form of DoS attack is emulating the end of state. HIP 3816 relies on timers plus a CLOSE/CLOSE_ACK handshake to explicitly 3817 signals the end of a state. Because both CLOSE and CLOSE_ACK 3818 messages contain an HMAC, an outsider cannot close a connection. The 3819 presence of an additional SIGNATURE allows middle-boxes to inspect 3820 these messages and discard the associated state (for e.g., 3821 firewalling, SPI-based NATing, etc.). However, the optional behavior 3822 of replying to CLOSE with an ICMP Parameter Problem packet (as 3823 described in Section 5.4.4) might allow an IP spoofer sending CLOSE 3824 messages to launch reflection attacks. 3826 A fifth form of DoS attack is replaying R1s to cause the Initiator to 3827 solve stale puzzles and become out of synchronization with the 3828 Responder. The R1 generation counter is a monotonically increasing 3829 counter designed to protect against this attack, as described in 3830 section Section 4.1.4. 3832 Man-in-the-middle attacks are difficult to defend against, without 3833 third-party authentication. A skillful MitM could easily handle all 3834 parts of HIP; but HIP indirectly provides the following protection 3835 from a MitM attack. If the Responder's HI is retrieved from a signed 3836 DNS zone, a certificate, or through some other secure means, the 3837 Initiator can use this to validate the R1 HIP packet. 3839 Likewise, if the Initiator's HI is in a secure DNS zone, a trusted 3840 certificate, or otherwise securely available, the Responder can 3841 retrieve it after it gets the I2 HIP packet and validate that. 3842 However, since an Initiator may choose to use an anonymous HI, it 3843 knowingly risks a MitM attack. The Responder may choose not to 3844 accept a HIP exchange with an anonymous Initiator. 3846 The HIP Opportunistic Mode concept has been introduced in this 3847 document, but this document does not specify the details of such a 3848 connection set up (Section 4.1.6). There are certain security 3849 concerns with opportunistic mode, and they must be addressed in a 3850 separate document if such a mode will be used. 3852 NOTIFY messages are used only for informational purposes and they are 3853 unacknowledged. A HIP implementation cannot rely solely on the 3854 information received in a NOTIFY message because the packet may have 3855 been replayed. It SHOULD NOT change any state information based 3856 purely on a received NOTIFY message. 3858 Since not all hosts will ever support HIP, ICMP 'Destination Protocol 3859 Unreachable' are to be expected and present a DoS attack. Against an 3860 Initiator, the attack would look like the Responder does not support 3861 HIP, but shortly after receiving the ICMP message, the Initiator 3862 would receive a valid R1 HIP packet. Thus to protect from this 3863 attack, an Initiator should not react to an ICMP message until a 3864 reasonable delta time to get the real Responder's R1 HIP packet. A 3865 similar attack against the Responder is more involved. First an ICMP 3866 message is expected if the I1 was a DoS attack and the real owner of 3867 the spoofed IP address does not support HIP. The Responder SHOULD 3868 NOT act on this ICMP message to remove the minimal state from the R1 3869 HIP packet (if it has one), but wait for either a valid I2 HIP packet 3870 or the natural timeout of the R1 HIP packet. This is to allow for a 3871 sophisticated attacker that is trying to break up the HIP exchange. 3872 Likewise, the Initiator should ignore any ICMP message while waiting 3873 for an R2 HIP packet, deleting state only after a natural timeout. 3875 9. IANA Considerations 3877 IANA has reserved protocol number 253 to be used for experimental 3878 purposes (see [RFC3692]). In HIP, this value is used until a 3879 permanent protocol number has been assigned by IANA. 3881 This document defines a new 128-bit value under the CGA Message Type 3882 namespace [RFC3972], 0xF0EF F02F BFF4 3D0F E793 0C3C 6E61 74EA, to be 3883 used for HIT generation as specified in ORCHID [RFC4843]. 3885 This document also creates a set of new name spaces. These are 3886 described below. 3888 Packet Type 3890 The 7-bit Packet Type field in a HIP protocol packet describes the 3891 type of a HIP protocol message. It is defined in Section 5.1. 3892 The current values are defined in Section 5.3.1 through 3893 Section 5.3.8. 3895 New values are assigned through IETF Consensus [RFC2434]. 3897 HIP Version 3899 The four bit Version field in a HIP protocol packet describes the 3900 version of the HIP protocol. It is defined in Section 5.1. The 3901 only currently defined value is 1. New values are assigned 3902 through IETF Consensus. 3904 Parameter Type 3906 The 16 bit Type field in a HIP parameter describes the type of the 3907 parameter. It is defined in Section 5.2.1. The current values 3908 are defined in Section 5.2.3 through Section 5.2.20. 3910 With the exception of the assigned type codes, the type codes 0 3911 through 1023 and 61440 through 65535 are reserved for future base 3912 protocol extensions, and are assigned through IETF Consensus. 3914 The type codes 32768 through 49141 are reserved for 3915 experimentation and private use. Types SHOULD be selected in a 3916 random fashion from this range, thereby reducing the probability 3917 of collisions. A method employing genuine randomness (such as 3918 flipping a coin) SHOULD be used. 3920 All other type codes are assigned through First Come First Served, 3921 with Specification Required [RFC2434]. 3923 Group ID 3925 The eight bit Group ID values appear in the DIFFIE_HELLMAN 3926 parameter and are defined in Section 5.2.6. New values either 3927 from the reserved or unassigned space are assigned through IETF 3928 Consensus. 3930 Suite ID 3932 The 16 bit Suite ID values in a HIP_TRANSFORM parameter are 3933 defined in Section 5.2.7. New values either from the reserved or 3934 unassigned space are assigned through IETF Consensus. 3936 DI-Type 3938 The four bit DI-Type values in a HOST_ID parameter are defined in 3939 Section 5.2.8. New values are assigned through IETF Consensus. 3941 Notify Message Type 3943 The 16 bit Notify Message Type values in a NOTIFICATION parameter 3944 are defined in Section 5.2.16. New values are assigned through 3945 First Come First Served, with Specification Required. 3947 Notify Message Type values 1 through 10 are used for informing 3948 about errors in packet structures, values 11 through 20 for 3949 informing about problems in parameters containing cryptographic 3950 related material, values 21 through 30 for informing about 3951 problems in authentication or packet integrity verification. 3952 Parameter numbers above 30 can be used for informing about other 3953 types of errors or events. Values 51 - 8191 are error types 3954 reserved to be allocated by IANA. Values 8192 - 16383 are error 3955 types for private use. Values 16385 - 40959 are status types to 3956 be allocated by IANA and values 40960 - 65535 are status types for 3957 private use. 3959 10. Acknowledgments 3961 The drive to create HIP came to being after attending the MALLOC 3962 meeting at the 43rd IETF meeting. Baiju Patel and Hilarie Orman 3963 really gave the original author, Bob Moskowitz, the assist to get HIP 3964 beyond 5 paragraphs of ideas. It has matured considerably since the 3965 early drafts thanks to extensive input from IETFers. Most 3966 importantly, its design goals are articulated and are different from 3967 other efforts in this direction. Particular mention goes to the 3968 members of the NameSpace Research Group of the IRTF. Noel Chiappa 3969 provided the framework for LSIs and Keith Moore the impetus to 3970 provide resolvability. Steve Deering provided encouragement to keep 3971 working, as a solid proposal can act as a proof of ideas for a 3972 research group. 3974 Many others contributed; extensive security tips were provided by 3975 Steve Bellovin. Rob Austein kept the DNS parts on track. Paul 3976 Kocher taught Bob Moskowitz how to make the puzzle exchange expensive 3977 for the Initiator to respond, but easy for the Responder to validate. 3978 Bill Sommerfeld supplied the Birthday concept, which later evolved 3979 into the R1 generation counter, to simplify reboot management. Erik 3980 Nordmark supplied CLOSE-mechanism for closing connections. Rodney 3981 Thayer and Hugh Daniels provide extensive feedback. In the early 3982 times of this document, John Gilmore kept Bob Moskowitz challenged to 3983 provide something of value. 3985 During the later stages of this document, when the editing baton was 3986 transferred to Pekka Nikander, the input from the early implementors 3987 were invaluable. Without having actual implementations, this 3988 document would not be on the level it is now. 3990 In the usual IETF fashion, a large number of people have contributed 3991 to the actual text or ideas. The list of these people include Jeff 3992 Ahrenholz, Francis Dupont, Derek Fawcus, George Gross, Andrew 3993 McGregor, Julien Laganier, Miika Komu, Mika Kousa, Jan Melen, Henrik 3994 Petander, Michael Richardson, Tim Shepard, Jorma Wall, and Jukka 3995 Ylitalo. Our apologies to anyone whose name is missing. 3997 Once the HIP Working Group was founded in early 2004, a number of 3998 changes were introduced through the working group process. Most 3999 notably, the original draft was split in two, one containing the base 4000 exchange and the other one defining how to use ESP. Some 4001 modifications to the protocol proposed by Aura et al. [AUR03] were 4002 added at a later stage. 4004 11. References 4006 11.1. Normative References 4008 [RFC0768] Postel, J., "User Datagram Protocol", STD 6, RFC 768, 4009 August 1980. 4011 [RFC1035] Mockapetris, P., "Domain names - implementation and 4012 specification", STD 13, RFC 1035, November 1987. 4014 [RFC1885] Conta, A. and S. Deering, "Internet Control Message 4015 Protocol (ICMPv6) for the Internet Protocol Version 6 4016 (IPv6)", RFC 1885, December 1995. 4018 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 4019 Requirement Levels", BCP 14, RFC 2119, March 1997. 4021 [RFC2404] Madson, C. and R. Glenn, "The Use of HMAC-SHA-1-96 within 4022 ESP and AH", RFC 2404, November 1998. 4024 [RFC2451] Pereira, R. and R. Adams, "The ESP CBC-Mode Cipher 4025 Algorithms", RFC 2451, November 1998. 4027 [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6 4028 (IPv6) Specification", RFC 2460, December 1998. 4030 [RFC2535] Eastlake, D., "Domain Name System Security Extensions", 4031 RFC 2535, March 1999. 4033 [RFC2536] Eastlake, D., "DSA KEYs and SIGs in the Domain Name System 4034 (DNS)", RFC 2536, March 1999. 4036 [RFC2898] Kaliski, B., "PKCS #5: Password-Based Cryptography 4037 Specification Version 2.0", RFC 2898, September 2000. 4039 [RFC3110] Eastlake, D., "RSA/SHA-1 SIGs and RSA KEYs in the Domain 4040 Name System (DNS)", RFC 3110, May 2001. 4042 [RFC3484] Draves, R., "Default Address Selection for Internet 4043 Protocol version 6 (IPv6)", RFC 3484, February 2003. 4045 [RFC3526] Kivinen, T. and M. Kojo, "More Modular Exponential (MODP) 4046 Diffie-Hellman groups for Internet Key Exchange (IKE)", 4047 RFC 3526, May 2003. 4049 [RFC3602] Frankel, S., Glenn, R., and S. Kelly, "The AES-CBC Cipher 4050 Algorithm and Its Use with IPsec", RFC 3602, 4051 September 2003. 4053 [RFC3972] Aura, T., "Cryptographically Generated Addresses (CGA)", 4054 RFC 3972, March 2005. 4056 [RFC4307] Schiller, J., "Cryptographic Algorithms for Use in the 4057 Internet Key Exchange Version 2 (IKEv2)", RFC 4307, 4058 December 2005. 4060 [RFC4843] Nikander, P., Laganier, J., and F. Dupont, "An IPv6 Prefix 4061 for Overlay Routable Cryptographic Hash Identifiers 4062 (ORCHID)", RFC 4843, April 2007. 4064 [I-D.ietf-radext-rfc2486bis] 4065 Aboba, B., "The Network Access Identifier", 4066 draft-ietf-radext-rfc2486bis-06 (work in progress), 4067 July 2005. 4069 [I-D.ietf-hip-esp] 4070 Jokela, P., "Using ESP transport format with HIP", 4071 draft-ietf-hip-esp-05 (work in progress), February 2007. 4073 [FIPS95] NIST, "FIPS PUB 180-1: Secure Hash Standard", April 1995. 4075 11.2. Informative References 4077 [RFC0792] Postel, J., "Internet Control Message Protocol", STD 5, 4078 RFC 792, September 1981. 4080 [RFC2409] Harkins, D. and D. Carrel, "The Internet Key Exchange 4081 (IKE)", RFC 2409, November 1998. 4083 [RFC2412] Orman, H., "The OAKLEY Key Determination Protocol", 4084 RFC 2412, November 1998. 4086 [RFC2434] Narten, T. and H. Alvestrand, "Guidelines for Writing an 4087 IANA Considerations Section in RFCs", BCP 26, RFC 2434, 4088 October 1998. 4090 [RFC3692] Narten, T., "Assigning Experimental and Testing Numbers 4091 Considered Useful", BCP 82, RFC 3692, January 2004. 4093 [I-D.ietf-hip-arch] 4094 Moskowitz, R. and P. Nikander, "Host Identity Protocol 4095 Architecture", draft-ietf-hip-arch-03 (work in progress), 4096 August 2005. 4098 [I-D.ietf-shim6-proto] 4099 Bagnulo, M. and E. Nordmark, "Shim6: Level 3 Multihoming 4100 Shim Protocol for IPv6", draft-ietf-shim6-proto-08 (work 4101 in progress), April 2007. 4103 [I-D.henderson-hip-applications] 4104 Henderson, T. and P. Nikander, "Using HIP with Legacy 4105 Applications", draft-henderson-hip-applications-03 (work 4106 in progress), May 2006. 4108 [I-D.ietf-hip-mm] 4109 Henderson, T., "End-Host Mobility and Multihoming with the 4110 Host Identity Protocol", draft-ietf-hip-mm-05 (work in 4111 progress), March 2007. 4113 [I-D.ietf-hip-dns] 4114 Nikander, P. and J. Laganier, "Host Identity Protocol 4115 (HIP) Domain Name System (DNS) Extensions", 4116 draft-ietf-hip-dns-09 (work in progress), April 2007. 4118 [I-D.ietf-hip-rvs] 4119 Laganier, J. and L. Eggert, "Host Identity Protocol (HIP) 4120 Rendezvous Extension", draft-ietf-hip-rvs-05 (work in 4121 progress), June 2006. 4123 [AUR03] Aura, T., Nagarajan, A., and A. Gurtov, "Analysis of the 4124 HIP Base Exchange Protocol", in Proceedings of 10th 4125 Australasian Conference on Information Security and 4126 Privacy, July 2003. 4128 [KRA03] Krawczyk, H., "SIGMA: The 'SIGn-and-MAc' Approach to 4129 Authenticated Diffie-Hellman and Its Use in the IKE- 4130 Protocols", in Proceedings of CRYPTO 2003, pages 400-425, 4131 August 2003. 4133 [CRO03] Crosby, SA. and DS. Wallach, "Denial of Service via 4134 Algorithmic Complexity Attacks", in Proceedings of Usenix 4135 Security Symposium 2003, Washington, DC., August 2003. 4137 [FIPS01] NIST, "FIPS PUB 197: Advanced Encryption Standard", 4138 Nov 2001. 4140 [DIF76] Diffie, W. and M. Hellman, "New Directions in 4141 Cryptography", IEEE Transactions on Information 4142 Theory vol. IT-22, number 6, pages 644-654, Nov 1976. 4144 [KAU03] Kaufman, C., Perlman, R., and B. Sommerfeld, "DoS 4145 protection for UDP-based protocols", ACM Conference on 4146 Computer and Communications Security , Oct 2003. 4148 Appendix A. Using Responder Puzzles 4150 As mentioned in Section 4.1.1, the Responder may delay state creation 4151 and still reject most spoofed I2s by using a number of pre-calculated 4152 R1s and a local selection function. This appendix defines one 4153 possible implementation in detail. The purpose of this appendix is 4154 to give the implementors an idea on how to implement the mechanism. 4155 If the implementation is based on this appendix, it MAY contain some 4156 local modification that makes an attacker's task harder. 4158 The Responder creates a secret value S, that it regenerates 4159 periodically. The Responder needs to remember two latest values of 4160 S. Each time the S is regenerated, R1 generation counter value is 4161 incremented by one. 4163 The Responder generates a pre-signed R1 packet. The signature for 4164 pre-generated R1s must be recalculated when the Diffie-Hellman key is 4165 recomputed or when the R1_COUNTER value changes due to S value 4166 regeneration. 4168 When the Initiator sends the I1 packet for initializing a connection, 4169 the Responder gets the HIT and IP address from the packet, and 4170 generates an I-value for the puzzle. The I value is set to the pre- 4171 signed R1 packet. 4173 I value calculation: 4174 I = Ltrunc( RHASH ( S | HIT-I | HIT-R | IP-I | IP-R ), 64) 4176 The RHASH algorithm is the same that is used to generate the 4177 Responder's HIT value. 4179 From an incoming I2 packet, the Responder gets the required 4180 information to validate the puzzle: HITs, IP addresses, and the 4181 information of the used S value from the R1_COUNTER. Using these 4182 values, the Responder can regenerate the I, and verify it against the 4183 I received in the I2 packet. If the I values match, it can verify 4184 the solution using I, J, and difficulty K. If the I values do not 4185 match, the I2 is dropped. 4187 puzzle_check: 4188 V := Ltrunc( RHASH( I2.I | I2.hit_i | I2.hit_r | I2.J ), K ) 4189 if V != 0, drop the packet 4191 If the puzzle solution is correct, the I and J values are stored for 4192 later use. They are used as input material when keying material is 4193 generated. 4195 Keeping state about failed puzzle solutions depends on the 4196 implementation. Although it is possible that the Responder doesn't 4197 keep any state information, it still may do so to protect itself 4198 against certain attacks (see Section 4.1.1). 4200 Appendix B. Generating a Public Key Encoding from a HI 4202 The following pseudo-codes illustrate the process to generate a 4203 public key encoding from a HI for both RSA and DSA. 4205 The symbol := denotes assignment; the symbol += denotes appending. 4206 The pseudo-function encode_in_network_byte_order takes two 4207 parameters, an integer (bignum) and a length in bytes, and returns 4208 the integer encoded into a byte string of the given length. 4210 switch ( HI.algorithm ) 4211 { 4213 case RSA: 4214 buffer := encode_in_network_byte_order ( HI.RSA.e_len, 4215 ( HI.RSA.e_len > 255 ) ? 3 : 1 ) 4216 buffer += encode_in_network_byte_order ( HI.RSA.e, HI.RSA.e_len ) 4217 buffer += encode_in_network_byte_order ( HI.RSA.n, HI.RSA.n_len ) 4218 break; 4220 case DSA: 4221 buffer := encode_in_network_byte_order ( HI.DSA.T , 1 ) 4222 buffer += encode_in_network_byte_order ( HI.DSA.Q , 20 ) 4223 buffer += encode_in_network_byte_order ( HI.DSA.P , 64 + 4224 8 * HI.DSA.T ) 4225 buffer += encode_in_network_byte_order ( HI.DSA.G , 64 + 4226 8 * HI.DSA.T ) 4227 buffer += encode_in_network_byte_order ( HI.DSA.Y , 64 + 4228 8 * HI.DSA.T ) 4229 break; 4231 } 4233 Appendix C. Example Checksums for HIP Packets 4235 The HIP checksum for HIP packets is specified in Section 5.1.1. 4236 Checksums for TCP and UDP packets running over HIP-enabled security 4237 associations are specified in Section 3.5. The examples below use IP 4238 addresses of 192.168.0.1 and 192.168.0.2 (and their respective IPv4- 4239 compatible IPv6 formats), and HITs with the first two bits "01" 4240 followed by 124 zeroes followed by a decimal 1 or 2, respectively. 4242 The following example is defined only for testing a checksum 4243 calculation. The address format for IPv4-compatible IPv6 address is 4244 not a valid one, but using these IPv6 addresses when testing an IPv6 4245 implementation gives the same checksum output as an IPv4 4246 implementation with the corresponding IPv4 addresses. 4248 C.1. IPv6 HIP Example (I1) 4250 Source Address: ::192.168.0.1 4251 Destination Address: ::192.168.0.2 4252 Upper-Layer Packet Length: 40 0x28 4253 Next Header: 253 0xfd 4254 Payload Protocol: 59 0x3b 4255 Header Length: 4 0x4 4256 Packet Type: 1 0x1 4257 Version: 1 0x1 4258 Reserved: 1 0x1 4259 Control: 0 0x0 4260 Checksum: 8046 0x1f6e 4261 Sender's HIT : 1100::1 4262 Receiver's HIT: 1100::2 4264 C.2. IPv4 HIP Packet (I1) 4266 The IPv4 checksum value for the same example I1 packet is the same as 4267 the IPv6 checksum (since the checksums due to the IPv4 and IPv6 4268 pseudo-header components are the same). 4270 C.3. TCP Segment 4272 Regardless of whether IPv6 or IPv4 is used, the TCP and UDP sockets 4273 use the IPv6 pseudo-header format [RFC2460], with the HITs used in 4274 place of the IPv6 addresses. 4276 Sender's HIT: 1100::0001 4277 Receiver's HIT: 1100::0002 4278 Upper-Layer Packet Length: 20 0x14 4279 Next Header: 6 0x06 4280 Source port: 65500 0xffdc 4281 Destination port: 22 0x0016 4282 Sequence number: 1 0x00000001 4283 Acknowledgment number: 0 0x00000000 4284 Header length: 20 0x14 4285 Flags: SYN 0x02 4286 Window size: 65535 0xffff 4287 Checksum: 60301 0xeb8d 4288 Urgent pointer: 0 0x0000 4290 0x0000: 6000 0000 0014 0640 1100 0000 0000 0000 4291 0x0010: 0000 0000 0000 0002 1100 0000 0000 0000 4292 0x0020: 0000 0000 0000 0002 ffdc 0016 0000 0001 4293 0x0030: 0000 0000 5002 ffff 8deb 0000 4295 Appendix D. 384-bit Group 4297 This 384-bit group is defined only to be used with HIP. NOTE: The 4298 security level of this group is very low! The encryption may be 4299 broken in a very short time, even real-time. It should be used only 4300 when the host is not powerful enough (e.g. some PDAs) and when 4301 security requirements are low (e.g. during normal web surfing). 4303 This prime is: 2^384 - 2^320 - 1 + 2^64 * { [ 2^254 pi] + 5857 } 4305 Its hexadecimal value is: 4307 FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 4308 29024E08 8A67CC74 020BBEA6 3B13B202 FFFFFFFF FFFFFFFF 4310 The generator is: 2. 4312 Appendix E. OAKLEY Well-known group 1 4314 See also [RFC2412] for definition of OAKLEY Well-known group 1. 4316 OAKLEY Well-Known Group 1: A 768 bit prime 4318 The prime is 2^768 - 2^704 - 1 + 2^64 * { [2^638 pi] + 149686 }. 4320 The hexadecimal value is: 4322 FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 4323 29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD 4324 EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245 4325 E485B576 625E7EC6 F44C42E9 A63A3620 FFFFFFFF FFFFFFFF 4327 This has been rigorously verified as a prime. 4329 The generator is: 22 (decimal) 4331 Authors' Addresses 4333 Robert Moskowitz 4334 ICSAlabs, a Division of TruSecure Corporation 4335 1000 Bent Creek Blvd, Suite 200 4336 Mechanicsburg, PA 4337 USA 4339 Email: rgm@icsalabs.com 4341 Pekka Nikander 4342 Ericsson Research NomadicLab 4343 JORVAS FIN-02420 4344 FINLAND 4346 Phone: +358 9 299 1 4347 Email: pekka.nikander@nomadiclab.com 4349 Petri Jokela 4350 Ericsson Research NomadicLab 4351 JORVAS FIN-02420 4352 FINLAND 4354 Phone: +358 9 299 1 4355 Email: petri.jokela@nomadiclab.com 4357 Thomas R. Henderson 4358 The Boeing Company 4359 P.O. Box 3707 4360 Seattle, WA 4361 USA 4363 Email: thomas.r.henderson@boeing.com 4365 Full Copyright Statement 4367 Copyright (C) The IETF Trust (2007). 4369 This document is subject to the rights, licenses and restrictions 4370 contained in BCP 78, and except as set forth therein, the authors 4371 retain all their rights. 4373 This document and the information contained herein are provided on an 4374 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 4375 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND 4376 THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS 4377 OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF 4378 THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 4379 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 4381 Intellectual Property 4383 The IETF takes no position regarding the validity or scope of any 4384 Intellectual Property Rights or other rights that might be claimed to 4385 pertain to the implementation or use of the technology described in 4386 this document or the extent to which any license under such rights 4387 might or might not be available; nor does it represent that it has 4388 made any independent effort to identify any such rights. Information 4389 on the procedures with respect to rights in RFC documents can be 4390 found in BCP 78 and BCP 79. 4392 Copies of IPR disclosures made to the IETF Secretariat and any 4393 assurances of licenses to be made available, or the result of an 4394 attempt made to obtain a general license or permission for the use of 4395 such proprietary rights by implementers or users of this 4396 specification can be obtained from the IETF on-line IPR repository at 4397 http://www.ietf.org/ipr. 4399 The IETF invites any interested party to bring to its attention any 4400 copyrights, patents or patent applications, or other proprietary 4401 rights that may cover technology that may be required to implement 4402 this standard. Please address the information to the IETF at 4403 ietf-ipr@ietf.org. 4405 Acknowledgment 4407 Funding for the RFC Editor function is provided by the IETF 4408 Administrative Support Activity (IASA).