Network Working Group R. Moskowitz Internet-Draft ICSAlabs, a Division of TruSecure Expires: April 25, 2005 Corporation P. Nikander P. Jokela (editor) Ericsson Research NomadicLab T. Henderson The Boeing Company October 25, 2004 Host Identity Protocol draft-ietf-hip-base-01 Status of this Memo By submitting this Internet-Draft, I certify that any applicable patent or other IPR claims of which I am aware have been disclosed, and any of which I become aware will be disclosed, in accordance with RFC 3668. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet-Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." The list of current Internet-Drafts can be accessed at http:// www.ietf.org/ietf/1id-abstracts.txt. The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. This Internet-Draft will expire on April 25, 2005. Copyright Notice Copyright (C) The Internet Society (2004). All Rights Reserved. Abstract This memo specifies the details of the Host Identity Protocol (HIP). The overall description of protocol and the underlying architectural thinking is available in the separate HIP architecture specification. The Host Identity Protocol is used to establish a rapid authentication between two hosts and to provide continuity of Moskowitz, et al. Expires April 25, 2005 [Page 1] Internet-Draft Host Identity Protocol October 2004 communications between those hosts independent of the networking layer. The various forms of the Host Identity, Host Identity Tag (HIT) and Local Scope Identifier (LSI), are covered in detail. It is described how they are used to support authentication and the establishment of keying material, which is then used by IPsec Encapsulated Security payload (ESP) to establish a two-way secured communication channel between the hosts. The basic state machine for HIP provides a HIP compliant host with the resiliency to avoid many denial-of-service (DoS)attacks. The basic HIP exchange for two public hosts shows the actual packet flow. Other HIP exchanges, including those that work across NATs are covered elsewhere. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 5 1.1 A new name space and identifiers . . . . . . . . . . . . . 5 1.2 The HIP protocol . . . . . . . . . . . . . . . . . . . . . 5 2. Conventions used in this document . . . . . . . . . . . . . 7 3. Host Identifier (HI) and its representations . . . . . . . . 8 3.1 Host Identity Tag (HIT) . . . . . . . . . . . . . . . . . 8 3.1.1 Generating a HIT from a HI . . . . . . . . . . . . . . 9 3.2 Local Scope Identifier (LSI) . . . . . . . . . . . . . . . 11 3.3 Security Parameter Index (SPI) . . . . . . . . . . . . . . 11 4. Host Identity Protocol . . . . . . . . . . . . . . . . . . . 13 4.1 HIP base exchange . . . . . . . . . . . . . . . . . . . . 13 4.1.1 HIP Cookie Mechanism . . . . . . . . . . . . . . . . . 14 4.1.2 Authenticated Diffie-Hellman protocol . . . . . . . . 17 4.1.3 HIP replay protection . . . . . . . . . . . . . . . . 18 4.2 TCP and UDP pseudo-header computation . . . . . . . . . . 19 4.3 Updating a HIP association . . . . . . . . . . . . . . . . 19 4.4 Error processing . . . . . . . . . . . . . . . . . . . . . 19 4.5 Certificate distribution . . . . . . . . . . . . . . . . . 19 4.6 Sending data on HIP packets . . . . . . . . . . . . . . . 20 5. HIP protocol overview . . . . . . . . . . . . . . . . . . . 21 5.1 HIP Scenarios . . . . . . . . . . . . . . . . . . . . . . 21 5.2 Refusing a HIP exchange . . . . . . . . . . . . . . . . . 22 5.3 Reboot and SA timeout restart of HIP . . . . . . . . . . . 22 5.4 HIP State Machine . . . . . . . . . . . . . . . . . . . . 23 5.4.1 HIP States . . . . . . . . . . . . . . . . . . . . . . 23 5.4.2 HIP State Processes . . . . . . . . . . . . . . . . . 23 5.4.3 Simplified HIP State Diagram . . . . . . . . . . . . . 27 6. Packet formats . . . . . . . . . . . . . . . . . . . . . . . 29 6.1 Payload format . . . . . . . . . . . . . . . . . . . . . . 29 6.1.1 HIP Controls . . . . . . . . . . . . . . . . . . . . . 30 6.1.2 Checksum . . . . . . . . . . . . . . . . . . . . . . . 30 6.2 HIP parameters . . . . . . . . . . . . . . . . . . . . . . 31 Moskowitz, et al. Expires April 25, 2005 [Page 2] Internet-Draft Host Identity Protocol October 2004 6.2.1 TLV format . . . . . . . . . . . . . . . . . . . . . . 32 6.2.2 Defining new parameters . . . . . . . . . . . . . . . 33 6.2.3 SPI . . . . . . . . . . . . . . . . . . . . . . . . . 34 6.2.4 R1_COUNTER . . . . . . . . . . . . . . . . . . . . . . 35 6.2.5 PUZZLE . . . . . . . . . . . . . . . . . . . . . . . . 36 6.2.6 SOLUTION . . . . . . . . . . . . . . . . . . . . . . . 37 6.2.7 DIFFIE_HELLMAN . . . . . . . . . . . . . . . . . . . . 38 6.2.8 HIP_TRANSFORM . . . . . . . . . . . . . . . . . . . . 39 6.2.9 ESP_TRANSFORM . . . . . . . . . . . . . . . . . . . . 39 6.2.10 HOST_ID . . . . . . . . . . . . . . . . . . . . . . 40 6.2.11 CERT . . . . . . . . . . . . . . . . . . . . . . . . 41 6.2.12 HMAC . . . . . . . . . . . . . . . . . . . . . . . . 42 6.2.13 HMAC_2 . . . . . . . . . . . . . . . . . . . . . . . 42 6.2.14 HIP_SIGNATURE . . . . . . . . . . . . . . . . . . . 43 6.2.15 HIP_SIGNATURE_2 . . . . . . . . . . . . . . . . . . 44 6.2.16 NES . . . . . . . . . . . . . . . . . . . . . . . . 44 6.2.17 SEQ . . . . . . . . . . . . . . . . . . . . . . . . 45 6.2.18 ACK . . . . . . . . . . . . . . . . . . . . . . . . 46 6.2.19 ENCRYPTED . . . . . . . . . . . . . . . . . . . . . 47 6.2.20 NOTIFY . . . . . . . . . . . . . . . . . . . . . . . 48 6.2.21 ECHO_REQUEST . . . . . . . . . . . . . . . . . . . . 51 6.2.22 ECHO_RESPONSE . . . . . . . . . . . . . . . . . . . 52 6.3 ICMP messages . . . . . . . . . . . . . . . . . . . . . . 52 6.3.1 Invalid Version . . . . . . . . . . . . . . . . . . . 52 6.3.2 Other problems with the HIP header and packet structure . . . . . . . . . . . . . . . . . . . . . . 53 6.3.3 Unknown SPI . . . . . . . . . . . . . . . . . . . . . 53 6.3.4 Invalid Cookie Solution . . . . . . . . . . . . . . . 53 6.3.5 Non-existing HIP association . . . . . . . . . . . . . 53 7. HIP Packets . . . . . . . . . . . . . . . . . . . . . . . . 54 7.1 I1 - the HIP initiator packet . . . . . . . . . . . . . . 54 7.2 R1 - the HIP responder packet . . . . . . . . . . . . . . 55 7.3 I2 - the second HIP initiator packet . . . . . . . . . . . 56 7.4 R2 - the second HIP responder packet . . . . . . . . . . . 58 7.5 CER - the HIP Certificate Packet . . . . . . . . . . . . . 58 7.6 UPDATE - the HIP Update Packet . . . . . . . . . . . . . . 59 7.7 NOTIFY - the HIP Notify Packet . . . . . . . . . . . . . . 60 7.8 CLOSE - the HIP association closing packet . . . . . . . . 60 7.9 CLOSE_ACK - the HIP closing acknowledgment packet . . . . 61 8. Packet processing . . . . . . . . . . . . . . . . . . . . . 62 8.1 Processing outgoing application data . . . . . . . . . . . 62 8.2 Processing incoming application data . . . . . . . . . . . 63 8.3 HMAC and SIGNATURE calculation and verification . . . . . 64 8.3.1 HMAC calculation . . . . . . . . . . . . . . . . . . . 64 8.3.2 Signature calculation . . . . . . . . . . . . . . . . 64 8.4 Initiation of a HIP exchange . . . . . . . . . . . . . . . 65 8.4.1 Sending multiple I1s in parallel . . . . . . . . . . . 66 8.4.2 Processing incoming ICMP Protocol Unreachable Moskowitz, et al. Expires April 25, 2005 [Page 3] Internet-Draft Host Identity Protocol October 2004 messages . . . . . . . . . . . . . . . . . . . . . . . 66 8.5 Processing incoming I1 packets . . . . . . . . . . . . . . 67 8.5.1 R1 Management . . . . . . . . . . . . . . . . . . . . 67 8.5.2 Handling malformed messages . . . . . . . . . . . . . 68 8.6 Processing incoming R1 packets . . . . . . . . . . . . . . 68 8.6.1 Handling malformed messages . . . . . . . . . . . . . 70 8.7 Processing incoming I2 packets . . . . . . . . . . . . . . 70 8.7.1 Handling malformed messages . . . . . . . . . . . . . 71 8.8 Processing incoming R2 packets . . . . . . . . . . . . . . 72 8.9 Dropping HIP associations . . . . . . . . . . . . . . . . 72 8.10 Initiating rekeying . . . . . . . . . . . . . . . . . . 72 8.11 Processing UPDATE packets . . . . . . . . . . . . . . . 74 8.11.1 Processing an UPDATE packet in state ESTABLISHED . . 75 8.11.2 Processing an UPDATE packet in state REKEYING . . . 75 8.11.3 Leaving REKEYING state . . . . . . . . . . . . . . . 76 8.12 Processing CER packets . . . . . . . . . . . . . . . . . 76 8.13 Processing NOTIFY packets . . . . . . . . . . . . . . . 76 8.14 Processing CLOSE packets . . . . . . . . . . . . . . . . 77 8.15 Processing CLOSE_ACK packets . . . . . . . . . . . . . . 77 9. HIP KEYMAT . . . . . . . . . . . . . . . . . . . . . . . . . 78 10. HIP Fragmentation Support . . . . . . . . . . . . . . . . . 80 11. ESP with HIP . . . . . . . . . . . . . . . . . . . . . . . . 81 11.1 ESP Security Associations . . . . . . . . . . . . . . . 81 11.2 Updating ESP SAs during rekeying . . . . . . . . . . . . 81 11.3 Security Association Management . . . . . . . . . . . . 82 11.4 Security Parameter Index (SPI) . . . . . . . . . . . . . 82 11.5 Supported Transforms . . . . . . . . . . . . . . . . . . 82 11.6 Sequence Number . . . . . . . . . . . . . . . . . . . . 83 12. HIP Policies . . . . . . . . . . . . . . . . . . . . . . . . 84 13. Security Considerations . . . . . . . . . . . . . . . . . . 85 14. IANA Considerations . . . . . . . . . . . . . . . . . . . . 88 15. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . 89 16. References . . . . . . . . . . . . . . . . . . . . . . . . . 90 16.1 Normative references . . . . . . . . . . . . . . . . . . . 90 16.2 Informative references . . . . . . . . . . . . . . . . . . 91 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . 92 A. API issues . . . . . . . . . . . . . . . . . . . . . . . . . 93 B. Probabilities of HIT collisions . . . . . . . . . . . . . . 95 C. Probabilities in the cookie calculation . . . . . . . . . . 96 D. Using responder cookies . . . . . . . . . . . . . . . . . . 97 E. Running HIP over IPv4 UDP . . . . . . . . . . . . . . . . . 100 F. Example checksums for HIP packets . . . . . . . . . . . . . 101 F.1 IPv6 HIP example (I1) . . . . . . . . . . . . . . . . . . 101 F.2 IPv4 HIP packet (I1) . . . . . . . . . . . . . . . . . . . 101 F.3 TCP segment . . . . . . . . . . . . . . . . . . . . . . . 101 G. 384-bit group . . . . . . . . . . . . . . . . . . . . . . . 103 Intellectual Property and Copyright Statements . . . . . . . 104 Moskowitz, et al. Expires April 25, 2005 [Page 4] Internet-Draft Host Identity Protocol October 2004 1. Introduction The Host Identity Protocol (HIP) provides a rapid exchange of Host Identities between two hosts. The exchange also establishes a pair IPsec Security Associations (SA), to be used with IPsec Encapsulated Security Payload (ESP) [19]. The HIP protocol is designed to be resistant to Denial-of-Service (DoS) and Man-in-the-middle (MitM) attacks, and when used to enable ESP, provides DoS and MitM protection for upper layer protocols, such as TCP and UDP. 1.1 A new name space and identifiers The Host Identity Protocol introduces a new namespace, the Host Identity. The effects of this change are explained in the companion document, the HIP architecture [21] specification. There are two main representations of the Host Identity, the full Host Identifier (HI) and the Host Identity Tag (HIT). The HI is a public key and directly represents the Identity. Since there are different public key algorithms that can be used with different key lengths, the HI is not good for using as a packet identifier, or as a index into the various operational tables needed to support HIP. Consequently, a hash of the HI, the Host Identity Tag (HIT), becomes the operational representation. It is 128 bits long and is used in the HIP payloads and to index the corresponding state in the end hosts. 1.2 The HIP protocol The base HIP exchange consists of four packets. The four-packet design helps to make HIP DoS resilient. The protocol exchanges Diffie-Hellman keys in the 2nd and 3rd packets, and authenticates the parties in the 3rd and 4th packets. Additionally, it starts the cookie exchange in the 2nd packet, completing it in the 3rd packet. The exchange uses the Diffie-Hellman exchange to hide the Host Identity of the Initiator in packet 3. The Responder's Host Identity is not protected. It should be noted, however, that both the Initiator's and the Responder's HITs are transported as such (in cleartext) in the packets, allowing an eavesdropper with a priori knowledge about the parties to verify their identities. Data packets start after the 4th packet. The 3rd and 4th HIP packets may carry a data payload in the future. However, the details of this are to be defined later as more implementation experience is gained. Finally, HIP is designed as an end-to-end authentication and key establishment protocol. It lacks much of the fine-grained policy Moskowitz, et al. Expires April 25, 2005 [Page 5] Internet-Draft Host Identity Protocol October 2004 control found in Internet Key Exchange IKE RFC2409 [8] that allows IKE to support complex gateway policies. Thus, HIP is not a complete replacement for IKE. Moskowitz, et al. Expires April 25, 2005 [Page 6] Internet-Draft Host Identity Protocol October 2004 2. Conventions used in this document The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC2119 [5]. Moskowitz, et al. Expires April 25, 2005 [Page 7] Internet-Draft Host Identity Protocol October 2004 3. Host Identifier (HI) and its representations A public key of an asymmetric key pair is used as the Host Identifier (HI). Correspondingly, the host itself is the entity that holds the private key from the key pair. See the HIP architecture specification [21] for more details about the difference between an identity and the corresponding identifier. HIP implementations MUST support the Rivest Shamir Adelman (RSA) [14] public key algorithm, and SHOULD support the Digital Signature Algorithm (DSA) [13] algorithm; other algorithms MAY be supported. A hash of the HI, the Host Identity Tag (HIT), is used in protocols to represent the Host Identity. The HIT is 128 bits long and has the following three key properties: i) it is the same length as an IPv6 address and can be used in address-sized fields in APIs and protocols, ii) it is self-certifying (i.e., given a HIT, it is computationally hard to find a Host Identity key that matches the HIT), and iii) the probability of HIT collision between two hosts is very low. In many environments, 128 bits is still considered large. For example, currently used IPv4 based applications are constrained with 32-bit address fields. Another problem is that the cohabitation of IPv6 and HIP might require some applications to differentiate an IPv6 address from a HIT. Thus, a third representation, the Local Scope Identifier (LSI), may be needed. There are two types of such LSIs: 32 bits long IPv4-compatible one and 128 bits long IPv6-compatible one. The LSI provides a compression of the HIT with only a local scope so that it can be carried efficiently in any application level packet and used in API calls. LSIs do not have the same properties as HITs (i.e., they are not self-certifying nor are they as unlikely to collide -- hence their local scope), and consequently they must be used more carefully. Finally, HIs, HITs, and LSIs are not carried explicitly in the headers of user data packets. Instead, the IPsec Security Parameter Index (SPI) is used in data packets to index the right host context. The SPIs are selected during the HIP exchange. For user data packets, then, the combination of IPsec SPIs and IP addresses are used indirectly to identify the host context, thereby avoiding an additional explicit protocol header. 3.1 Host Identity Tag (HIT) The Host Identity Tag is a 128 bit value -- a hash of the Host Identifier. There are two advantages of using a hash over the actual Identity in protocols. Firstly, its fixed length makes for easier Moskowitz, et al. Expires April 25, 2005 [Page 8] Internet-Draft Host Identity Protocol October 2004 protocol coding and also better manages the packet size cost of this technology. Secondly, it presents a consistent format to the protocol whatever underlying identity technology is used. There are two types of HITs. HITs of the first type, called *type 1 HIT*, consist of 128 bits of the SHA-1 hash of the public key. HITs of the second type consist of a Host Assigning Authority Field (HAA), and only the last 64 bits come from a SHA-1 hash of the Host Identity. This latter format for HIT is recommended for 'well known' systems. It is possible to support a resolution mechanism for these names in hierarchical directories, like the DNS. Another use of HAA is in policy controls, see Section 12. As the type of a HIT cannot be determined by inspecting its contents, the HIT type must be communicated by some external means. When comparing HITs for equality, it is RECOMMENDED that conforming implementations ignore the TBD top most bits. This is to allow better compatibility for legacy IPv6 applications; see Appendix A. However, independent of how many bits are actually used for HIT comparison, it is also RECOMMENDED that the final equality decision is based on the public key and not the HIT, if possible. See also Section 3.2 for related discussion. This document fully specifies only type 1 HITs. HITs that consists of the HAA field and the hash are specified in [24]. Any conforming implementation MUST be able to deal with Type 1 HITs. When handling other than type 1 HITs, the implementation is RECOMMENDED to explicitly learn and record the binding between the Host Identifier and the HIT, as it may not be able to generate such HITs from the Host Identifiers. 3.1.1 Generating a HIT from a HI The 128 or 64 hash bits in a HIT MUST be generated by taking the least significant 128 or 64 bits of the SHA-1 [22] hash of the Host Identifier as it is represented in the Host Identity field in a HIP payload packet. For Identities that are either RSA or DSA public keys, the HIT is formed as follows: 1. The public key is encoded as specified in the corresponding DNSSEC document, taking the algorithm specific portion of the RDATA part of the KEY RR. There is currently only two defined public key algorithms: RSA and DSA. Hence, either of the following applies: Moskowitz, et al. Expires April 25, 2005 [Page 9] Internet-Draft Host Identity Protocol October 2004 The RSA public key is encoded as defined in RFC3110 [14] Section 2, taking the exponent length (e_len), exponent (e) and modulus (n) fields concatenated. The length of the modulus (n) can be determined from the total HI length (hi_len) and the preceding HI fields including the exponent (e). Thus, the data to be hashed has the same length than the HI (hi_len). The fields MUST be encoded in network byte order, as defined in RFC3110 [14]. The DSA public key is encoded as defined in RFC2536 [13] Section 2, taking the fields T, Q, P, G, and Y, concatenated. Thus, the data to be hashed is 1 + 20 + 3 * 64 + 3 * 8 * T octets long, where T is the size parameter as defined in RFC2536 [13]. The size parameter T, affecting the field lengths, MUST be selected as the minimum value that is long enough to accommodate P, G, and Y. The fields MUST be encoded in network byte order, as defined in RFC2536 [13]. 2. A SHA-1 hash [22] is calculated over the encoded key. 3. The least significant 128 or 64 bits of the hash result are used to create the HIT, as defined above. The following pseudo-codes illustrates the process for both RSA and DSA. The symbol := denotes assignment; the symbol += denotes appending. The pseudo-function encode_in_network_byte_order takes two parameters, an integer (bignum) and a length in bytes, and returns the integer encoded into a byte string of the given length. switch ( HI.algorithm ) { case RSA: buffer := encode_in_network_byte_order ( HI.RSA.e_len, ( HI.RSA.e_len > 255 ) ? 3 : 1 ) buffer += encode_in_network_byte_order ( HI.RSA.e, HI.RSA.e_len ) buffer += encode_in_network_byte_order ( HI.RSA.n, HI.hi_len ) break; case DSA: buffer := encode_in_network_byte_order ( HI.DSA.T , 1 ) buffer += encode_in_network_byte_order ( HI.DSA.Q , 20 ) buffer += encode_in_network_byte_order ( HI.DSA.P , 64 + 8 * HI.DSA.T ) buffer += encode_in_network_byte_order ( HI.DSA.G , 64 + 8 * HI.DSA.T ) buffer += encode_in_network_byte_order ( HI.DSA.Y , 64 + 8 * HI.DSA.T ) break; } digest := SHA-1 ( buffer ) Moskowitz, et al. Expires April 25, 2005 [Page 10] Internet-Draft Host Identity Protocol October 2004 hit_128 := low_order_bits ( digest, 128 ) hit_haa := concatenate ( HAA, low_order_bits ( digest, 64 ) ) 3.2 Local Scope Identifier (LSI) LSIs are 32 or 128 bits long localized representations of a Host Identity. The purpose of an LSI is to facilitate using Host Identities in existing IPv4 or IPv6 based protocols and APIs. The LSI can be used anywhere in system processes where IP addresses have traditionally been used, such as IPv4 and IPv6 API calls and FTP PORT commands. The IPv4-compatible LSIs MUST be allocated from the TBD subnet and the IPv6-compatible LSIs MUST be allocated from the TBD subnet. That makes it easier to differentiate between LSIs and IP addresses at the API level. By default, the low order 24 bits of an IPv4-compatible LSI are equal to the low order 24 bits of the corresponding HIT, while the low order TBD bits of an IPv6-compatible LSI are equal to the low order TBD bits of the corresponding HIT. A host performing a HIP handshake may discover that the LSI formed from the peer's HIT collides with another LSI in use locally (i.e., the lower 24 or TBD bits of two different HITs are the same). In that case, the host MUST handle the LSI collision locally such that application calls can be disambiguated. One possible means of doing so is to perform a Host NAT function to locally convert a peer's LSI into a different LSI value. This would require the host to ensure that LSI bits on the wire (i.e., in the application data stream) are converted back to match that host's LSI. Other alternatives for resolving LSI collisions may be added in the future. 3.3 Security Parameter Index (SPI) SPIs are used in ESP to find the right security association for received packets. The ESP SPIs have added significance when used with HIP; they are a compressed representation of the HITs in every packet. Thus, SPIs MAY be used by intermediary systems in providing services like address mapping. Note that since the SPI has significance at the receiver, only the < DST, SPI >, where DST is a destination IP address, uniquely identifies the receiver HIT at every given point of time. The same SPI value may be used by several hosts. A single < DST, SPI > value may denote different hosts at different points of time, depending on which host is currently reachable at the DST. Each host selects for itself the SPI it wants to see in packets received from its peer. This allows it to select different SPIs for Moskowitz, et al. Expires April 25, 2005 [Page 11] Internet-Draft Host Identity Protocol October 2004 different peers. The SPI selection SHOULD be random; the rules of Section 2.1 of the ESP specification [19] must be followed. A different SPI SHOULD be used for each HIP exchange with a particular host; this is to avoid a replay attack. Additionally, when a host rekeys, the SPI MUST be changed. Furthermore, if a host changes over to use a different IP address, it MAY change the SPI. One method for SPI creation that meets these criteria would be to concatenate the HIT with a 32-bit random or sequential number, hash this (using SHA1), and then use the high order 32 bits as the SPI. The selected SPI is communicated to the peer in the third (I2) and fourth (R2) packets of the base HIP exchange. Changes in SPI are signaled with NES parameters. Moskowitz, et al. Expires April 25, 2005 [Page 12] Internet-Draft Host Identity Protocol October 2004 4. Host Identity Protocol The Host Identity Protocol is IP protocol TBD (number will be assigned by IANA). The HIP payload could be carried in every datagram. However, since HIP datagrams are relatively large (at least 40 bytes), and ESP already has all of the functionality to maintain and protect state, the HIP payload is 'compressed' into an ESP payload after the HIP exchange. Thus in practice, HIP packets only occur in datagrams to establish or change HIP state. For testing purposes, the protocol number 99 is currently used. 4.1 HIP base exchange The base HIP exchange serves to manage the establishment of state between an Initiator and a Responder. During the exchange, an IPsec Security Association is created between the hosts. The last three packets of the exchange, R1, I2, and R2, constitute a standard authenticated Diffie-Hellman key exchange for session key generation. The Initiator first sends a trigger packet, I1, to the Responder. The packet contains only the HIT of the Initiator and possibly the HIT of the Responder, if it is known. The second packet, R1, starts the actual exchange. It contains a puzzle, that is, a cryptographic challenge that the Initiator must solve before continuing the exchange. In addition, it contains the initial Diffie-Hellman parameters and a signature, covering part of the message. Some fields are left outside the signature to support pre-created R1s. In the I2 packet, the Initiator must display the solution to the received puzzle. Without a correct solution, the I2 message is discarded. The I2 also contains a Diffie-Hellman parameter that carries needed information for the Responder. The packet is signed by the sender. The R2 packet finalizes the 4-way handshake, containing the SPI value of the Responder. The packet is signed. The base exchange is illustrated below. During this D-H procedure, the hosts create an IPsec session key. Moskowitz, et al. Expires April 25, 2005 [Page 13] Internet-Draft Host Identity Protocol October 2004 Initiator Responder I1: trigger exchange --------------------------> select pre-computed R1 R1: puzzle, D-H, key, sig <------------------------- check sig remain stateless solve puzzle I2: solution, D-H, {key}, sig --------------------------> compute D-H check cookie check puzzle check sig R2: sig <-------------------------- check sig compute D-H In R1, the signature covers the packet, after setting the Initiator HIT, header checksum, and the PUZZLE parameter's Opaque and Random #I fields temporarily to zero, and excluding any TLVs that follow the signature. In I2, the signature covers the whole packet, excluding any TLVs that follow the signature. In R2, the signature and the HMAC cover the whole envelope. In this section we cover the overall design of the base exchange. The details are the subject of the rest of this memo. 4.1.1 HIP Cookie Mechanism The purpose of the HIP cookie mechanism is to protect the Responder from a number of denial-of-service threats. It allows the Responder to delay state creation until receiving I2. Furthermore, the puzzle included in the cookie allows the Responder to use a fairly cheap calculation to check that the Initiator is "sincere" in the sense that it has churned CPU cycles in solving the puzzle. The Cookie mechanism has been explicitly designed to give space for various implementation options. It allows a responder implementation to completely delay session specific state creation until a valid I2 is received. In such a case a validly formatted I2 can be rejected earliest only once the Responder has checked its validity by computing one hash function. On the other hand, the design also allows a responder implementation to keep state about received I1s, Moskowitz, et al. Expires April 25, 2005 [Page 14] Internet-Draft Host Identity Protocol October 2004 and match the received I2s against the state, thereby allowing the implementation to avoid the computational cost of the hash function. The drawback of this latter approach is the requirement of creating state. Finally, it also allows an implementation to use any combination of the space-saving and computation-saving mechanisms. One possible way for a Responder to remain stateless but drop most spoofed I2s is to base the selection of the cookie on some function over the Initiator's Host Identity. The idea is that the Responder has a (perhaps varying) number of pre-calculated R1 packets, and it selects one of these based on the information carried in I1. When the Responder then later receives I2, it checks that the cookie in the I2 matches with the cookie sent in the R1, thereby making it impractical for the attacker to first exchange one I1/R1, and then generate a large number of spoofed I2s that seemingly come from different IP addresses or use different HITs. The method does not protect from an attacker that uses fixed IP addresses and HITs, though. Against such an attacker it is probably best to create a piece of local state, and remember that the puzzle check has previously failed. See Appendix D for one possible implementation. Note, however, that the implementations MUST NOT use the exact implementation given in the appendix, and SHOULD include sufficient randomness to the algorithm so that algorithm complexity attacks become impossible [26]. The Responder can set the difficulty for Initiator, based on its concern of trust of the Initiator. The Responder SHOULD use heuristics to determine when it is under a denial-of-service attack, and set the difficulty value K appropriately. The Responder starts the cookie exchange when it receives an I1. The Responder supplies a random number I, and requires the Initiator to find a number J. To select a proper J, the Initiator must create the concatenation of I, the HITs of the parties, and J, and take a SHA-1 hash over this concatenation. The lowest order K bits of the result MUST be zeros. To generate a proper number J, the Initiator will have to generate a number of Js until one produces the hash target of zero. The Initiator SHOULD give up after exceeding the puzzle lifetime received in PUZZLE TLV. The Responder needs to re-create the concatenation of I, the HITs, and the provided J, and compute the hash once to prove that the Initiator did its assigned task. To prevent pre-computation attacks, the Responder MUST select the number I in such a way that the Initiator cannot guess it. Furthermore, the construction MUST allow the Responder to verify that the value was indeed selected by it and not by the Initiator. See Moskowitz, et al. Expires April 25, 2005 [Page 15] Internet-Draft Host Identity Protocol October 2004 Appendix D for an example on how to implement this. Using the Opaque data field in the ECHO_REQUEST, the Responder can include some data in R1 that the Initiator must copy unmodified in the corresponding I2 packet. The Responder can generate the Opaque data e.g. using the sent I, some secret and possibly other related data. Using this same secret, received I in I2 packet and possible other data, the Receiver can verify that it has itself sent the I to the Initiator. The Responder must change the secret periodically. It is RECOMMENDED that the Responder generates a new cookie and a new R1 once every few minutes. Furthermore, it is RECOMMENDED that the Responder remembers an old cookie at least 2*lifetime seconds after it has been deprecated. These time values allow a slower Initiator to solve the cookie puzzle while limiting the usability that an old, solved cookie has to an attacker. NOTE: The protocol developers explicitly considered whether R1 should include a timestamp in order to protect the Initiator from replay attacks. The decision was NOT to include a timestamp. In R1, the values I and K are sent in network byte order. Similarly, in I2 the values I and J are sent in network byte order. The SHA-1 hash is created by concatenating, in network byte order, the following data, in the following order: 64-bit random value I, in network byte order, as appearing in R1 and I2. 128-bit initiator HIT, in network byte order, as appearing in the HIP Payload in R1 and I2. 128-bit responder HIT, in network byte order, as appearing in the HIP Payload in R1 and I2. 64-bit random value J, in network byte order, as appearing in I2. In order to be a valid response cookie, the K low-order bits of the resulting SHA-1 digest must be zero. Notes: The length of the data to be hashed is 48 bytes. All the data in the hash input MUST be in network byte order. The order of the initiator and responder HITs are different in the R1 and I2 packets, see Section 6.1. Care must be taken to copy the values in right order to the hash input. Precomputation by the Responder Sets up the challenge difficulty K. Creates a signed R1 and caches it. Moskowitz, et al. Expires April 25, 2005 [Page 16] Internet-Draft Host Identity Protocol October 2004 Responder Selects a suitable cached R1. Generates a random number I. Sends I and K in a HIP Cookie in the R1. Saves I and K for a Delta time. Initiator Generates repeated attempts to solve the challenge until a matching J is found: Ltrunc( SHA-1( I | HIT-I | HIT-R | J ), K ) == 0 Sends I and J in HIP Cookie in a I2. Responder Verifies that the received I is a saved one. Finds the right K based on I. Computes V := Ltrunc( SHA-1( I | HIT-I | HIT-R | J ), K ) Rejects if V != 0 Accept if V == 0 The Ltrunc (SHA-1(), K) denotes the lowest order K bits of the SHA-1 result. 4.1.2 Authenticated Diffie-Hellman protocol The packets R1, I2, and R2 implement a standard authenticated Diffie-Hellman exchange. The Responder sends its public Diffie-Hellman key and its public authentication key, i.e., its host identity, in R1. The signature in R1 allows the Initiator to verify that the R1 has been once generated by the Responder. However, since it is precomputed and therefore does not cover all of the packet, it does not protect from replay attacks. When the Initiator receives an R1, it computes the Diffie-Hellman session key. It creates a HIP security association using keying material from the session key (see Section 9), and uses the security association to encrypt its public authentication key, i.e., host identity. The resulting I2 contains the Initiator's Diffie-Hellman key and its the encrypted public authentication key. The signature in I2 covers all of the packet. The Responder extracts the Initiator Diffie-Hellman public key from the I2, computes the Diffie-Hellman session key, creates a corresponding HIP security association, and decrypts the Initiator's public authentication key. It can then verify the signature using the authentication key. Moskowitz, et al. Expires April 25, 2005 [Page 17] Internet-Draft Host Identity Protocol October 2004 The final message, R2, is needed to protect the Initiator from replay attacks. 4.1.3 HIP replay protection The HIP protocol includes the following mechanisms to protect against malicious replays. Responders are protected against replays of I1 packets by virtue of the stateless response to I1s with presigned R1 messages. Initiators are protected against R1 replays by a monotonically increasing "R1 generation counter" included in the R1. Responders are protected against replays or false I2s by the cookie mechanism (Section 4.1.1 above), and optional use of opaque data. Hosts are protected against replays to R2s and UPDATEs by use of a less expensive HMAC verification preceding HIP signature verification. The R1 generation counter is a monotonically increasing 64-bit counter that may be initialized to any value. The scope of the counter MAY be system-wide but SHOULD be per host identity, if there is more than one local host identity. The value of this counter SHOULD be kept across system reboots and invocations of the HIP signaling process. This counter indicates the current generation of cookie puzzles. Implementations MUST accept puzzles from the current generation and MAY accept puzzles from earlier generations. A system's local counter MUST be incremented at least as often as every time old R1s cease to be valid, and SHOULD never be decremented, lest the host expose its peers to the replay of previously generated, higher numbered R1s. Also, the R1 generation counter MUST NOT roll over; if the counter is about to become exhausted, the corresponding HI must be abandoned and replaced with a new one. A host may receive more than one R1, either due to sending multiple I1s (Section 8.4.1) or due to a replay of an old R1. When sending multiple I1s, an initiator SHOULD wait for a small amount of time after the first R1 reception to allow possibly multiple R1s to arrive, and it SHOULD respond to an R1 among the set with the largest R1 generation counter. If an initiator is processing an R1 or has already sent an I2 (still waiting for R2) and it receives another R1 with a larger R1 generation counter, it MAY elect to restart R1 processing with the fresher R1, as if it were the first R1 to arrive. Upon conclusion of an active HIP association with another host, the R1 generation counter associated with the peer host SHOULD be flushed. A local policy MAY override the default flushing of R1 counters on a per-HIT basis. The reason for recommending the flushing of this counter is that there may be hosts where the R1 generation counter (occasionally) decreases; e.g., due to hardware failure. Moskowitz, et al. Expires April 25, 2005 [Page 18] Internet-Draft Host Identity Protocol October 2004 4.2 TCP and UDP pseudo-header computation When computing TCP and UDP checksums on sockets bound to HITs or LSIs, the IPv6 pseudo-header format [11] MUST be used. Additionally, the HITs MUST be used in the place of the IPv6 addresses in the IPv6 pseudo-header. Note that the pseudo-header for actual HIP payloads is computed differently; see Section 6.1.2. 4.3 Updating a HIP association A HIP association between two hosts may need to be updated over time. Examples include the need to rekey expiring security associations, add new security associations, or change IP addresses associated with hosts. This document only specifies how UPDATE is used for rekeying; other uses are deferred to other drafts. HIP provides a general purpose UPDATE packet, which can carry multiple HIP parameters, for updating the HIP state between two peers. The UPDATE mechanism has the following properties: UPDATE messages carry a monotonically increasing sequence number and are explicitly acknowledged by the peer. Lost UPDATEs or acknowledgments may be recovered via retransmission. Multiple UPDATE messages may be outstanding. UPDATE is protected by both HMAC and HIP_SIGNATURE parameters, since processing UPDATE signatures alone is a potential DoS attack against intermediate systems. The UPDATE packet is defined in Section 7.6. 4.4 Error processing HIP error processing behaviour depends on whether there exists an active HIP association or not. In general, if an HIP security association exists between the sender and receiver of a packet causing an error condition, the receiver SHOULD respond with a NOTIFY packet. On the other hand, if there are no existing HIP security associations between the sender and receiver, or the receiver cannot reasonably determine the identity of the sender, the receiver MAY respond with a suitable ICMP message; see Section 6.3 for more details. 4.5 Certificate distribution HIP does not define how to use certificates. However, it does define a simple certificate transport mechanisms that MAY be used to implement certificate based security policies. The certificate payload is defined in Section 6.2.11, and the certificate packet in Section 7.5. Moskowitz, et al. Expires April 25, 2005 [Page 19] Internet-Draft Host Identity Protocol October 2004 4.6 Sending data on HIP packets A future version of this document may define how to include ESP protected data on various HIP packets. However, currently the HIP header is a terminal header, and not followed by any other headers. Moskowitz, et al. Expires April 25, 2005 [Page 20] Internet-Draft Host Identity Protocol October 2004 5. HIP protocol overview The following material is an overview of the HIP protocol operation. Section 8 describes the packet processing steps in more detail. A typical HIP packet flow is shown below, between an Initiator (I) and a Responder (R). It illustrates the exchange of four HIP packets (I1, R1, I2, and R2). I --> Directory: lookup R I <-- Directory: return R's addresses, and HI and/or HIT I1 I --> R (Hi. Here is my I1, let's talk HIP) R1 I <-- R (OK. Here is my R1, handle this HIP cookie) I2 I --> R (Compute, compute, here is my counter I2) R2 I <-- R (OK. Let's finish HIP with my R2) I --> R (ESP protected data) I <-- R (ESP protected data) By definition, the system initiating a HIP exchange is the Initiator, and the peer is the Responder. This distinction is forgotten once the base exchange completes, and either party can become the initiator in future communications. 5.1 HIP Scenarios The HIP protocol and state machine is designed to recover from one of the parties crashing and losing its state. The following scenarios describe the main use cases covered by the design. No prior state between the two systems. The system with data to send is the Initiator. The process follows the standard four packet base exchange, establishing the SAs. The system with data to send has no state with the receiver, but the receiver has a residual SA. The system with data to send is the Initiator. The Initiator acts as in no prior state, sending I1 and getting R1. When the Responder receives a valid I2, the old SAs are 'discovered' and deleted, and the new SAs are established. The system with data to send has an SA, but the receiver does not. The system sends data on the outbound SA. The receiver 'detects' the situation when it receives an ESP packet that contains an unknown SPI. The receiving host MUST discard this packet, in accordance with IPsec architecture. Optionally, the receiving host MAY send an ICMP packet with the Parameter Problem type to inform about invalid SPI (see Section 6.3, and it MAY initiate a new HIP negotiation. However, responding with these optional mechanisms is implementation or policy dependent. Moskowitz, et al. Expires April 25, 2005 [Page 21] Internet-Draft Host Identity Protocol October 2004 A system determines that it needs to reset ESP Sequence Number, or rekey. The system sends a HIP UPDATE packet. The peer responds with a HIP UPDATE response. The UPDATE exchanges can refresh or establish new SAs for peers. 5.2 Refusing a HIP exchange A HIP aware host may choose not to accept a HIP exchange. If the host's policy is to only be an Initiator, it should begin its own HIP exchange. A host MAY choose to have such a policy since only the Initiator HI is protected in the exchange. There is a risk of a race condition if each host's policy is to only be an Initiator, at which point the HIP exchange will fail. If the host's policy does not permit it to enter into a HIP exchange with the Initiator, it should send an ICMP 'Destination Unreachable, Administratively Prohibited' message. A more complex HIP packet is not used here as it actually opens up more potential DoS attacks than a simple ICMP message. 5.3 Reboot and SA timeout restart of HIP Simulating a loss of state is a potential DoS attack. The following process has been crafted to manage state recovery without presenting a DoS opportunity. If a host reboots or times out, it has lost its HIP state. If the system that lost state has a datagram to deliver to its peer, it simply restarts the HIP exchange. The peer replies with an R1 HIP packet, but does not reset its state until it receives the I2 HIP packet. The I2 packet MUST have a valid solution to the puzzle and, if inserted in R1, a valid Opaque data as well as a valid signature. Note that either the original Initiator or the Responder could end up restarting the exchange, becoming the new Initiator. If a system receives an ESP packet for an unknown SPI, it is possible that it has lost the state and its peer has not. It MAY send an ICMP packet with the Parameter Problem type, the Pointer pointing to the SPI value within the ESP header. Reacting to ESP traffic with unknown SPI depends on the implementation and the environment where the implementation is used. The initiating host cannot know, if the SA indicated by the received ESP packet is either a HIP SA or and IKE SA. If the old SA was not a HIP SA, the peer may not respond to the I1 packet. After sending the I1, the HIP negotiation proceeds as normally and, Moskowitz, et al. Expires April 25, 2005 [Page 22] Internet-Draft Host Identity Protocol October 2004 when successful, the SA is created at the initiating end. The peer end removes the OLD SA and replaces it with the new one. 5.4 HIP State Machine The HIP protocol itself has very little state. In the HIP base exchange, there is an Initiator and a Responder. Once the SAs are established, this distinction is lost. If the HIP state needs to be re-established, the controlling parameters are which peer still has state and which has a datagram to send to its peer. The following state machine attempts to capture these processes. The state machine is presented in a single system view, representing either an Initiator or a Responder. There is not a complete overlap of processing logic here and in the packet definitions. Both are needed to completely implement HIP. Implementors must understand that the state machine, as described here, is informational. Specific implementations are free to implement the actual functions differently. Section 8 describes the packet processing rules in more detail. This state machine focuses on the HIP I1, R1, I2, R2, and UPDATE packets only, and specifically, the state induced by an UPDATE that triggers a rekeying event. Other states may be introduced by mechanisms in other drafts (such as mobility and multihoming). 5.4.1 HIP States UNASSOCIATED State machine start I1-SENT Initiating HIP I2-SENT Waiting to finish HIP R2-SENT Waiting to finish HIP ESTABLISHED HIP SA established REKEYING HIP SA established, but UPDATE is outstanding for rekeying CLOSING HIP SA closing, no data (ESP) can be sent CLOSED HIP SA closed, no data (ESP) can be sent E-FAILED HIP exchange failed 5.4.2 HIP State Processes +------------+ |UNASSOCIATED| Start state +------------+ Datagram to send requiring a new SA, send I1 and go to I1-SENT Receive I1, send R1 and stay at UNASSOCIATED Receive I2, process if successful, send R2 and go to R2-SENT Moskowitz, et al. Expires April 25, 2005 [Page 23] Internet-Draft Host Identity Protocol October 2004 if fail, stay at UNASSOCIATED Receive ESP for unknown SA, optionally send ICMP as defined in Section 6.3 and stay at UNASSOCIATED Receive CLOSE, or UPDATE, optionally send ICMP Parameter Problem and stay in UNASSOCIATED. Receive ANYOTHER, drop and stay at UNASSOCIATED +---------+ | I1-SENT | Initiating HIP +---------+ Receive I1, send R1 and stay at I1-SENT Receive I2, process if successful, send R2 and go to R2-SENT if fail, stay at I1-SENT Receive R1, process if successful, send I2 and go to I2-SENT if fail, go to E-FAILED Receive ANYOTHER, drop and stay at I1-SENT Timeout, increment timeout counter If counter is less than I1_RETRIES_MAX, send I1 and stay at I1-SENT If counter is greater than I1_RETRIES_MAX, go to E-FAILED +---------+ | I2-SENT | Waiting to finish HIP +---------+ Receive I1, send R1 and stay at I2-SENT Receive R1, process if successful, send I2 and cycle at I2-SENT if fail, stay at I2-SENT Receive I2, process if successful, send R2 and go to R2-SENT if fail, stay at I2-SENT Receive R2, process if successful, go to ESTABLISHED if fail, go to E-FAILED Receive ANYOTHER, drop and stay at I2-SENT Timeout, increment timeout counter If counter is less than I2_RETRIES_MAX, send I2 and stay at I2-SENT Moskowitz, et al. Expires April 25, 2005 [Page 24] Internet-Draft Host Identity Protocol October 2004 If counter is greater than I2_RETRIES_MAX, go to E-FAILED +---------+ | R2-SENT | Waiting to finish HIP +---------+ Receive I1, send R1 and stay at R2-SENT Receive I2, process, if successful, send R2, and cycle at R2-SENT if failed, stay at R2-SENT Receive R1, drop and stay at R2-SENT Receive R2, drop and stay at R2-SENT Receive ESP for SA, process and go to ESTABLISHED Receive UPDATE, go to ESTABLISHED and process from ESTABLISHED state Move to ESTABLISHED after an implementation specific time. +------------+ |ESTABLISHED | HIP SA established +------------+ Receive I1, send R1 and stay at ESTABLISHED Receive I2, process with cookie and possible Opaque data verification if successful, send R2, drop old SAs, establish new SA, go to R2-SENT if fail, stay at ESTABLISHED Receive R1, drop and stay at ESTABLISHED Receive R2, drop and stay at ESTABLISHED Receive ESP for SA, process and stay at ESTABLISHED Receive UPDATE, process if successful, send UPDATE in reply and go to REKEYING if failed, stay at ESTABLISHED Need rekey, send UPDATE and go to REKEYING No packet sent/received during UAL minutes, send CLOSE and go to CLOSING. Receive CLOSE, process if successful, send CLOSE_ACK and go to CLOSED if failed, stay at ESTABLISHED +---------+ | CLOSING | HIP association has not been used for UAL (Unused +---------+ Association Lifetime) minutes. Datagram to send, requires the creation of another incarnation Moskowitz, et al. Expires April 25, 2005 [Page 25] Internet-Draft Host Identity Protocol October 2004 of the HIP association, started by sending an I1, and stay at CLOSING Receive I1, send R1 and stay at CLOSING Receive I2, process if successful, send R2 and go to R2-SENT if fail, stay at CLOSING Receive R1, process if successful, send I2 and go to I2-SENT if fail, stay at CLOSING Receive CLOSE, process if successful, send CLOSE_ACK, discard state and go to CLOSED if failed, stay at CLOSING Receive CLOSE_ACK, process if successful, discard state and go to UNASSOCIATED if failed, stay at CLOSING Receive ANYOTHER, drop and stay at CLOSING Timeout, increment timeout sum, reset timer if timeout sum is less than UAL+MSL minutes, retransmit CLOSE and stay at CLOSING if timeout sum is greater than UAL+MSL minutes, go to UNASSOCIATED +--------+ | CLOSED | CLOSE_ACK sent, resending CLOSE_ACK if necessary +--------+ Datagram to send, requires the creation of another incarnation of the HIP association, started by sending an I1, and stay at CLOSED Receive I1, send R1 and stay at CLOSED Receive I2, process if successful, send R2 and go to R2-SENT if fail, stay at CLOSED Receive R1, process if successful, send I2 and go to I2-SENT if fail, stay at CLOSED Receive CLOSE, process if successful, send CLOSE_ACK, stay at CLOSED if failed, stay at CLOSED Moskowitz, et al. Expires April 25, 2005 [Page 26] Internet-Draft Host Identity Protocol October 2004 Receive CLOSE_ACK, process if successful, discard state and go to UNASSOCIATED if failed, stay at CLOSED Receive ANYOTHER, drop and stay at CLOSED Timeout (UAL + 2MSL), discard state and go to UNASSOCIATED +----------+ | REKEYING | HIP SA established, rekey pending +----------+ Receive I1, send R1 and stay at REKEYING Receive I2, process with cookie and possible Opaque data verification if successful, send R2, drop old SA and go to R2-SENT if fail, stay at REKEYING Receive R1, drop and stay at REKEYING Receive R2, drop and stay at REKEYING Receive ESP for SA, process and stay at REKEYING Receive UPDATE, process if successful completion of rekey, go to ESTABLISHED if failed, stay at REKEYING Timeout, increment timeout counter If counter is less than UPDATE_RETRIES_MAX, send UPDATE and stay at REKEYING If counter is greater than UPDATE_RETRIES_MAX, go to E-FAILED +----------+ | E-FAILED | HIP failed to establish association with peer +----------+ Move to UNASSOCIATED after an implementation specific time. Re-negotiation is possible after moving to UNASSOCIATED state. 5.4.3 Simplified HIP State Diagram The following diagram shows the major state transitions. Transitions based on received packets implicitly assume that the packets are successfully authenticated or processed. The diagram assumes that UPDATE messages are being used for rekeying. +-+ +------------------------------+ I1 received, send R1 | | | | | v v | Moskowitz, et al. Expires April 25, 2005 [Page 27] Internet-Draft Host Identity Protocol October 2004 Datagram to send +--------------+ I2 received, send R2 | +---------------| UNASSOCIATED |---------------+ | | +--------------+ | | v | | +---------+ I2 received, send R2 | | +---->| I1-SENT |---------------------------------------+ | | | +---------+ | | | | | +------------------------+ | | | | | R1 received, | I2 received, send R2 | | | | | v send I2 | v v v | | +---------+ | +---------+ | | +->| I2-SENT |------------+ | R2-SENT |<-----+ | | | +---------+ +---------+ | | | | | | | | | | | | | | | |receive | | | | | |R1, send | timeout, | receive I2,| | | |I2 |R2 received +--------------+ ESP | send R2| | | | +----------->| ESTABLISHED |<---------+ | | | | +--------------+ | | | | Update received/ | ^ | | | | | | | Update triggered | | | | +---------------------------+ | | | +----------------+ | | | | | | | | | | | No packet sent/received | | | | v | | | for UAL min, send CLOSE | | | | +----------+ | | | | | | | | REKEYING |-------------+ | | +---------+<-+ timeout | | | | +----------+ UPDATE acked | +--->| CLOSING |--+ (UAL+MSL) | | | | and NES received | +---------+ retransmit | | +--+----------------------------+---------+ | | | | CLOSE | | | +----------------------------+-----------+ | | +----------------+ | | | | +-----------+ +------------------+--+ | | | | receive CLOSE, CLOSE_ACK | | | | | | send CLOSE_ACK received or | | | | v v timeout | | | | +--------+ (UAL+MSL) | | | +---------------------------| CLOSED |---------------------------+ | +------------------------------+--------+------------------------------+ Datagram to send ^ | timeout (UAL+2MSL), +-+ move to UNASSOCIATED CLOSE received, send CLOSE_ACK Moskowitz, et al. Expires April 25, 2005 [Page 28] Internet-Draft Host Identity Protocol October 2004 6. Packet formats 6.1 Payload format All HIP packets start with a fixed header. 0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Payload Len | Type | VER. | RES. | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Controls | Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Sender's Host Identity Tag (HIT) | | | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Receiver's Host Identity Tag (HIT) | | | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | / HIP Parameters / / / | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ The HIP header is logically an IPv6 extension header. However, this document does not describe processing for Next Header values other than decimal 59, IPPROTO_NONE, the IPV6 no next header value. Future documents MAY do so. However, implementations MUST ignore trailing data if a Next Header value is received that is not implemented. The Header Length field contains the length of the HIP Header and the length of HIP parameters in 8 bytes units, excluding the first 8 bytes. Since all HIP headers MUST contain the sender's and receiver's HIT fields, the minimum value for this field is 4, and conversely, the maximum length of the HIP Parameters field is (255*8)-32 = 2008 bytes. Note: this sets an additional limit for sizes of TLVs included in the Parameters field, independent of the individual TLV parameter maximum lengths. The Packet Type indicates the HIP packet type. The individual packet types are defined in the relevant sections. If a HIP host receives a Moskowitz, et al. Expires April 25, 2005 [Page 29] Internet-Draft Host Identity Protocol October 2004 HIP packet that contains an unknown packet type, it MUST drop the packet. The HIP Version is four bits. The current version is 1. The version number is expected to be incremented only if there are incompatible changes to the protocol. Most extensions can be handled by defining new packet types, new parameter types, or new controls. The following four bits are reserved for future use. They MUST be zero when sent, and they SHOULD be ignored when handling a received packet. The HIT fields are always 128 bits (16 bytes) long. 6.1.1 HIP Controls The HIP control section transfers information about the structure of the packet and capabilities of the host. The following fields have been defined: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SHT | DHT | | | | | | | | |C|A| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ C - Certificate One or more certificate packets (CER) follows this HIP packet (see Section 7.5). A - Anonymous If this is set, the sender's HI in this packet is anonymous, i.e., one not listed in a directory. Anonymous HIs SHOULD NOT be stored. This control is set in packets R1 and/or I2. The peer receiving an anonymous HI may choose to refuse it by silently dropping the exchange. SHT - Sender's HIT Type Currently the following values are specified: 0 RESERVED 1 Type 1 HIT 2 Type 2 HIT 3-6 UNASSIGNED 7 RESERVED DHT - Destination's HIT Type Using the same values as SHT. The rest of the fields are reserved for future use and MUST be set to zero on sent packets and ignored on received packets. 6.1.2 Checksum The checksum field is located at the same location within the header as the checksum field in UDP packets, enabling hardware assisted checksum generation and verification. Note that since the checksum covers the source and destination addresses in the IP header, it must Moskowitz, et al. Expires April 25, 2005 [Page 30] Internet-Draft Host Identity Protocol October 2004 be recomputed on HIP based NAT boxes. If IPv6 is used to carry the HIP packet, the pseudo-header [11] contains the source and destination IPv6 addresses, HIP packet length in the pseudo-header length field, a zero field, and the HIP protocol number (TBD, see Section 4) in the Next Header field. The length field is in bytes and can be calculated from the HIP header length field: (HIP Header Length + 1) * 8. In case of using IPv4, the IPv4 UDP pseudo header format [1] is used. In the pseudo header, the source and destination addresses are those used in the IP header, the zero field is obviously zero, the protocol is the HIP protocol number (TBD, see Section 4), and the length is calculated as in the IPv6 case. 6.2 HIP parameters The HIP Parameters are used to carry the public key associated with the sender's HIT, together with other related security information. The HIP Parameters consists of ordered parameters, encoded in TLV format. The following parameter types are currently defined. TLV Type Length Data SPI 1 4 Remote's SPI. R1_COUNTER 2 12 System Boot Counter PUZZLE 5 12 K and Random #I SOLUTION 7 20 K, Random #I and puzzle solution NES 9 12 Old SPI, New SPI and other info needed for UPDATE SEQ 11 4 Update packet ID number ACK 13 variable Update packet ID number DIFFIE_HELLMAN 15 variable public key HIP_TRANSFORM 17 variable HIP Encryption and Integrity Transform ESP_TRANSFORM 19 variable ESP Encryption and Authentication Transform Moskowitz, et al. Expires April 25, 2005 [Page 31] Internet-Draft Host Identity Protocol October 2004 ENCRYPTED 21 variable Encrypted part of I2 or CER packets HOST_ID 35 variable Host Identity with Fully Qualified Domain Name CERT 64 variable HI certificate NOTIFY 256 variable Informational data ECHO_REQUEST 1022 variable Opaque data to be echoed back; under signature ECHO_RESPONSE 1024 variable Opaque data echoed back; under signature HMAC 65245 20 HMAC based message authentication code, with key material from HIP_TRANSFORM HMAC_2 65247 20 HMAC based message authentication code, with key material from HIP_TRANSFORM HIP_SIGNATURE_2 65277 variable Signature of the R1 packet HIP_SIGNATURE 65279 variable Signature of the packet ECHO_REQUEST 65281 variable Opaque data to be echoed back ECHO_RESPONSE 65283 variable Opaque data echoed back; after signature 6.2.1 TLV format The TLV encoded parameters are described in the following subsections. The type-field value also describes the order of these fields in the packet. The parameters MUST be included into the packet so that the types form an increasing order. If the order does not follow this rule, the packet is considered to be malformed and it MUST be discarded. All the TLV parameters have a length (including Type and Length fields) which is a multiple of 8 bytes. When needed, padding MUST be added to the end of the parameter so that the total length becomes a multiple of 8 bytes. This rule ensures proper alignment of data. If Moskowitz, et al. Expires April 25, 2005 [Page 32] Internet-Draft Host Identity Protocol October 2004 padding is added, the Length field MUST NOT include the padding. Any added padding bytes MUST be set zero by the sender, but their content SHOULD NOT be checked on the receiving end. Consequently, the Length field indicates the length of the Contents field (in bytes). The total length of the TLV parameter (including Type, Length, Contents, and Padding) is related to the Length field according to the following formula: Total Length = 11 + Length - (Length + 3) % 8; 0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type |C| Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | / Contents / / +-+-+-+-+-+-+-+-+ | | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type Type code for the parameter C Critical. One if this parameter is critical, and MUST be recognized by the recipient, zero otherwise. The C bit is considered to be a part of the Type field. Consequently, critical parameters are always odd and non-critical ones have an even value. Length Length of the Contents, in bytes. Contents Parameter specific, defined by Type Padding Padding, 0-7 bytes, added if needed Critical parameters MUST be recognized by the recipient. If a recipient encounters a critical parameter that it does not recognize, it MUST NOT process the packet any further. Non-critical parameters MAY be safely ignored. If a recipient encounters a non-critical parameter that it does not recognize, it SHOULD proceed as if the parameter was not present in the received packet. 6.2.2 Defining new parameters Future specifications may define new parameters as needed. When defining new parameters, care must be taken to ensure that the parameter type values are appropriate and leave suitable space for other future extensions. One must remember that the parameters MUST always be arranged in the increasing order by the type code, thereby Moskowitz, et al. Expires April 25, 2005 [Page 33] Internet-Draft Host Identity Protocol October 2004 limiting the order of parameters. The following rules must be followed when defining new parameters. 1. The low order bit C of the Type code is used to distinguish between critical and non-critical parameters. 2. A new parameter may be critical only if an old recipient ignoring it would cause security problems. In general, new parameters SHOULD be defined as non-critical, and expect a reply from the recipient. 3. If a system implements a new critical parameter, it MUST provide the ability to configure the associated feature off, such that the critical parameter is not sent at all. The configuration option must be well documented. By default, sending of such a new critical parameter SHOULD be off. In other words, the management interface MUST allow vanilla standards only mode as a default configuration setting, and MAY allow new critical payloads to be configured on (and off). 4. The following type codes are reserved for future base protocol extensions, and may be assigned only through an appropriate WG or RFC action. 0 - 511 65024 - 65535 5. The following type codes are reserved for experimentation and private use. Types SHOULD be selected in a random fashion from this range, thereby reducing the probability of collisions. A method employing genuine randomness (such as flipping a coin) SHOULD be used. 32768 - 49141 6. All other parameter type codes MUST be registered by the IANA. See Section 14. 6.2.3 SPI The SPI parameter contains the SPI that the receiving host must use when sending data to the sending host. It may be possible, in future extensions of this protocol, for multiple SPIs to exist in a host-host communications context. 0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SPI | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type 1 Length 4 Moskowitz, et al. Expires April 25, 2005 [Page 34] Internet-Draft Host Identity Protocol October 2004 SPI Security Parameter Index 6.2.4 R1_COUNTER 0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Reserved, 4 bytes | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | R1 generation counter, 8 bytes | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type 2 Length 12 R1 generation counter The current generation of valid puzzles The R1_COUNTER parameter contains an 64-bit unsigned integer in network byte order, indicating the current generation of valid puzzles. The sender is supposed to increment this counter periodically. It is RECOMMENDED that the counter value is incremented at least as often as old PUZZLE values are deprecated so that SOLUTIONs to them are no longer accepted. The R1_COUNTER parameter is optional. It SHOULD be included in the R1 (in which case it is covered by the signature), and if present in the R1, it MAY be echoed (including the Reserved field) by the Initiator in the I2. Moskowitz, et al. Expires April 25, 2005 [Page 35] Internet-Draft Host Identity Protocol October 2004 6.2.5 PUZZLE 0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | K, 1 byte | Lifetime | Opaque, 2 bytes | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Random # I, 8 bytes | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type 5 Length 12 K K is the number of verified bits Lifetime Puzzle lifetime 2^(value-32) seconds Opaque Data set by the Responder, indexing the puzzle Random #I random number Random #I is represented as 64-bit integer, K and Lifetime as 8-bit integer, all in network byte order. The PUZZLE parameter contains the puzzle difficulty K and an 64-bit puzzle random integer #I. Puzzle Lifetime indicates the time during which the puzzle solution is valid and sets a time limit for initiator which it should not exceed while trying to solve the puzzle. The lifetime is indicated as power of 2 using formula 2^(Lifetime-32) seconds. A puzzle MAY be augmented by including an ECHO_REQUEST parameter to an R1. The contents of the ECHO_REQUEST are then echoed back in ECHO_RESPONSE, allowing the Responder to use the included information as a part of puzzle processing. The Opaque and Random #I field are not covered by the HIP_SIGNATURE_2 parameter. Moskowitz, et al. Expires April 25, 2005 [Page 36] Internet-Draft Host Identity Protocol October 2004 6.2.6 SOLUTION 0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | K, 1 byte | Reserved | Opaque, 2 bytes | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Random #I, 8 bytes | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Puzzle solution #J, 8 bytes | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type 7 Length 20 K K is the number of verified bits Reserved zero when sent, ignored when received Opaque Copied unmodified from the received PUZZLE TLV Random #I random number Puzzle solution #J random number Random #I, and Random #J are represented as 64-bit integers, K as 8-bit integer, all in network byte order. The SOLUTION parameter contains a solution to a puzzle. It also echoes back the random difficulty K, the Opaque field, and the puzzle integer #I. Moskowitz, et al. Expires April 25, 2005 [Page 37] Internet-Draft Host Identity Protocol October 2004 6.2.7 DIFFIE_HELLMAN 0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Group ID | Public Value / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / | padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type 15 Length length in octets, excluding Type, Length, and padding Group ID defines values for p and g Public Value the sender's public Diffie-Hellman key The following Group IDs have been defined: Group Value Reserved 0 384-bit group 1 OAKLEY well known group 1 2 1536-bit MODP group 3 3072-bit MODP group 4 6144-bit MODP group 5 8192-bit MODP group 6 The MODP Diffie-Hellman groups are defined in [18]. The OAKLEY group is defined in [9]. The OAKLEY well known group 5 is the same as the 1536-bit MODP group. A HIP implementation MUST support Group IDs 1 and 3. The 384-bit group can be used when lower security is enough (e.g. web surfing) and when the equipment is not powerful enough (e.g. some PDAs). Equipment powerful enough SHOULD implement also group ID 5. The 384-bit group is defined in Appendix G. To avoid unnecessary failures during the 4-way handshake, the rest of the groups SHOULD be implemented in hosts where resources are adequate. Moskowitz, et al. Expires April 25, 2005 [Page 38] Internet-Draft Host Identity Protocol October 2004 6.2.8 HIP_TRANSFORM 0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Transform-ID #1 | Transform-ID #2 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Transform-ID #n | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type 17 Length length in octets, excluding Type, Length, and padding Transform-ID Defines the HIP Suite to be used The Suite-IDs are identical to those defined in Section 6.2.9. There MUST NOT be more than six (6) HIP Suite-IDs in one HIP transform TLV. The limited number of transforms sets the maximum size of HIP_TRANSFORM TLV. The HIP_TRANSFORM TLV MUST contain at least one of the mandatory Suite-IDs. Mandatory implementations: ENCR-AES-CBC with HMAC-SHA1 and ENCR-NULL with HMAC-SHA1. 6.2.9 ESP_TRANSFORM 0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Reserved |E| Suite-ID #1 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Suite-ID #2 | Suite-ID #3 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Suite-ID #n | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type 19 Length length in octets, excluding Type, Length, and padding E One if the ESP transform requires 64-bit sequence numbers (see Section 11.6 ) Reserved zero when sent, ignored when received Moskowitz, et al. Expires April 25, 2005 [Page 39] Internet-Draft Host Identity Protocol October 2004 Suite-ID defines the ESP Suite to be used The following Suite-IDs are defined ([20],[23]): Suite-ID Value RESERVED 0 ESP-AES-CBC with HMAC-SHA1 1 ESP-3DES-CBC with HMAC-SHA1 2 ESP-3DES-CBC with HMAC-MD5 3 ESP-BLOWFISH-CBC with HMAC-SHA1 4 ESP-NULL with HMAC-SHA1 5 ESP-NULL with HMAC-MD5 6 There MUST NOT be more than six (6) ESP Suite-IDs in one ESP_TRANSFORM TLV. The limited number of Suite-IDs sets the maximum size of ESP_TRANSFORM TLV. The ESP_TRANSFORM MUST contain at least one of the mandatory Suite-IDs. Mandatory implementations: ESP-AES-CBC with HMAC-SHA1 and ESP-NULL with HMAC-SHA1. 6.2.10 HOST_ID 0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | HI Length |DI-type| DI Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Host Identity / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / | Domain Identifier / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type 35 Length length in octets, excluding Type, Length, and Padding DI-type type of the following Domain Identifier field DI Length length of the FQDN or NAI in octets N if set, the following FQDN/NAI field contains a NAI Host Identity actual host identity Domain Identifier the identifier of the sender Moskowitz, et al. Expires April 25, 2005 [Page 40] Internet-Draft Host Identity Protocol October 2004 The Host Identity is represented in RFC2535 [12] format. The algorithms used in RDATA format are the following: Algorithms Values RESERVED 0 DSA 3 [RFC2536] (RECOMMENDED) RSA 5 [RFC3110] (REQUIRED) The following DI-types have been defined: Type Value none included 0 FQDN 1 NAI 2 FQDN Fully Qualified Domain Name, in binary format. NAI Network Access Identifier, in binary format. The format of the NAI is login@FQDN. The format for the FQDN is defined in RFC1035 [3] Section 3.1. If there is no Domain Identifier, i.e. the DI-type field is zero, also the DI Length field is set to zero. 6.2.11 CERT 0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Cert count | Cert ID | Cert type | / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / Certificate / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type 64 Length length in octets, excluding Type, Length, and padding Cert count total count of certificates that are sent, possibly in several consecutive CER packets Cert ID the order number for this certificate Cert Type describes the type of the certificate The receiver must know the total number (Cert count) of certificates Moskowitz, et al. Expires April 25, 2005 [Page 41] Internet-Draft Host Identity Protocol October 2004 that it will receive from the sender, related to the R1 or I2. The Cert ID identifies the particular certificate and its order in the certificate chain. The numbering in Cert ID MUST go from 1 to Cert count. The following certificate types are defined: Cert format Type number X.509 v3 1 The encoding format for X.509v3 certificate is defined in [15]. 6.2.12 HMAC 0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | HMAC | | | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type 65245 Length 20 HMAC 160 low order bits of the HMAC computed over the HIP packet, excluding the HMAC parameter and any following HIP_SIGNATURE or HIP_SIGNATURE_2 parameters. The checksum field MUST be set to zero and the HIP header length in the HIP common header MUST be calculated not to cover any excluded parameters when the HMAC is calculated. The HMAC calculation and verification process is presented in Section 8.3.1 6.2.13 HMAC_2 The TLV structure is the same as in Section 6.2.12. The fields are: Moskowitz, et al. Expires April 25, 2005 [Page 42] Internet-Draft Host Identity Protocol October 2004 Type 65247 Length 20 HMAC 160 low order bits of the HMAC computed over the HIP packet, excluding the HMAC parameter and any following HIP_SIGNATURE or HIP_SIGNATURE_2 parameters and including an additional sender's HOST_ID TLV during the HMAC calculation. The checksum field MUST be set to zero and the HIP header length in the HIP common header MUST be calculated not to cover any excluded parameters when the HMAC is calculated. The HMAC calculation and verification process is presented in Section 8.3.1 6.2.14 HIP_SIGNATURE 0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SIG alg | Signature / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type 65279 (2^16-2^8-1) Length length in octets, excluding Type, Length, and Padding SIG alg Signature algorithm Signature the signature is calculated over the HIP packet, excluding the HIP_SIGNATURE TLV field and any TLVs that follow the HIP_SIGNATURE TLV. The checksum field MUST be set to zero, and the HIP header length in the HIP common header MUST be calculated only to the beginning of the HIP_SIGNATURE TLV when the signature is calculated. The signature algorithms are defined in Section 6.2.10. The signature in the Signature field is encoded using the proper method depending on the signature algorithm (e.g. according to [14] in case of RSA, or according to [13] in case of DSA). The HIP_SIGNATURE calculation and verification process is presented in Section 8.3.2 Moskowitz, et al. Expires April 25, 2005 [Page 43] Internet-Draft Host Identity Protocol October 2004 6.2.15 HIP_SIGNATURE_2 The TLV structure is the same as in Section 6.2.14. The fields are: Type 65277 (2^16-2^8-3) Length length in octets, excluding Type, Length, and Padding SIG alg Signature algorithm Signature the signature is calculated over the HIP R1 packet, excluding the HIP_SIGNATURE_2 TLV field and any TLVs that follow the HIP_SIGNATURE_2 TLV. Initiator's HIT, checksum field, and the Opaque and Random #I fields in the PUZZLE TLV MUST be set to zero while computing the HIP_SIGNATURE_2 signature. Further, the HIP packet length in the HIP header MUST be calculated to the beginning of the HIP_SIGNATURE_2 TLV when the signature is calculated. Zeroing the Initiator's HIT makes it possible to create R1 packets beforehand to minimize the effects of possible DoS attacks. Zeroing the I and Opaque fields allows these fields to be populated dynamically on precomputed R1s. Signature calculation and verification follows the process in Section 8.3.2. 6.2.16 NES During the life of an SA established by HIP, one of the hosts may need to reset the Sequence Number to one (to prevent wrapping) and rekey. The reason for rekeying might be an approaching sequence number wrap in ESP, or a local policy on use of a key. Rekeying ends the current SAs and starts new ones on both peers. The NES parameter is carried in the HIP UPDATE packet. It is used to reset Security Associations. It introduces a new SPI to be used when sending data to the sender of the UPDATE packet. The keys for the new Security Association will be drawn from KEYMAT. If the packet contains a Diffie-Hellman parameter, the KEYMAT is first recomputed before drawing the new keys. Moskowitz, et al. Expires April 25, 2005 [Page 44] Internet-Draft Host Identity Protocol October 2004 0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Reserved | Keymat Index | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Old SPI | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | New SPI | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type 9 Length 12 Keymat Index Index, in bytes, where to continue to draw ESP keys from KEYMAT. If the packet includes a new Diffie-Hellman key, the field MUST be zero. Note that the length of this field limits the amount of keying material that can be drawn from KEYMAT. If that amount is exceeded, the NES packet MUST contain a new Diffie-Hellman key. Old SPI Old SPI for data sent to the source address of this packet New SPI New SPI for data sent to the source address of this packet A host that receives an NES must reply shortly thereafter with an NES. Any middleboxes between the communicating hosts will learn the mappings from the pair of UPDATE messages. 6.2.17 SEQ 0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Update ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type 11 Length 4 Update ID 32-bit sequence number The Update ID is an unsigned quantity, initialized by a host to zero upon moving to ESTABLISHED state. The Update ID has scope within a single HIP association, and not across multiple associations or multiple hosts. The Update ID is incremented by one before each new Moskowitz, et al. Expires April 25, 2005 [Page 45] Internet-Draft Host Identity Protocol October 2004 UPDATE that is sent by the host (i.e., the first UPDATE packet originated by a host has an Update ID of 1). 6.2.18 ACK 0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | peer Update ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type 13 Length variable (multiple of 4) peer Update ID 32-bit sequence number corresponding to the Update ID being acked. The ACK parameter includes one or more Update IDs that have been received from the peer. The Length field identifies the number of peer Update IDs that are present in the parameter. Moskowitz, et al. Expires April 25, 2005 [Page 46] Internet-Draft Host Identity Protocol October 2004 6.2.19 ENCRYPTED 0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | IV / / / / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / / Encrypted data / / / / +-------------------------------+ / | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type 21 Length length in octets, excluding Type, Length, and Padding Reserved zero when sent, ignored when received IV Initialization vector, if needed, otherwise nonexistent. The length of the IV is inferred from the HIP transform. Encrypted The data is encrypted using an encryption algorithm as data defined in HIP transform. Padding Any Padding, if necessary, to make the TLV a multiple of 8 bytes. The encrypted data is in TLV format itself. Consequently, the first fields in the contents are Type and Length, allowing the contents to be easily parsed after decryption. Each of the TLVs to be encrypted, must be padded according to rules in Section 6.2.1 before encryption. If the encryption algorithm requires the length of the data to be encrypted to be a multiple of the cipher algorithm block size, thereby necessitating padding, and if the encryption algorithm does not specify the padding contents, then an implementation MUST append the TLV parameter that is to be encrypted with an additional padding, so that the length of the resulting cleartext is a multiple of the cipher block size length. Such a padding MUST be constructed as specified in [19] Section 2.4. On the other hand, if the data to be encrypted is already a multiple of the block size, or if the encryption algorithm does specify padding as per [19] Section 2.4, then such additional padding SHOULD NOT be added. The Length field in the inside, to be encrypted TLV does not include the padding. The Length field in the outside ENCRYPTED TLV is the Moskowitz, et al. Expires April 25, 2005 [Page 47] Internet-Draft Host Identity Protocol October 2004 length of the data after encryption (including the Reserved field, the IV field, and the output from the encryption process specified for that suite, but not any additional external padding). Note that the length of the cipher suite output may be smaller or larger than the length of the data to be encrypted, since the encryption process may compress the data or add additional padding to the data. The ENCRYPTED payload may contain additional external padding, if the result of encryption, the TLV header and the IV is not a multiple of 8 bytes. The contents of this external padding MUST follow the rules given in Section 6.2.1. 6.2.20 NOTIFY The NOTIFY parameter is used to transmit informational data, such as error conditions and state transitions, to a HIP peer. A NOTIFY parameter may appear in the NOTIFY packet type. The use of the NOTIFY parameter in other packet types is for further study. 0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Reserved | Notify Message Type | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | / / Notification data / / +---------------+ / | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type 256 Length length in octets, excluding Type, Length, and Padding Reserved zero when sent, ignored when received Notify Message Specifies the type of notification Type Notification Informational or error data transmitted in addition Data to the Notify Message Type. Values for this field are type specific (see below). Padding Any Padding, if necessary, to make the TLV a multiple of 8 bytes. Notification information can be error messages specifying why an SA could not be established. It can also be status data that a process managing an SA database wishes to communicate with a peer process. The table below lists the Notification messages and their corresponding values. Moskowitz, et al. Expires April 25, 2005 [Page 48] Internet-Draft Host Identity Protocol October 2004 To avoid certain types of attacks, a Responder SHOULD avoid sending a NOTIFY to any host with which it has not successfully verified a puzzle solution. Types in the range 0 - 16383 are intended for reporting errors. An implementation that receives a NOTIFY error parameter in response to a request packet (e.g., I1, I2, UPDATE), SHOULD assume that the corresponding request has failed entirely. Unrecognized error types MUST be ignored except that they SHOULD be logged. Notify payloads with status types MUST be ignored if not recognized. NOTIFY PARAMETER - ERROR TYPES Value ------------------------------ ----- UNSUPPORTED_CRITICAL_PARAMETER_TYPE 1 Sent if the parameter type has the "critical" bit set and the parameter type is not recognized. Notification Data contains the two octet parameter type. INVALID_SYNTAX 7 Indicates that the HIP message received was invalid because some type, length, or value was out of range or because the request was rejected for policy reasons. To avoid a denial of service attack using forged messages, this status may only be returned for and in an encrypted packet if the message ID and cryptographic checksum were valid. To avoid leaking information to someone probing a node, this status MUST be sent in response to any error not covered by one of the other status types. To aid debugging, more detailed error information SHOULD be written to a console or log. NO_DH_PROPOSAL_CHOSEN 14 None of the proposed group IDs was acceptable. INVALID_DH_CHOSEN 15 The D-H Group ID field does not correspond to one offered by the responder. NO_HIP_PROPOSAL_CHOSEN 16 Moskowitz, et al. Expires April 25, 2005 [Page 49] Internet-Draft Host Identity Protocol October 2004 None of the proposed HIP Transform crypto suites was acceptable. INVALID_HIP_TRANSFORM_CHOSEN 17 The HIP Transform crypto suite does not correspond to one offered by the responder. NO_ESP_PROPOSAL_CHOSEN 18 None of the proposed ESP Transform crypto suites was acceptable. INVALID_ESP_TRANSFORM_CHOSEN 19 The ESP Transform crypto suite does not correspond to one offered by the responder. AUTHENTICATION_FAILED 24 Sent in response to a HIP signature failure. CHECKSUM_FAILED 26 Sent in response to a HIP checksum failure. HMAC_FAILED 28 Sent in response to a HIP HMAC failure. ENCRYPTION_FAILED 32 The responder could not successfully decrypt the ENCRYPTED TLV. INVALID_HIT 40 Sent in response to a failure to validate the peer's HIT from the corresponding HI. BLOCKED_BY_POLICY 42 The responder is unwilling to set up an association for some policy reason (e.g. received HIT is NULL and policy does not allow opportunistic mode). SERVER_BUSY_PLEASE_RETRY 44 Moskowitz, et al. Expires April 25, 2005 [Page 50] Internet-Draft Host Identity Protocol October 2004 The responder is unwilling to set up an association as it is suffering under some kind of overload and has chosen to shed load by rejecting your request. You may retry if you wish, however you MUST find another (different) puzzle solution for any such retries. Note that you may need to obtain a new puzzle with a new I1/R1 exchange. I2_ACKNOWLEDGEMENT 46 The responder has received your I2 but had to queue the I2 for processing. The puzzle was correctly solved and the responder is willing to set up an association but has currently a number of I2s in processing queue. R2 will be sent after the I2 has been processed. NOTIFY MESSAGES - STATUS TYPES Value ------------------------------ ----- (None defined at present) 6.2.21 ECHO_REQUEST 0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Opaque data (variable length) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type 65281 or 1022 Length variable Opaque data Opaque data, supposed to be meaningful only to the node that sends ECHO_REQUEST and receives a corresponding ECHO_RESPONSE. The ECHO_REQUEST parameter contains an opaque blob of data that the sender wants to get echoed back in the corresponding reply packet. The ECHO_REQUEST and ECHO_RESPONSE parameters MAY be used for any purpose where a node wants to carry some state in a request packet and get it back in a response packet. The ECHO_REQUEST MAY be covered by the HMAC and SIGNATURE. This is dictated by the Type field selected for the parameter; Type 1022 ECHO_REQUEST is covered and Type 65281 is not. Moskowitz, et al. Expires April 25, 2005 [Page 51] Internet-Draft Host Identity Protocol October 2004 6.2.22 ECHO_RESPONSE 0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Opaque data (variable length) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type 65283 or 1024 Length variable Opaque data Opaque data, copied unmodified from the ECHO_REQUEST parameter that triggered this response. The ECHO_RESPONSE parameter contains an opaque blob of data that the sender of the ECHO_REQUEST wants to get echoed back. The opaque data is copied unmodified from the ECHO_REQUEST parameter. The ECHO_REQUEST and ECHO_RESPONSE parameters MAY be used for any purpose where a node wants to carry some state in a request packet and get it back in a response packet. The ECHO_RESPONSE MAY be covered by the HMAC and SIGNATURE. This is dictated by the Type field selected for the parameter; Type 1024 ECHO_RESPONSE is covered and Type 65283 is not. 6.3 ICMP messages When a HIP implementation detects a problem with an incoming packet, and it either cannot determine the identity of the sender of the packet or does not have any existing HIP security association with the sender of the packet, it MAY respond with an ICMP packet. Any such replies MUST be rate limited as described in [4]. In most cases, the ICMP packet will have the Parameter Problem type (12 for ICMPv4, 4 for ICMPv6), with the Pointer field pointing to the field that caused the ICMP message to be generated. XXX: Should we say something more about rate limitation here? 6.3.1 Invalid Version If a HIP implementation receives a HIP packet that has an unrecognized HIP version number, it SHOULD respond, rate limited, with an ICMP packet with type Parameter Problem, the Pointer pointing to the VER./RES. byte in the HIP header. Moskowitz, et al. Expires April 25, 2005 [Page 52] Internet-Draft Host Identity Protocol October 2004 6.3.2 Other problems with the HIP header and packet structure If a HIP implementation receives a HIP packet that has other unrecoverable problems in the header or packet format, it MAY respond, rate limited, with an ICMP packet with type Parameter Problem, the Pointer pointing to the field that failed to pass the format checks. However, an implementation MUST NOT send an ICMP message if the Checksum fails; instead, it MUST silently drop the packet. 6.3.3 Unknown SPI If a HIP implementation receives an ESP packet that has an unrecognized SPI number, it MAY responder, rate limited, with an ICMP packet with type Parameter Problem, the Pointer pointing to the the beginning of SPI field in the ESP header. 6.3.4 Invalid Cookie Solution If a HIP implementation receives an I2 packet that has an invalid cookie solution, the behaviour depends on the underlying version of IP. If IPv6 is used, the implementation SHOULD respond with an ICMP packet with type Parameter Problem, the Pointer pointing to the beginning of the Puzzle solution #J field in the SOLUTION payload in the HIP message. If IPv4 is used, the implementation MAY respond with an ICMP packet with the type Parameter Problem, copying enough of bytes form the I2 message so that the SOLUTION parameter fits in to the ICMP message, the Pointer pointing to the beginning of the Puzzle solution #J field, as in the IPv6 case. Note, however, that the resulting ICMPv4 message exceeds the typical ICMPv4 message size as defined in [2]. 6.3.5 Non-existing HIP association If a HIP implementation receives a CLOSE, or UPDATE packet, or any other packet whose handling requires an existing association, that has either a Receiver or Sender HIT that does not match with any existing HIP association, the implementation MAY respond, rate limited, with an ICMP packet with the type Parameter Problem, the Pointer pointing to the the beginning of the first HIT that does not match. A host MUST NOT reply with such an ICMP if it receives any of the following messages: I1, R2, I2, R2, CER, and NOTIFY. When introducing new packet types, a specification SHOULD define the appropriate rules for sending or not sending this kind of ICMP replies. Moskowitz, et al. Expires April 25, 2005 [Page 53] Internet-Draft Host Identity Protocol October 2004 7. HIP Packets There are nine basic HIP packets. Four are for the base HIP exchange, one is for updating, one is a broadcast for use when there is no IP addressing (e.g., before DHCP exchange), one is used to send certificates, one for sending notifications, and one is for sending unencrypted data. Packets consist of the fixed header as described in Section 6.1, followed by the parameters. The parameter part, in turn, consists of zero or more TLV coded parameters. In addition to the base packets, other packets types will be defined later in separate specifications. For example, support for mobility and multi-homing is not included in this specification. Packet representation uses the following operations: () parameter x{y} operation x on content y i x exists i times [] optional parameter x | y x or y In the future, an OPTIONAL upper layer payload MAY follow the HIP header. The payload proto field in the header indicates if there is additional data following the HIP header. The HIP packet, however, MUST NOT be fragmented. This limits the size of the possible additional data in the packet. 7.1 I1 - the HIP initiator packet The HIP header values for the I1 packet: Header: Packet Type = 1 SRC HIT = Initiator's HIT DST HIT = Responder's HIT, or NULL IP ( HIP () ) The I1 packet contains only the fixed HIP header. Valid control bits: none The Initiator gets the Responder's HIT either from a DNS lookup of the Responder's FQDN, from some other repository, or from a local table. If the Initiator does not know the Responder's HIT, it may Moskowitz, et al. Expires April 25, 2005 [Page 54] Internet-Draft Host Identity Protocol October 2004 attempt opportunistic mode by using NULL (all zeros) as the Responder's HIT. If the Initiator send a NULL as the Responder's HIT, it MUST be able to handle all MUST and SHOULD algorithms from Section 3, which are currently RSA and DSA. Since this packet is so easy to spoof even if it were signed, no attempt is made to add to its generation or processing cost. Implementation MUST be able to handle a storm of received I1 packets, discarding those with common content that arrive within a small time delta. 7.2 R1 - the HIP responder packet The HIP header values for the R1 packet: Header: Packet Type = 2 SRC HIT = Responder's HIT DST HIT = Initiator's HIT IP ( HIP ( [ R1_COUNTER, ] PUZZLE, DIFFIE_HELLMAN, HIP_TRANSFORM, ESP_TRANSFORM, HOST_ID, [ ECHO_REQUEST, ] HIP_SIGNATURE_2 ) [, ECHO_REQUEST ]) Valid control bits: C, A The R1 packet may be followed by one or more CER packets. In this case, the C-bit in the control field MUST be set. If the responder HI is an anonymous one, the A control MUST be set. The initiator HIT MUST match the one received in I1. If the Responder has multiple HIs, the responder HIT used MUST match Initiator's request. If the Initiator used opportunistic mode, the Responder may select freely among its HIs. The R1 generation counter is used to determine the currently valid generation of puzzles. The value is increased periodically, and it is RECOMMENDED that it is increased at least as often as solutions to old puzzles are not accepted any longer. Moskowitz, et al. Expires April 25, 2005 [Page 55] Internet-Draft Host Identity Protocol October 2004 The Puzzle contains a random #I and the difficulty K. The difficulty K is the number of bits that the Initiator must get zero in the puzzle. The random #I is not covered by the signature and must be zeroed during the signature calculation, allowing the sender to select and set the #I into a pre-computed R1 just prior sending it to the peer. The Diffie-Hellman value is ephemeral, but can be reused over a number of connections. In fact, as a defense against I1 storms, an implementation MAY use the same Diffie-Hellman value for a period of time, for example, 15 minutes. By using a small number of different Cookies for a given Diffie-Hellman value, the R1 packets can be pre-computed and delivered as quickly as I1 packets arrive. A scavenger process should clean up unused DHs and Cookies. The HIP_TRANSFORM contains the encryption and integrity algorithms supported by the Responder to protect the HI exchange, in the order of preference. All implementations MUST support the AES [10] with HMAC-SHA-1-96 [6]. The ESP_TRANSFORM contains the ESP modes supported by the Responder, in the order of preference. All implementations MUST support AES [10] with HMAC-SHA-1-96 [6]. The ECHO_REQUEST contains data that the sender wants to receive unmodified in the corresponding response packet in the ECHO_RESPONSE parameter. The ECHO_REQUEST can be either covered by the signature, or it can be left out from it. In the first case, the ECHO_REQUEST gets Type number 1022 and in the latter case 65281. The signature is calculated over the whole HIP envelope, after setting the initiator HIT, header checksum as well as the Opaque field and the Random #I in the PUZZLE parameter temporarily to zero, and excluding any TLVs that follow the signature, as described in Section 6.2.15. This allows the Responder to use precomputed R1s. The Initiator SHOULD validate this signature. It SHOULD check that the responder HI received matches with the one expected, if any. 7.3 I2 - the second HIP initiator packet The HIP header values for the I2 packet: Moskowitz, et al. Expires April 25, 2005 [Page 56] Internet-Draft Host Identity Protocol October 2004 Header: Type = 3 SRC HIT = Initiator's HIT DST HIT = Responder's HIT IP ( HIP ( SPI, [R1_COUNTER,] SOLUTION, DIFFIE_HELLMAN, HIP_TRANSFORM, ESP_TRANSFORM, ENCRYPTED { HOST_ID }, [ ECHO_RESPONSE ,] HMAC, HIP_SIGNATURE [, ECHO_RESPONSE] ) ) Valid control bits: C, A The HITs used MUST match the ones used previously. If the initiator HI is an anonymous one, the A control MUST be set. The Initiator MAY include an unmodified copy of the R1_COUNTER parameter received in the corresponding R1 packet into the I2 packet. The Solution contains the random # I from R1 and the computed # J. The low order K bits of the SHA-1(I | ... | J) MUST be zero. The Diffie-Hellman value is ephemeral. If precomputed, a scavenger process should clean up unused DHs. The HIP_TRANSFORM contains the encryption and integrity used to protect the HI exchange selected by the Initiator. All implementations MUST support the AES transform [10]. The Initiator's HI is encrypted using the HIP_TRANSFORM encryption algorithm. The keying material is derived from the Diffie-Hellman exchanged as defined in Section 9. The ESP_TRANSFORM contains the ESP mode selected by the Initiator. All implementations MUST support AES [10] with HMAC-SHA-1-96 [6]. The ECHO_RESPONSE contains the the unmodified Opaque data copied from the corresponding ECHO_REQUEST TLV. The ECHO_RESPONSE can be either covered by the signature, or it can be left out from it. In the first case, the ECHO_RESPONSE gets Type number 1024 and in the latter case 65283. Moskowitz, et al. Expires April 25, 2005 [Page 57] Internet-Draft Host Identity Protocol October 2004 The HMAC is calculated over whole HIP envelope, excluding any TLVs after the HMAC, as described in Section 8.3.1. The Responder MUST validate the HMAC. The signature is calculated over whole HIP envelope, excluding any TLVs after the HIP_SIGNATURE, as described in Section 6.2.14. The Responder MUST validate this signature. It MAY use either the HI in the packet or the HI acquired by some other means. 7.4 R2 - the second HIP responder packet The HIP header values for the R2 packet: Header: Packet Type = 4 SRC HIT = Responder's HIT DST HIT = Initiator's HIT IP ( HIP ( SPI, HMAC_2, HIP_SIGNATURE ) ) Valid control bits: none The HMAC_2 is calculated over whole HIP envelope, with Responder's HOST_ID TLV concatenated with the HIP envelope. The HOST_ID TLV is removed after the HMAC calculation. The procedure is described in 8.3.1. The signature is calculated over whole HIP envelope. The Initiator MUST validate both the HMAC and the signature. 7.5 CER - the HIP Certificate Packet The CER packet is OPTIONAL. The Optional CER packets over the Announcer's HI by a higher level authority known to the Recipient is an alternative method for the Recipient to trust the Announcer's HI (over DNSSEC or PKI). The HIP header values for CER packet: Header: Packet Type = 5 SRC HIT = Announcer's HIT DST HIT = Recipient's HIT IP ( HIP ( i , HIP_SIGNATURE ) ) or Moskowitz, et al. Expires April 25, 2005 [Page 58] Internet-Draft Host Identity Protocol October 2004 IP ( HIP ( ENCRYPTED { i }, HIP_SIGNATURE ) ) Valid control bits: None Certificates in the CER packet MAY be encrypted. The encryption algorithm is provided in the HIP transform of the previous (R1 or I2) packet. 7.6 UPDATE - the HIP Update Packet Support for the UPDATE packet is MANDATORY. The HIP header values for the UPDATE packet: Header: Packet Type = 6 SRC HIT = Sender's HIT DST HIT = Recipient's HIT IP ( HIP ( [NES, SEQ, ACK, DIFFIE_HELLMAN, ] HMAC, HIP_SIGNATURE ) ) Valid control bits: None The UPDATE packet contains mandatory HMAC and HIP_SIGNATURE parameters, and other optional parameters. 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. An UPDATE packet contains zero or one ACK parameters. The ACK parameter echoes the SEQ sequence number of the UPDATE packet being acked. A host MAY choose to ack more than one UPDATE packet at a time; e.g., the ACK may contain the last two SEQ values received, for robustness to ack loss. ACK values are not cumulative; each received unique SEQ value requires at least one corresponding ACK value in reply. Received ACKs that are redundant are ignored. The UPDATE packet may contain both a SEQ and an ACK parameter. In this case, the ACK is being