idnits 2.17.1 draft-ietf-hip-base-02.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.a on line 21. -- Found old boilerplate from RFC 3978, Section 5.5 on line 3756. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 3733. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 3740. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 3746. ** The document seems to lack an RFC 3978 Section 5.1 IPR Disclosure Acknowledgement. ** This document has an original RFC 3978 Section 5.4 Copyright Line, instead of the newer IETF Trust Copyright according to RFC 4748. ** This document has an original RFC 3978 Section 5.5 Disclaimer, instead of the newer disclaimer which includes the IETF Trust according to RFC 4748. ** The document uses RFC 3667 boilerplate or RFC 3978-like boilerplate instead of verbatim RFC 3978 boilerplate. After 6 May 2005, submission of drafts without verbatim RFC 3978 boilerplate is not accepted. The following non-3978 patterns matched text found in the document. That text should be removed or replaced: This document is an Internet-Draft and is subject to all provisions of Section 3 of RFC 3667. By submitting this Internet-Draft, each author represents that any applicable patent or other IPR claims of which he or she is aware have been or will be disclosed, and any of which he or she becomes aware will be disclosed, in accordance with Section 6 of BCP 79. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- == No 'Intended status' indicated for this document; assuming Proposed Standard == It seems as if not all pages are separated by form feeds - found 0 form feeds but 95 pages Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There are 78 instances of too long lines in the document, the longest one being 7 characters in excess of 72. == There are 5 instances of lines with non-RFC2606-compliant FQDNs in the document. == There are 1 instance of lines with private range IPv4 addresses in the document. If these are generic example addresses, they should be changed to use any of the ranges defined in RFC 6890 (or successor): 192.0.2.x, 198.51.100.x or 203.0.113.x. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the RFC 3978 Section 5.4 Copyright Line does not match the current year == Line 1548 has weird spacing: '...c Value the ...' == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: The UPDATE packet contains zero or one SEQ parameter. The presence of a SEQ parameter indicates that the receiver MUST ack the UPDATE. An UPDATE that does not contain a SEQ parameter is simply an ACK of a previous UPDATE and itself MUST not be acked. == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: All compliant implementations MUST produce R1 packets. An R1 packet MAY be precomputed. An R1 packet MAY be reused for time Delta T, which is implementation dependent. R1 information MUST not be discarded until Delta S after T. Time S is the delay needed for the last I2 to arrive back to the responder. -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (February 21, 2005) is 7004 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: 'RFC2536' on line 1644 -- Looks like a reference, but probably isn't: 'RFC3110' on line 1645 == Missing Reference: '0' is mentioned on line 3600, but not defined == Unused Reference: '7' is defined on line 3389, but no explicit reference was found in the text == Unused Reference: '17' is defined on line 3421, but no explicit reference was found in the text == Unused Reference: '26' is defined on line 3453, but no explicit reference was found in the text == Unused Reference: '28' is defined on line 3462, but no explicit reference was found in the text ** Obsolete normative reference: RFC 1885 (ref. '4') (Obsoleted by RFC 2463) ** Obsolete normative reference: RFC 2408 (ref. '7') (Obsoleted by RFC 4306) ** Obsolete normative reference: RFC 2409 (ref. '8') (Obsoleted by RFC 4306) ** Downref: Normative reference to an Informational RFC: RFC 2412 (ref. '9') ** Obsolete normative reference: RFC 2460 (ref. '11') (Obsoleted by RFC 8200) ** Obsolete normative reference: RFC 2535 (ref. '12') (Obsoleted by RFC 4033, RFC 4034, RFC 4035) ** Obsolete normative reference: RFC 3280 (ref. '15') (Obsoleted by RFC 5280) ** Obsolete normative reference: RFC 3484 (ref. '16') (Obsoleted by RFC 6724) ** Obsolete normative reference: RFC 3513 (ref. '17') (Obsoleted by RFC 4291) == Outdated reference: A later version (-10) exists of draft-ietf-ipsec-esp-v3-05 == Outdated reference: A later version (-17) exists of draft-ietf-ipsec-ikev2-07 == Outdated reference: A later version (-06) exists of draft-moskowitz-hip-arch-03 -- Possible downref: Normative reference to a draft: ref. '21' -- Possible downref: Non-RFC (?) normative reference: ref. '22' -- Possible downref: Normative reference to a draft: ref. '23' -- No information found for draft-nikander-hip-nat - is the name correct? == Outdated reference: A later version (-09) exists of draft-nikander-esp-beet-mode-00 == Outdated reference: A later version (-03) exists of draft-henderson-hip-applications-00 Summary: 15 errors (**), 0 flaws (~~), 18 warnings (==), 14 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 Network Working Group R. Moskowitz 2 Internet-Draft ICSAlabs, a Division of TruSecure 3 Expires: August 25, 2005 Corporation 4 P. Nikander 5 P. Jokela (editor) 6 Ericsson Research NomadicLab 7 T. Henderson 8 The Boeing Company 9 February 21, 2005 11 Host Identity Protocol 12 draft-ietf-hip-base-02 14 Status of this Memo 16 This document is an Internet-Draft and is subject to all provisions 17 of Section 3 of RFC 3667. By submitting this Internet-Draft, each 18 author represents that any applicable patent or other IPR claims of 19 which he or she is aware have been or will be disclosed, and any of 20 which he or she become aware will be disclosed, in accordance with 21 RFC 3668. 23 Internet-Drafts are working documents of the Internet Engineering 24 Task Force (IETF), its areas, and its working groups. Note that 25 other groups may also distribute working documents as 26 Internet-Drafts. 28 Internet-Drafts are draft documents valid for a maximum of six months 29 and may be updated, replaced, or obsoleted by other documents at any 30 time. It is inappropriate to use Internet-Drafts as reference 31 material or to cite them other than as "work in progress." 33 The list of current Internet-Drafts can be accessed at 34 http://www.ietf.org/ietf/1id-abstracts.txt. 36 The list of Internet-Draft Shadow Directories can be accessed at 37 http://www.ietf.org/shadow.html. 39 This Internet-Draft will expire on August 25, 2005. 41 Copyright Notice 43 Copyright (C) The Internet Society (2005). 45 Abstract 47 This memo specifies the details of the Host Identity Protocol (HIP). 49 The overall description of protocol and the underlying architectural 50 thinking is available in the separate HIP architecture specification. 51 The Host Identity Protocol is used to establish a rapid 52 authentication between two hosts and to provide continuity of 53 communications between those hosts independent of the networking 54 layer. 56 The various forms of the Host Identity, Host Identity Tag (HIT) and 57 Local Scope Identifier (LSI), are covered in detail. It is described 58 how they are used to support authentication and the establishment of 59 keying material, which is then used for protecting subsequent HIP 60 messages, and which can be used for generating session keys for other 61 security protocols, such as IPsec Encapsulaed Security Payload (ESP). 62 The basic state machine for HIP provides a HIP compliant host with 63 the resiliency to avoid many denial-of-service (DoS) attacks. The 64 basic HIP exchange for two public hosts shows the actual packet flow. 65 Other HIP exchanges, including those that work across NATs, are 66 covered elsewhere. 68 Table of Contents 70 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 6 71 1.1 A new name space and identifiers . . . . . . . . . . . . . 6 72 1.2 The HIP base exchange . . . . . . . . . . . . . . . . . . 6 73 2. Conventions used in this document . . . . . . . . . . . . . 8 74 3. Host Identifier (HI) and its representations . . . . . . . . 9 75 3.1 Host Identity Tag (HIT) . . . . . . . . . . . . . . . . . 9 76 3.1.1 Restricting HIT values . . . . . . . . . . . . . . . . 10 77 3.1.2 Generating a HIT from a HI . . . . . . . . . . . . . . 11 78 3.2 Local Scope Identifier (LSI) . . . . . . . . . . . . . . . 12 79 4. Host Identity Protocol . . . . . . . . . . . . . . . . . . . 14 80 4.1 HIP base exchange . . . . . . . . . . . . . . . . . . . . 14 81 4.1.1 HIP Cookie Mechanism . . . . . . . . . . . . . . . . . 15 82 4.1.2 Authenticated Diffie-Hellman protocol . . . . . . . . 18 83 4.1.3 HIP replay protection . . . . . . . . . . . . . . . . 19 84 4.2 TCP and UDP pseudo-header computation for user data . . . 20 85 4.3 Updating a HIP association . . . . . . . . . . . . . . . . 20 86 4.4 Error processing . . . . . . . . . . . . . . . . . . . . . 20 87 4.5 Certificate distribution . . . . . . . . . . . . . . . . . 21 88 4.6 Sending data on HIP packets . . . . . . . . . . . . . . . 21 89 4.7 Transport Formats . . . . . . . . . . . . . . . . . . . . 21 90 5. HIP protocol overview . . . . . . . . . . . . . . . . . . . 22 91 5.1 HIP Scenarios . . . . . . . . . . . . . . . . . . . . . . 22 92 5.2 Refusing a HIP exchange . . . . . . . . . . . . . . . . . 23 93 5.3 Reboot and SA timeout restart of HIP . . . . . . . . . . . 23 94 5.4 HIP State Machine . . . . . . . . . . . . . . . . . . . . 23 95 5.4.1 HIP States . . . . . . . . . . . . . . . . . . . . . . 24 96 5.4.2 HIP State Processes . . . . . . . . . . . . . . . . . 24 97 5.4.3 Simplified HIP State Diagram . . . . . . . . . . . . . 28 98 6. Packet formats . . . . . . . . . . . . . . . . . . . . . . . 30 99 6.1 Payload format . . . . . . . . . . . . . . . . . . . . . . 30 100 6.1.1 HIP Controls . . . . . . . . . . . . . . . . . . . . . 31 101 6.1.2 Checksum . . . . . . . . . . . . . . . . . . . . . . . 31 102 6.2 HIP parameters . . . . . . . . . . . . . . . . . . . . . . 32 103 6.2.1 TLV format . . . . . . . . . . . . . . . . . . . . . . 33 104 6.2.2 Defining new parameters . . . . . . . . . . . . . . . 35 105 6.2.3 R1_COUNTER . . . . . . . . . . . . . . . . . . . . . . 36 106 6.2.4 PUZZLE . . . . . . . . . . . . . . . . . . . . . . . . 37 107 6.2.5 SOLUTION . . . . . . . . . . . . . . . . . . . . . . . 38 108 6.2.6 DIFFIE_HELLMAN . . . . . . . . . . . . . . . . . . . . 39 109 6.2.7 HIP_TRANSFORM . . . . . . . . . . . . . . . . . . . . 40 110 6.2.8 HOST_ID . . . . . . . . . . . . . . . . . . . . . . . 41 111 6.2.9 CERT . . . . . . . . . . . . . . . . . . . . . . . . . 42 112 6.2.10 HMAC . . . . . . . . . . . . . . . . . . . . . . . . 43 113 6.2.11 HMAC_2 . . . . . . . . . . . . . . . . . . . . . . . 43 114 6.2.12 HIP_SIGNATURE . . . . . . . . . . . . . . . . . . . 44 115 6.2.13 HIP_SIGNATURE_2 . . . . . . . . . . . . . . . . . . 44 116 6.2.14 SEQ . . . . . . . . . . . . . . . . . . . . . . . . 45 117 6.2.15 ACK . . . . . . . . . . . . . . . . . . . . . . . . 45 118 6.2.16 ENCRYPTED . . . . . . . . . . . . . . . . . . . . . 46 119 6.2.17 NOTIFY . . . . . . . . . . . . . . . . . . . . . . . 47 120 6.2.18 ECHO_REQUEST . . . . . . . . . . . . . . . . . . . . 50 121 6.2.19 ECHO_RESPONSE . . . . . . . . . . . . . . . . . . . 51 122 6.3 ICMP messages . . . . . . . . . . . . . . . . . . . . . . 51 123 6.3.1 Invalid Version . . . . . . . . . . . . . . . . . . . 51 124 6.3.2 Other problems with the HIP header and packet 125 structure . . . . . . . . . . . . . . . . . . . . . . 51 126 6.3.3 Invalid Cookie Solution . . . . . . . . . . . . . . . 52 127 6.3.4 Non-existing HIP association . . . . . . . . . . . . . 52 128 7. HIP Packets . . . . . . . . . . . . . . . . . . . . . . . . 53 129 7.1 I1 - the HIP initiator packet . . . . . . . . . . . . . . 53 130 7.2 R1 - the HIP responder packet . . . . . . . . . . . . . . 54 131 7.3 I2 - the second HIP initiator packet . . . . . . . . . . . 55 132 7.4 R2 - the second HIP responder packet . . . . . . . . . . . 56 133 7.5 CER - the HIP Certificate Packet . . . . . . . . . . . . . 57 134 7.6 UPDATE - the HIP Update Packet . . . . . . . . . . . . . . 57 135 7.7 NOTIFY - the HIP Notify Packet . . . . . . . . . . . . . . 58 136 7.8 CLOSE - the HIP association closing packet . . . . . . . . 59 137 7.9 CLOSE_ACK - the HIP closing acknowledgment packet . . . . 59 138 8. Packet processing . . . . . . . . . . . . . . . . . . . . . 61 139 8.1 Processing outgoing application data . . . . . . . . . . . 61 140 8.2 Processing incoming application data . . . . . . . . . . . 62 141 8.3 HMAC and SIGNATURE calculation and verification . . . . . 63 142 8.3.1 HMAC calculation . . . . . . . . . . . . . . . . . . . 63 143 8.3.2 Signature calculation . . . . . . . . . . . . . . . . 63 144 8.4 Initiation of a HIP exchange . . . . . . . . . . . . . . . 64 145 8.4.1 Sending multiple I1s in parallel . . . . . . . . . . . 65 146 8.4.2 Processing incoming ICMP Protocol Unreachable 147 messages . . . . . . . . . . . . . . . . . . . . . . . 65 148 8.5 Processing incoming I1 packets . . . . . . . . . . . . . . 66 149 8.5.1 R1 Management . . . . . . . . . . . . . . . . . . . . 66 150 8.5.2 Handling malformed messages . . . . . . . . . . . . . 67 151 8.6 Processing incoming R1 packets . . . . . . . . . . . . . . 67 152 8.6.1 Handling malformed messages . . . . . . . . . . . . . 68 153 8.7 Processing incoming I2 packets . . . . . . . . . . . . . . 69 154 8.7.1 Handling malformed messages . . . . . . . . . . . . . 70 155 8.8 Processing incoming R2 packets . . . . . . . . . . . . . . 70 156 8.9 Sending UPDATE packets . . . . . . . . . . . . . . . . . . 71 157 8.10 Receiving UPDATE packets . . . . . . . . . . . . . . . . 71 158 8.10.1 Handling a SEQ paramaeter in a received UPDATE 159 message . . . . . . . . . . . . . . . . . . . . . . 72 160 8.10.2 Handling an ACK parameter in a received UPDATE 161 packet . . . . . . . . . . . . . . . . . . . . . . . 72 162 8.11 Processing CER packets . . . . . . . . . . . . . . . . . 73 163 8.12 Processing NOTIFY packets . . . . . . . . . . . . . . . 73 164 8.13 Processing CLOSE packets . . . . . . . . . . . . . . . . 73 165 8.14 Processing CLOSE_ACK packets . . . . . . . . . . . . . . 73 166 8.15 Dropping HIP associations . . . . . . . . . . . . . . . 73 167 9. HIP KEYMAT . . . . . . . . . . . . . . . . . . . . . . . . . 75 168 10. HIP Fragmentation Support . . . . . . . . . . . . . . . . . 77 169 11. HIP Policies . . . . . . . . . . . . . . . . . . . . . . . . 78 170 12. Security Considerations . . . . . . . . . . . . . . . . . . 79 171 13. IANA Considerations . . . . . . . . . . . . . . . . . . . . 82 172 14. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . 83 173 15. References . . . . . . . . . . . . . . . . . . . . . . . . . 84 174 15.1 Normative references . . . . . . . . . . . . . . . . . . 84 175 15.2 Informative references . . . . . . . . . . . . . . . . . 85 176 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . 86 177 A. Probabilities of HIT collisions . . . . . . . . . . . . . . 87 178 B. Probabilities in the cookie calculation . . . . . . . . . . 88 179 C. Using responder cookies . . . . . . . . . . . . . . . . . . 89 180 D. Example checksums for HIP packets . . . . . . . . . . . . . 92 181 D.1 IPv6 HIP example (I1) . . . . . . . . . . . . . . . . . . 92 182 D.2 IPv4 HIP packet (I1) . . . . . . . . . . . . . . . . . . . 92 183 D.3 TCP segment . . . . . . . . . . . . . . . . . . . . . . . 92 184 E. 384-bit group . . . . . . . . . . . . . . . . . . . . . . . 94 185 Intellectual Property and Copyright Statements . . . . . . . 95 187 1. Introduction 189 The Host Identity Protocol (HIP) provides a rapid exchange of Host 190 Identities between two hosts. The protocol is designed to be 191 resistant to Denial-of-Service (DoS) and Man-in-the-middle (MitM) 192 attacks, and when used together with another suitable security 193 protocol, such as Encapsulated Security Payload (ESP) [23], it 194 provides DoS and MitM protection for upper layer protocols, such as 195 TCP and UDP. 197 1.1 A new name space and identifiers 199 The Host Identity Protocol introduces a new namespace, the Host 200 Identity. The effects of this change are explained in the companion 201 document, the HIP architecture [21] specification. 203 There are two main representations of the Host Identity, the full 204 Host Identifier (HI) and the Host Identity Tag (HIT). The HI is a 205 public key and directly represents the Identity. Since there are 206 different public key algorithms that can be used with different key 207 lengths, the HI is not good for use as a packet identifier, or as an 208 index into the various operational tables needed to support HIP. 209 Consequently, a hash of the HI, the Host Identity Tag (HIT), becomes 210 the operational representation. It is 128 bits long and is used in 211 the HIP payloads and to index the corresponding state in the end 212 hosts. 214 1.2 The HIP base exchange 216 The HIP base exchange is a two-party cryptographic protocol that 217 consists of four packets. The first party is called the Initiator 218 and the second party the Responder. The four-packet design helps to 219 make HIP DoS resilient. The protocol exchanges Diffie-Hellman keys 220 in the 2nd and 3rd packets, and authenticates the parties in the 3rd 221 and 4th packets. Additionally, it starts the cookie exchange in the 222 2nd packet, completing it in the 3rd packet. 224 The exchange uses the Diffie-Hellman exchange to hide the Host 225 Identity of the Initiator in packet 3. The Responder's Host Identity 226 is not protected. It should be noted, however, that both the 227 Initiator's and the Responder's HITs are transported as such (in 228 cleartext) in the packets, allowing an eavesdropper with a priori 229 knowledge about the parties to verify their identities. 231 Data packets start after the 4th packet. The 3rd and 4th HIP packets 232 may carry a data payload in the future. However, the details of this 233 are to be defined later as more implementation experience is gained. 235 Finally, HIP is designed as an end-to-end authentication and key 236 establishment protocol, to be used with Encapsulated Security Payload 237 (ESP) [23] and other end-to-end security protocols. The base 238 protocol lacks the details for security association management and 239 much of the fine-grained policy control found in Internet Key 240 Exchange IKE RFC2409 [8] that allows IKE to support complex gateway 241 policies. Thus, HIP is not a replacement for IKE. 243 2. Conventions used in this document 245 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 246 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 247 document are to be interpreted as described in RFC2119 [5]. 249 3. Host Identifier (HI) and its representations 251 A public key of an asymmetric key pair is used as the Host Identifier 252 (HI). Correspondingly, the host itself is defined as the entity that 253 holds the private key from the key pair. See the HIP architecture 254 specification [21] for more details about the difference between an 255 identity and the corresponding identifier. 257 HIP implementations MUST support the Rivest Shamir Adelman (RSA) [14] 258 public key algorithm, and SHOULD support the Digital Signature 259 Algorithm (DSA) [13] algorithm; other algorithms MAY be supported. 261 A hash of the HI, the Host Identity Tag (HIT), is used in protocols 262 to represent the Host Identity. The HIT is 128 bits long and has the 263 following three key properties: i) it is the same length as an IPv6 264 address and can be used in address-sized fields in APIs and 265 protocols, ii) it is self-certifying (i.e., given a HIT, it is 266 computationally hard to find a Host Identity key that matches the 267 HIT), and iii) the probability of HIT collision between two hosts is 268 very low. 270 In many environments, 128 bits is still considered large. For 271 example, currently used IPv4 based applications are constrained with 272 32-bit address fields. Another problem is that the cohabitation of 273 IPv6 and HIP might require some applications to differentiate an IPv6 274 address from a HIT. Thus, a third representation, the Local Scope 275 Identifier (LSI), may be needed. There are two types of such LSIs: 276 32-bit IPv4-compatible ones and 128-bit IPv6-compatible ones. The 277 LSI provides a compression of the HIT with only a local scope so that 278 it can be carried efficiently in any application level packet and 279 used in API calls. The LSIs do not have the same properties as HITs 280 (i.e., they are not self-certifying nor are they as unlikely to 281 collide -- hence their local scope), and consequently they must be 282 used more carefully. 284 Finally, HIs, HITs, and LSIs are not expected to be carried 285 explicitly in the headers of user data packets. Depending on the 286 form of further communication, other methods are used to map the data 287 packet to the these representatives of host identities. For example, 288 if ESP is used to protect data traffic, the Security Parameter Index 289 (SPI) can be used for this purpose. In some cases, this makes it 290 possible to use HIP without an additional explicit protocol header. 292 3.1 Host Identity Tag (HIT) 294 The Host Identity Tag is a 128 bits long value -- a hash of the Host 295 Identifier. There are two advantages of using a hash over the actual 296 Identity in protocols. Firstly, its fixed length makes for easier 297 protocol coding and also better manages the packet size cost of this 298 technology. Secondly, it presents a consistent format to the 299 protocol whatever underlying identity technology is used. 301 There are two types of HITs. HITs of the first type, called _type 1 302 HIT_, consist of 128 bits of the SHA-1 hash of the public key. HITs 303 of the second type consist of a Host Assigning Authority Field (HAA), 304 and only the last 64 bits come from a SHA-1 hash of the Host 305 Identity. This latter format for HIT is recommended for 'well known' 306 systems. It is possible to support a resolution mechanism for these 307 names in hierarchical directories, like the DNS. Another use of HAA 308 is in policy controls, see Section 11. 310 As the type of a HIT cannot be determined by inspecting its contents, 311 the HIT type must be communicated by some external means. 313 When comparing HITs for equality, it is RECOMMENDED that conforming 314 implementations ignore the TBD top most bits. This is to allow 315 better compatibility for legacy IPv6 applications; see [29]. 316 However, independent of how many bits are actually used for HIT 317 comparison, it is also RECOMMENDED that the final equality decision 318 is based on the public key and not the HIT, if possible. See also 319 Section 3.2 for related discussion. 321 This document fully specifies only type 1 HITs. HITs that consists 322 of the HAA field and the hash are specified in [25]. 324 Any conforming implementation MUST be able to deal with Type 1 HITs. 325 When handling other than type 1 HITs, the implementation is 326 RECOMMENDED to explicitly learn and record the binding between the 327 Host Identifier and the HIT, as it may not be able to generate such 328 HITs from the Host Identifiers. 330 3.1.1 Restricting HIT values 332 To facilitate experimentation and make certain kind of 333 implementations easier, the following restrictions are temporarily 334 placed on HITs. These restriction are to be lifted at the end of 335 2008. That is, after January 1st 2009, any implementation claiming 336 conformance to this specification MUST accept any HITs from peers and 337 be able to process them normally. 339 The restrictions: Before the end of 2008, all implementations SHOULD 340 restrict the HITs they generate to ones whose upper-most (left-most) 341 two bits are either binary01 or10. That is, when generating new HIs, 342 if the resulting HIT has as its first two bits as00 or11, the 343 implementation SHOULD generate new HIs until it generates one that 344 fulfills this restriction. Additionally, a conforming implementation 345 MAY refuse to communicate with a peer that has a HIT with the 346 upper-most bits either00 or11. When refusing a HIP connection on 347 this bases, the implementation MAY send an R2 with a NOTIFY payload, 348 with the NOTIFY code being UNSUPPORTED_HIT_VALUE_RANGE. Any such 349 NOTIFYs may be rate-limited 351 A rationale: One way to experimentally implement HIP is to use 352 unmodified IPv6, TCP and UDP implementations in the stack, using HITs 353 in the place of IPv6 addresses. This modification makes it easier to 354 use existing IPv6 data structures to hold HITs and to distinguish 355 between the two data types. If the IPv6 address space and the HIT 356 value space overlap, it becomes hard to define secure IPsec policies 357 without explicitly tagging the values either as HITs or IPv6 358 addresses. 360 3.1.2 Generating a HIT from a HI 362 The 128 or 64 hash bits in a HIT MUST be generated by taking the 363 least significant 128 or 64 bits of the SHA-1 [22] hash of the Host 364 Identifier as it is represented in the Host Identity field in a HIP 365 payload packet. 367 For Identities that are either RSA or DSA public keys, the HIT is 368 formed as follows: 369 1. The public key is encoded as specified in the corresponding 370 DNSSEC document, taking the algorithm specific portion of the 371 RDATA part of the KEY RR. There is currently only two defined 372 public key algorithms: RSA and DSA. Hence, either of the 373 following applies: 374 The RSA public key is encoded as defined in RFC3110 [14] 375 Section 2, taking the exponent length (e_len), exponent (e) 376 and modulus (n) fields concatenated. The length (n_len) of 377 the modulus (n) can be determined from the total HI length 378 (hi_len) and the preceding HI fields including the exponent 379 (e). Thus, the data to be hashed has the same length as the 380 HI (hi_len). The fields MUST be encoded in network byte 381 order, as defined in RFC3110 [14]. 382 The DSA public key is encoded as defined in RFC2536 [13] 383 Section 2, taking the fields T, Q, P, G, and Y, concatenated. 384 Thus, the data to be hashed is 1 + 20 + 3 * 64 + 3 * 8 * T 385 octets long, where T is the size parameter as defined in 386 RFC2536 [13]. The size parameter T, affecting the field 387 lengths, MUST be selected as the minimum value that is long 388 enough to accommodate P, G, and Y. The fields MUST be encoded 389 in network byte order, as defined in RFC2536 [13]. 390 2. A SHA-1 hash [22] is calculated over the encoded key. 391 3. The least significant 128 or 64 bits of the hash result are used 392 to create the HIT, as defined above. 394 The following pseudo-codes illustrates the process for both RSA and 395 DSA. The symbol := denotes assignment; the symbol += denotes 396 appending. The pseudo-function encode_in_network_byte_order takes 397 two parameters, an integer (bignum) and a length in bytes, and 398 returns the integer encoded into a byte string of the given length. 400 switch ( HI.algorithm ) 401 { 403 case RSA: 404 buffer := encode_in_network_byte_order ( HI.RSA.e_len, 405 ( HI.RSA.e_len > 255 ) ? 3 : 1 ) 406 buffer += encode_in_network_byte_order ( HI.RSA.e, HI.RSA.e_len ) 407 buffer += encode_in_network_byte_order ( HI.RSA.n, HI.RSA.n_len ) 408 break; 410 case DSA: 411 buffer := encode_in_network_byte_order ( HI.DSA.T , 1 ) 412 buffer += encode_in_network_byte_order ( HI.DSA.Q , 20 ) 413 buffer += encode_in_network_byte_order ( HI.DSA.P , 64 + 8 * HI.DSA.T ) 414 buffer += encode_in_network_byte_order ( HI.DSA.G , 64 + 8 * HI.DSA.T ) 415 buffer += encode_in_network_byte_order ( HI.DSA.Y , 64 + 8 * HI.DSA.T ) 416 break; 418 } 420 digest := SHA-1 ( buffer ) 422 hit_128 := low_order_bits ( digest, 128 ) 423 hit_haa := concatenate ( HAA, low_order_bits ( digest, 64 ) ) 425 3.2 Local Scope Identifier (LSI) 427 LSIs are 32 or 128 bits long localized representations of a Host 428 Identity. The purpose of an LSI is to facilitate using Host 429 Identities in existing IPv4 or IPv6 based protocols and APIs. The 430 LSI can be used anywhere in system processes where IP addresses have 431 traditionally been used, such as IPv4 and IPv6 API calls and FTP PORT 432 commands. 434 The IPv4-compatible LSIs MUST be allocated from the TBD subnet and 435 the IPv6-compatible LSIs MUST be allocated from the TBD subnet. That 436 makes it easier to differentiate between LSIs and IP addresses at the 437 API level. By default, the low order 24 bits of an IPv4-compatible 438 LSI are equal to the low order 24 bits of the corresponding HIT, 439 while the low order TBD bits of an IPv6-compatible LSI are equal to 440 the low order TBD bits of the corresponding HIT. 442 A host performing a HIP handshake may discover that the LSI formed 443 from the peer's HIT collides with another LSI in use locally (i.e., 444 the lower 24 or TBD bits of two different HITs are the same). In 445 that case, the host MUST handle the LSI collision locally such that 446 application calls can be disambiguated. One possible means of doing 447 so is to perform a Host NAT function to locally convert a peer's LSI 448 into a different LSI value. This would require the host to ensure 449 that LSI bits on the wire (i.e., in the application data stream) are 450 converted back to match that host's LSI. Other alternatives for 451 resolving LSI collisions may be added in the future. 453 4. Host Identity Protocol 455 The Host Identity Protocol is IP protocol TBD (number will be 456 assigned by IANA). The HIP payload (Section 6.1) header could be 457 carried in every datagram. However, since HIP datagrams are 458 relatively large (at least 40 bytes), it is desirable to 'compress' 459 the HIP header so that the HIP header only occur in datagrams to 460 establish or change HIP state. The actual method for header 461 'compression' and matching data packets with existing HIP 462 associations (if any) is defined in separate extension documents, 463 describing transport formats and methods. All HIP implementations 464 MUST implement, at minimum, the ESP transport format for HIP [23]. 466 For testing purposes, the protocol number 99 is currently used. 468 4.1 HIP base exchange 470 The HIP base exchange serves to manage the establishment of state 471 between an Initiator and a Responder. The last three packets of the 472 exchange, R1, I2, and R2, constitute a standard authenticated 473 Diffie-Hellman key exchange for session key generation. During the 474 Diffie-Hellman key exchange, a piece of keying material is generated. 475 The HIP association keys are drawn from this keying material. If 476 other cryptographic keys are needed, e.g., to be used with ESP, they 477 are expected to be drawn from the same keying material. 479 The Initiator first sends a trigger packet, I1, to the Responder. 480 The packet contains only the HIT of the Initiator and possibly the 481 HIT of the Responder, if it is known. 483 The second packet, R1, starts the actual exchange. It contains a 484 puzzle, that is, a cryptographic challenge that the Initiator must 485 solve before continuing the exchange. In addition, it 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. 500 Initiator Responder 502 I1: trigger exchange 503 --------------------------> 504 select pre-computed R1 505 R1: puzzle, D-H, key, sig 506 <------------------------- 507 check sig remain stateless 508 solve puzzle 509 I2: solution, D-H, {key}, sig 510 --------------------------> 511 compute D-H check cookie 512 check puzzle 513 check sig 514 R2: sig 515 <-------------------------- 516 check sig compute D-H 518 In R1, the signature covers the packet, after setting the Initiator 519 HIT, header checksum, and the PUZZLE parameter's Opaque and Random #I 520 fields temporarily to zero, and excluding any TLVs that follow the 521 signature. 523 In I2, the signature covers the whole packet, excluding any TLVs that 524 follow the signature. 526 In R2, the signature and the HMAC cover the whole envelope. 528 In this section we cover the overall design of the base exchange. 529 The details are the subject of the rest of this memo. 531 4.1.1 HIP Cookie Mechanism 533 The purpose of the HIP cookie mechanism is to protect the Responder 534 from a number of denial-of-service threats. It allows the Responder 535 to delay state creation until receiving I2. Furthermore, the puzzle 536 included in the cookie allows the Responder to use a fairly cheap 537 calculation to check that the Initiator is "sincere" in the sense 538 that it has churned CPU cycles in solving the puzzle. 540 The Cookie mechanism has been explicitly designed to give space for 541 various implementation options. It allows a responder implementation 542 to completely delay session specific state creation until a valid I2 543 is received. In such a case a validly formatted I2 can be rejected 544 earliest only once the Responder has checked its validity by 545 computing one hash function. On the other hand, the design also 546 allows a responder implementation to keep state about received I1s, 547 and match the received I2s against the state, thereby allowing the 548 implementation to avoid the computational cost of the hash function. 549 The drawback of this latter approach is the requirement of creating 550 state. Finally, it also allows an implementation to use other 551 combinations of the space-saving and computation-saving mechanisms. 553 One possible way for a Responder to remain stateless but drop most 554 spoofed I2s is to base the selection of the cookie on some function 555 over the Initiator's Host Identity. The idea is that the Responder 556 has a (perhaps varying) number of pre-calculated R1 packets, and it 557 selects one of these based on the information carried in I1. When 558 the Responder then later receives I2, it checks that the cookie in 559 the I2 matches with the cookie sent in the R1, thereby making it 560 impractical for the attacker to first exchange one I1/R1, and then 561 generate a large number of spoofed I2s that seemingly come from 562 different IP addresses or use different HITs. The method does not 563 protect from an attacker that uses fixed IP addresses and HITs, 564 though. Against such an attacker it is probably best to create a 565 piece of local state, and remember that the puzzle check has 566 previously failed. See Appendix C for one possible implementation. 567 Note, however, that the implementations MUST NOT use the exact 568 implementation given in the appendix, and SHOULD include sufficient 569 randomness to the algorithm so that algorithm complexity attacks 570 become impossible [27]. 572 The Responder can set the puzzle difficulty for Initiator, based on 573 its concern of trust of the Initiator. The Responder SHOULD use 574 heuristics to determine when it is under a denial-of-service attack, 575 and set the puzzle difficulty value K appropriately; see below. 577 The Responder starts the cookie exchange when it receives an I1. The 578 Responder supplies a random number I, and requires the Initiator to 579 find a number J. To select a proper J, the Initiator must create the 580 concatenation of I, the HITs of the parties, and J, and take a SHA-1 581 hash over this concatenation. The lowest order K bits of the result 582 MUST be zeros. The value K sets the difficulty of the puzzle. 584 To generate a proper number J, the Initiator will have to generate a 585 number of Js until one produces the hash target of zero. The 586 Initiator SHOULD give up after exceeding the puzzle lifetime in the 587 PUZZLE TLV. The Responder needs to re-create the concatenation of I, 588 the HITs, and the provided J, and compute the hash once to prove that 589 the Initiator did its assigned task. 591 To prevent pre-computation attacks, the Responder MUST select the 592 number I in such a way that the Initiator cannot guess it. 593 Furthermore, the construction MUST allow the Responder to verify that 594 the value was indeed selected by it and not by the Initiator. See 595 Appendix C for an example on how to implement this. 597 Using the Opaque data field in an ECHO_REQUEST parameter, the 598 Responder can include some data in R1 that the Initiator must copy 599 unmodified in the corresponding I2 packet. The Responder can 600 generate the Opaque data in various ways; e.g. using the sent I, 601 some secret, and possibly other related data. Using this same 602 secret, received I in I2 packet and possible other data, the Receiver 603 can verify that it has itself sent the I to the Initiator. The 604 Responder MUST change the secret periodically. 606 It is RECOMMENDED that the Responder generates a new cookie and a new 607 R1 once every few minutes. Furthermore, it is RECOMMENDED that the 608 Responder remembers an old cookie at least 2*lifetime seconds after 609 it has been deprecated. These time values allow a slower Initiator 610 to solve the cookie puzzle while limiting the usability that an old, 611 solved cookie has to an attacker. 613 NOTE: The protocol developers explicitly considered whether R1 should 614 include a timestamp in order to protect the Initiator from replay 615 attacks. The decision was NOT to include a timestamp. 617 NOTE: The protocol developers explicitly considered whether a memory 618 bound function should be used for the puzzle instead of a CPU bound 619 function. The decision was not to use memory bound functions. At 620 the time of the decision the idea of memory bound functions was 621 relatively new and their IPR status were unknown. Once there is more 622 experience about memory bound functions and once their IPR status is 623 better known, it may be reasonable to reconsider this decision. 625 In R1, the values I and K are sent in network byte order. Similarly, 626 in I2 the values I and J are sent in network byte order. The SHA-1 627 hash is created by concatenating, in network byte order, the 628 following data, in the following order: 629 64-bit random value I, in network byte order, as appearing in R1 630 and I2. 631 128-bit initiator HIT, in network byte order, as appearing in the 632 HIP Payload in R1 and I2. 633 128-bit responder HIT, in network byte order, as appearing in the 634 HIP Payload in R1 and I2. 635 64-bit random value J, in network byte order, as appearing in I2. 636 In order to be a valid response cookie, the K low-order bits of the 637 resulting SHA-1 digest must be zero. 639 Notes: 640 The length of the data to be hashed is 48 bytes. 641 All the data in the hash input MUST be in network byte order. 643 The order of the initiator and responder HITs are different in the 644 R1 and I2 packets, see Section 6.1. Care must be taken to copy 645 the values in right order to the hash input. 647 Precomputation by the Responder 649 Sets up the puzzle difficulty K. 650 Creates a signed R1 and caches it. 651 Responder 653 Selects a suitable cached R1. 654 Generates a random number I. 655 Sends I and K in an R1. 656 Saves I and K for a Delta time. 657 Initiator 659 Generates repeated attempts to solve the puzzle until a matching J 660 is found: 662 Ltrunc( SHA-1( I | HIT-I | HIT-R | J ), K ) == 0 663 Sends I and J in an I2. 664 Responder 666 Verifies that the received I is a saved one. 667 Finds the right K based on I. 668 Computes V := Ltrunc( SHA-1( I | HIT-I | HIT-R | J ), K ) 669 Rejects if V != 0 670 Accept if V == 0 672 The Ltrunc (SHA-1(), K) denotes the lowest order K bits of the SHA-1 673 result. 675 4.1.2 Authenticated Diffie-Hellman protocol 677 The packets R1, I2, and R2 implement a standard authenticated 678 Diffie-Hellman exchange. The Responder sends its public 679 Diffie-Hellman key and its public authentication key, i.e., its host 680 identity, in R1. The signature in R1 allows the Initiator to verify 681 that the R1 has been once generated by the Responder. However, since 682 it is precomputed and therefore does not cover all of the packet, it 683 does not protect from replay attacks. 685 When the Initiator receives an R1, it computes the Diffie-Hellman 686 session key. It creates a HIP association using keying material from 687 the session key (see Section 9), and uses the association to encrypt 688 its public authentication key, i.e., host identity. The resulting I2 689 contains the Initiator's Diffie-Hellman key and its encrypted public 690 authentication key. The signature in I2 covers all of the packet. 692 The Responder extracts the Initiator Diffie-Hellman public key from 693 the I2, computes the Diffie-Hellman session key, creates a 694 corresponding HIP association, and decrypts the Initiator's public 695 authentication key. It can then verify the signature using the 696 authentication key. 698 The final message, R2, is needed to protect the Initiator from replay 699 attacks. 701 4.1.3 HIP replay protection 703 The HIP protocol includes the following mechanisms to protect against 704 malicious replays. Responders are protected against replays of I1 705 packets by virtue of the stateless response to I1s with presigned R1 706 messages. Initiators are protected against R1 replays by a 707 monotonically increasing "R1 generation counter" included in the R1. 708 Responders are protected against replays or false I2s by the cookie 709 mechanism (Section 4.1.1 above), and optional use of opaque data. 710 Hosts are protected against replays to R2s and UPDATEs by use of a 711 less expensive HMAC verification preceding HIP signature 712 verification. 714 The R1 generation counter is a monotonically increasing 64-bit 715 counter that may be initialized to any value. The scope of the 716 counter MAY be system-wide but SHOULD be per host identity, if there 717 is more than one local host identity. The value of this counter 718 SHOULD be kept across system reboots and invocations of the HIP base 719 exchange. This counter indicates the current generation of cookie 720 puzzles. Implementations MUST accept puzzles from the current 721 generation and MAY accept puzzles from earlier generations. A 722 system's local counter MUST be incremented at least as often as every 723 time old R1s cease to be valid, and SHOULD never be decremented, lest 724 the host expose its peers to the replay of previously generated, 725 higher numbered R1s. Also, the R1 generation counter MUST NOT roll 726 over; if the counter is about to become exhausted, the corresponding 727 HI must be abandoned and replaced with a new one. 729 A host may receive more than one R1, either due to sending multiple 730 I1s (Section 8.4.1) or due to a replay of an old R1. When sending 731 multiple I1s, an initiator SHOULD wait for a small amount of time 732 after the first R1 reception to allow possibly multiple R1s to 733 arrive, and it SHOULD respond to an R1 among the set with the largest 734 R1 generation counter. If an initiator is processing an R1 or has 735 already sent an I2 (still waiting for R2) and it receives another R1 736 with a larger R1 generation counter, it MAY elect to restart R1 737 processing with the fresher R1, as if it were the first R1 to arrive. 739 Upon conclusion of an active HIP association with another host, the 740 R1 generation counter associated with the peer host SHOULD be 741 flushed. A local policy MAY override the default flushing of R1 742 counters on a per-HIT basis. The reason for recommending the 743 flushing of this counter is that there may be hosts where the R1 744 generation counter (occasionally) decreases; e.g., due to hardware 745 failure. 747 4.2 TCP and UDP pseudo-header computation for user data 749 When computing TCP and UDP checksums on user data packets that flow 750 through sockets bound to HITs or LSIs, the IPv6 pseudo-header format 751 [11] MUST be used. Additionally, the HITs MUST be used in the place 752 of the IPv6 addresses in the IPv6 pseudo-header. Note that the 753 pseudo-header for actual HIP payloads is computed differently; see 754 Section 6.1.2. 756 4.3 Updating a HIP association 758 A HIP association between two hosts may need to be updated over time. 759 Examples include the need to rekey expiring user data security 760 associations, add new security associations, or change IP addresses 761 associated with hosts. The UPDATE packet is used for those and other 762 similar purposes. This document only specifies the UPDATE packet 763 format and basic processing rules, with mandatory TLVs. The actual 764 usage is defined in separate specifications. 766 HIP provides a general purpose UPDATE packet, which can carry 767 multiple HIP parameters, for updating the HIP state between two 768 peers. The UPDATE mechanism has the following properties: 769 UPDATE messages carry a monotonically increasing sequence number 770 and are explicitly acknowledged by the peer. Lost UPDATEs or 771 acknowledgments may be recovered via retransmission. Multiple 772 UPDATE messages may be outstanding. 773 UPDATE is protected by both HMAC and HIP_SIGNATURE parameters, 774 since processing UPDATE signatures alone is a potential DoS attack 775 against intermediate systems. 777 The UPDATE packet is defined in Section 7.6. 779 4.4 Error processing 781 HIP error processing behaviour depends on whether there exists an 782 active HIP association or not. In general, if an HIP association 783 exists between the sender and receiver of a packet causing an error 784 condition, the receiver SHOULD respond with a NOTIFY packet. On the 785 other hand, if there are no existing HIP associations between the 786 sender and receiver, or the receiver cannot reasonably determine the 787 identity of the sender, the receiver MAY respond with a suitable ICMP 788 message; see Section 6.3 for more details. 790 4.5 Certificate distribution 792 HIP does not define how to use certificates. However, it does define 793 a simple certificate transport mechanisms that MAY be used to 794 implement certificate-based security policies. The certificate 795 payload is defined in Section 6.2.9, and the certificate packet in 796 Section 7.5. 798 4.6 Sending data on HIP packets 800 A future version of this document may define how to include user data 801 on various HIP packets. However, currently the HIP header is a 802 terminal header, and not followed by any other headers. 804 4.7 Transport Formats 806 The actual data transmission format, used for user data after the HIP 807 base exchange, is not defined in this document. Such transport 808 formats and methods are described in separate specifications. All 809 HIP implementations MUST implement, at minimum, the ESP transport 810 format for HIP [23]. 812 When new transport formats are defined, the corresponding parameters 813 MUST have smaller type value than the ESP_TRANSFORM parameter. The 814 order in which the transport formats are presented in the R1 packet, 815 is the preferred order. The last of the transport formats MUST be 816 ESP transport format, represented by the ESP_TRANSFORM parameter. 818 5. HIP protocol overview 820 The following material is an overview of the HIP protocol operation. 821 Section 8 describes the packet processing steps in more detail. 823 A typical HIP packet flow is shown below, between an Initiator (I) 824 and a Responder (R). It illustrates the exchange of four HIP packets 825 (I1, R1, I2, and R2). 827 I --> Directory: lookup R 828 I <-- Directory: return R's addresses, and HI and/or HIT 829 I1 I --> R (Hi. Here is my I1, let's talk HIP) 830 R1 I <-- R (OK. Here is my R1, handle this HIP cookie) 831 I2 I --> R (Compute, compute, here is my counter I2) 832 R2 I <-- R (OK. Let's finish HIP with my R2) 833 I --> R (data) 834 I <-- R (data) 836 By definition, the system initiating a HIP exchange is the Initiator, 837 and the peer is the Responder. This distinction is forgotten once 838 the base exchange completes, and either party can become the 839 initiator in future communications. 841 5.1 HIP Scenarios 843 The HIP protocol and state machine is designed to recover from one of 844 the parties crashing and losing its state. The following scenarios 845 describe the main use cases covered by the design. 846 No prior state between the two systems. 847 The system with data to send is the Initiator. The process 848 follows the standard four packet base exchange, establishing 849 the HIP association. 850 The system with data to send has no state with the receiver, but 851 the receiver has a residual HIP association. 852 The system with data to send is the Initiator. The Initiator 853 acts as in no prior state, sending I1 and getting R1. When the 854 Responder receives a valid I2, the old association is 855 'discovered' and deleted, and the new association is 856 established. 857 The system with data to send has an HIP association, but the 858 receiver does not. 859 The system sends data on the outbound user data security 860 association. The receiver 'detects' the situation when it 861 receives a user data packet that it cannot match to any HIP 862 association. The receiving host MUST discard this packet. 863 Optionally, the receiving host MAY send an ICMP packet with the 864 Parameter Problem type to inform about non-existing HIP 865 association (see Section 6.3), and it MAY initiate a new HIP 866 negotiation. However, responding with these optional 867 mechanisms is implementation or policy dependent. 869 5.2 Refusing a HIP exchange 871 A HIP aware host may choose not to accept a HIP exchange. If the 872 host's policy is to only be an Initiator, it should begin its own HIP 873 exchange. A host MAY choose to have such a policy since only the 874 Initiator HI is protected in the exchange. There is a risk of a race 875 condition if each host's policy is to only be an Initiator, at which 876 point the HIP exchange will fail. 878 If the host's policy does not permit it to enter into a HIP exchange 879 with the Initiator, it should send an ICMP 'Destination Unreachable, 880 Administratively Prohibited' message. A more complex HIP packet is 881 not used here as it actually opens up more potential DoS attacks than 882 a simple ICMP message. 884 5.3 Reboot and SA timeout restart of HIP 886 Simulating a loss of state is a potential DoS attack. The following 887 process has been crafted to manage state recovery without presenting 888 a DoS opportunity. 890 If a host reboots or times out, it has lost its HIP state. If the 891 system that lost state has a datagram to deliver to its peer, it 892 simply restarts the HIP exchange. The peer replies with an R1 HIP 893 packet, but does not reset its state until it receives the I2 HIP 894 packet. The I2 packet MUST have a valid solution to the puzzle and, 895 if inserted in R1, a valid Opaque data as well as a valid signature. 896 Note that either the original Initiator or the Responder could end up 897 restarting the exchange, becoming the new Initiator. 899 If a system receives a user data packet that cannot be matched to any 900 existing HIP association, it is possible that it has lost the state 901 and its peer has not. It MAY send an ICMP packet with the Parameter 902 Problem type, the Pointer pointing to the referred HIP-related 903 association information. Reacting to such traffic depends on the 904 implementation and the environment where the implementation is used. 906 After sending the I1, the HIP negotiation proceeds as normally and, 907 when successful, the SA is created at the initiating end. The peer 908 end removes the OLD SA and replaces it with the new one. 910 5.4 HIP State Machine 912 The HIP protocol itself has little state. In the HIP base exchange, 913 there is an Initiator and a Responder. Once the SAs are established, 914 this distinction is lost. If the HIP state needs to be 915 re-established, the controlling parameters are which peer still has 916 state and which has a datagram to send to its peer. The following 917 state machine attempts to capture these processes. 919 The state machine is presented in a single system view, representing 920 either an Initiator or a Responder. There is not a complete overlap 921 of processing logic here and in the packet definitions. Both are 922 needed to completely implement HIP. 924 Implementors must understand that the state machine, as described 925 here, is informational. Specific implementations are free to 926 implement the actual functions differently. Section 8 describes the 927 packet processing rules in more detail. This state machine focuses 928 on the HIP I1, R1, I2, and R2 packets only. Other states may be 929 introduced by mechanisms in other drafts (such as mobility and 930 multihoming). 932 5.4.1 HIP States 934 +---------------------+---------------------------------------------+ 935 | State | Explanation | 936 +---------------------+---------------------------------------------+ 937 | UNASSOCIATED | State machine start | 938 | | | 939 | I1-SENT | Initiating HIP | 940 | | | 941 | I2-SENT | Waiting to finish HIP | 942 | | | 943 | R2-SENT | Waiting to finish HIP | 944 | | | 945 | ESTABLISHED | HIP association established | 946 | | | 947 | CLOSING | HIP association closing, no data can be | 948 | | sent | 949 | | | 950 | CLOSED | HIP association closed, no data can be sent | 951 | | | 952 | E-FAILED | HIP exchange failed | 953 +---------------------+---------------------------------------------+ 955 5.4.2 HIP State Processes 957 +------------+ 958 |UNASSOCIATED| Start state 959 +------------+ 960 User data to send requiring a new HIP association, send I1 and go to I1-SENT 961 Receive I1, send R1 and stay at UNASSOCIATED 962 Receive I2, process 963 if successful, send R2 and go to R2-SENT 964 if fail, stay at UNASSOCIATED 966 Receive user data for unknown HIP association, optionally send ICMP as 967 defined in 968 Section 6.3 969 and stay at UNASSOCIATED 970 Receive CLOSE, optionally send ICMP Parameter Problem and stay 971 in UNASSOCIATED. 973 Receive ANYOTHER, drop and stay at UNASSOCIATED 975 +---------+ 976 | I1-SENT | Initiating HIP 977 +---------+ 979 Receive I1, send R1 and stay at I1-SENT 980 Receive I2, process 981 if successful, send R2 and go to R2-SENT 982 if fail, stay at I1-SENT 983 Receive R1, process 984 if successful, send I2 and go to I2-SENT 985 if fail, go to E-FAILED 987 Receive ANYOTHER, drop and stay at I1-SENT 988 Timeout, increment timeout counter 989 If counter is less than I1_RETRIES_MAX, send I1 and stay at I1-SENT 990 If counter is greater than I1_RETRIES_MAX, go to E-FAILED 992 +---------+ 993 | I2-SENT | Waiting to finish HIP 994 +---------+ 996 Receive I1, send R1 and stay at I2-SENT 997 Receive R1, process 998 if successful, send I2 and cycle at I2-SENT 999 if fail, stay at I2-SENT 1000 Receive I2, process 1001 if successful, send R2 and go to R2-SENT 1002 if fail, stay at I2-SENT 1003 Receive R2, process 1004 if successful, go to ESTABLISHED 1005 if fail, go to E-FAILED 1007 Receive ANYOTHER, drop and stay at I2-SENT 1008 Timeout, increment timeout counter 1009 If counter is less than I2_RETRIES_MAX, send I2 and stay at I2-SENT 1010 If counter is greater than I2_RETRIES_MAX, go to E-FAILED 1012 +---------+ 1013 | R2-SENT | Waiting to finish HIP 1014 +---------+ 1016 Receive I1, send R1 and stay at R2-SENT 1017 Receive I2, process, 1018 if successful, send R2, and cycle at R2-SENT 1019 if failed, stay at R2-SENT 1020 Receive R1, drop and stay at R2-SENT 1021 Receive R2, drop and stay at R2-SENT 1023 Move to ESTABLISHED after an implementation specific time. 1025 +------------+ 1026 |ESTABLISHED | HIP association established 1027 +------------+ 1029 Receive I1, send R1 and stay at ESTABLISHED 1030 Receive I2, process with cookie and possible Opaque data verification 1031 if successful, send R2, drop old HIP association, establish a new 1032 HIP association, to to R2-SENT 1033 if fail, stay at ESTABLISHED 1034 Receive R1, drop and stay at ESTABLISHED 1035 Receive R2, drop and stay at ESTABLISHED 1037 Receive user data for HIP association, process and stay at ESTABLISHED 1038 No packet sent/received during UAL minutes, send CLOSE and go to CLOSING. 1039 Receive CLOSE, process 1040 if successful, send CLOSE_ACK and go to CLOSED 1041 if failed, stay at ESTABLISHED 1043 +---------+ 1044 | CLOSING | HIP association has not been used for UAL (Unused 1045 +---------+ Association Lifetime) minutes. 1047 User data to send, requires the creation of another incarnation 1048 of the HIP association, started by sending an I1, 1049 and stay at CLOSING 1051 Receive I1, send R1 and stay at CLOSING 1052 Receive I2, process 1053 if successful, send R2 and go to R2-SENT 1054 if fail, stay at CLOSING 1056 Receive R1, process 1057 if successful, send I2 and go to I2-SENT 1058 if fail, stay at CLOSING 1060 Receive CLOSE, process 1061 if successful, send CLOSE_ACK, discard state and go to CLOSED 1062 if failed, stay at CLOSING 1063 Receive CLOSE_ACK, process 1064 if successful, discard state and go to UNASSOCIATED 1065 if failed, stay at CLOSING 1067 Receive ANYOTHER, drop and stay at CLOSING 1069 Timeout, increment timeout sum, reset timer 1070 if timeout sum is less than UAL+MSL minutes, retransmit CLOSE 1071 and stay at CLOSING 1072 if timeout sum is greater than UAL+MSL minutes, go to 1073 UNASSOCIATED 1075 +--------+ 1076 | CLOSED | CLOSE_ACK sent, resending CLOSE_ACK if necessary 1077 +--------+ 1079 Datagram to send, requires the creation of another incarnation 1080 of the HIP association, started by sending an I1, 1081 and stay at CLOSED 1083 Receive I1, send R1 and stay at CLOSED 1084 Receive I2, process 1085 if successful, send R2 and go to R2-SENT 1086 if fail, stay at CLOSED 1088 Receive R1, process 1089 if successful, send I2 and go to I2-SENT 1090 if fail, stay at CLOSED 1092 Receive CLOSE, process 1093 if successful, send CLOSE_ACK, stay at CLOSED 1094 if failed, stay at CLOSED 1096 Receive CLOSE_ACK, process 1097 if successful, discard state and go to UNASSOCIATED 1098 if failed, stay at CLOSED 1100 Receive ANYOTHER, drop and stay at CLOSED 1102 Timeout (UAL + 2MSL), discard state and go to UNASSOCIATED 1103 +----------+ 1104 | E-FAILED | HIP failed to establish association with peer 1105 +----------+ 1107 Move to UNASSOCIATED after an implementation specific time. Re-negotiation 1108 is possible after moving to UNASSOCIATED state. 1110 5.4.3 Simplified HIP State Diagram 1112 The following diagram shows the major state transitions. Transitions 1113 based on received packets implicitly assume that the packets are 1114 successfully authenticated or processed. 1116 +-+ +------------------------------+ 1117 I1 received, send R1 | | | | 1118 | v v | 1119 Datagram to send +--------------+ I2 received, send R2 | 1120 +---------------| UNASSOCIATED |---------------+ | 1121 | +--------------+ | | 1122 v | | 1123 +---------+ I2 received, send R2 | | 1124 +---->| I1-SENT |---------------------------------------+ | | 1125 | +---------+ | | | 1126 | | +------------------------+ | | | 1127 | | R1 received, | I2 received, send R2 | | | | 1128 | v send I2 | v v v | 1129 | +---------+ | +---------+ | 1130 | +->| I2-SENT |------------+ | R2-SENT |<-----+ | 1131 | | +---------+ +---------+ | | 1132 | | | | | | 1133 | | | | | | 1134 | |receive | | | | 1135 | |R1, send | timeout, | receive I2,| | 1136 | |I2 |R2 received +--------------+ data | send R2| | 1137 | | +----------->| ESTABLISHED |<---------+ | | 1138 | | +--------------+ | | 1139 | | | | | | | 1140 | | | | +---------------------------+ | 1141 | | | | | | 1142 | | | | No packet sent/received | | 1143 | | | | for UAL min, send CLOSE | | 1144 | | | | | | 1145 | | | | +---------+<-+ timeout | | 1146 | | | +--->| CLOSING |--+ (UAL+MSL) | | 1147 | | | +---------+ retransmit | | 1148 +--+----------------------------+---------+ | | | | CLOSE | | 1149 | +----------------------------+-----------+ | | +----------------+ | 1150 | | | +-----------+ +------------------+--+ 1151 | | | | receive CLOSE, CLOSE_ACK | | 1152 | | | | send CLOSE_ACK received or | | 1153 | | v v timeout | | 1154 | | +--------+ (UAL+MSL) | | 1155 | +---------------------------| CLOSED |---------------------------+ | 1156 +------------------------------+--------+------------------------------+ 1157 Datagram to send ^ | timeout (UAL+2MSL), 1158 +-+ move to UNASSOCIATED 1159 CLOSE received, 1160 send CLOSE_ACK 1162 6. Packet formats 1164 6.1 Payload format 1166 All HIP packets start with a fixed header. 1168 0 1 2 3 1169 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 1170 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1171 | Next Header | Payload Len | Type | VER. | RES. | 1172 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1173 | Controls | Checksum | 1174 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1175 | Sender's Host Identity Tag (HIT) | 1176 | | 1177 | | 1178 | | 1179 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1180 | Receiver's Host Identity Tag (HIT) | 1181 | | 1182 | | 1183 | | 1184 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1185 | | 1186 / HIP Parameters / 1187 / / 1188 | | 1189 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1191 The HIP header is logically an IPv6 extension header. However, this 1192 document does not describe processing for Next Header values other 1193 than decimal 59, IPPROTO_NONE, the IPV6 no next header value. Future 1194 documents MAY do so. However, implementations MUST ignore trailing 1195 data if an unimplemented Next Header value is received. 1197 The Header Length field contains the length of the HIP Header and HIP 1198 parameters in 8 bytes units, excluding the first 8 bytes. Since all 1199 HIP headers MUST contain the sender's and receiver's HIT fields, the 1200 minimum value for this field is 4, and conversely, the maximum length 1201 of the HIP Parameters field is (255*8)-32 = 2008 bytes. Note: this 1202 sets an additional limit for sizes of TLVs included in the Parameters 1203 field, independent of the individual TLV parameter maximum lengths. 1205 The Packet Type indicates the HIP packet type. The individual packet 1206 types are defined in the relevant sections. If a HIP host receives a 1207 HIP packet that contains an unknown packet type, it MUST drop the 1208 packet. 1210 The HIP Version is four bits. The current version is 1. The version 1211 number is expected to be incremented only if there are incompatible 1212 changes to the protocol. Most extensions can be handled by defining 1213 new packet types, new parameter types, or new controls. 1215 The following four bits are reserved for future use. They MUST be 1216 zero when sent, and they SHOULD be ignored when handling a received 1217 packet. 1219 The HIT fields are always 128 bits (16 bytes) long. 1221 6.1.1 HIP Controls 1223 The HIP control section transfers information about the structure of 1224 the packet and capabilities of the host. 1226 The following fields have been defined: 1228 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1229 | SHT | DHT | | | | | | | | |C|A| 1230 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1232 C - Certificate One or more certificate packets (CER) follows this 1233 HIP packet (see Section 7.5). 1234 A - Anonymous If this is set, the sender's HI in this packet is 1235 anonymous, i.e., one not listed in a directory. Anonymous HIs 1236 SHOULD NOT be stored. This control is set in packets R1 and/or 1237 I2. The peer receiving an anonymous HI may choose to refuse it. 1238 SHT - Sender's HIT Type Currently the following values are specified: 1239 0 RESERVED 1240 1 Type 1 HIT 1241 2 Type 2 HIT 1242 3-6 UNASSIGNED 1243 7 RESERVED 1244 DHT - Destination's HIT Type Using the same values as SHT. 1245 The rest of the fields are reserved for future use and MUST be set to 1246 zero on sent packets and ignored on received packets. 1248 6.1.2 Checksum 1250 The checksum field is located at the same location within the header 1251 as the checksum field in UDP packets, enabling hardware assisted 1252 checksum generation and verification. Note that since the checksum 1253 covers the source and destination addresses in the IP header, it must 1254 be recomputed on HIP-aware NAT boxes. 1256 If IPv6 is used to carry the HIP packet, the pseudo-header [11] 1257 contains the source and destination IPv6 addresses, HIP packet length 1258 in the pseudo-header length field, a zero field, and the HIP protocol 1259 number (TBD, see Section 4) in the Next Header field. The length 1260 field is in bytes and can be calculated from the HIP header length 1261 field: (HIP Header Length + 1) * 8. 1263 In case of using IPv4, the IPv4 UDP pseudo header format [1] is used. 1264 In the pseudo header, the source and destination addresses are those 1265 used in the IP header, the zero field is obviously zero, the protocol 1266 is the HIP protocol number (TBD, see Section 4), and the length is 1267 calculated as in the IPv6 case. 1269 6.2 HIP parameters 1271 The HIP Parameters are used to carry the public key associated with 1272 the sender's HIT, together with other related security and other 1273 information. The HIP Parameters consists of ordered parameters, 1274 encoded in TLV format. 1276 The following parameter types are currently defined. 1278 +-----------------+-------+----------+------------------------------+ 1279 | TLV | Type | Length | Data | 1280 +-----------------+-------+----------+------------------------------+ 1281 | R1_COUNTER | 2 | 12 | System Boot Counter | 1282 | | | | | 1283 | PUZZLE | 5 | 12 | K and Random #I | 1284 | | | | | 1285 | SOLUTION | 7 | 20 | K, Random #I and puzzle | 1286 | | | | solution J | 1287 | | | | | 1288 | SEQ | 11 | 4 | Update packet ID number | 1289 | | | | | 1290 | ACK | 13 | variable | Update packet ID number | 1291 | | | | | 1292 | DIFFIE_HELLMAN | 15 | variable | public key | 1293 | | | | | 1294 | HIP_TRANSFORM | 17 | variable | HIP Encryption and Integrity | 1295 | | | | Transform | 1296 | | | | | 1297 | ENCRYPTED | 21 | variable | Encrypted part of I2 or CER | 1298 | | | | packets | 1299 | | | | | 1300 | HOST_ID | 35 | variable | Host Identity with Fully | 1301 | | | | Qualified Domain Name or NAI | 1302 | | | | | 1303 | CERT | 64 | variable | HI Certificate | 1304 | | | | | 1305 | NOTIFY | 256 | variable | Informational data | 1306 | | | | | 1307 | ECHO_REQUEST | 1022 | variable | Opaque data to be echoed | 1308 | | | | back; under signature | 1309 | | | | | 1310 | ECHO_RESPONSE | 1024 | variable | Opaque data echoed back; | 1311 | | | | under signature | 1312 | | | | | 1313 | HMAC | 65245 | 20 | HMAC based message | 1314 | | | | authentication code, with | 1315 | | | | key material from | 1316 | | | | HIP_TRANSFORM | 1317 | | | | | 1318 | HMAC_2 | 65247 | 20 | HMAC based message | 1319 | | | | authentication code, with | 1320 | | | | key material from | 1321 | | | | HIP_TRANSFORM | 1322 | | | | | 1323 | HIP_SIGNATURE_2 | 65277 | variable | Signature of the R1 packet | 1324 | | | | | 1325 | HIP_SIGNATURE | 65279 | variable | Signature of the packet | 1326 | | | | | 1327 | ECHO_REQUEST | 65281 | variable | Opaque data to be echoed | 1328 | | | | back | 1329 | | | | | 1330 | ECHO_RESPONSE | 65283 | variable | Opaque data echoed back; | 1331 | | | | after signature | 1332 +-----------------+-------+----------+------------------------------+ 1334 6.2.1 TLV format 1336 The TLV encoded parameters are described in the following 1337 subsections. The type-field value also describes the order of these 1338 fields in the packet, except for type values from 2048 to 4095 which 1339 are reserved for new transport forms. The parameters MUST be 1340 included into the packet so that the types form an increasing order. 1341 If the order does not follow this rule, the packet is considered to 1342 be malformed and it MUST be discarded. 1344 Parameters using type values from 2048 up to 4095 are transport 1345 formats. Currently, one transport format is defined: the ESP 1346 transport format [23]. The order of these parameters does not follow 1347 the order of their type value, but they are put in the packet in 1348 order of preference. First one of the transport formats it the most 1349 preferred, and so on. 1351 All the TLV parameters have a length (including Type and Length 1352 fields) which is a multiple of 8 bytes. When needed, padding MUST be 1353 added to the end of the parameter so that the total length becomes a 1354 multiple of 8 bytes. This rule ensures proper alignment of data. If 1355 padding is added, the Length field MUST NOT include the padding. Any 1356 added padding bytes MUST be set zero by the sender, but their content 1357 SHOULD NOT be checked on the receiving end. 1359 Consequently, the Length field indicates the length of the Contents 1360 field (in bytes). The total length of the TLV parameter (including 1361 Type, Length, Contents, and Padding) is related to the Length field 1362 according to the following formula: 1364 Total Length = 11 + Length - (Length + 3) % 8; 1366 0 1 2 3 1367 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 1368 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1369 | Type |C| Length | 1370 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1371 | | 1372 / Contents / 1373 / +-+-+-+-+-+-+-+-+ 1374 | | Padding | 1375 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1377 Type Type code for the parameter 1378 C Critical. One if this parameter is critical, and 1379 MUST be recognized by the recipient, zero otherwise. 1380 The C bit is considered to be a part of the Type field. 1381 Consequently, critical parameters are always odd 1382 and non-critical ones have an even value. 1383 Length Length of the Contents, in bytes. 1384 Contents Parameter specific, defined by Type 1385 Padding Padding, 0-7 bytes, added if needed 1387 Critical parameters MUST be recognized by the recipient. If a 1388 recipient encounters a critical parameter that it does not recognize, 1389 it MUST NOT process the packet any further. It MAY send an ICMP or 1390 NOTIFY, as defined in Section 4.4. 1392 Non-critical parameters MAY be safely ignored. If a recipient 1393 encounters a non-critical parameter that it does not recognize, it 1394 SHOULD proceed as if the parameter was not present in the received 1395 packet. 1397 6.2.2 Defining new parameters 1399 Future specifications may define new parameters as needed. When 1400 defining new parameters, care must be taken to ensure that the 1401 parameter type values are appropriate and leave suitable space for 1402 other future extensions. One must remember that the parameters MUST 1403 always be arranged in the increasing order by the type code, thereby 1404 limiting the order of parameters. 1406 The following rules must be followed when defining new parameters. 1407 1. The low order bit C of the Type code is used to distinguish 1408 between critical and non-critical parameters. 1409 2. A new parameter may be critical only if an old recipient ignoring 1410 it would cause security problems. In general, new parameters 1411 SHOULD be defined as non-critical, and expect a reply from the 1412 recipient. 1413 3. If a system implements a new critical parameter, it MUST provide 1414 the ability to configure the associated feature off, such that 1415 the critical parameter is not sent at all. The configuration 1416 option must be well documented. By default, sending of such a 1417 new critical parameter SHOULD be off. In other words, the 1418 management interface MUST allow vanilla standards-only mode as a 1419 default configuration setting, and MAY allow new critical 1420 payloads to be configured on (and off). 1421 4. The following type codes are reserved for future base protocol 1422 extensions, and may be assigned only through an appropriate WG or 1423 RFC action. 1424 0 - 511 1425 65024 - 65535 1426 5. The following type codes are reserved for experimentation and 1427 private use. Types SHOULD be selected in a random fashion from 1428 this range, thereby reducing the probability of collisions. A 1429 method employing genuine randomness (such as flipping a coin) 1430 SHOULD be used. 1431 32768 - 49141 1432 6. All other parameter type codes MUST be registered by the IANA. 1433 See Section 13. 1435 6.2.3 R1_COUNTER 1437 0 1 2 3 1438 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 1439 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1440 | Type | Length | 1441 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1442 | Reserved, 4 bytes | 1443 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1444 | R1 generation counter, 8 bytes | 1445 | | 1446 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1448 Type 2 1449 Length 12 1450 R1 generation 1451 counter The current generation of valid puzzles 1453 The R1_COUNTER parameter contains an 64-bit unsigned integer in 1454 network byte order, indicating the current generation of valid 1455 puzzles. The sender is supposed to increment this counter 1456 periodically. It is RECOMMENDED that the counter value is 1457 incremented at least as often as old PUZZLE values are deprecated so 1458 that SOLUTIONs to them are no longer accepted. 1460 The R1_COUNTER parameter is optional. It SHOULD be included in the 1461 R1 (in which case it is covered by the signature), and if present in 1462 the R1, it MAY be echoed (including the Reserved field in verbatim) 1463 by the Initiator in the I2. 1465 6.2.4 PUZZLE 1467 0 1 2 3 1468 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 1469 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1470 | Type | Length | 1471 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1472 | K, 1 byte | Lifetime | Opaque, 2 bytes | 1473 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1474 | Random # I, 8 bytes | 1475 | | 1476 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1478 Type 5 1479 Length 12 1480 K K is the number of verified bits 1481 Lifetime Puzzle lifetime 2^(value-32) seconds 1482 Opaque Data set by the Responder, indexing the puzzle 1483 Random #I random number 1485 Random #I is represented as 64-bit integer, K and Lifetime as 8-bit 1486 integer, all in network byte order. 1488 The PUZZLE parameter contains the puzzle difficulty K and an 64-bit 1489 puzzle random integer #I. Puzzle Lifetime indicates the time during 1490 which the puzzle solution is valid and sets a time limit for 1491 initiator which it should not exceed while trying to solve the 1492 puzzle. The lifetime is indicated as power of 2 using formula 1493 2^(Lifetime-32) seconds. A puzzle MAY be augmented by including an 1494 ECHO_REQUEST parameter to an R1. The contents of the ECHO_REQUEST 1495 are then echoed back in ECHO_RESPONSE, allowing the Responder to use 1496 the included information as a part of puzzle processing. 1498 The Opaque and Random #I field are not covered by the HIP_SIGNATURE_2 1499 parameter. 1501 6.2.5 SOLUTION 1503 0 1 2 3 1504 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 1505 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1506 | Type | Length | 1507 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1508 | K, 1 byte | Reserved | Opaque, 2 bytes | 1509 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1510 | Random #I, 8 bytes | 1511 | | 1512 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1513 | Puzzle solution #J, 8 bytes | 1514 | | 1515 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1517 Type 7 1518 Length 20 1519 K K is the number of verified bits 1520 Reserved zero when sent, ignored when received 1521 Opaque Copied unmodified from the received PUZZLE TLV 1522 Random #I random number 1523 Puzzle solution 1524 #J random number 1526 Random #I, and Random #J are represented as 64-bit integers, K as 1527 8-bit integer, all in network byte order. 1529 The SOLUTION parameter contains a solution to a puzzle. It also 1530 echoes back the random difficulty K, the Opaque field, and the puzzle 1531 integer #I. 1533 6.2.6 DIFFIE_HELLMAN 1535 0 1 2 3 1536 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 1537 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1538 | Type | Length | 1539 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1540 | Group ID | Public Value / 1541 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1542 / | padding | 1543 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1545 Type 15 1546 Length length in octets, excluding Type, Length, and padding 1547 Group ID defines values for p and g 1548 Public Value the sender's public Diffie-Hellman key 1550 The following Group IDs have been defined: 1552 Group Value 1553 Reserved 0 1554 384-bit group 1 1555 OAKLEY well known group 1 2 1556 1536-bit MODP group 3 1557 3072-bit MODP group 4 1558 6144-bit MODP group 5 1559 8192-bit MODP group 6 1561 The MODP Diffie-Hellman groups are defined in [18]. The OAKLEY group 1562 is defined in [9]. The OAKLEY well known group 5 is the same as the 1563 1536-bit MODP group. 1565 A HIP implementation MUST support Group IDs 1 and 3. The 384-bit 1566 group can be used when lower security is enough (e.g. web surfing) 1567 and when the equipment is not powerful enough (e.g. some PDAs). 1568 Equipment powerful enough SHOULD implement also group ID 5. The 1569 384-bit group is defined in Appendix E. 1571 To avoid unnecessary failures during the base exchange, the rest of 1572 the groups SHOULD be implemented in hosts where resources are 1573 adequate. 1575 6.2.7 HIP_TRANSFORM 1577 0 1 2 3 1578 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 1579 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1580 | Type | Length | 1581 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1582 | Transform-ID #1 | Transform-ID #2 | 1583 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1584 | Transform-ID #n | Padding | 1585 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1587 Type 17 1588 Length length in octets, excluding Type, Length, and padding 1589 Transform-ID Defines the HIP Suite to be used 1591 The following Suite-IDs are defined ([20],[24]): 1593 XXX: Deprecate MD5 in the light of recent development? 1595 Suite-ID Value 1597 RESERVED 0 1598 AES-CBC with HMAC-SHA1 1 1599 3DES-CBC with HMAC-SHA1 2 1600 3DES-CBC with HMAC-MD5 3 1601 BLOWFISH-CBC with HMAC-SHA1 4 1602 NULL-ENCRYPT with HMAC-SHA1 5 1603 NULL-ENCRYPT with HMAC-MD5 6 1605 There MUST NOT be more than six (6) HIP Suite-IDs in one HIP 1606 transform TLV. The limited number of transforms sets the maximum 1607 size of HIP_TRANSFORM TLV. The HIP_TRANSFORM TLV MUST contain at 1608 least one of the mandatory Suite-IDs. 1610 Mandatory implementations: AES-CBC with HMAC-SHA1 and NULL-ENCRYPTION 1611 with HMAC-SHA1. 1613 6.2.8 HOST_ID 1615 0 1 2 3 1616 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 1617 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1618 | Type | Length | 1619 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1620 | HI Length |DI-type| DI Length | 1621 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1622 | Host Identity / 1623 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1624 / | Domain Identifier / 1625 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1626 / | Padding | 1627 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1629 Type 35 1630 Length length in octets, excluding Type, Length, and 1631 Padding 1632 HI Length Length of the Host Identity in octets 1633 DI-type type of the following Domain Identifier field 1634 DI Length length of the FQDN or NAI in octets 1635 Host Identity actual host identity 1636 Domain Identifier the identifier of the sender 1638 The Host Identity is represented in RFC2535 [12] format. The 1639 algorithms used in RDATA format are the following: 1641 Algorithms Values 1643 RESERVED 0 1644 DSA 3 [RFC2536] (RECOMMENDED) 1645 RSA 5 [RFC3110] (REQUIRED) 1647 The following DI-types have been defined: 1649 Type Value 1650 none included 0 1651 FQDN 1 1652 NAI 2 1654 FQDN Fully Qualified Domain Name, in binary format. 1655 NAI Network Access Identifier, in binary format. The 1656 format of the NAI is login@FQDN. 1658 The format for the FQDN is defined in RFC1035 [3] Section 3.1. 1660 If there is no Domain Identifier, i.e. the DI-type field is zero, 1661 also the DI Length field is set to zero. 1663 6.2.9 CERT 1665 0 1 2 3 1666 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 1667 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1668 | Type | Length | 1669 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1670 | Cert count | Cert ID | Cert type | / 1671 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1672 / Certificate / 1673 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1674 / | Padding | 1675 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1677 Type 64 1678 Length length in octets, excluding Type, Length, and padding 1679 Cert count total count of certificates that are sent, possibly 1680 in several consecutive CER packets 1681 Cert ID the order number for this certificate 1682 Cert Type describes the type of the certificate 1684 The receiver must know the total number (Cert count) of certificates 1685 that it will receive from the sender, related to the R1 or I2. The 1686 Cert ID identifies the particular certificate and its order in the 1687 certificate chain. The numbering in Cert ID MUST go from 1 to Cert 1688 count. 1690 The following certificate types are defined: 1692 Cert format Type number 1693 X.509 v3 1 1695 The encoding format for X.509v3 certificate is defined in [15]. 1697 6.2.10 HMAC 1699 0 1 2 3 1700 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 1701 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1702 | Type | Length | 1703 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1704 | | 1705 | HMAC | 1706 | | 1707 | | 1708 | | 1709 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1711 Type 65245 1712 Length 20 1713 HMAC 160 low order bits of the HMAC computed over the HIP 1714 packet, excluding the HMAC parameter and any 1715 following HIP_SIGNATURE or HIP_SIGNATURE_2 1716 parameters. The checksum field MUST be set to zero 1717 and the HIP header length in the HIP common header 1718 MUST be calculated not to cover any excluded 1719 parameters when the HMAC is calculated. 1721 The HMAC calculation and verification process is presented in 1722 Section 8.3.1 1724 6.2.11 HMAC_2 1726 The TLV structure is the same as in Section 6.2.10. The fields are: 1728 Type 65247 1729 Length 20 1730 HMAC 160 low order bits of the HMAC computed over the HIP 1731 packet, excluding the HMAC parameter and any 1732 following HIP_SIGNATURE or HIP_SIGNATURE_2 1733 parameters and including an additional sender's 1734 HOST_ID TLV during the HMAC calculation. The 1735 checksum field MUST be set to zero and the HIP 1736 header length in the HIP common header MUST be 1737 calculated not to cover any excluded parameters when 1738 the HMAC is calculated. 1740 The HMAC calculation and verification process is presented in 1741 Section 8.3.1 1743 6.2.12 HIP_SIGNATURE 1745 0 1 2 3 1746 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1747 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1748 | Type | Length | 1749 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1750 | SIG alg | Signature / 1751 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1752 / | Padding | 1753 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1755 Type 65279 (2^16-2^8-1) 1756 Length length in octets, excluding Type, Length, and Padding 1757 SIG alg Signature algorithm 1758 Signature the signature is calculated over the HIP packet, 1759 excluding the HIP_SIGNATURE TLV field and any TLVs 1760 that follow the HIP_SIGNATURE TLV. The checksum field 1761 MUST be set to zero, and the HIP header length in the 1762 HIP common header MUST be calculated only to the 1763 beginning of the HIP_SIGNATURE TLV when the signature 1764 is calculated. 1766 The signature algorithms are defined in Section 6.2.8. The signature 1767 in the Signature field is encoded using the proper method depending 1768 on the signature algorithm (e.g. according to [14] in case of RSA, 1769 or according to [13] in case of DSA). 1771 The HIP_SIGNATURE calculation and verification process is presented 1772 in Section 8.3.2 1774 6.2.13 HIP_SIGNATURE_2 1776 The TLV structure is the same as in Section 6.2.12. The fields are: 1778 Type 65277 (2^16-2^8-3) 1779 Length length in octets, excluding Type, Length, and Padding 1780 SIG alg Signature algorithm 1781 Signature the signature is calculated over the HIP R1 packet, 1782 excluding the HIP_SIGNATURE_2 TLV field and any 1783 TLVs that follow the HIP_SIGNATURE_2 TLV. Initiator's 1784 HIT, checksum field, and the Opaque and Random #I 1785 fields in the PUZZLE TLV MUST be set to zero while 1786 computing the HIP_SIGNATURE_2 signature. Further, the 1787 HIP packet length in the HIP header MUST be 1788 calculated to the beginning of the HIP_SIGNATURE_2 1789 TLV when the signature is calculated. 1791 Zeroing the Initiator's HIT makes it possible to create R1 packets 1792 beforehand to minimize the effects of possible DoS attacks. Zeroing 1793 the I and Opaque fields allows these fields to be populated 1794 dynamically on precomputed R1s. 1796 Signature calculation and verification follows the process in 1797 Section 8.3.2. 1799 6.2.14 SEQ 1801 0 1 2 3 1802 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 1803 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1804 | Type | Length | 1805 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1806 | Update ID | 1807 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1809 Type 11 1810 Length 4 1811 Update ID 32-bit sequence number 1813 The Update ID is an unsigned quantity, initialized by a host to zero 1814 upon moving to ESTABLISHED state. The Update ID has scope within a 1815 single HIP association, and not across multiple associations or 1816 multiple hosts. The Update ID is incremented by one before each new 1817 UPDATE that is sent by the host (i.e., the first UPDATE packet 1818 originated by a host has an Update ID of 1). 1820 6.2.15 ACK 1822 0 1 2 3 1823 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 1824 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1825 | Type | Length | 1826 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1827 | peer Update ID | 1828 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1830 Type 13 1831 Length variable (multiple of 4) 1832 peer Update ID 32-bit sequence number corresponding to the 1833 Update ID being acked. 1835 The ACK parameter includes one or more Update IDs that have been 1836 received from the peer. The Length field identifies the number of 1837 peer Update IDs that are present in the parameter. 1839 6.2.16 ENCRYPTED 1841 0 1 2 3 1842 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 1843 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1844 | Type | Length | 1845 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1846 | Reserved | 1847 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1848 | IV / 1849 / / 1850 / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1851 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / 1852 / Encrypted data / 1853 / / 1854 / +-------------------------------+ 1855 / | Padding | 1856 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1858 Type 21 1859 Length length in octets, excluding Type, Length, and Padding 1860 Reserved zero when sent, ignored when received 1861 IV Initialization vector, if needed, otherwise nonexistent. 1862 The length of the IV is inferred from the HIP transform. 1863 Encrypted The data is encrypted using an encryption algorithm as 1864 data defined in HIP transform. 1865 Padding Any Padding, if necessary, to make the TLV a multiple 1866 of 8 bytes. 1868 The encrypted data is in TLV format itself. Consequently, the first 1869 fields in the contents are Type and Length, allowing the contents to 1870 be easily parsed after decryption. Each of the TLVs to be encrypted, 1871 must be padded according to rules in Section 6.2.1 before encryption. 1873 If the encryption algorithm requires the length of the data to be 1874 encrypted to be a multiple of the cipher algorithm block size, 1875 thereby necessitating padding, and if the encryption algorithm does 1876 not specify the padding contents, then an implementation MUST append 1877 the TLV parameter that is to be encrypted with an additional padding, 1878 so that the length of the resulting cleartext is a multiple of the 1879 cipher block size length. Such a padding MUST be constructed as 1880 specified in [19] Section 2.4. On the other hand, if the data to be 1881 encrypted is already a multiple of the block size, or if the 1882 encryption algorithm does specify padding as per [19] Section 2.4, 1883 then such additional padding SHOULD NOT be added. 1885 The Length field in the inside, to be encrypted TLV does not include 1886 the padding. The Length field in the outside ENCRYPTED TLV is the 1887 length of the data after encryption (including the Reserved field, 1888 the IV field, and the output from the encryption process specified 1889 for that suite, but not any additional external padding). Note that 1890 the length of the cipher suite output may be smaller or larger than 1891 the length of the data to be encrypted, since the encryption process 1892 may compress the data or add additional padding to the data. 1894 The ENCRYPTED payload may contain additional external padding, if the 1895 result of encryption, the TLV header and the IV is not a multiple of 1896 8 bytes. The contents of this external padding MUST follow the rules 1897 given in Section 6.2.1. 1899 6.2.17 NOTIFY 1901 The NOTIFY parameter is used to transmit informational data, such as 1902 error conditions and state transitions, to a HIP peer. A NOTIFY 1903 parameter may appear in the NOTIFY packet type. The use of the 1904 NOTIFY parameter in other packet types is for further study. 1906 0 1 2 3 1907 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1908 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1909 | Type | Length | 1910 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1911 | Reserved | Notify Message Type | 1912 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1913 | / 1914 / Notification data / 1915 / +---------------+ 1916 / | Padding | 1917 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1919 Type 256 1920 Length length in octets, excluding Type, Length, and Padding 1921 Reserved zero when sent, ignored when received 1922 Notify Message Specifies the type of notification 1923 Type 1924 Notification Informational or error data transmitted in addition 1925 Data to the Notify Message Type. Values for this field are 1926 type specific (see below). 1927 Padding Any Padding, if necessary, to make the TLV a multiple 1928 of 8 bytes. 1930 Notification information can be error messages specifying why an SA 1931 could not be established. It can also be status data that a process 1932 managing an SA database wishes to communicate with a peer process. 1933 The table below lists the Notification messages and their 1934 corresponding values. 1936 To avoid certain types of attacks, a Responder SHOULD avoid sending a 1937 NOTIFY to any host with which it has not successfully verified a 1938 puzzle solution. 1940 Types in the range 0 - 16383 are intended for reporting errors. An 1941 implementation that receives a NOTIFY error parameter in response to 1942 a request packet (e.g., I1, I2, UPDATE), SHOULD assume that the 1943 corresponding request has failed entirely. Unrecognized error types 1944 MUST be ignored except that they SHOULD be logged. 1946 Notify payloads with status types MUST be ignored if not recognized. 1948 NOTIFY PARAMETER - ERROR TYPES Value 1949 ------------------------------ ----- 1951 UNSUPPORTED_CRITICAL_PARAMETER_TYPE 1 1953 Sent if the parameter type has the "critical" bit set and the 1954 parameter type is not recognized. Notification Data contains 1955 the two octet parameter type. 1957 INVALID_SYNTAX 7 1959 Indicates that the HIP message received was invalid because 1960 some type, length, or value was out of range or because the 1961 request was rejected for policy reasons. To avoid a denial 1962 of service attack using forged messages, this status may 1963 only be returned for and in an encrypted packet if the 1964 message ID and cryptographic checksum were valid. To avoid 1965 leaking information to someone probing a node, this status 1966 MUST be sent in response to any error not covered by one of 1967 the other status types. To aid debugging, more detailed 1968 error information SHOULD be written to a console or log. 1970 NO_DH_PROPOSAL_CHOSEN 14 1972 None of the proposed group IDs was acceptable. 1974 INVALID_DH_CHOSEN 15 1976 The D-H Group ID field does not correspond to one offered 1977 by the responder. 1979 NO_HIP_PROPOSAL_CHOSEN 16 1980 None of the proposed HIP Transform crypto suites was 1981 acceptable. 1983 INVALID_HIP_TRANSFORM_CHOSEN 17 1985 The HIP Transform crypto suite does not correspond to 1986 one offered by the responder. 1988 AUTHENTICATION_FAILED 24 1990 Sent in response to a HIP signature failure. 1992 CHECKSUM_FAILED 26 1994 Sent in response to a HIP checksum failure. 1996 HMAC_FAILED 28 1998 Sent in response to a HIP HMAC failure. 2000 ENCRYPTION_FAILED 32 2002 The responder could not successfully decrypt the 2003 ENCRYPTED TLV. 2005 INVALID_HIT 40 2007 Sent in response to a failure to validate the peer's 2008 HIT from the corresponding HI. 2010 BLOCKED_BY_POLICY 42 2012 The responder is unwilling to set up an association 2013 for some policy reason (e.g. received HIT is NULL 2014 and policy does not allow opportunistic mode). 2016 SERVER_BUSY_PLEASE_RETRY 44 2018 The responder is unwilling to set up an association 2019 as it is suffering under some kind of overload and 2020 has chosen to shed load by rejecting your request. 2021 You may retry if you wish, however you MUST find 2022 another (different) puzzle solution for any such 2023 retries. Note that you may need to obtain a new 2024 puzzle with a new I1/R1 exchange. 2026 I2_ACKNOWLEDGEMENT 46 2027 The responder has received your I2 but had to queue 2028 the I2 for processing. The puzzle was correctly solved 2029 and the responder is willing to set up an association 2030 but has currently a number of I2s in processing queue. 2031 R2 will be sent after the I2 has been processed. 2033 NOTIFY MESSAGES - STATUS TYPES Value 2034 ------------------------------ ----- 2036 (None defined at present) 2038 6.2.18 ECHO_REQUEST 2040 0 1 2 3 2041 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 2042 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2043 | Type | Length | 2044 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2045 | Opaque data (variable length) | 2046 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2048 Type 65281 or 1022 2049 Length variable 2050 Opaque data Opaque data, supposed to be meaningful only to the 2051 node that sends ECHO_REQUEST and receives a corresponding 2052 ECHO_RESPONSE. 2054 The ECHO_REQUEST parameter contains an opaque blob of data that the 2055 sender wants to get echoed back in the corresponding reply packet. 2057 The ECHO_REQUEST and ECHO_RESPONSE parameters MAY be used for any 2058 purpose where a node wants to carry some state in a request packet 2059 and get it back in a response packet. The ECHO_REQUEST MAY be 2060 covered by the HMAC and SIGNATURE. This is dictated by the Type 2061 field selected for the parameter; Type 1022 ECHO_REQUEST is covered 2062 and Type 65281 is not. 2064 6.2.19 ECHO_RESPONSE 2066 0 1 2 3 2067 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 2068 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2069 | Type | Length | 2070 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2071 | Opaque data (variable length) | 2072 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2074 Type 65283 or 1024 2075 Length variable 2076 Opaque data Opaque data, copied unmodified from the ECHO_REQUEST 2077 parameter that triggered this response. 2079 The ECHO_RESPONSE parameter contains an opaque blob of data that the 2080 sender of the ECHO_REQUEST wants to get echoed back. The opaque data 2081 is copied unmodified from the ECHO_REQUEST parameter. 2083 The ECHO_REQUEST and ECHO_RESPONSE parameters MAY be used for any 2084 purpose where a node wants to carry some state in a request packet 2085 and get it back in a response packet. The ECHO_RESPONSE MAY be 2086 covered by the HMAC and SIGNATURE. This is dictated by the Type 2087 field selected for the parameter; Type 1024 ECHO_RESPONSE is covered 2088 and Type 65283 is not. 2090 6.3 ICMP messages 2092 When a HIP implementation detects a problem with an incoming packet, 2093 and it either cannot determine the identity of the sender of the 2094 packet or does not have any existing HIP association with the sender 2095 of the packet, it MAY respond with an ICMP packet. Any such replies 2096 MUST be rate limited as described in [4]. In most cases, the ICMP 2097 packet will have the Parameter Problem type (12 for ICMPv4, 4 for 2098 ICMPv6), with the Pointer field pointing to the field that caused the 2099 ICMP message to be generated. 2101 6.3.1 Invalid Version 2103 If a HIP implementation receives a HIP packet that has an 2104 unrecognized HIP version number, it SHOULD respond, rate limited, 2105 with an ICMP packet with type Parameter Problem, the Pointer pointing 2106 to the VER./RES. byte in the HIP header. 2108 6.3.2 Other problems with the HIP header and packet structure 2110 If a HIP implementation receives a HIP packet that has other 2111 unrecoverable problems in the header or packet format, it MAY 2112 respond, rate limited, with an ICMP packet with type Parameter 2113 Problem, the Pointer pointing to the field that failed to pass the 2114 format checks. However, an implementation MUST NOT send an ICMP 2115 message if the Checksum fails; instead, it MUST silently drop the 2116 packet. 2118 6.3.3 Invalid Cookie Solution 2120 If a HIP implementation receives an I2 packet that has an invalid 2121 cookie solution, the behaviour depends on the underlying version of 2122 IP. If IPv6 is used, the implementation SHOULD respond with an ICMP 2123 packet with type Parameter Problem, the Pointer pointing to the 2124 beginning of the Puzzle solution #J field in the SOLUTION payload in 2125 the HIP message. 2127 If IPv4 is used, the implementation MAY respond with an ICMP packet 2128 with the type Parameter Problem, copying enough of bytes form the I2 2129 message so that the SOLUTION parameter fits in to the ICMP message, 2130 the Pointer pointing to the beginning of the Puzzle solution #J 2131 field, as in the IPv6 case. Note, however, that the resulting ICMPv4 2132 message exceeds the typical ICMPv4 message size as defined in [2]. 2134 6.3.4 Non-existing HIP association 2136 If a HIP implementation receives a CLOSE, or UPDATE packet, or any 2137 other packet whose handling requires an existing association, that 2138 has either a Receiver or Sender HIT that does not match with any 2139 existing HIP association, the implementation MAY respond, rate 2140 limited, with an ICMP packet with the type Parameter Problem, the 2141 Pointer pointing to the the beginning of the first HIT that does not 2142 match. 2144 A host MUST NOT reply with such an ICMP if it receives any of the 2145 following messages: I1, R2, I2, R2, CER, and NOTIFY. When 2146 introducing new packet types, a specification SHOULD define the 2147 appropriate rules for sending or not sending this kind of ICMP 2148 replies. 2150 7. HIP Packets 2152 There are nine basic HIP packets. Four are for the HIP base 2153 exchange, one is for updating, one is for sending certificates, one 2154 for sending notifications, and two for closing a HIP association. 2156 Packets consist of the fixed header as described in Section 6.1, 2157 followed by the parameters. The parameter part, in turn, consists of 2158 zero or more TLV coded parameters. 2160 In addition to the base packets, other packets types will be defined 2161 later in separate specifications. For example, support for mobility 2162 and multi-homing is not included in this specification. 2164 Packet representation uses the following operations: 2166 () parameter 2167 x{y} operation x on content y 2168 i x exists i times 2169 [] optional parameter 2170 x | y x or y 2172 In the future, an OPTIONAL upper layer payload MAY follow the HIP 2173 header. The payload proto field in the header indicates if there is 2174 additional data following the HIP header. The HIP packet, however, 2175 MUST NOT be fragmented. This limits the size of the possible 2176 additional data in the packet. 2178 7.1 I1 - the HIP initiator packet 2180 The HIP header values for the I1 packet: 2182 Header: 2183 Packet Type = 1 2184 SRC HIT = Initiator's HIT 2185 DST HIT = Responder's HIT, or NULL 2187 IP ( HIP () ) 2189 The I1 packet contains only the fixed HIP header. 2191 Valid control bits: none 2193 The Initiator gets the Responder's HIT either from a DNS lookup of 2194 the Responder's FQDN, from some other repository, or from a local 2195 table. If the Initiator does not know the Responder's HIT, it may 2196 attempt opportunistic mode by using NULL (all zeros) as the 2197 Responder's HIT. If the Initiator send a NULL as the Responder's 2198 HIT, it MUST be able to handle all MUST and SHOULD algorithms from 2199 Section 3, which are currently RSA and DSA. 2201 Since this packet is so easy to spoof even if it were signed, no 2202 attempt is made to add to its generation or processing cost. 2204 Implementation MUST be able to handle a storm of received I1 packets, 2205 discarding those with common content that arrive within a small time 2206 delta. 2208 7.2 R1 - the HIP responder packet 2210 The HIP header values for the R1 packet: 2212 Header: 2213 Packet Type = 2 2214 SRC HIT = Responder's HIT 2215 DST HIT = Initiator's HIT 2217 IP ( HIP ( [ R1_COUNTER, ] 2218 PUZZLE, 2219 DIFFIE_HELLMAN, 2220 HIP_TRANSFORM, 2221 HOST_ID, 2222 [ ECHO_REQUEST, ] 2223 HIP_SIGNATURE_2 ) 2224 [, ECHO_REQUEST ]) 2226 Valid control bits: C, A 2228 The R1 packet may be followed by one or more CER packets. In this 2229 case, the C-bit in the control field MUST be set. 2231 If the responder HI is an anonymous one, the A control MUST be set. 2233 The initiator HIT MUST match the one received in I1. If the 2234 Responder has multiple HIs, the responder HIT used MUST match 2235 Initiator's request. If the Initiator used opportunistic mode, the 2236 Responder may select freely among its HIs. 2238 The R1 generation counter is used to determine the currently valid 2239 generation of puzzles. The value is increased periodically, and it 2240 is RECOMMENDED that it is increased at least as often as solutions to 2241 old puzzles are not accepted any longer. 2243 The Puzzle contains a random #I and the difficulty K. The difficulty 2244 K is the number of bits that the Initiator must get zero in the 2245 puzzle. The random #I is not covered by the signature and must be 2246 zeroed during the signature calculation, allowing the sender to 2247 select and set the #I into a pre-computed R1 just prior sending it to 2248 the peer. 2250 The Diffie-Hellman value is ephemeral, but can be reused over a 2251 number of connections. In fact, as a defense against I1 storms, an 2252 implementation MAY use the same Diffie-Hellman value for a period of 2253 time, for example, 15 minutes. By using a small number of different 2254 Cookies for a given Diffie-Hellman value, the R1 packets can be 2255 pre-computed and delivered as quickly as I1 packets arrive. A 2256 scavenger process should clean up unused DHs and Cookies. 2258 The HIP_TRANSFORM contains the encryption and integrity algorithms 2259 supported by the Responder to protect the HI exchange, in the order 2260 of preference. All implementations MUST support the AES [10] with 2261 HMAC-SHA-1-96 [6]. 2263 The ECHO_REQUEST contains data that the sender wants to receive 2264 unmodified in the corresponding response packet in the ECHO_RESPONSE 2265 parameter. The ECHO_REQUEST can be either covered by the signature, 2266 or it can be left out from it. In the first case, the ECHO_REQUEST 2267 gets Type number 1022 and in the latter case 65281. 2269 The signature is calculated over the whole HIP envelope, after 2270 setting the initiator HIT, header checksum as well as the Opaque 2271 field and the Random #I in the PUZZLE parameter temporarily to zero, 2272 and excluding any TLVs that follow the signature, as described in 2273 Section 6.2.13. This allows the Responder to use precomputed R1s. 2274 The Initiator SHOULD validate this signature. It SHOULD check that 2275 the responder HI received matches with the one expected, if any. 2277 7.3 I2 - the second HIP initiator packet 2279 The HIP header values for the I2 packet: 2281 Header: 2282 Type = 3 2283 SRC HIT = Initiator's HIT 2284 DST HIT = Responder's HIT 2286 IP ( HIP ( [R1_COUNTER,] 2287 SOLUTION, 2288 DIFFIE_HELLMAN, 2289 HIP_TRANSFORM, 2290 ENCRYPTED { HOST_ID }, 2291 [ ECHO_RESPONSE ,] 2292 HMAC, 2293 HIP_SIGNATURE 2295 [, ECHO_RESPONSE] ) ) 2297 Valid control bits: C, A 2299 The HITs used MUST match the ones used previously. 2301 If the initiator HI is an anonymous one, the A control MUST be set. 2303 The Initiator MAY include an unmodified copy of the R1_COUNTER 2304 parameter received in the corresponding R1 packet into the I2 packet. 2306 The Solution contains the random # I from R1 and the computed # J. 2307 The low order K bits of the SHA-1(I | ... | J) MUST be zero. 2309 The Diffie-Hellman value is ephemeral. If precomputed, a scavenger 2310 process should clean up unused DHs. 2312 The HIP_TRANSFORM contains the encryption and integrity used to 2313 protect the HI exchange selected by the Initiator. All 2314 implementations MUST support the AES transform [10]. 2316 The Initiator's HI is encrypted using the HIP_TRANSFORM encryption 2317 algorithm. The keying material is derived from the Diffie-Hellman 2318 exchanged as defined in Section 9. 2320 The ECHO_RESPONSE contains the the unmodified Opaque data copied from 2321 the corresponding ECHO_REQUEST TLV. The ECHO_RESPONSE can be either 2322 covered by the signature, or it can be left out from it. In the 2323 first case, the ECHO_RESPONSE gets Type number 1024 and in the latter 2324 case 65283. 2326 The HMAC is calculated over whole HIP envelope, excluding any TLVs 2327 after the HMAC, as described in Section 8.3.1. The Responder MUST 2328 validate the HMAC. 2330 The signature is calculated over whole HIP envelope, excluding any 2331 TLVs after the HIP_SIGNATURE, as described in Section 6.2.12. The 2332 Responder MUST validate this signature. It MAY use either the HI in 2333 the packet or the HI acquired by some other means. 2335 7.4 R2 - the second HIP responder packet 2337 The HIP header values for the R2 packet: 2339 Header: 2340 Packet Type = 4 2341 SRC HIT = Responder's HIT 2342 DST HIT = Initiator's HIT 2344 IP ( HIP ( HMAC_2, HIP_SIGNATURE ) ) 2346 Valid control bits: none 2348 The HMAC_2 is calculated over whole HIP envelope, with Responder's 2349 HOST_ID TLV concatenated with the HIP envelope. The HOST_ID TLV is 2350 removed after the HMAC calculation. The procedure is described in 2351 8.3.1. 2353 The signature is calculated over whole HIP envelope. 2355 The Initiator MUST validate both the HMAC and the signature. 2357 7.5 CER - the HIP Certificate Packet 2359 The CER packet is OPTIONAL. 2361 The Optional CER packets over the Announcer's HI by a higher level 2362 authority known to the Recipient is an alternative method for the 2363 Recipient to trust the Announcer's HI (over DNSSEC or PKI). 2365 The HIP header values for CER packet: 2367 Header: 2368 Packet Type = 5 2369 SRC HIT = Announcer's HIT 2370 DST HIT = Recipient's HIT 2372 IP ( HIP ( i , HIP_SIGNATURE ) ) or 2374 IP ( HIP ( ENCRYPTED { i }, HIP_SIGNATURE ) ) 2376 Valid control bits: None 2378 Certificates in the CER packet MAY be encrypted. The encryption 2379 algorithm is provided in the HIP transform of the previous (R1 or I2) 2380 packet. 2382 7.6 UPDATE - the HIP Update Packet 2384 Support for the UPDATE packet is MANDATORY. 2386 The HIP header values for the UPDATE packet: 2388 Header: 2389 Packet Type = 6 2390 SRC HIT = Sender's HIT 2391 DST HIT = Recipient's HIT 2393 IP ( HIP ( [SEQ, ACK, ] HMAC, HIP_SIGNATURE ) ) 2395 Valid control bits: None 2397 The UPDATE packet contains mandatory HMAC and HIP_SIGNATURE 2398 parameters, and other optional parameters. 2400 The UPDATE packet contains zero or one SEQ parameter. The presence 2401 of a SEQ parameter indicates that the receiver MUST ack the UPDATE. 2402 An UPDATE that does not contain a SEQ parameter is simply an ACK of a 2403 previous UPDATE and itself MUST not be acked. 2405 An UPDATE packet contains zero or one ACK parameters. The ACK 2406 parameter echoes the SEQ sequence number of the UPDATE packet being 2407 acked. A host MAY choose to ack more than one UPDATE packet at a 2408 time; e.g., the ACK may contain the last two SEQ values received, for 2409 robustness to ack loss. ACK values are not cumulative; each received 2410 unique SEQ value requires at least one corresponding ACK value in 2411 reply. Received ACKs that are redundant are ignored. 2413 The UPDATE packet may contain both a SEQ and an ACK parameter. In 2414 this case, the ACK is being piggybacked on an outgoing UPDATE. In 2415 general, UPDATEs carrying SEQ SHOULD be acked upon completion of the 2416 processing of the UPDATE. A host MAY choose to hold the UPDATE 2417 carrying ACK for a short period of time to allow for the possibility 2418 of piggybacking the ACK parameter, in a manner similar to TCP delayed 2419 acknowledgments. 2421 A sender MAY choose to forego reliable transmission of a particular 2422 UPDATE (e.g., it becomes overcome by events). The semantics are such 2423 that the receiver MUST acknowledge the UPDATE but the sender MAY 2424 choose to not care about receiving the ACK. 2426 UPDATEs MAY be retransmitting without incrementing SEQ. If the same 2427 subset of parameters is included in multiple UPDATEs with different 2428 SEQs, the host MUST ensure that receiver processing of the parameters 2429 multiple times will not result in a protocol error. 2431 7.7 NOTIFY - the HIP Notify Packet 2433 The NOTIFY packet is OPTIONAL. The NOTIFY packet MAY be used to 2434 provide information to a peer. Typically, NOTIFY is used to indicate 2435 some type of protocol error or negotiation failure. 2437 The HIP header values for the NOTIFY packet: 2439 Header: 2440 Packet Type = 7 2441 SRC HIT = Sender's HIT 2442 DST HIT = Recipient's HIT, or zero if unknown 2444 IP ( HIP (i, [HOST_ID, ] HIP_SIGNATURE) ) 2446 Valid control bits: None 2448 The NOTIFY packet is used to carry one or more NOTIFY parameters. 2450 7.8 CLOSE - the HIP association closing packet 2452 The HIP header values for the CLOSE packet: 2454 Header: 2455 Packet Type = 8 2456 SRC HIT = Sender's HIT 2457 DST HIT = Recipient's HIT 2459 IP ( HIP ( ECHO_REQUEST, HMAC, HIP_SIGNATURE ) ) 2461 Valid control bits: none 2463 The sender MUST include an ECHO_REQUEST used to validate CLOSE_ACK 2464 received in response, and both an HMAC and a signature (calculated 2465 over the whole HIP envelope). 2467 The receiver peer MUST validate both the HMAC and the signature if it 2468 has a HIP association state, and MUST reply with a CLOSE_ACK 2469 containing an ECHO_REPLY corresponding to the received ECHO_REQUEST. 2471 7.9 CLOSE_ACK - the HIP closing acknowledgment packet 2473 The HIP header values for the CLOSE_ACK packet: 2475 Header: 2476 Packet Type = 9 2477 SRC HIT = Sender's HIT 2478 DST HIT = Recipient's HIT 2480 IP ( HIP ( ECHO_REPLY, HMAC, HIP_SIGNATURE ) ) 2482 Valid control bits: none 2483 The sender MUST include both an HMAC and signature (calculated over 2484 the whole HIP envelope). 2486 The receiver peer MUST validate both the HMAC and the signature. 2488 8. Packet processing 2490 Each host is assumed to have a single HIP protocol implementation 2491 that manages the host's HIP associations and handles requests for new 2492 ones. Each HIP association is governed by a conceptual state 2493 machine, with states defined above in Section 5.4. The HIP 2494 implementation can simultaneously maintain HIP associations with more 2495 than one host. Furthermore, the HIP implementation may have more 2496 than one active HIP association with another host; in this case, HIP 2497 associations are distinguished by their respective HITs. It is not 2498 possible to have more than one HIP associations between any given 2499 pair of HITs. Consequently, the only way for two hosts to have more 2500 than one parallel association is to use different HITs, at least at 2501 one end. 2503 The processing of packets depends on the state of the HIP 2504 association(s) with respect to the authenticated or apparent 2505 originator of the packet. A HIP implementation determines whether it 2506 has an active association with the originator of the packet based on 2507 the HITs. In the case of user data carried in a specific transport 2508 format, the transport format document specifies how the incoming 2509 packets are matched with the active associations. 2511 8.1 Processing outgoing application data 2513 In a HIP host, an application can send application level data using 2514 HITs or LSIs as source and destination identifiers. The HITs and 2515 LSIs may be specified via a backwards compatible API (see [29]) or a 2516 completely new API. The exact format and method for transferring the 2517 data from the source HIP host to the destination HIP host is defined 2518 in the corresponding transport format document. The actual data is 2519 transmitted in the network using the appropriate source and 2520 destination IP addresses. Here, we specify the processing rules only 2521 for the base case where both hosts have only single usable IP 2522 addresses; the multi-address multi-homing case will be specified 2523 separately. 2525 If the IPv4 or IPv6 backward compatible APIs and therefore LSIs are 2526 supported, it is assumed that the LSIs will be converted into proper 2527 HITs somewhere in the stack. The exact location of the conversion is 2528 an implementation specific issue and not discussed here. The 2529 following conceptual algorithm discusses only HITs, with the 2530 assumption that the LSI-to-HIT conversion takes place somewhere. 2532 The following steps define the conceptual processing rules for 2533 outgoing datagrams destined to a HIT. 2534 1. If the datagram has a specified source address, it MUST be a HIT. 2535 If it is not, the implementation MAY replace the source address 2536 with a HIT. Otherwise it MUST drop the packet. 2537 2. If the datagram has an unspecified source address, the 2538 implementation must choose a suitable source HIT for the 2539 datagram. In selecting a proper local HIT, the implementation 2540 SHOULD consult the table of currently active HIP sessions, and 2541 preferably select a HIT that already has an active session with 2542 the target HIT. 2543 3. If there is no active HIP session with the given < source, 2544 destination > HIT pair, one must be created by running the base 2545 exchange. The implementation SHOULD queue at least one packet 2546 per HIP session to be formed, and it MAY queue more than one. 2547 4. Once there is an active HIP session for the given < source, 2548 destination > HIT pair, the outgoing datagram is passed to 2549 transport handling. The possible transport formats are defined 2550 in separate documents, of which the ESP transport format for HIP 2551 is mandatory for all HIP implementations. 2552 5. The HITs in the datagram are replaced with suitable IP addresses. 2553 For IPv6, the rules defined in [16] SHOULD be followed. Note 2554 that this HIT-to-IP-address conversion step MAY also be performed 2555 at some other point in the stack, e.g., before wrapping the 2556 packet into the output format. 2558 8.2 Processing incoming application data 2560 The transport format and method (defined in separate specifications) 2561 determines the format in which incoming HIP packets arrive to the 2562 host. The following steps define the conceptual processing rules for 2563 incoming datagrams. The specific transport format and method 2564 specifications define in more detail the packet processing, related 2565 to the method. 2567 1. The incoming datagram is mapped to an existing HIP association, 2568 typically using some information from the packet. For example, 2569 such mapping may be based on IPsec Security Parameter Index (SPI) 2570 or a protocol port number. 2571 2. The specific transport format is unwrapped, in a way depending on 2572 the transport format, yielding a packet that looks like a 2573 standard (unencrypted) IP packet. If possible, this step SHOULD 2574 also verify that the packet was indeed (once) sent by the remote 2575 HIP host, as identified by the HIP association. 2576 3. The IP addresses in the datagram are replaced with the HITs 2577 associated with the HIP association. Note that this 2578 IP-address-to-HIT conversion step MAY also be performed at some 2579 other point in the stack. 2580 4. The datagram is delivered to the upper layer. Demultiplexing the 2581 datagram the right upper layer socket is based on the HITs (or 2582 LSIs). 2584 8.3 HMAC and SIGNATURE calculation and verification 2586 The following subsections define the actions for processing HMAC, 2587 HIP_SIGNATURE and HIP_SIGNATURE_2 TLVs. 2589 8.3.1 HMAC calculation 2591 The following process applies both to the HMAC and HMAC_2 TLVs. When 2592 processing HMAC_2, the difference is that the HMAC calculation 2593 includes pseudo HOST_ID field containing the Responder's information 2594 as sent in the R1 packet earlier. 2596 The HMAC TLV is defined in Section 6.2.10 and HMAC_2 TLV in 2597 Section 6.2.11. HMAC calculation and verification process: 2599 Packet sender: 2600 1. Create the HIP packet, without the HMAC or any possible 2601 HIP_SIGNATURE or HIP_SIGNATURE_2 TLVs. 2602 2. In case of HMAC_2 calculation, add a HOST_ID (Responder) TLV to 2603 the packet. 2604 3. Calculate the Length field in the HIP header. 2605 4. Compute the HMAC. 2606 5. In case of HMAC_2, remove the HOST_ID TLV from the packet. 2607 6. Add the HMAC TLV to the packet and any HIP_SIGNATURE or 2608 HIP_SIGNATURE_2 TLVs that may follow. 2609 7. Recalculate the Length field in the HIP header. 2611 Packet receiver: 2612 1. Verify the HIP header Length field. 2613 2. Remove the HMAC or HMAC_2 TLV, and if the packet contains any 2614 HIP_SIGNATURE or HIP_SIGNATURE_2 fields, remove them too, saving 2615 the contents if they will be needed later. 2616 3. In case of HMAC_2, build and add a HOST_ID TLV (with Responder 2617 information) to the packet. 2618 4. Recalculate the HIP packet length in the HIP header and clear the 2619 Checksum field (set it to all zeros). 2620 5. Compute the HMAC and verify it against the received HMAC. 2621 6. In case of HMAC_2, remove the HOST_ID TLV from the packet before 2622 further processing. 2624 8.3.2 Signature calculation 2626 The following process applies both to the HIP_SIGNATURE and 2627 HIP_SIGNATURE_2 TLVs. When processing HIP_SIGNATURE_2, the only 2628 difference is that instead of HIP_SIGNATURE TLV, the HIP_SIGNATURE_2 2629 TLV is used, and the Initiator's HIT and PUZZLE Opaque and Random #I 2630 fields are cleared (set to all zeros) before computing the signature. 2631 The HIP_SIGNATURE TLV is defined in Section 6.2.12 and the 2632 HIP_SIGNATURE_2 TLV in Section 6.2.13. 2634 Signature calculation and verification process: 2636 Packet sender: 2637 1. Create the HIP packet without the HIP_SIGNATURE TLV or any TLVs 2638 that follow the HIP_SIGNATURE TLV. 2639 2. Calculate the Length field in the HIP header. 2640 3. Compute the signature. 2641 4. Add the HIP_SIGNATURE TLV to the packet. 2642 5. Add any TLVs that follow the HIP_SIGNATURE TLV. 2643 6. Recalculate the Length field in the HIP header. 2645 Packet receiver: 2646 1. Verify the HIP header Length field. 2647 2. Save the contents of the HIP_SIGNATURE TLV and any TLVs following 2648 the HIP_SIGNATURE TLV and remove them from the packet. 2649 3. Recalculate the HIP packet Length in the HIP header and clear the 2650 Checksum field (set it to all zeros). 2651 4. Compute the signature and verify it against the received 2652 signature. 2654 The verification can use either the HI received from a HIP packet, 2655 the HI from a DNS query, if the FQDN has been received either in the 2656 HOST_ID or in the CER packet, or one received by some other means. 2658 8.4 Initiation of a HIP exchange 2660 An implementation may originate a HIP exchange to another host based 2661 on a local policy decision, usually triggered by an application 2662 datagram, in much the same way that an IPsec IKE key exchange can 2663 dynamically create a Security Association. Alternatively, a system 2664 may initiate a HIP exchange if it has rebooted or timed out, or 2665 otherwise lost its HIP state, as described in Section 5.3. 2667 The implementation prepares an I1 packet and sends it to the IP 2668 address that corresponds to the peer host. The IP address of the 2669 peer host may be obtained via conventional mechanisms, such as DNS 2670 lookup. The I1 contents are specified in Section 7.1. The selection 2671 of which host identity to use, if a host has more than one to choose 2672 from, is typically a policy decision. 2674 The following steps define the conceptual processing rules for 2675 initiating a HIP exchange: 2676 1. The Initiator gets the Responder's HIT and one or more addresses 2677 either from a DNS lookup of the responder's FQDN, from some other 2678 repository, or from a local table. If the initiator does not 2679 know the responder's HIT, it may attempt opportunistic mode by 2680 using NULL (all zeros) as the responder's HIT. 2681 2. The Initiator sends an I1 to one of the Responder's addresses. 2682 The selection of which address to use is a local policy decision. 2683 3. Upon sending an I1, the sender shall transition to state I1-SENT, 2684 start a timer whose timeout value should be larger than the 2685 worst-case anticipated RTT, and shall increment a timeout counter 2686 associated with the I1. 2687 4. Upon timeout, the sender SHOULD retransmit the I1 and restart the 2688 timer, up to a maximum of I1_RETRIES_MAX tries. 2690 8.4.1 Sending multiple I1s in parallel 2692 For the sake of minimizing the session establishment latency, an 2693 implementation MAY send the same I1 to more than one of the 2694 Responder's addresses. However, it MUST NOT send to more than three 2695 (3) addresses in parallel. Furthermore, upon timeout, the 2696 implementation MUST refrain from sending the same I1 packet to 2697 multiple addresses. These limitations are placed order to avoid 2698 congestion of the network, and potential DoS attacks that might 2699 happen, e.g., because someone claims to have hundreds or thousands of 2700 addresses. 2702 As the Responder is not guaranteed to distinguish the duplicate I1's 2703 it receives at several of its addresses (because it avoids to store 2704 states when it answers back an R1), the Initiator may receive several 2705 duplicate R1's. 2707 The Initiator SHOULD then select the initial preferred destination 2708 address using the source address of the selected received R1, and use 2709 the preferred address as a source address for the I2. Processing 2710 rules for received R1s are discussed in Section 8.6. 2712 8.4.2 Processing incoming ICMP Protocol Unreachable messages 2714 A host may receive an ICMP Destination Protocol Unreachable message 2715 as a response to sending an HIP I1 packet. Such a packet may be an 2716 indication that the peer does not support HIP, or it may be an 2717 attempt to launch an attack by making the Initiator believe that the 2718 Responder does not support HIP. 2720 When a system receives an ICMP Destination Protocol Unreachable 2721 message while it is waiting for an R1, it MUST NOT terminate the 2722 wait. It MAY continue as if it had not received the ICMP message, 2723 and send a few more I1s. Alternatively, it MAY take the ICMP message 2724 as a hint that the peer most probably does not support HIP, and 2725 return to state UNASSOCIATED earlier than otherwise. However, at 2726 minimum, it MUST continue waiting for an R1 for a reasonable time 2727 before returning to UNASSOCIATED. 2729 8.5 Processing incoming I1 packets 2731 An implementation SHOULD reply to an I1 with an R1 packet, unless the 2732 implementation is unable or unwilling to setup a HIP association. If 2733 the implementation is unable to setup a HIP association, the host 2734 SHOULD send an ICMP Destination Protocol Unreachable, 2735 Administratively Prohibited, message to the I1 source address. If 2736 the implementation is unwilling to setup a HIP association, the host 2737 MAY ignore the I1. This latter case may occur during a DoS attack 2738 such as an I1 flood. 2740 The implementation MUST be able to handle a storm of received I1 2741 packets, discarding those with common content that arrive within a 2742 small time delta. 2744 A spoofed I1 can result in an R1 attack on a system. An R1 sender 2745 MUST have a mechanism to rate limit R1s to an address. 2747 Under no circumstances does the HIP state machine transition upon 2748 sending an R1. 2750 The following steps define the conceptual processing rules for 2751 responding to an I1 packet: 2752 1. The responder MUST check that the responder HIT in the received 2753 I1 is either one of its own HITs, or NULL. 2754 2. If the responder is in ESTABLISHED state, the responder MAY 2755 respond to this with an R1 packet, prepare to drop existing SAs 2756 and stay at ESTABLISHED state. 2757 3. If the implementation chooses to respond to the I1 with and R1 2758 packet, it creates a new R1 or selects a precomputed R1 according 2759 to the format described in Section 7.2. 2760 4. The R1 MUST contain the received responder HIT, unless the 2761 received HIT is NULL, in which case the Responder SHOULD select a 2762 HIT that is constructed with the MUST algorithm in Section 3, 2763 which is currently RSA. Other than that, selecting the HIT is a 2764 local policy matter. 2765 5. The responder sends the R1 to the source IP address of the I1 2766 packet. 2768 8.5.1 R1 Management 2770 All compliant implementations MUST produce R1 packets. An R1 packet 2771 MAY be precomputed. An R1 packet MAY be reused for time Delta T, 2772 which is implementation dependent. R1 information MUST not be 2773 discarded until Delta S after T. Time S is the delay needed for the 2774 last I2 to arrive back to the responder. 2776 An implementation MAY keep state about received I1s and match the 2777 received I2s against the state, as discussed in Section 4.1.1. 2779 8.5.2 Handling malformed messages 2781 If an implementation receives a malformed I1 message, it SHOULD NOT 2782 respond with a NOTIFY message, as such practice could open up a 2783 potential denial-of-service danger. Instead, it MAY respond with an 2784 ICMP packet, as defined in Section 6.3. 2786 8.6 Processing incoming R1 packets 2788 A system receiving an R1 MUST first check to see if it has sent an I1 2789 to the originator of the R1 (i.e., it is in state I1-SENT). If so, 2790 it SHOULD process the R1 as described below, send an I2, and go to 2791 state I2-SENT, setting a timer to protect the I2. If the system is 2792 in state I2-SENT, it MAY respond to an R1 if the R1 has a larger R1 2793 generation counter; if so, it should drop its state due to processing 2794 the previous R1 and start over from state I1-SENT. If the system is 2795 in any other state with respect to that host, it SHOULD silently drop 2796 the R1. 2798 When sending multiple I1s, an initiator SHOULD wait for a small 2799 amount of time after the first R1 reception to allow possibly 2800 multiple R1s to arrive, and it SHOULD respond to an R1 among the set 2801 with the largest R1 generation counter. 2803 The following steps define the conceptual processing rules for 2804 responding to an R1 packet: 2805 1. A system receiving an R1 MUST first check to see if it has sent 2806 an I1 to the originator of the R1 (i.e., it has a HIP 2807 association that is in state I1-SENT and that is associated with 2808 the HITs in the R1). If so, it should process the R1 as 2809 described below. 2810 2. Otherwise, if the system is in any other state than I1-SENT or 2811 I2-SENT with respect to the HITs included in the R1, it SHOULD 2812 silently drop the R1 and remain in the current state. 2813 3. If the HIP association state is I1-SENT or I2-SENT, the received 2814 Initiator's HIT MUST correspond to the HIT used in the original, 2815 I1 and the Responder's HIT MUST correspond to the one used, 2816 unless the I1 contained a NULL HIT. 2817 4. The system SHOULD validate the R1 signature before applying 2818 further packet processing, according to Section 6.2.13. 2819 5. If the HIP association state is I1-SENT, and multiple valid R1s 2820 are present, the system SHOULD select from among the R1s with 2821 the largest R1 generation counter. 2822 6. If the HIP association state is I2-SENT, the system MAY reenter 2823 state I1-SENT and process the received R1 if it has a larger R1 2824 generation counter than the R1 responded to previously. 2826 7. The R1 packet may have the C bit set -- in this case, the system 2827 should anticipate the receipt of HIP CER packets that contain 2828 the host identity corresponding to the responder's HIT. 2829 8. The R1 packet may have the A bit set -- in this case, the system 2830 MAY choose to refuse it by dropping the R1 and returning to 2831 state UNASSOCIATED. The system SHOULD consider dropping the R1 2832 only if it used a NULL HIT in I1. If the A bit is set, the 2833 Responder's HIT is anonymous and should not be stored. 2834 9. The system SHOULD attempt to validate the HIT against the 2835 received Host Identity. 2836 10. The system MUST store the received R1 generation counter for 2837 future reference. 2838 11. The system attempts to solve the cookie puzzle in R1. The 2839 system MUST terminate the search after exceeding the remaining 2840 lifetime of the puzzle. If the cookie puzzle is not 2841 successfully solved, the implementation may either resend I1 2842 within the retry bounds or abandon the HIP exchange. 2843 12. The system computes standard Diffie-Hellman keying material 2844 according to the public value and Group ID provided in the 2845 DIFFIE_HELLMAN parameter. The Diffie-Hellman keying material 2846 Kij is used for key extraction as specified in Section 9. If 2847 the received Diffie-Hellman Group ID is not supported, the 2848 implementation may either resend I1 within the retry bounds or 2849 abandon the HIP exchange. 2850 13. The system selects the HIP transform from the choices presented 2851 in the R1 packet and uses the selected values subsequently when 2852 generating and using encryption keys, and when sending the I2. 2853 If the proposed alternatives are not acceptable to the system, 2854 it may either resend I1 within the retry bounds or abandon the 2855 HIP exchange. 2856 14. The system initialized the remaining variables in the associated 2857 state, including Update ID counters. 2858 15. The system prepares and sends an I2, as described in 2859 Section 7.3. 2860 16. The system SHOULD start a timer whose timeout value should be 2861 larger than the worst-case anticipated RTT, and MUST increment a 2862 timeout counter associated with the I2. The sender SHOULD 2863 retransmit the I2 upon a timeout and restart the timer, up to a 2864 maximum of I2_RETRIES_MAX tries. 2865 17. If the system is in state I1-SENT, it shall transition to state 2866 I2-SENT. If the system is in any other state, it remains in the 2867 current state. 2869 8.6.1 Handling malformed messages 2871 If an implementation receives a malformed R1 message, it MUST 2872 silently drop the packet. Sending a NOTIFY or ICMP would not help, 2873 as the sender of the R1 typically doesn't have any state. An 2874 implementation SHOULD wait for some more time for a possible good R1, 2875 after which it MAY try again by sending a new I1 packet. 2877 8.7 Processing incoming I2 packets 2879 Upon receipt of an I2, the system MAY perform initial checks to 2880 determine whether the I2 corresponds to a recent R1 that has been 2881 sent out, if the Responder keeps such state. For example, the sender 2882 could check whether the I2 is from an address or HIT that has 2883 recently received an R1 from it. The R1 may have had Opaque data 2884 included that was echoed back in the I2. If the I2 is considered to 2885 be suspect, it MAY be silently discarded by the system. 2887 Otherwise, the HIP implementation SHOULD process the I2. This 2888 includes validation of the cookie puzzle solution, generating the 2889 Diffie-Hellman key, decrypting the Initiator's Host Identity, 2890 verifying the signature, creating state, and finally sending an R2. 2892 The following steps define the conceptual processing rules for 2893 responding to an I2 packet: 2894 1. The system MAY perform checks to verify that the I2 corresponds 2895 to a recently sent R1. Such checks are implementation 2896 dependent. See Appendix C for a description of an example 2897 implementation. 2898 2. The system MUST check that the Responder's HIT corresponds to one 2899 of its own HITs. 2900 3. If the system is in the R2-SENT state, it MAY check if the newly 2901 received I2 is similar to the one that triggered moving to 2902 R2-SENT. If so, it MAY retransmit a previously sent R2, reset 2903 the R2-SENT timer, and stay in R2-SENT. 2904 4. If the system is in any other state, it SHOULD check that the 2905 echoed R1 generation counter in I2 is within the acceptable 2906 range. Implementations MUST accept puzzles from the current 2907 generation and MAY accept puzzles from earlier generations. If 2908 the newly received I2 is outside the accepted range, the I2 is 2909 stale (perhaps replayed) and SHOULD be dropped. 2910 5. The system MUST validate the solution to the cookie puzzle by 2911 computing the SHA-1 hash described in Section 7.3. 2912 6. The I2 MUST have a single value in the HIP_TRANSFORM parameter, 2913 which MUST match one of the values offered to the Initiator in 2914 the R1 packet. 2915 7. The system must derive Diffie-Hellman keying material Kij based 2916 on the public value and Group ID in the DIFFIE_HELLMAN 2917 parameter. This key is used to derive the HIP association keys, 2918 as described in Section 9. If the Diffie-Hellman Group ID is 2919 unsupported, the I2 packet is silently dropped. 2920 8. The encrypted HOST_ID decrypted by the Initiator encryption key 2921 defined in Section 9. If the decrypted data is not an HOST_ID 2922 parameter, the I2 packet is silently dropped. 2923 9. The implementation SHOULD also verify that the Initiator's HIT in 2924 the I2 corresponds to the Host Identity sent in the I2. 2925 10. The system MUST verify the HMAC according to the procedures in 2926 Section 6.2.10. 2927 11. The system MUST verify the HIP_SIGNATURE according to 2928 Section 6.2.12 and Section 7.3. 2929 12. If the checks above are valid, then the system proceeds with 2930 further I2 processing; otherwise, it discards the I2 and remains 2931 in the same state. 2932 13. The I2 packet may have the C bit set -- in this case, the system 2933 should anticipate the receipt of HIP CER packets that contain 2934 the host identity corresponding to the responder's HIT. 2935 14. The I2 packet may have the A bit set -- in this case, the system 2936 MAY choose to refuse it by dropping the I2 and returning to 2937 state UNASSOCIATED. If the A bit is set, the Initiator's HIT is 2938 anonymous and should not be stored. 2939 15. The system initialized the remaining variables in the associated 2940 state, including Update ID counters. 2941 16. Upon successful processing of an I2 in states UNASSOCIATED, 2942 I1-SENT, I2-SENT, and R2-SENT, an R2 is sent and the state 2943 machine transitions to state ESTABLISHED. 2944 17. Upon successful processing of an I2 in state ESTABLISHED, the 2945 old HIP association is dropped and a new one is installed, an R2 2946 is sent, and the state machine transitions to R2-SENT. 2947 18. Upon transitioning to R2-SENT, start a timer. Leave R2-SENT if 2948 either the timer expires (allowing for maximal retransmission of 2949 I2s), some data has been received on the incoming HIP 2950 association, or an UPDATE packet has been received (or some 2951 other packet that indicates that the peer has moved to 2952 ESTABLISHED). 2954 8.7.1 Handling malformed messages 2956 If an implementation receives a malformed I2 message, the behaviour 2957 SHOULD depend on how much checks the message has already passed. If 2958 the puzzle solution in the message has already been checked, the 2959 implementation SHOULD report the error by responding with a NOTIFY 2960 packet. Otherwise the implementation MAY respond with an ICMP 2961 message as defined in Section 6.3. 2963 8.8 Processing incoming R2 packets 2965 An R2 received in states UNASSOCIATED, I1-SENT, ESTABLISHED, or 2966 REKEYING results in the R2 being dropped and the state machine 2967 staying in the same state. If an R2 is received in state I2-SENT, it 2968 SHOULD be processed. 2970 The following steps define the conceptual processing rules for 2971 incoming R2 packet: 2972 1. The system MUST verify that the HITs in use correspond to the 2973 HITs that were received in R1. 2974 2. The system MUST verify the HMAC_2 according to the procedures in 2975 Section 6.2.11. 2976 3. The system MUST verify the HIP signature according to the 2977 procedures in Section 6.2.12. 2978 4. If any of the checks above fail, there is a high probability of 2979 an ongoing man-in-the-middle or other security attack. The 2980 system SHOULD act accordingly, based on its local policy. 2981 5. If the system is in any other state than I2-SENT, the R2 is 2982 silently dropped. 2983 6. Upon successful processing of the R2, the state machine moves to 2984 state ESTABLISHED. 2986 8.9 Sending UPDATE packets 2988 A host sends an UPDATE packet when it wants to update some 2989 information related to a HIP association. There are a number of 2990 likely situations, e.g. mobility management and rekeying of an 2991 existing ESP Security Association. The following paragraphs define 2992 the conceptual rules for sending an UPDATE packet to the peer. 2993 Additional steps can be defined in other documents where the UPDATE 2994 packet is used. 2995 1. The system increments its own Update ID value by one. 2996 2. The system creates an UPDATE packet that contains a SEQ parameter 2997 with the current value of Update ID. The UPDATE packet may also 2998 include an ACK of the Update ID found in the received UPDATE SEQ 2999 parameter, if any. 3000 3. The system sends the created UPDATE packet and starts an UPDATE 3001 timer. The default value for the timer is 2 * RTT estimate. 3002 4. If the UPDATE timer expires, the UPDATE is resent. The UPDATE 3003 can be resent UPDATE_RETRY_MAX times. The UPDATE timer SHOULD be 3004 exponentially backed off for subsequent retransmissions. 3006 8.10 Receiving UPDATE packets 3008 When a system receives an UPDATE packet, its processing depends on 3009 the state of the HIP association and the presence of and values of 3010 the SEQ and ACK parameters. Typically, an UPDATE message also 3011 carries optional parameters whose handling is defined in separate 3012 documents. 3014 1. If there is no corresponding HIP association, the implementation 3015 MAY reply with an ICMP Parameter Problem, as specified in 3016 Section 6.3.4. 3018 2. If the association is in the ESTABLISHED state and the SEQ 3019 parameter is present, the UPDATE is processed and replied as 3020 described in Section 8.10.1. 3021 3. Additionally (or alternatively), if the association is in the 3022 ESTABLISHED state and there is an ACK (of outstanding Update ID) 3023 in the UPDATE, the UPDATE is processed as described in 3024 Section 8.10.2. 3026 8.10.1 Handling a SEQ paramaeter in a received UPDATE message 3028 1. If the Update ID in the received SEQ is smaller than the stored 3029 Update ID for the peer host, the packet MUST BE dropped as a 3030 duplicate. 3031 2. If the Update ID in the received SEQ is equal to the stored 3032 Update ID for the host, the packet is treated as a 3033 retransmission. The HMAC verification (next step) MUST NOT be 3034 skipped. (A byte-by-byte comparison of the received and a store 3035 packet would be OK, though.) It is recommended that a host cache 3036 the last packet that was acked to avoid the cost of generating a 3037 new ACK packet to respond to a replayed UPDATE. The system MUST 3038 acknowledge, again, such (apparent) UPDATE message 3039 retransmissions but SHOULD also consider rate-limiting such 3040 retransmission responses to guard against replay attacks. 3041 3. The system MUST verify the HMAC in the UPDATE packet. If the 3042 verification fails, the packet MUST be dropped. 3043 4. The system MAY verify the SIGNATURE in the UPDATE packet. If the 3044 verification fails, the packet SHOULD be dropped and an error 3045 message logged. 3046 5. If a new SEQ parameter is being processed, the system MUST record 3047 the Update ID in the received SEQ parameter, for replay 3048 protection. 3049 6. An UPDATE acknowledgement packet with ACK parameter is prepared 3050 and send to the peer. 3052 8.10.2 Handling an ACK parameter in a received UPDATE packet 3054 1. The UPDATE packet with ACK must match to an earlier sent UPDATE 3055 packet. If no match is found, the packet MUST be dropped. 3056 2. The system MUST verify the HMAC in the UPDATE packet. If the 3057 verification fails, the packet MUST be dropped. 3058 3. The system MAY verify the SIGNATURE in the UPDATE packet. If the 3059 verification fails, the packet SHOULD be dropped and an error 3060 message logged. 3061 4. The corresponding UPDATE timer is stopped (see Section 8.9) so 3062 that the now acknowledged UPDATE is no longer retransmitted. 3064 8.11 Processing CER packets 3066 Processing CER packets is OPTIONAL, and currently undefined. 3068 8.12 Processing NOTIFY packets 3070 Processing NOTIFY packets is OPTIONAL. If processed, any errors 3071 noted by the NOTIFY parameter SHOULD be taken into account by the HIP 3072 state machine (e.g., by terminating a HIP handshake), and the error 3073 SHOULD be logged. 3075 8.13 Processing CLOSE packets 3077 When the host receives a CLOSE message it responds with a CLOSE_ACK 3078 message and moves to CLOSED state. (The authenticity of the CLOSE 3079 message is verified using both HMAC and SIGNATURE). This processing 3080 applies whether or not the HIP association state is CLOSING in order 3081 to handle CLOSE messages from both ends crossing in flight. 3083 The HIP association is not discarded before the host moves from the 3084 UNASSOCIATED state. 3086 Once the closing process has started, any need to send data packets 3087 will trigger creating and establishing of a new HIP association, 3088 starting with sending an I1. 3090 If there is no corresponding HIP association, the implementation MAY 3091 reply to a CLOSE with an ICMP Parameter Problem, as specified in 3092 Section 6.3.4. 3094 8.14 Processing CLOSE_ACK packets 3096 When a host receives a CLOSE_ACK message it verifies that it is in 3097 CLOSING or CLOSED state and that the CLOSE_ACK was in response to the 3098 CLOSE (using the included ECHO_REPLY in response to the sent 3099 ECHO_REQUEST). 3101 The CLOSE_ACK uses HMAC and SIGNATURE for verification. The state is 3102 discarded when the state changes to UNASSOCIATED and, after that, 3103 NOTIFY is sent as a response to a CLOSE message. 3105 8.15 Dropping HIP associations 3107 A HIP implementation is free to drop a HIP association at any time, 3108 based on its own policy. If a HIP host decides to drop a HIP 3109 association, it deletes the corresponding HIP state, including the 3110 keying material. The implementation MUST also drop the peer's R1 3111 generation counter value, unless a local policy explicitly defines 3112 that the value of that particular host is stored. An implementation 3113 MUST NOT store R1 generation counters by default, but storing R1 3114 generation counter values, if done, MUST be configured by explicit 3115 HITs. 3117 9. HIP KEYMAT 3119 HIP keying material is derived from the Diffie-Hellman Kij produced 3120 during the HIP base exchange. The Initiator has Kij during the 3121 creation of the I2 packet, and the Responder has Kij once it receives 3122 the I2 packet. This is why I2 can already contain encrypted 3123 information. 3125 The KEYMAT is derived by feeding Kij and the HITs into the following 3126 operation; the | operation denotes concatenation. 3128 KEYMAT = K1 | K2 | K3 | ... 3129 where 3131 K1 = SHA-1( Kij | sort(HIT-I | HIT-R) | 0x01 ) 3132 K2 = SHA-1( Kij | K1 | 0x02 ) 3133 K3 = SHA-1( Kij | K2 | 0x03 ) 3134 ... 3135 K255 = SHA-1( Kij | K254 | 0xff ) 3136 K256 = SHA-1( Kij | K255 | 0x00 ) 3137 etc. 3139 Sort(HIT-I | HIT-R) is defined as the network byte order 3140 concatenation of the two HITs, with the smaller HIT preceding the 3141 larger HIT, resulting from the numeric comparison of the two HITs 3142 interpreted as positive (unsigned) 128-bit integers in network byte 3143 order. 3145 The initial keys are drawn sequentially in the order that is 3146 determined by the numeric comparison of the two HITs, with comparison 3147 method described in the previous paragraph. HOST_g denotes the host 3148 with the greater HIT value, and HOST_l the host with the lower HIT 3149 value. 3151 The drawing order for initial keys: 3152 HIP-gl encryption key for HOST_g's outgoing HIP packets 3153 HIP-gl integrity (HMAC) key for HOST_g's outgoing HIP packets 3154 HIP-lg encryption key (currently unused) for HOST_l's outgoing HIP 3155 packets 3156 HIP-lg integrity (HMAC) key for HOST_l's outgoing HIP packets 3158 The number of bits drawn for a given algorithm is the "natural" size 3159 of the keys. For the mandatory algorithms, the following sizes 3160 apply: 3161 AES 128 bits 3162 SHA-1 160 bits 3163 NULL 0 bits 3165 10. HIP Fragmentation Support 3167 A HIP implementation must support IP fragmentation / reassembly. 3168 Fragment reassembly MUST be implemented in both IPv4 and IPv6, but 3169 fragment generation MUST be implemented only in IPv4 (IPv4 stacks and 3170 networks will usually do this by default) and SHOULD be implemented 3171 in IPv6. In the IPv6 world, the minimum MTU is larger, 1280 bytes, 3172 than in the IPv4 world. The larger MTU size is usually sufficient 3173 for most HIP packets, and therefore fragment generation may not be 3174 needed. If a host expects to send HIP packets that are larger than 3175 the minimum IPv6 MTU, it MUST implement fragment generation even for 3176 IPv6. 3178 In the IPv4 world, HIP packets may encounter low MTUs along their 3179 routed path. Since HIP does not provide a mechanism to use multiple 3180 IP datagrams for a single HIP packet, support of path MTU discovery 3181 does not bring any value to HIP in the IPv4 world. HIP-aware NAT 3182 systems MUST perform any IPv4 reassembly/fragmentation. 3184 All HIP implementations MUST employ a reassembly algorithm that is 3185 sufficiently resistant against DoS attacks. 3187 11. HIP Policies 3189 There are a number of variables that will influence the HIP exchanges 3190 that each host must support. All HIP implementations MUST support 3191 more than one simultaneous HIs, at least one of which SHOULD be 3192 reserved for anonymous usage. Although anonymous HIs will be rarely 3193 used as responder HIs, they will be common for Initiators. Support 3194 for more than two HIs is RECOMMENDED. 3196 Many Initiators would want to use a different HI for different 3197 Responders. The implementations SHOULD provide for an ACL of 3198 initiator HIT to responder HIT. This ACL SHOULD also include 3199 preferred transform and local lifetimes. For HITs with HAAs, 3200 wildcarding SHOULD be supported. Thus if a Community of Interest, 3201 like Banking, gets an RAA, a single ACL could be used. A global 3202 wildcard would represent the general policy to be used. Policy 3203 selection would be from most specific to most general. 3205 The value of K used in the HIP R1 packet can also vary by policy. K 3206 should never be greater than 20, but for trusted partners it could be 3207 as low as 0. 3209 Responders would need a similar ACL, representing which hosts they 3210 accept HIP exchanges, and the preferred transform and local 3211 lifetimes. Wildcarding SHOULD be supported for this ACL also. 3213 12. Security Considerations 3215 HIP is designed to provide secure authentication of hosts. HIP also 3216 attempts to limit the exposure of the host to various 3217 denial-of-service and man-in-the-middle (MitM) attacks. In so doing, 3218 HIP itself is subject to its own DoS and MitM attacks that 3219 potentially could be more damaging to a host's ability to conduct 3220 business as usual. 3222 Denial-of-service attacks take advantage of the cost of start of 3223 state for a protocol on the Responder compared to the 'cheapness' on 3224 the Initiator. HIP makes no attempt to increase the cost of the 3225 start of state on the Initiator, but makes an effort to reduce the 3226 cost to the Responder. This is done by having the Responder start 3227 the 3-way exchange instead of the Initiator, making the HIP protocol 3228 4 packets long. In doing this, packet 2 becomes a 'stock' packet 3229 that the Responder MAY use many times. The duration of use is a 3230 paranoia versus throughput concern. Using the same Diffie-Hellman 3231 values and random puzzle #I has some risk. This risk needs to be 3232 balanced against a potential storm of HIP I1 packets. 3234 This shifting of the start of state cost to the Initiator in creating 3235 the I2 HIP packet, presents another DoS attack. The attacker spoofs 3236 the I1 HIP packet and the Responder sends out the R1 HIP packet. 3237 This could conceivably tie up the 'initiator' with evaluating the R1 3238 HIP packet, and creating the I2 HIP packet. The defense against this 3239 attack is to simply ignore any R1 packet where a corresponding I1 was 3240 not sent. 3242 A second form of DoS attack arrives in the I2 HIP packet. Once the 3243 attacking Initiator has solved the puzzle, it can send packets with 3244 spoofed IP source addresses with either invalid encrypted HIP payload 3245 component or a bad HIP signature. This would take resources in the 3246 Responder's part to reach the point to discover that the I2 packet 3247 cannot be completely processed. The defense against this attack is 3248 after N bad I2 packets, the Responder would discard any I2s that 3249 contain the given Initiator HIT. Thus will shut down the attack. 3250 The attacker would have to request another R1 and use that to launch 3251 a new attack. The Responder could up the value of K while under 3252 attack. On the downside, valid I2s might get dropped too. 3254 A third form of DoS attack is emulating the restart of state after a 3255 reboot of one of the partners. A host restarting would send an I1 to 3256 a peer, which would respond with an R1 even if it were in the 3257 ESTABLISHED state. If the I1 were spoofed, the resulting R1 would be 3258 received unexpectedly by the spoofed host and would be dropped, as in 3259 the first case above. 3261 A fourth form of DoS attack is emulating the end of state. HIP 3262 relies on timers plus a CLOSE/CLOSE_ACK handshake to explicitly 3263 signals the end of a state. Because both CLOSE and CLOSE_ACK 3264 messages contain an HMAC, an outsider cannot close a connection. The 3265 presence of an additional SIGNATURE allows middle-boxes to inspect 3266 these messages and discard the associated state (for e.g., 3267 firewalling, SPI-based NATing, etc.). However, the optional behavior 3268 of replying to CLOSE with an ICMP Parameter Problem packet (as 3269 described in Section 6.3.4) might allow an IP spoofer sending CLOSE 3270 messages to launch reflection attacks. 3272 A fifth form of DoS attack is replaying R1s to cause the initiator to 3273 solve stale puzzles and become out of synchronization with the 3274 responder. The R1 generation counter is a monotonically increasing 3275 counter designed to protect against this attack, as described in 3276 section Section 4.1.3. 3278 Man-in-the-middle attacks are difficult to defend against, without 3279 third-party authentication. A skillful MitM could easily handle all 3280 parts of HIP; but HIP indirectly provides the following protection 3281 from a MitM attack. If the Responder's HI is retrieved from a signed 3282 DNS zone, a certificate, or through some other secure means, the 3283 Initiator can use this to validate the R1 HIP packet. 3285 Likewise, if the Initiator's HI is in a secure DNS zone, a trusted 3286 certificate, or otherwise securely available, the Responder can 3287 retrieve it after it gets the I2 HIP packet and validate that. 3288 However, since an Initiator may choose to use an anonymous HI, it 3289 knowingly risks a MitM attack. The Responder may choose not to 3290 accept a HIP exchange with an anonymous Initiator. 3292 If an initiator wants to use opportunistic mode, it is vulnerable to 3293 man-in-the-middle attacks. Furthermore, the available HI types are 3294 limited to the MUST implement algorithms, as per Section 3. Hence, 3295 if a future specification deprecates the current MUST implement 3296 algorithm(s) and replaces it (them) with some new one(s), backward 3297 compatibility cannot be preserved. 3299 Since not all hosts will ever support HIP, ICMP 'Destination Protocol 3300 Unreachable' are to be expected and present a DoS attack. Against an 3301 Initiator, the attack would look like the Responder does not support 3302 HIP, but shortly after receiving the ICMP message, the Initiator 3303 would receive a valid R1 HIP packet. Thus to protect from this 3304 attack, an Initiator should not react to an ICMP message until a 3305 reasonable delta time to get the real Responder's R1 HIP packet. A 3306 similar attack against the Responder is more involved. First an ICMP 3307 message is expected if the I1 was a DoS attack and the real owner of 3308 the spoofed IP address does not support HIP. The Responder SHOULD 3309 NOT act on this ICMP message to remove the minimal state from the R1 3310 HIP packet (if it has one), but wait for either a valid I2 HIP packet 3311 or the natural timeout of the R1 HIP packet. This is to allow for a 3312 sophisticated attacker that is trying to break up the HIP exchange. 3313 Likewise, the Initiator should ignore any ICMP message while waiting 3314 for an R2 HIP packet, deleting state only after a natural timeout. 3316 13. IANA Considerations 3318 IANA has assigned IP Protocol number TBD to HIP. 3320 IANA needs to create registries for: 3321 1. HIP packet types 3322 2. HIP parameter types 3324 14. Acknowledgments 3326 The drive to create HIP came to being after attending the MALLOC 3327 meeting at the 43rd IETF meeting. Baiju Patel and Hilarie Orman 3328 really gave the original author, Bob Moskowitz, the assist to get HIP 3329 beyond 5 paragraphs of ideas. It has matured considerably since the 3330 early drafts thanks to extensive input from IETFers. Most 3331 importantly, its design goals are articulated and are different from 3332 other efforts in this direction. Particular mention goes to the 3333 members of the NameSpace Research Group of the IRTF. Noel Chiappa 3334 provided the framework for LSIs and Keith Moore the impetus to 3335 provide resolvability. Steve Deering provided encouragement to keep 3336 working, as a solid proposal can act as a proof of ideas for a 3337 research group. 3339 Many others contributed; extensive security tips were provided by 3340 Steve Bellovin. Rob Austein kept the DNS parts on track. Paul 3341 Kocher taught Bob Moskowitz how to make the cookie exchange expensive 3342 for the Initiator to respond, but easy for the Responder to validate. 3343 Bill Sommerfeld supplied the Birthday concept, which later evolved 3344 into the R1 generation counter, to simplify reboot management. 3345 Rodney Thayer and Hugh Daniels provide extensive feedback. In the 3346 early times of this draft, John Gilmore kept Bob Moskowitz challenged 3347 to provide something of value. 3349 During the later stages of this document, when the editing baton was 3350 transfered to Pekka Nikander, the input from the early implementors 3351 were invaluable. Without having actual implementations, this 3352 document would not be on the level it is now. 3354 In the usual IETF fashion, a large number of people have contributed 3355 to the actual text or ideas. The list of these people include Jeff 3356 Ahrenholz, Francis Dupont, Derek Fawcus, George Gross, Andrew 3357 McGregor, Julien Laganier, Miika Komu, Mika Kousa, Jan Melen, Henrik 3358 Petander, Michael Richardson, Tim Shepard, Jorma Wall, and Jukka 3359 Ylitalo. Our apologies to anyone whose name is missing. 3361 Once the HIP Working Group was founded in early 2004, a number of 3362 changes were introduced through the working group process. Most 3363 notably, the original draft was split in two, one containing the base 3364 exchange and the other one defining how to use ESP. 3366 15. References 3368 15.1 Normative references 3370 [1] Postel, J., "User Datagram Protocol", STD 6, RFC 768, August 3371 1980. 3373 [2] Postel, J., "Internet Control Message Protocol", STD 5, 3374 RFC 792, September 1981. 3376 [3] Mockapetris, P., "Domain names - implementation and 3377 specification", STD 13, RFC 1035, November 1987. 3379 [4] Conta, A. and S. Deering, "Internet Control Message Protocol 3380 (ICMPv6) for the Internet Protocol Version 6 (IPv6)", RFC 1885, 3381 December 1995. 3383 [5] Bradner, S., "Key words for use in RFCs to Indicate Requirement 3384 Levels", BCP 14, RFC 2119, March 1997. 3386 [6] Madson, C. and R. Glenn, "The Use of HMAC-SHA-1-96 within ESP 3387 and AH", RFC 2404, November 1998. 3389 [7] Maughan, D., Schneider, M. and M. Schertler, "Internet Security 3390 Association and Key Management Protocol (ISAKMP)", RFC 2408, 3391 November 1998. 3393 [8] Harkins, D. and D. Carrel, "The Internet Key Exchange (IKE)", 3394 RFC 2409, November 1998. 3396 [9] Orman, H., "The OAKLEY Key Determination Protocol", RFC 2412, 3397 November 1998. 3399 [10] Pereira, R. and R. Adams, "The ESP CBC-Mode Cipher Algorithms", 3400 RFC 2451, November 1998. 3402 [11] Deering, S. and R. Hinden, "Internet Protocol, Version 6 (IPv6) 3403 Specification", RFC 2460, December 1998. 3405 [12] Eastlake, D., "Domain Name System Security Extensions", 3406 RFC 2535, March 1999. 3408 [13] Eastlake, D., "DSA KEYs and SIGs in the Domain Name System 3409 (DNS)", RFC 2536, March 1999. 3411 [14] Eastlake, D., "RSA/SHA-1 SIGs and RSA KEYs in the Domain Name 3412 System (DNS)", RFC 3110, May 2001. 3414 [15] Housley, R., Polk, W., Ford, W. and D. Solo, "Internet X.509 3415 Public Key Infrastructure Certificate and Certificate 3416 Revocation List (CRL) Profile", RFC 3280, April 2002. 3418 [16] Draves, R., "Default Address Selection for Internet Protocol 3419 version 6 (IPv6)", RFC 3484, February 2003. 3421 [17] Hinden, R. and S. Deering, "Internet Protocol Version 6 (IPv6) 3422 Addressing Architecture", RFC 3513, April 2003. 3424 [18] Kivinen, T. and M. Kojo, "More Modular Exponential (MODP) 3425 Diffie-Hellman groups for Internet Key Exchange (IKE)", 3426 RFC 3526, May 2003. 3428 [19] Kent, S., "IP Encapsulating Security Payload (ESP)", 3429 Internet-Draft draft-ietf-ipsec-esp-v3-05, April 2003. 3431 [20] Kaufman, C., "Internet Key Exchange (IKEv2) Protocol", 3432 Internet-Draft draft-ietf-ipsec-ikev2-07, April 2003. 3434 [21] Moskowitz, R., "Host Identity Protocol Architecture", 3435 Internet-Draft draft-moskowitz-hip-arch-03, May 2003. 3437 [22] NIST, "FIPS PUB 180-1: Secure Hash Standard", April 1995. 3439 [23] Jokela, P., Moskowitz, R. and P. Nikander, "Using ESP transport 3440 format with HIP", Internet-Draft draft-jokela-hip-esp-00, 3441 January 2005. 3443 15.2 Informative references 3445 [24] Bellovin, S. and W. Aiello, "Just Fast Keying (JFK)", 3446 Internet-Draft draft-ietf-ipsec-jfk-04, July 2002. 3448 [25] Moskowitz, R. and P. Nikander, "Using Domain Name System (DNS) 3449 with Host Identity Protocol (HIP)", 3450 Internet-Draft draft-nikander-hip-dns-00 (to be issued), June 3451 2003. 3453 [26] Nikander, P., "SPI assisted NAT traversal (SPINAT) with Host 3454 Identity Protocol (HIP)", 3455 Internet-Draft draft-nikander-hip-nat-00 (to be issued), June 3456 2003. 3458 [27] Crosby, SA. and DS. Wallach, "Denial of Service via Algorithmic 3459 Complexity Attacks", in Proceedings of Usenix Security 3460 Symposium 2003, Washington, DC., August 2003. 3462 [28] Nikander, P., "A Bound End-to-End Tunnel (BEET) mode for ESP", 3463 Internet-Draft draft-nikander-esp-beet-mode-00 (expired), Oct 3464 2003. 3466 [29] Henderson, T., "Using HIP with Legacy Applications", 3467 Internet-Draft draft-henderson-hip-applications-00.txt, Feb 3468 2005. 3470 Authors' Addresses 3472 Robert Moskowitz 3473 ICSAlabs, a Division of TruSecure Corporation 3474 1000 Bent Creek Blvd, Suite 200 3475 Mechanicsburg, PA 3476 USA 3478 Email: rgm@icsalabs.com 3480 Pekka Nikander 3481 Ericsson Research NomadicLab 3482 JORVAS FIN-02420 3483 FINLAND 3485 Phone: +358 9 299 1 3486 Email: pekka.nikander@nomadiclab.com 3488 Petri Jokela 3489 Ericsson Research NomadicLab 3490 JORVAS FIN-02420 3491 FINLAND 3493 Phone: +358 9 299 1 3494 Email: petri.jokela@nomadiclab.com 3496 Thomas R. Henderson 3497 The Boeing Company 3498 P.O. Box 3707 3499 Seattle, WA 3500 USA 3502 Email: thomas.r.henderson@boeing.com 3504 Appendix A. Probabilities of HIT collisions 3506 The birthday paradox sets a bound for the expectation of collisions. 3507 It is based on the square root of the number of values. A 64-bit 3508 hash, then, would put the chances of a collision at 50-50 with 2^32 3509 hosts (4 billion). A 1% chance of collision would occur in a 3510 population of 640M and a .001% collision chance in a 20M population. 3511 A 128 bit hash will have the same .001% collision chance in a 9x10^16 3512 population. 3514 Appendix B. Probabilities in the cookie calculation 3516 A question: Is it guaranteed that the Initiator is able to solve the 3517 puzzle in this way when the K value is large? 3519 Answer: No, it is not guaranteed. But it is not guaranteed even in 3520 the old mechanism, since the Initiator may start far away from J and 3521 arrive to J after far too many steps. If we wanted to make sure that 3522 the Initiator finds a value, we would need to give some hint of a 3523 suitable J, and I don't think we want to do that. 3525 In general, if we model the hash function with a random function, the 3526 probability that one iteration gives are result with K zero bits is 3527 2^-K. Thus, the probability that one iteration does _not_ give K 3528 zero bits is (1 - 2^-K). Consequently, the probability that 2^K 3529 iterations does not give K zero bits is (1 - 2^-K)^(2^K). 3531 Since my calculus starts to be rusty, I made a small experiment and 3532 found out that 3534 lim (1 - 2^-k)^(2^k) = 0.36788 3535 k->inf 3537 lim (1 - 2^-k)^(2^(k+1)) = 0.13534 3538 k->inf 3540 lim (1 - 2^-k)^(2^(k+2)) = 0.01832 3541 k->inf 3543 lim (1 - 2^-k)^(2^(k+3)) = 0.000335 3544 k->inf 3546 Thus, if hash functions were random functions, we would need about 3547 2^(K+3) iterations to make sure that the probability of a failure is 3548 less than 1% (actually less than 0.04%). Now, since my perhaps 3549 flawed understanding of hash functions is that they are "flatter" 3550 than random functions, 2^(K+3) is probably an overkill. OTOH, the 3551 currently suggested 2^K is clearly too little. 3553 Appendix C. Using responder cookies 3555 As mentioned in Section 4.1.1, the Responder may delay state creation 3556 and still reject most spoofed I2s by using a number of pre-calculated 3557 R1s and a local selection function. This appendix defines one 3558 possible implementation in detail. The purpose of this appendix is 3559 to give the implementors an idea on how to implement the mechanism. 3560 The method described in this appendix SHOULD NOT be used in any real 3561 implementation. If the implementation is based on this appendix, it 3562 SHOULD contain some local modification that makes an attacker's task 3563 harder. 3565 The basic idea is to create a cheap, varying local mapping function 3566 f: 3568 f( IP-I, IP-R, HIT-I, HIT-R ) -> cookie-index 3570 That is, given the Initiator's and Responder's IP addresses and 3571 HITs, the function returns an index to a cookie. When processing an 3572 I1, the cookie is embedded in an pre-computed R1, and the Responder 3573 simply sends that particular R1 to the Initiator. When processing an 3574 I2, the cookie may still be embedded in the R1, or the R1 may be 3575 deprecated (and replaced with a new one), but the cookie is still 3576 there. If the received cookie does not match with the R1 or saved 3577 cookie, the I2 is simply dropped. That prevents the Initiator from 3578 generating spoofed I2s with a probability that depends on the number 3579 of pre-computed R1s. 3581 As a concrete example, let us assume that the Responder has an array 3582 of R1s. Each slot in the array contains a timestamp, an R1, and an 3583 old cookie that was sent in the previous R1 that occupied that 3584 particular slot. The Responder replaces one R1 in the array every 3585 few minutes, thereby replacing all the R1s gradually. 3587 To create a varying mapping function, the Responder generates a 3588 random number every few minutes. The octets in the IP addresses and 3589 HITs are XORed together, and finally the result is XORed with the 3590 random number. Using pseudo-code, the function looks like the 3591 following. 3593 Pre-computation: 3594 r1 := random number 3596 Index computation: 3597 index := r1 XOR hit_r[0] XOR hit_r[1] XOR ... XOR hit_r[15] 3598 index := index XOR hit_i[0] XOR hit_i[1] XOR ... XOR hit_i[15] 3599 index := index XOR ip_r[0] XOR ip_r[1] XOR ... XOR ip_r[15] 3600 index := index XOR ip_i[0] XOR ip_i[1] XOR ... XOR ip_i[15] 3602 The index gives the slot used in the array. 3604 It is possible that an Initiator receives an I1, and while it is 3605 computing I2, the Responder deprecates an R1 and/or chooses a new 3606 random number for the mapping function. Therefore the Responder must 3607 remember the cookies used in deprecated R1s and the previous random 3608 number. 3610 To check an received I2, the Responder can use a simple algorithm, 3611 expressed in pseudo-code as follows. 3613 If I2.hit_r does not match my_hits, drop the packet. 3615 index := compute_index(current_random_number, I2) 3616 If current_cookie[index] == I2.cookie, go to cookie check. 3617 If previous_cookie[index] == I2.cookie, go to cookie check. 3619 index := compute_index(previous_random_number, I2) 3620 If current_cookie[index] == I2.cookie, go to cookie check. 3621 If previous_cookie[index] == I2.cookie, go to cookie check. 3623 Drop packet. 3625 cookie_check: 3626 V := Ltrunc( SHA-1( I2.I, I2.hit_i, I2.hit_r, I2.J ), K ) 3627 if V != 0, drop the packet. 3629 Whenever the Responder receives an I2 that fails on the index check, 3630 it can simply drop the packet on the floor and forget about it. New 3631 I2s with the same or other spoofed parameters will get dropped with a 3632 reasonable probability and minimal effort. 3634 If a Responder receives an I2 that passes the index check but fails 3635 on the puzzle check, it should create a state indicating this. After 3636 two or three failures the Responder should cease checking the puzzle 3637 but drop the packets directly. This saves the Responder from the 3638 SHA-1 calculations. Such block should not last long, however, or 3639 there would be a danger that a legitimate Initiator could be blocked 3640 from getting connections. 3642 A key for the success of the defined scheme is that the mapping 3643 function must be considerably cheaper than computing SHA-1. It also 3644 must detect any changes in the IP addresses, and preferably most 3645 changes in the HITs. Checking the HITs is not that essential, 3646 though, since HITs are included in the cookie computation, too. 3648 The effectivity of the method can be varied by varying the size of 3649 the array containing pre-computed R1s. If the array is large, the 3650 probability that an I2 with a spoofed IP address or HIT happens to 3651 map to the same slot is fairly slow. However, a large array means 3652 that each R1 has a fairly long life time, thereby allowing an 3653 attacker to utilize one solved puzzle for a longer time. 3655 Appendix D. Example checksums for HIP packets 3657 The HIP checksum for HIP packets is specified in Section 6.1.2. 3658 Checksums for TCP and UDP packets running over HIP-enabled security 3659 associations are specified in Section 3.5. The examples below use IP 3660 addresses of 192.168.0.1 and 192.168.0.2 (and their respective 3661 IPv4-compatible IPv6 formats), and type 1 HITs with the first two 3662 bits "01" followed by 124 zeroes followed by a decimal 1 or 2, 3663 respectively. 3665 D.1 IPv6 HIP example (I1) 3667 Source Address: ::c0a8:0001 3668 Destination Address: ::c0a8:0002 3669 Upper-Layer Packet Length: 40 0x28 3670 Next Header: 99 0x63 3671 Payload Protocol: 59 0x3b 3672 Header Length: 4 0x04 3673 Packet Type: 1 0x01 3674 Version: 1 0x1 3675 Reserved: 0 0x0 3676 Control: 0 0x0000 3677 Checksum: 49672 0xc208 3678 Sender's HIT: 4000::0001 3679 Receiver's HIT: 4000::0002 3681 D.2 IPv4 HIP packet (I1) 3683 The IPv4 checksum value for the same example I1 packet is the same as 3684 the IPv6 checksum (since the checksums due to the IPv4 and IPv6 3685 pseudo-header components are the same). 3687 D.3 TCP segment 3689 Regardless of whether IPv6 or IPv4 is used, the TCP and UDP sockets 3690 use the IPv6 pseudo-header format [8], with the HITs used in place of 3691 the IPv6 addresses. 3693 Sender's HIT: 4000::0001 3694 Receiver's HIT: 4000::0002 3695 Upper-Layer Packet Length: 20 0x14 3696 Next Header: 6 0x06 3697 Source port: 32769 0x8001 3698 Destination port: 22 0x0016 3699 Sequence number: 1 0x00000001 3700 Acknowledgment number: 0 0x00000000 3701 Header length: 20 0x14 3702 Flags: SYN 0x02 3703 Window size: 5840 0x16d0 3704 Checksum: 54519 0xd4f7 3705 Urgent pointer: 0 0x0000 3707 Appendix E. 384-bit group 3709 This 384-bit group is defined only to be used with HIP. NOTE: The 3710 security level of this group is very low! The encryption may be 3711 broken in a very short time, even real-time. It should be used only 3712 when the host is not powerful enough (e.g. some PDAs) and when 3713 security requirements are low (e.g. during normal web surfing). 3715 This prime is: 2^384 - 2^320 - 1 + 2^64 * { [ 2^254 pi] + 5857 } 3717 Its hexadecimal value is: 3719 FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 3720 29024E08 8A67CC74 020BBEA6 3B13B202 FFFFFFFF FFFFFFFF 3722 The generator is: 2. 3724 Intellectual Property Statement 3726 The IETF takes no position regarding the validity or scope of any 3727 Intellectual Property Rights or other rights that might be claimed to 3728 pertain to the implementation or use of the technology described in 3729 this document or the extent to which any license under such rights 3730 might or might not be available; nor does it represent that it has 3731 made any independent effort to identify any such rights. Information 3732 on the procedures with respect to rights in RFC documents can be 3733 found in BCP 78 and BCP 79. 3735 Copies of IPR disclosures made to the IETF Secretariat and any 3736 assurances of licenses to be made available, or the result of an 3737 attempt made to obtain a general license or permission for the use of 3738 such proprietary rights by implementers or users of this 3739 specification can be obtained from the IETF on-line IPR repository at 3740 http://www.ietf.org/ipr. 3742 The IETF invites any interested party to bring to its attention any 3743 copyrights, patents or patent applications, or other proprietary 3744 rights that may cover technology that may be required to implement 3745 this standard. Please address the information to the IETF at 3746 ietf-ipr@ietf.org. 3748 Disclaimer of Validity 3750 This document and the information contained herein are provided on an 3751 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 3752 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET 3753 ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, 3754 INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE 3755 INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 3756 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 3758 Copyright Statement 3760 Copyright (C) The Internet Society (2005). This document is subject 3761 to the rights, licenses and restrictions contained in BCP 78, and 3762 except as set forth therein, the authors retain all their rights. 3764 Acknowledgment 3766 Funding for the RFC Editor function is currently provided by the 3767 Internet Society.