Network Working Group R. Moskowitz Internet-Draft ICSAlabs, a Division of TruSecure Expires:AugustDecember 25, 2005 Corporation P. Nikander P. Jokela (editor) Ericsson Research NomadicLab T. Henderson The Boeing CompanyFebruary 21,June 23, 2005 Host Identity Protocoldraft-ietf-hip-base-02draft-ietf-hip-base-03 Status of this MemoThis document is an Internet-Draft and is subject to all provisions of Section 3 of RFC 3667.By submitting this Internet-Draft, each author represents that any applicable patent or other IPR claims of which he or she is aware have been or will be disclosed, and any of which he or shebecomebecomes aware will be disclosed, in accordance withRFC 3668.Section 6 of BCP 79. 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 asInternet-Drafts.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 onAugustDecember 25, 2005. Copyright Notice Copyright (C) The Internet Society (2005). 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 separateHIParchitecture specification. The Host Identity Protocol is used to establishprovides a rapidauthenticationexchange of Host Identities (public keys) betweentwohosts and uses a Sigma-compliant [REF] Diffie-Hellman key exchange toprovide continuity of communicationsestablish shared secrets betweenthose hosts independent of the networking layer.such endpoints. Thevarious forms of the Host Identity, Host Identity Tag (HIT) and Local Scope Identifier (LSI), are covered in detail. Itprotocol isdescribed how they are useddesigned tosupport authenticationbe resistant to Denial-of-Service (DoS) andthe establishment of keying material, which is then used for protecting subsequent HIP messages,Man-in-the-middle (MitM) attacks, andwhich can bewhen usedfor generating session keys for othertogether with another suitable securityprotocols,protocol, such asIPsec EncapsulaedEncapsulated Security Payload(ESP). The basic state machine for HIP(ESP) [24], it providesa HIP compliant host with the resiliency to avoid many denial-of-service (DoS) attacks. The basic HIP exchangeencryption and/or authentication protection fortwo public hosts shows the actual packet flow. Other HIP exchanges, including those that workupper layer protocols such as TCP and UDP, while enabling continuity of communications acrossNATs, are covered elsewhere.network layer address changes. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . .65 1.1 Anew name spaceNew Name Space andidentifiersIdentifiers . . . . . . . . . . . . .65 1.2 The HIPbase exchangeBase Exchange . . . . . . . . . . . . . . . . . .65 2.Conventions used in this document . . .Terms and Definitions . . . . . . . . . .8 3. Host Identifier (HI) and its representations. . . . . . . .9 3.1 Host Identity Tag (HIT). 7 2.1 Requirements Terminology . . . . . . . . . . . . . . . .9 3.1.1 Restricting HIT values. 7 2.2 Notation . . . . . . . . . . . . . . .10 3.1.2 Generating a HIT from a HI. . . . . . . . . . 7 2.3 Definitions . . . .11 3.2 Local Scope Identifier (LSI). . . . . . . . . . . . . . .12 4. Host Identity Protocol .. . . . 7 3. Host Identifier (HI) and its Representations . . . . . . . . 8 3.1 Host Identity Tag (HIT) . . . . . .14 4.1 HIP base exchange. . . . . . . . . . . 8 3.2 Generating a HIT from a HI . . . . . . . . .14 4.1.1 HIP Cookie Mechanism. . . . . . . 9 4. Protocol Overview . . . . . . . . . .15 4.1.2 Authenticated Diffie-Hellman protocol. . . . . . . .18 4.1.3 HIP replay protection. . . 11 4.1 Creating a HIP Association . . . . . . . . . . . . .19 4.2 TCP and UDP pseudo-header computation for user data. . .20 4.3 Updating a11 4.1.1 HIPassociationCookie Mechanism . . . . . . . . . . . . . . . .20 4.4 Error processing. 12 4.1.2 Authenticated Diffie-Hellman Protocol . . . . . . . . 14 4.1.3 HIP Replay Protection . . . . . . . . . . . .20 4.5 Certificate distribution. . . . 15 4.1.4 Refusing a HIP Exchange . . . . . . . . . . . . .21 4.6 Sending data on. . 16 4.2 Updating a HIPpacketsAssociation . . . . . . . . . . . . . . .21 4.7 Transport Formats. 16 4.3 Error Processing . . . . . . . . . . . . . . . . . . . .21 5.. 17 4.4 HIPprotocol overviewState Machine . . . . . . . . . . . . . . . . . . .22 5.1. 17 4.4.1 HIPScenariosStates . . . . . . . . . . . . . . . . . . . . . .22 5.2 Refusing a18 4.4.2 HIPexchangeState Processes . . . . . . . . . . . . . . . . .23 5.3 Reboot and SA timeout restart of18 4.4.3 Simplified HIP State Diagram . . . . . . . . . . .23 5.4 HIP State Machine. . 22 4.5 User Data Considerations . . . . . . . . . . . . . . . . . 24 4.5.1 TCP and UDP Pseudo-header Computation for User Data .23 5.4.124 4.5.2 Sending Data on HIPStatesPackets . . . . . . . . . . . . . 24 4.5.3 Transport Formats . . . . . . . . . .24 5.4.2 HIP State Processes. . . . . . . . 24 4.5.4 Reboot and SA Timeout Restart of HIP . . . . . . . . . 245.4.3 Simplified HIP State Diagram4.6 Certificate Distribution . . . . . . . . . . . . .28 6.. . . . 25 5. PacketformatsFormats . . . . . . . . . . . . . . . . . . . . . . .30 6.126 5.1 PayloadformatFormat . . . . . . . . . . . . . . . . . . . . . .30 6.1.126 5.1.1 HIP Controls . . . . . . . . . . . . . . . . . . . . .31 6.1.227 5.1.2 Checksum . . . . . . . . . . . . . . . . . . . . . . .31 6.228 5.1.3 HIPparameters .Fragmentation Support . . . . . . . . . . . . . . 28 5.1.4 Solving the Puzzle . . . . . . .32 6.2.1 TLV format. . . . . . . . . . . 28 5.2 HIP Parameters . . . . . . . . . . .33 6.2.2 Defining new parameters. . . . . . . . . . . 30 5.2.1 TLV Format . . . .35 6.2.3 R1_COUNTER. . . . . . . . . . . . . . . . . . 32 5.2.2 Defining New Parameters . . . .36 6.2.4 PUZZLE. . . . . . . . . . . 33 5.2.3 R1_COUNTER . . . . . . . . . . . . .37 6.2.5 SOLUTION. . . . . . . . . 34 5.2.4 PUZZLE . . . . . . . . . . . . . .38 6.2.6 DIFFIE_HELLMAN. . . . . . . . . . 35 5.2.5 SOLUTION . . . . . . . . . .39 6.2.7 HIP_TRANSFORM. . . . . . . . . . . . . 36 5.2.6 DIFFIE_HELLMAN . . . . . . .40 6.2.8 HOST_ID. . . . . . . . . . . . . 36 5.2.7 HIP_TRANSFORM . . . . . . . . . .41 6.2.9 CERT. . . . . . . . . . 37 5.2.8 HOST_ID . . . . . . . . . . . . . . .42 6.2.10 HMAC. . . . . . . . 38 5.2.9 HMAC . . . . . . . . . . . . . . . .43 6.2.11 HMAC_2 . . . . . . . . .. . . . . . . . . 40 5.2.10 HMAC_2 . . . . .43 6.2.12 HIP_SIGNATURE. . . . . . . . . . . . . . . . . . 40 5.2.11 HIP_SIGNATURE .44 6.2.13 HIP_SIGNATURE_2. . . . . . . . . . . . . . . . . .44 6.2.14 SEQ41 5.2.12 HIP_SIGNATURE_2 . . . . . . . . . . . . . . . . . . 41 5.2.13 SEQ . . . . . .45 6.2.15 ACK. . . . . . . . . . . . . . . . . . 42 5.2.14 ACK . . . . . .45 6.2.16 ENCRYPTED. . . . . . . . . . . . . . . . . . 43 5.2.15 ENCRYPTED . . .46 6.2.17 NOTIFY. . . . . . . . . . . . . . . . . . 44 5.2.16 NOTIFY . . . . .47 6.2.18 ECHO_REQUEST. . . . . . . . . . . . . . . . . . 45 5.2.17 ECHO_REQUEST . .50 6.2.19 ECHO_RESPONSE. . . . . . . . . . . . . . . . . . 48 5.2.18 ECHO_RESPONSE .51 6.3 ICMP messages. . . . . . . . . . . . . . . . . . 49 5.3 HIP Packets . . . .51 6.3.1 Invalid Version. . . . . . . . . . . . . . . . . . .51 6.3.2 Other problems with49 5.3.1 I1 - the HIPheader and packet structure . . . .Initiator Packet . . . . . . . . . . . . 50 5.3.2 R1 - the HIP Responder Packet . . . . . .51 6.3.3 Invalid Cookie Solution. . . . . . 50 5.3.3 I2 - the Second HIP Initiator Packet . . . . . . . . . 526.3.4 Non-existing5.3.4 R2 - the Second HIPassociation . . . .Responder Packet . . . . . . . . .52 7.53 5.3.5 UPDATE - the HIPPacketsUpdate Packet . . . . . . . . . . . . 54 5.3.6 NOTIFY - the HIP Notify Packet . . . . . . . . . . . .53 7.1 I155 5.3.7 CLOSE - the HIPinitiatorassociation closing packet . . . . . . 55 5.3.8 CLOSE_ACK - the HIP Closing Acknowledgment Packet . . 55 5.4 ICMP Messages . . . . . .53 7.2 R1 - the HIP responder packet .. . . . . . . . . . . . .54 7.3 I2 - the second HIP initiator packet. . . 56 5.4.1 Invalid Version . . . . . . . .55 7.4 R2 - the second HIP responder packet. . . . . . . . . . . 567.5 CER -5.4.2 Other Problems with the HIPCertificateHeader and Packet Structure . . . . . . . . . . . . .57 7.6 UPDATE - the HIP Update Packet . . . .. . . . . . . . . 56 5.4.3 Invalid Cookie Solution .57 7.7 NOTIFY - the HIP Notify Packet. . . . . . . . . . . . . .58 7.8 CLOSE - the56 5.4.4 Non-existing HIPassociation closing packetAssociation . . . . . . . .59 7.9 CLOSE_ACK - the HIP closing acknowledgment packet. . . .59 8.. 57 6. PacketprocessingProcessing . . . . . . . . . . . . . . . . . . . . .61 8.158 6.1 Processingoutgoing application dataOutgoing Application Data . . . . . . . . . . .61 8.258 6.2 Processingincoming application dataIncoming Application Data . . . . . . . . . . .62 8.359 6.3 HMAC and SIGNATUREcalculationCalculation andverificationVerification . . . . .63 8.3.160 6.3.1 HMACcalculationCalculation . . . . . . . . . . . . . . . . . . .63 8.3.260 6.3.2 SignaturecalculationCalculation . . . . . . . . . . . . . . . .63 8.4 Initiation of a61 6.4 HIPexchangeKEYMAT Generation . . . . . . . . . . . . . . .64 8.4.1 Sending multiple I1s in parallel. . . 62 6.5 Initiation of a HIP Exchange . . . . . . . .65 8.4.2 Processing incoming ICMP. . . . . . . 63 6.5.1 Sending Multiple I1s in Parallel . . . . . . . . . . . 64 6.5.2 Processing Incoming ICMP Protocol UnreachablemessagesMessages . . . . . . . . . . . . . . . . . . . . . . .65 8.564 6.6 ProcessingincomingIncoming I1packetsPackets . . . . . . . . . . . . . .66 8.5.165 6.6.1 R1 Management . . . . . . . . . . . . . . . . . . . . 668.5.26.6.2 Handlingmalformed messagesMalformed Messages . . . . . . . . . . . . .67 8.666 6.7 ProcessingincomingIncoming R1packetsPackets . . . . . . . . . . . . . .67 8.6.166 6.7.1 Handlingmalformed messagesMalformed Messages . . . . . . . . . . . . . 688.76.8 ProcessingincomingIncoming I2packetsPackets . . . . . . . . . . . . . .69 8.7.168 6.8.1 Handlingmalformed messagesMalformed Messages . . . . . . . . . . . . .70 8.871 6.9 ProcessingincomingIncoming R2packetsPackets . . . . . . . . . . . . . .70 8.971 6.10 Sending UPDATEpackets .Packets . . . . . . . . . . . . . . . . . 718.106.11 Receiving UPDATEpacketsPackets . . . . . . . . . . . . . . . .71 8.10.172 6.11.1 Handling a SEQ paramaeter in a received UPDATE message . . . . . . . . . . . . . . . . . . . . . . 728.10.26.11.2 Handling an ACKparameterParameter in areceivedReceived UPDATEpacket . . . . . . . . . . . . . . . . .Packet . . . . . .72 8.11 Processing CER packets. . . . . . . . . . . . . . . . . 738.126.12 Processing NOTIFYpacketsPackets . . . . . . . . . . . . . . .73 8.1374 6.13 Processing CLOSEpacketsPackets . . . . . . . . . . . . . . . .73 8.1474 6.14 Processing CLOSE_ACKpacketsPackets . . . . . . . . . . . . . .73 8.1574 6.15 Dropping HIPassociations . . . . . . . . . . . . . . . 73 9. HIP KEYMAT . . . . . . . . . . . . . . . . . . . . . . . . . 75 10. HIP Fragmentation Support . .Associations . . . . . . . . . . . . . . .77 11.74 7. HIP Policies . . . . . . . . . . . . . . . . . . . . . . . .78 12.75 8. Security Considerations . . . . . . . . . . . . . . . . . .79 13.76 9. IANA Considerations . . . . . . . . . . . . . . . . . . . .82 14.79 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . .83 15.84 11. References . . . . . . . . . . . . . . . . . . . . . . . . .84 15.185 11.1 NormativereferencesReferences . . . . . . . . . . . . . . . . . .84 15.285 11.2 InformativereferencesReferences . . . . . . . . . . . . . . . . .8586 Authors' Addresses . . . . . . . . . . . . . . . . . . . . .8687 A. Probabilities of HITcollisionsCollisions . . . . . . . . . . . . . .8789 B. Probabilities in thecookie calculationCookie Calculation . . . . . . . . . .8890 C. Usingresponder cookiesResponder Cookies . . . . . . . . . . . . . . . . . .8991 D. Generating a HIT from a HI . . . . . . . . . . . . . . . . . 92 E. ExamplechecksumsChecksums for HIPpacketsPackets . . . . . . . . . . . . .92 D.193 E.1 IPv6 HIPexampleExample (I1) . . . . . . . . . . . . . . . . . .92 D.293 E.2 IPv4 HIPpacketPacket (I1) . . . . . . . . . . . . . . . . . . .92 D.393 E.3 TCPsegmentSegment . . . . . . . . . . . . . . . . . . . . . . .92 E.93 F. 384-bitgroupGroup . . . . . . . . . . . . . . . . . . . . . . .9495 Intellectual Property and Copyright Statements . . . . . . .9596 1. IntroductionTheThis memo specifies the details of the Host Identity Protocol(HIP) provides a rapid exchange(HIP). A high-level description ofHost Identities between two hosts. Thethe protocolis designed to be resistant to Denial-of-Service (DoS)andMan-in-the-middle (MitM) attacks,the underlying architectural thinking is available in the separate HIP architecture description [25]. Briefly, the HIP architecture proposes an alternative to the dual use of IP addresses as "locators" (routing labels) andwhen"identifiers" (endpoint, or host, identifiers). Instead, in HIP, the host identifiers are public keys of a public/private key pair. By using public keys (and their representations) as host identifiers, to which higher layer protocols are bound instead of an IP address, dynamic changes to IP address sets can be directly authenticated between hosts, and if desired, strong authentication between hosts at the TCP/IP stack level can be obtained. This memo specifies the base HIP protocol ("base exchange") usedtogetherbetween hosts to establish communications context (keying material, per-packet context tags) prior to communications. It also defines a packet format and procedures for updating an active HIP association. Other elements of the HIP architecture are specified in other documents, including how HIP can be combined withanother suitable security protocol, such as Encapsulateda variant of the Encapsulating Security Payload (ESP)[23], it provides DoSfor encryption and/or authentication protection, mobility andMitM protectionhost multihoming extensions, DNS extensions forupper layer protocols, such as TCPstoring host identities, HIP-related infrastructure in the network, techniques for NAT traversal, andUDP.possibly other future extensions. 1.1 Anew name spaceNew Name Space andidentifiersIdentifiers The Host Identity Protocol introduces a new namespace, the Host Identity.The effectsSome ramifications of thischangenew namespace are explained in the companion document, the HIP architecture[21][25] 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 use as a packet identifier, or as an 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. The HIT has an important security property in that it is self-certifying (see Section 3). 1.2 The HIPbase exchangeBase Exchange The HIP base exchange is a two-party cryptographic protocolthat consists ofused to establish communications context between hosts. The base exchange is a Sigma-compliant [REF] fourpackets.packet exchange. The first party is called the Initiator and the second party the Responder. Thefour-packetfour- 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 startsthe Responder starts a cookie puzzle exchange in the 2nd packet, with the Initiator completing it in the 3rdpacket.packet before the Responder stores any state from the exchange. The exchangeusescan use the Diffie-Hellmanexchangeoutput tohideencrypt the Host Identity of the Initiator in packet3. The Responder's3 (although Aura et al. [29] notes that such operation may interfere with packet-inspecting middleboxes), or the Host Identityis notmay instead be sent unencrypted. 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 to flow 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, to be used with Encapsulated Security Payload (ESP)[23][24] and other end-to-end security protocols. The base protocol lacks the details for security association management and much of the fine-grained policy control found in Internet Key Exchange IKE RFC2409 [8] that allows IKE to support complex gateway policies. Thus, HIP is not a replacement for IKE. 2.Conventions used in this documentTerms and Definitions 2.1 Requirements Terminology 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]. 2.2 Notation [x] indicates that x is optional. {x} indicates that x is encrypted. <x>y indicates that "x" is encrypted with the key "y". --> signifies "Initiator to Responder" communication (requests). <-- signifies "Responder to Initiator" communication (replies). | signifies concatenation of information-- e.g. X | Y is the concatenation of X with Y. Ltrunc (SHA-1(), K) denotes the lowest order K bits of the SHA-1 result. (This section needs work.) 2.3 Definitions (This section needs work. Examples from IKE include "Perfect Forward Secrecy", "Security Association") Unused Association Lifetime (UAL): Implementation-specific time for which, if no packet is sent or received for this time interval, a host MAY begin to tear down an active association. HIT Hash Algorithm: hash algorithm used to generate a Host Identity Tag (HIT) from the Host Identity public key. Currently SHA-1 [23] is used. 3. Host Identifier (HI) and itsrepresentationsRepresentations A public key of an asymmetric key pair is used as the Host Identifier (HI). Correspondingly, the host itself is defined as the entity that holds the private key from the key pair. See the HIP architecture specification[21][25] for more details about the difference between an identity and the corresponding identifier. HIP implementations MUST support the Rivest Shamir Adelman (RSA)[14][15] 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-bit IPv4-compatible ones and 128-bit IPv6-compatible ones. 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. The 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,HIs andLSIsHITs are not expected to be carried explicitly in the headers of user datapackets.packets, due to their sizes. Depending on the form of further communication, other methods are used to map the data packet to the these representatives of host identities. For example, if ESP is used to protect data traffic, the Security Parameter Index (SPI) can be used for this purpose. In some cases, this makes it possible to use HIP without an additional explicit protocol header. 3.1 Host Identity Tag (HIT) The Host Identity Tag is a 128 bits long value -- a hash of the Host Identifier. There are two advantages of using a hash over the actual Host Identity public key in protocols. Firstly, its fixed length makes for easier 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_Type 1 HIT_, consist of128an 8-bit prefix followed by 120 bits of theSHA-1hash of the public key. HITs of the second type (Type 2 HIT) 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 Section11. 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 [29]. 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.7. This document fully specifies onlytypeType 1 HITs. HITs that consists of the HAA field and the hash are specified in[25].[27]. Any conforming implementation MUST be able to deal with Type 1 HITs. When handling other thantypeType 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 Restricting HIT values To facilitate experimentation and make certain kindIt is a matter ofimplementations easier, thepolicy whether a host will accept a HIP connection when such binding is not known. The followingrestrictions are temporarily placed on HITs. These restriction are to be lifted atfigure shows theendstructure of a Type 1 HIT. 1 0 2 0 1 2 3 4 5 6 7 8 ... 7 +-+-+-+-+-+-+-+-+-+-//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Prefix | Hash | +-+-+-+-+-+-+-+-+-+-//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Prefix (8 bits) - Fixed prefix, TBD. All other values reserved. 0x40 - SHA-1 hash algorithm All other values reserved. Hash (120 bits) - Lower-order bits of2008. That is, after January 1st 2009, any implementation claiming conformance to this specification MUST accept any HITs from peers and be able to process them normally. The restrictions: Beforetheendhash (as specified by the hash algorithm) of2008, all implementations SHOULD restricttheHITs they generate to ones whose upper-most (left-most) two bits are either binary01 or10. That is, when generating new HIs, ifpublic key Additional values for theresultingprefix (including different hash algorithms, or other information) may be defined in the future. A host may receive a HIThas as its first two bits as00 or11,for which it does not understand theimplementation SHOULD generate new HIs untilprefix. In such a case, itgenerates one that fulfills this restriction. Additionally, a conforming implementation MAY refuse to communicate with a peer that has a HIT with the upper-most bits either00 or11. When refusing a HIP connection on this bases, the implementation MAY send an R2 with a NOTIFY payload, with the NOTIFY code being UNSUPPORTED_HIT_VALUE_RANGE. Any such NOTIFYs maywill not berate-limited A rationale: One way to experimentally implement HIP isable touse unmodified IPv6, TCP and UDP implementations in the stack, using HITs incheck theplace of IPv6 addresses. This modification makes it easier to use existing IPv6 data structures to hold HITs and to distinguishmapping betweenthe two data types. If the IPv6 address spaceHI andthe HIT value space overlap, it becomes hard to define secure IPsec policies without explicitly tagging the values either as HITs or IPv6 addresses. 3.1.2HIT. 3.2 Generating a HIT from a HI The128120 or 64 hash bits in a HIT MUST be generated by taking the least significant128120 or 64 bits of theSHA-1 [22]HIT Hash Algorithm 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: The RSA public key is encoded as defined in RFC3110[14][15] Section 2, taking the exponent length (e_len), exponent (e) and modulus (n) fields concatenated. The length (n_len) 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 as the HI (hi_len). The fields MUST be encoded in network byte order, as defined in RFC3110[14].[15]. 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][23] is calculated over the encoded key. 3. The least significant128120 or 64 bits of the hash result are used to create the HIT, as defined above. In Appendix D the HIT generation process is illustrated using pseudo- code. 4. Protocol Overview The followingpseudo-codes illustratesmaterial is an overview of theprocess for both RSAHIP protocol operation, andDSA. The symbol := denotes assignment;does not contain all details of thesymbol += denotes appending. The pseudo-function encode_in_network_byte_order takes two parameters, an integer (bignum)packet formats or the packet processing steps. Section 5 anda lengthSection 6 describe inbytes, and returnsmore detail theinteger encoded into a byte stringpacket formats and packet processing steps, respectively, and are normative in case of any conflicts with this section. The Host Identity Protocol is IP protocol TBD (Editor's note: protocol number will be assigned by IANA; for testing purposes, thegiven 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.RSA.n_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 ) 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.protocol number 99 is currently used). Thepurpose of an LSIHIP payload (Section 5.1) header could be carried in every IP datagram. However, since HIP headers are relatively large (40 bytes), it is desirable tofacilitate using Host Identities'compress' the HIP header so that the HIP header only occurs inexisting IPv4control packets used to establish orIPv6 based protocols and APIs.change HIP state. TheLSI can be used anywhere in system processes where IP addresses have traditionally been used, such as IPv4actual method for header 'compression' andIPv6 API callsfor matching data packets with existing HIP associations (if any) is defined in separate extension documents, describing transport formats andFTP PORT commands. The IPv4-compatible LSIsmethods. All HIP implementations MUSTbe allocated fromimplement, at minimum, theTBD subnet andESP transport format for HIP [24]. 4.1 Creating a HIP Association By definition, theIPv6-compatible LSIs MUST be allocated fromsystem initiating a HIP exchange is theTBD subnet. That makes it easier to differentiate between LSIsInitiator, andIP addresses attheAPI level. By default,peer is thelow order 24 bits of an IPv4-compatible LSI are equalResponder. This distinction is forgotten once the base exchange completes, and either party can become the Initiator in future communications. The HIP base exchange serves to manage thelow order 24 bitsestablishment of state between an Initiator and a Responder. The first packet, I1, initiates thecorresponding HIT, whileexchange, and thelow order TBD bitslast three packets, R1, I2, and R2, constitute a standard authenticated Diffie-Hellman key exchange for session key generation. During the Diffie-Hellman key exchange, a piece ofan IPv6-compatible LSIkeying material is generated. The HIP association keys areequaldrawn from this keying material. If other cryptographic keys are needed, e.g., to be used with ESP, they are expected to be drawn from thelow order TBD bits of the corresponding HIT. A host performingsame keying material. The Initiator first sends aHIP handshake may discover thattrigger packet, I1, to theLSI formed fromResponder. The packet contains only thepeer'sHITcollides with another LSI in use locally (i.e.,of thelower 24 or TBD bitsInitiator and possibly the HIT oftwo different HITs arethesame). InResponder, if it is known. The second packet, R1, starts the actual exchange. It contains a puzzle-- a cryptographic challenge thatcase,thehost MUST handleInitiator must solve before continuing theLSI collision locally such that application callsexchange. The level of difficulty of the puzzle can bedisambiguated. One possible meansadjusted based on level ofdoing so is to perform a Host NAT function to locally convert a peer's LSI into a different LSI value. This would requiretrust with thehost to ensure that LSI bits onInitiator, current load, or other factors. In addition, thewire (i.e., inR1 contains theapplication data stream) are converted back to match that host's LSI. Other alternatives for resolving LSI collisions may be added ininitial Diffie-Hellman parameters and a signature, covering part of thefuture. 4. Host Identity Protocol The Host Identity Protocol is IP protocol TBD (number will be assigned by IANA). The HIP payload (Section 6.1) header could be carried in every datagram. However, since HIP datagramsmessage. Some fields arerelatively large (at least 40 bytes), it is desirableleft outside the signature to'compress'support pre-created R1s. In theHIP header so thatI2 packet, theHIP header only occur in datagramsInitiator must display the solution toestablish or change HIP state.the received puzzle. Without a correct solution, the I2 message is discarded. Theactual methodI2 also contains a Diffie-Hellman parameter that carries needed information forheader 'compression' and matching data packets with existing HIP associations (if any)the Responder. The packet isdefined in separate extension documents, describing transport formats and methods. All HIP implementations MUST implement, at minimum,signed by theESP transport format for HIP [23]. For testing purposes,sender. The R2 packet finalizes theprotocol number 99 is currently used. 4.1 HIPbaseexchangeexchange. The packet is signed. TheHIPbase exchangeservesis illustrated below. The term "key" refers tomanagetheestablishment of state between an Initiatorhost identity public key, and "sig" represents aResponder.signature using such key. Thelast threepacketsof the exchange, R1, I2, and R2, constitute a standard authenticated Diffie-Hellman key exchange for session key generation. During the Diffie-Hellman key exchange, a piece of keying material is generated. The HIP association keys are drawn from this keying material. Ifcontain othercryptographic keys are needed, e.g., to be used with ESP, they are expected to be drawn from the same keying material. 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-Hellmanparametersand 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 base exchange. The packet is signed. The base exchange is illustrated below.not shown in this figure. 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-HIn 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 aresponderResponder implementation to completely delay session specific state creation until a valid I2 is received. In such a case avalidlycorrectly formatted I2 can be rejectedearliestonly once the Responder has checked its validity by computing one hash function. On the other hand, the design also allows aresponderResponder implementation to keep state about received I1s, 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 other combinations 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 C for one possible implementation.Note, however, that the implementations MUST NOT use the exact implementation given in the appendix, andImplementations SHOULD include sufficient randomness to the algorithm so that algorithm complexity attacks become impossible[27].[30]. The Responder can set the puzzle difficulty for Initiator, based on itsconcernlevel of trust of the Initiator. The Responder SHOULD use heuristics to determine when it is under a denial-of-service attack, and set the puzzle difficulty value K appropriately; see below. 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. The value K sets the difficulty of the puzzle. 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 in the 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 Appendix C for an example on how to implement this. Using the Opaque data field in an ECHO_REQUEST parameter, 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 in various ways; 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 wasNOTto NOT include a timestamp. NOTE: The protocol developers explicitly considered whether a memory bound function should be used for the puzzle instead of a CPU bound function. The decision was not to use memory bound functions. At the time of the decision the idea of memory bound functions was relatively new and their IPR status were unknown. Once there is more experience about memory bound functions and once their IPR status is better known, it may be reasonable to reconsider this decision.In4.1.2 Authenticated Diffie-Hellman Protocol The packets R1,the values II2, andK are sent in network byte order. Similarly, in I2 the values IR2 implement a standard authenticated Diffie- Hellman exchange. The Responder sends its public Diffie-Hellman key andJ are sentits public authentication key, i.e., its host identity, innetwork byte order.R1. TheSHA-1 hash is created by concatenating,signature innetwork byte order,R1 allows thefollowing data, inInitiator to verify that thefollowing order: 64-bit random value I, in network byte order, as appearing inR1and I2. 128-bit initiator HIT, in network byte order, as appearing inhas been once generated by theHIP Payload in R1Responder. However, since it is precomputed andI2. 128-bit responder HIT, in network byte order, as appearing intherefore 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 HIPPayload in R1association using keying material from the session key (see Section 6.4), andI2. 64-bit random value J, in network byte order, as appearing in I2. In ordermay use the association tobe a valid response cookie,encrypt its public authentication key, i.e., host identity. The resulting I2 contains theK low-order bitsInitiator's Diffie-Hellman key and its (optionally) encrypted public authentication key. The signature in I2 covers all of theresulting SHA-1 digest must be zero. Notes:packet. Thelength ofResponder extracts thedata to be hashed is 48 bytes. AllInitiator Diffie-Hellman public key from thedata in the hash input MUST be in network byte order. The order ofI2, computes theinitiatorDiffie-Hellman session key, creates a corresponding HIP association, andresponder HITs are different indecrypts theR1 and I2 packets, see Section 6.1. Care must be taken to copyInitiator's public authentication key. It can then verify thevalues in right ordersignature using the authentication key. The final message, R2, is needed to protect thehash input. Precomputation byInitiator from replay attacks. 4.1.3 HIP Replay Protection The HIP protocol includes theResponder Sets upfollowing mechanisms to protect against malicious replays. Responders are protected against replays of I1 packets by virtue of thepuzzle difficulty K. Creates a signedstateless response to I1s with presigned R1and caches it. Responder Selects a suitable cached R1. Generatesmessages. Initiators are protected against R1 replays by arandom number I. Sends I and Kmonotonically increasing "R1 generation counter" included inanthe R1.Saves IResponders are protected against replays or false I2s by the cookie mechanism (Section 4.1.1 above), andK for a Delta time. Initiator Generates repeated attemptsoptional use of opaque data. Hosts are protected against replays tosolve the puzzle until a matching J is found: Ltrunc( SHA-1( I | HIT-I | HIT-R | J ), K ) == 0 Sends IR2s andJ in an I2. Responder Verifies that the received IUPDATEs by use of a less expensive HMAC verification preceding HIP signature verification. The R1 generation counter is asaved one. Findsmonotonically increasing 64-bit counter that may be initialized to any value. The scope of theright K based on I. Computes V := Ltrunc( SHA-1( I | HIT-I | HIT-R | J ), K ) Rejects if V != 0 Acceptcounter MAY be system-wide but SHOULD be per host identity, ifV == 0there is more than one local host identity. TheLtrunc (SHA-1(), K) denotesvalue of this counter SHOULD be kept across system reboots and invocations of thelowest order K bitsHIP base exchange. This counter indicates the current generation of cookie puzzles. Implementations MUST accept puzzles from theSHA-1 result. 4.1.2 Authenticated Diffie-Hellman protocol The packets R1, I2,current generation andR2 implement a standard authenticated Diffie-Hellman exchange. The Responder sends its public Diffie-Hellman keyMAY 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, andits public authentication key, i.e., its host identity, in R1. The signature in R1 allowsSHOULD never be decremented, lest theInitiatorhost expose its peers toverify thatthe replay of previously generated, higher numbered R1s. Also, the R1has been once generated bygeneration counter MUST NOT roll over; if theResponder. However, since itcounter isprecomputed and therefore does not cover all ofabout to become exhausted, thepacket, it does not protect fromcorresponding 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 6.5.1) or due to a replayattacks.of an old R1. Whenthe Initiator receivessending multiple I1s, anR1, it computes the Diffie-Hellman session key. It createsinitiator SHOULD wait for aHIP association using keying material from the session key (see Section 9), and usessmall amount of time after theassociationfirst R1 reception toencrypt its public authentication key, i.e., host identity. The resulting I2 contains the Initiator's Diffie-Hellman keyallow possibly multiple R1s to arrive, andits encrypted public authentication key. The signature in I2 covers all ofit SHOULD respond to an R1 among thepacket. The Responder extractsset with the largest R1 generation counter. If an InitiatorDiffie-Hellman public key fromis 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 theI2, computesfresher R1, as if it were theDiffie-Hellman session key, creates a correspondingfirst R1 to arrive. Upon conclusion of an active HIPassociation, and decryptsassociation with another host, theInitiator's public authentication key. It can then verifyR1 generation counter associated with thesignature usingpeer host SHOULD be flushed. A local policy MAY override theauthentication key.default flushing of R1 counters on a per-HIT basis. Thefinal message, R2,reason for recommending the flushing of this counter isneeded to protectthat there may be hosts where theInitiator from replay attacks. 4.1.3R1 generation counter (occasionally) decreases; e.g., due to hardware failure. 4.1.4 Refusing a HIPreplay protection TheExchange A HIPprotocol includes the following mechanismsaware host may choose not toprotect against malicious replays. Responders are protected against replays of I1 packets by virtue ofaccept a HIP exchange. If thestateless responsehost's policy is toI1s with presigned R1 messages. Initiators are protected against R1 replays byonly be an Initiator, it should begin its own HIP exchange. A host MAY choose to have such amonotonically increasing "R1 generation counter" included inpolicy since only theR1. Responders areInitiator HI is protectedagainst replays or false I2s byin thecookie 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 counterexchange. There is amonotonically increasing 64-bit counter that may be initialized to any value. The scoperisk ofthe counter MAY be system-wide but SHOULD be per host identity,a race condition ifthereeach host's policy ismore than one local host identity. The value of this counter SHOULDto only bekept across system reboots and invocations ofan Initiator, at which point the HIPbase exchange. This counter indicatesexchange will fail. If thecurrent generation of cookie puzzles. Implementations MUST accept puzzles fromhost's policy does not permit it to enter into a HIP exchange with thecurrent generation and MAY accept puzzles from earlier generations.Initiator, it should send an ICMP 'Destination Unreachable, Administratively Prohibited' message. Asystem's local counter MUST be incremented at least as oftenmore complex HIP packet is not used here asevery time old R1s ceaseit actually opens up more potential DoS attacks than a simple ICMP message. 4.2 Updating a HIP Association A HIP association between two hosts may need to bevalid, and SHOULD never be decremented, lestupdated over time. Examples include thehost expose its peersneed tothe replay of previously generated, higher numbered R1s. Also, the R1 generation counter MUST NOT roll over; if the counterrekey expiring user data security associations, add new security associations, or change IP addresses associated with hosts. The UPDATE packet isabout to become exhausted,used for those and other similar purposes. This document only specifies thecorresponding HI must be abandonedUPDATE packet format andreplacedbasic processing rules, with mandatory TLVs. The actual usage is defined in separate specifications. HIP provides anew 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 sendinggeneral purpose UPDATE packet, which can carry multipleI1s, an initiator SHOULD waitHIP parameters, fora small amount of time afterupdating thefirst R1 reception to allow possibly multiple R1s to arrive, and it SHOULD respond to an R1 amongHIP state between two peers. The UPDATE mechanism has theset withfollowing properties: UPDATE messages carry a monotonically increasing sequence number and are explicitly acknowledged by thelargest R1 generation counter. If an initiatorpeer. 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 5.3.5. 4.3 Error Processing HIP error processing behavior depends on whether there exists anR1active HIP association orhas already sentnot. In general, if anI2 (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 activeHIP associationwith another host,exists between theR1 generation counter associated withsender and receiver of a packet causing an error condition, thepeer hostreceiver SHOULDbe flushed. A local policy MAY override the default flushing of R1 counters onrespond with aper-HIT basis. The reason for recommendingNOTIFY packet. On theflushing of this counter is thatother hand, if theremay be hosts whereare no existing HIP associations between theR1 generation counter (occasionally) decreases; e.g., due to hardware failure. 4.2 TCP and UDP pseudo-header computation for user data When computing TCPsender andUDP checksums on user data packets that flow through sockets bound to HITsreceiver, orLSIs, the IPv6 pseudo-header format [11] MUST be used. Additionally,theHITs MUST be used inreceiver cannot reasonably determine theplaceidentity of theIPv6 addresses in the IPv6 pseudo-header. Note thatsender, thepseudo-header for actual HIP payloads is computed differently;receiver MAY respond with a suitable ICMP message; see Section6.1.2. 4.3 Updating a HIP association A5.4 for more details. The HIPassociationprotocol 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 twohosts may needsystems. The system with data tobe updated over time. Examples includesend is theneed to rekey expiring user data security associations, add new security associations, or change IP addresses associated with hosts.Initiator. TheUPDATE packet is used for those and other similar purposes. This document only specifiesprocess follows theUPDATEstandard four packetformat and basic processing rules, with mandatory TLVs. The actual usage is defined in separate specifications. HIP provides a general purpose UPDATE packet, which can carry multiple HIP parameters, for updatingbase exchange, establishing the HIPstate between two peers.association. TheUPDATE mechanismsystem with data to send has no state with thefollowing properties: UPDATE messages carryreceiver, but the receiver has amonotonically increasing sequence numberresidual HIP association. The system with data to send is the Initiator. The Initiator acts as in no prior state, sending I1 andare explicitly acknowledged bygetting R1. When thepeer. Lost UPDATEs or acknowledgments may be recovered via retransmission. Multiple UPDATE messages may be outstanding. UPDATEResponder receives a valid I2, the old association isprotected by both HMAC'discovered' andHIP_SIGNATURE parameters, since processing UPDATE signatures alonedeleted, and the new association isa potential DoS attack against intermediate systems.established. TheUPDATE 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, ifsystem with data to send has an HIPassociation exists betweenassociation, but thesender andreceiverof a packet causing an error condition,does not. The system sends data on the outbound user data security association. The receiverSHOULD respond with a NOTIFY packet. On the other hand, if there are no existing HIP associations between'detects' thesender 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,situation when itdoes definereceives asimple certificate transport mechanismsuser data packet thatMAY be usedit cannot match toimplement certificate-based security policies.any HIP association. Thecertificate payload is defined in Section 6.2.9, andreceiving host MUST discard this packet. Optionally, thecertificatereceiving host MAY send an ICMP packetin Section 7.5. 4.6 Sending data on HIP packets A future version of this document may define howwith the Parameter Problem type toinclude user data on variousinform about non-existing HIPpackets. However, currently theassociation (see Section 5.4), and it MAY initiate a new HIPheadernegotiation. However, responding with these optional mechanisms isa terminal header, and not followed by any other headers. 4.7 Transport Formatsimplementation or policy dependent. 4.4 HIP State Machine Theactual data transmission format, used for user data afterHIP protocol itself has little state. In the HIP base exchange, there isnot defined in this document. Such transport formatsan Initiator andmethods are described in separate specifications. All HIP implementations MUST implement, at minimum, the ESP transport format for HIP [23]. When new transport formats are defined, the corresponding parameters MUST have smaller type value than the ESP_TRANSFORM parameter. The order in whicha Responder. Once thetransport formatsSAs arepresented in the R1 packet,established, this distinction is lost. If thepreferred order. The last of the transport formats MUSTHIP state needs to beESP transport format, represented byre- established, theESP_TRANSFORM parameter. 5. HIP protocol overviewcontrolling parameters are which peer still has state and which has a datagram to send to its peer. The followingmaterialstate machine attempts to capture these processes. The state machine is presented in a single system view, representing either anoverviewInitiator or a Responder. There is not a complete overlap of processing logic here and in theHIP protocol operation.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. Section86 describes the packet processingstepsrules in more detail.A typical HIP packet flow is shown below, between an Initiator (I) and a Responder (R). It illustratesThis state machine focuses on theexchange of fourHIPpackets (I1,I1, R1, I2, andR2). 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)R2I <-- R (OK. Let's finish HIP with my R2) I --> R (data) I <-- R (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 initiatorpackets only. Other states may be introduced by mechanisms infuture communications. 5.1 HIP Scenarios The HIP protocolother drafts (such as mobility andstatemultihoming). 4.4.1 HIP States +---------------------+---------------------------------------------+ | State | Explanation | +---------------------+---------------------------------------------+ | UNASSOCIATED | State machineis designedstart | | | | | I1-SENT | Initiating HIP | | | | | I2-SENT | Waiting torecover 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 datafinish HIP | | | | | R2-SENT | Waiting tosend is the Initiator. The process follows the standard four packet base exchange, establishing thefinish HIPassociation. The system with| | | | | ESTABLISHED | HIP association established | | | | | CLOSING | HIP association closing, no datato send hascan be | | | sent | | | | | CLOSED | HIP association closed, nostate with the receiver, but the receiver has a residualdata can be sent | | | | | E-FAILED | HIPassociation. The system withexchange failed | +---------------------+---------------------------------------------+ 4.4.2 HIP State Processes +------------+ |UNASSOCIATED| Start state +------------+ User data to sendis the Initiator. The Initiator acts as in no prior state, sendingrequiring a new HIP association, send I1 andgetting R1. When the Responder receives a valid I2, the old association is 'discovered'go to I1-SENT Receive I1, send R1 anddeleted,stay at UNASSOCIATED Receive I2, process if successful, send R2 andthe new association is established. The system with datago tosend has an HIP association, but the receiver does not. The system sends data on the outbound user data security association. The receiver 'detects' the situation when it receives aR2-SENT if fail, stay at UNASSOCIATED Receive user datapacket that it cannot match to anyfor unknown HIPassociation. The receiving host MUST discard this packet. Optionally, the receiving host MAYassociation, optionally send ICMP as defined in Section 5.4 and stay at UNASSOCIATED Receive CLOSE, optionally sendanICMPpacket with theParameter Problemtype to inform about non-existing HIP association (see Section 6.3),andit MAY initiate a new HIP negotiation. However, responding with these optional mechanisms is implementation or policy dependent. 5.2 Refusing a HIP exchange A HIP aware host may choose not to accept astay in UNASSOCIATED. Receive ANYOTHER, drop and stay at UNASSOCIATED +---------+ | I1-SENT | Initiating HIPexchange. If+---------+ Receive I1, if thehost's policylocal HIT isto only be an Initiator, it should begin its own HIP exchange. A host MAY choose to have such a policy since onlysmaller than theInitiator HI is protected inpeer HIT, drop I1 and stay at I1-SENT if theexchange. Therelocal HIT isa risk of a race conditiongreater than the peer HIT, send R1 and stay at I1-SENT Receive I2, process ifeach host's policy issuccessful, send R2 and go toonly be an Initiator,R2-SENT if fail, stay atwhich point the HIP exchange will fail.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 Ifthe host's policy does not permit itcounter is less than I1_RETRIES_MAX, send I1 and stay at I1-SENT If counter is greater than I1_RETRIES_MAX, go toenter into aE-FAILED +---------+ | I2-SENT | Waiting to finish HIPexchange with the Initiator, it should+---------+ Receive I1, sendan ICMP 'Destination Unreachable, Administratively Prohibited' message. A more complex HIP packetR1 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, and if local HIT isnot used here as it actually opens up more potential DoS attackssmaller thana simple ICMP message. 5.3 Rebootthe peer HIT, drop I2 andSA timeout restart of HIP Simulating a loss of statestay at I2-SENT if local HIT isa potential DoS attack. The followinggreater than the peer HIT, send R2 and go to R2-SENT if fail, stay at I2-SENT Receive R2, processhas been craftedif successful, go tomanage state recovery without presenting a DoS opportunity.ESTABLISHED if fail, go to E-FAILED Receive ANYOTHER, drop and stay at I2-SENT Timeout, increment timeout counter Ifa host reboots or times out, it has lost its HIP state.counter is less than I2_RETRIES_MAX, send I2 and stay at I2-SENT Ifthe system that lost state has a datagramcounter is greater than I2_RETRIES_MAX, go todeliverE-FAILED +---------+ | R2-SENT | Waiting toits peer, it simply restarts thefinish HIPexchange. The peer replies with an+---------+ Receive I1, send R1HIP 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,and stay at R2-SENT Receive I2, process, ifinserted insuccessful, 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 data, move to ESTABLISHED No packet sent/received during UAL minutes, send CLOSE and go to CLOSING +------------+ |ESTABLISHED | HIP association 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 HIP association, establish avalid 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 anew HIP association, to to R2-SENT if fail, stay at ESTABLISHED Receive R1, drop and stay at ESTABLISHED Receive R2, drop and stay at ESTABLISHED Receive user datapacket that cannot be matched to any existingfor HIP association,it is possible that it has lost the stateprocess andits peer has not. It MAY send an ICMPstay at ESTABLISHED No packetwith the Parameter Problem type, the Pointer pointingsent/received during UAL minutes, send CLOSE and go tothe referred HIP-relatedCLOSING. Receive CLOSE, process if successful, send CLOSE_ACK and go to CLOSED if failed, stay at ESTABLISHED +---------+ | CLOSING | HIP associationinformation. Reactinghas not been used for UAL (Unused +---------+ Association Lifetime) minutes. User data tosuch traffic depends on the implementation andsend, requires theenvironment wherecreation of another incarnation of theimplementation is used. AfterHIP association, started by sendingthean I1,the HIP negotiation proceeds as normally and, when successful, the SA is createdand stay atthe initiating end. The peer end removes the OLD SACLOSING Receive I1, send R1 andreplaces it with the new one. 5.4 HIP State Machine The HIP protocol itself has little state. In the HIP base exchange, there is an Initiatorstay at CLOSING Receive I2, process if successful, send R2 anda Responder. Once the SAs are established, this distinction is lost. If the HIP state needsgo tobe re-established, the controlling parameters are which peer still has stateR2-SENT if fail, stay at CLOSING Receive R1, process if successful, send I2 andwhich has a datagramgo to I2-SENT if fail, stay at CLOSING Receive CLOSE, process if successful, sendto its peer. The followingCLOSE_ACK, discard statemachine attemptsand go tocapture these processes. TheCLOSED if failed, stay at CLOSING Receive CLOSE_ACK, process if successful, discard statemachine is presented in a single system view, representing either an Initiator or a Responder. There is not a complete overlap of processing logic hereandin the packet definitions. Both are neededgo tocompletely implement HIP. Implementors must understand that the state machine, as described here,UNASSOCIATED if failed, stay at CLOSING Receive ANYOTHER, drop and stay at CLOSING Timeout, increment timeout sum, reset timer if timeout sum isinformational. Specific implementations are freeless than UAL+MSL minutes, retransmit CLOSE and stay at CLOSING if timeout sum is greater than UAL+MSL minutes, go toimplement the actual functions differently. Section 8 describesUNASSOCIATED +--------+ | CLOSED | CLOSE_ACK sent, resending CLOSE_ACK if necessary +--------+ Datagram to send, requires thepacket processing rules in more detail. This state machine focuses oncreation of another incarnation of the HIP association, started by sending an I1,R1, I2,andR2 packets only. Other states may be introduced by mechanisms in other drafts (such as mobilitystay at CLOSED Receive I1, send R1 andmultihoming). 5.4.1 HIP States +---------------------+---------------------------------------------+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 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 +----------+ | 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. 4.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. +-+ +---------------------------+ I1 received, send R1 |Explanation|+---------------------+---------------------------------------------+| | | v v | Datagram to send +--------------+ I2 received, send R2 | +---------------| UNASSOCIATED |---------------+ |State machine start| +--------------+ | | v | | +---------+ I2 received, send R2 | | +---->| I1-SENT |---------------------------------------+ |Initiating HIP| | +---------+ | | |I2-SENT|Waiting to finish HIP| +------------------------+ | | | |R2-SENT|Waiting to finish HIPR1 received, | I2 received, send R2 | | | |ESTABLISHED|HIP association establishedv send I2 | v v v | | +---------+ | +---------+ |CLOSING|HIP association closing, no data can be+->| I2-SENT |------------+ | R2-SENT |<----+ | |sent| +---------+ +---------+ | | | |CLOSED|HIP association closed, no data can be sent|| | | | | |E-FAILED||timeout |HIP exchange failed|+---------------------+---------------------------------------------+ 5.4.2 HIP State Processes +------------+ |UNASSOCIATED| Start state +------------+ User data to send requiring a new HIP association, send I1 and go to I1-SENT Receive I1, send R1 and stay at UNASSOCIATED Receive I2, process if successful,| |receive | || | | | |R1, sendR2 and go to R2-SENT if fail, stay at UNASSOCIATED Receive user| || receive I2,| | | |I2 |R2 received +--------------+ datafor unknown HIP association, optionally send ICMP as defined in Section 6.3 and stay at UNASSOCIATED Receive CLOSE, optionally|| sendICMP Parameter Problem and stay in UNASSOCIATED. Receive ANYOTHER, drop and stay at UNASSOCIATED +---------+R2| |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,| +----------->| ESTABLISHED |<-------+| | | | | +--------------+ | | | | | | | | | | | | | +------------+ | +------------------------+ | | | | | | | | | | | No packet sent| | | | | | | /received for | +----+ | | | | | UAL min, sendI2 and go to I2-SENT if fail, go to E-FAILED Receive ANYOTHER, drop and stay at I1-SENT Timeout, increment| V | | | | | CLOSE | +---------+<-+ timeoutcounter 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| | | +--->| CLOSING |--+ (UAL+MSL) | | | | | +---------+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,retransmit | | +--|------------|----------------------+ | | | | CLOSE | | | +------------|------------------------+ | | +----------------+ | | | | +-----------+ +------------------|--+ | | +------------+ | receive CLOSE, CLOSE_ACK | | | | | | sendR2 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, incrementCLOSE_ACK received or | | | | v v timeoutcounter If counter is less than I2_RETRIES_MAX, send I2 and stay at I2-SENT If counter is greater than I2_RETRIES_MAX, go to E-FAILED +---------+|R2-SENT|Waiting| | +--------+ (UAL+MSL) | | | +------------------------| CLOSED |---------------------------+ | +---------------------------+--------+------------------------------+ Datagram tofinish HIP +---------+ Receive I1, send R1 and stay at R2-SENT Receive I2, process, if successful,sendR2, 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 Move to ESTABLISHED after an implementation specific time. +------------+ |ESTABLISHED^ |HIP association established +------------+ Receive I1,timeout (UAL+2MSL), +-+ move to UNASSOCIATED CLOSE received, sendR1CLOSE_ACK 4.5 User Data Considerations 4.5.1 TCP andstay at ESTABLISHED Receive I2, process with cookieUDP Pseudo-header Computation for User Data When computing TCP andpossible OpaqueUDP checksums on user dataverification if successful, send R2, drop old HIP association, establish a new HIP association, topackets that flow through sockets bound toR2-SENT if fail, stay at ESTABLISHED Receive R1, drop and stay at ESTABLISHED Receive R2, drop and stay at ESTABLISHED Receive user dataHITs, the IPv6 pseudo-header format [11] MUST be used, even if the outer addresses on the packet are IPv4 addresses. 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 HIPassociation, process and stay at ESTABLISHED No packet sent/received during UAL minutes, send CLOSE and go to CLOSING. Receive CLOSE, process if successful, send CLOSE_ACK and gopayloads is computed differently; see Section 5.1.2. 4.5.2 Sending Data on HIP Packets A future version of this document may define how toCLOSED if failed, stay at ESTABLISHED +---------+ | CLOSING |include user data on various HIPassociation haspackets. However, currently the HIP header is a terminal header, and notbeenfollowed by any other headers. 4.5.3 Transport Formats The actual data transmission format, used forUAL (Unused +---------+ Association Lifetime) minutes. Useruser datato send, requires the creation of another incarnation ofafter the HIPassociation, started by sending an I1,base exchange, is not defined in this document. Such transport formats andstaymethods are described in separate specifications. All HIP implementations MUST implement, atCLOSING Receive I1, sendminimum, the ESP transport format for HIP [24]. When new transport formats are defined, they get the type value from the HIP Transform type value space 2048 - 4095. The order in which the transport formats are presented in the R1 packet, is the preferred order. The last of the transport formats MUST be ESP transport format, represented by the ESP_TRANSFORM parameter. 4.5.4 Reboot andstay 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, discardSA Timeout Restart of HIP Simulating a loss of stateand go to CLOSED if failed, stay at CLOSING Receive CLOSE_ACK,is a potential DoS attack. The following processif successful, discard state and gohas been crafted toUNASSOCIATED 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, gomanage 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 toUNASSOCIATED +--------+ | CLOSED | CLOSE_ACK sent, resending CLOSE_ACK if necessary +--------+ Datagramdeliver tosend, requires the creation of another incarnation ofits peer, it simply restarts the HIPassociation, started by sendingexchange. The peer replies with anI1, and stay at CLOSED Receive I1, sendR1and 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, sendHIP packet, but does not reset its state until it receives the I2and goHIP packet. The I2 packet MUST have a valid solution toI2-SENTthe puzzle and, iffail, stay at CLOSED Receive CLOSE, process if successful, send CLOSE_ACK, stay at CLOSED if failed, stay at CLOSED Receive CLOSE_ACK, process if successful, discard state and goinserted 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 a user data packet that cannot be matched toUNASSOCIATED if failed, stay at CLOSED Receive ANYOTHER, drop and stay at CLOSED Timeout (UAL + 2MSL), discardany existing HIP association, it is possible that it has lost the state andgo to UNASSOCIATED +----------+ | E-FAILED | HIP failedits peer has not. It MAY send an ICMP packet with the Parameter Problem type, the Pointer pointing toestablishthe referred HIP-related associationwith peer +----------+ Moveinformation. Reacting toUNASSOCIATED after ansuch traffic depends on the implementation and the environment where the implementationspecific time. Re-negotiationispossible after moving to UNASSOCIATED state. 5.4.3 Simplifiedused. After sending the I1, the HIPState Diagramnegotiation proceeds as normally and, when successful, the SA is created at the initiating end. Thefollowing diagram showspeer end removes themajor state transitions. Transitions based on received packets implicitly assume thatOLD SA and replaces it with thepackets are successfully authenticatednew one. 4.6 Certificate Distribution HIP base specification does not define how to use certificates orprocessed. +-+ +------------------------------+ I1 received, send R1 | | | | | v v | Datagramhow tosend +--------------+ 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 +--------------+ data | send R2| | | | +----------->| ESTABLISHED |<---------+ | | | | +--------------+ |transfer them between hosts. These functions are defined in a separate specification. The parameter type value, used for carrying certificates, is reserved: CERT, Type 768. 5. Packet Formats 5.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 | Header Length | Packet Type | VER. | RES. | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Controls | Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Sender's Host Identity Tag (HIT) | |+---------------------------+| | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Receiver's Host Identity Tag (HIT) | | | | |No packet sent/received| | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | / HIP Parameters / / / | |for UAL min, send CLOSE | | | | | | | | | | | | +---------+<-+ timeout | | | | | +--->| CLOSING |--+ (UAL+MSL) | | | | | +---------+ 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 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+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 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 an unimplemented Next Header value is received. The Header Length field contains the length of the HIP Header and 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 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.15.1.1 HIP Controls The HIPcontrolControls sectiontransfersconveys information about the structure of the packet and capabilities of the host. The following fields have been defined: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SHT | DHT | | | | | | | ||C|A|| |A| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+CSHT -Certificate One or more certificate packets (CER) follows this HIP packet (see Section 7.5). ASender'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 -Anonymous If this is set,Destination's HIT Type: Uses thesender'ssame values as the SHT. 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.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.25.1.2 Checksum The checksum field is located at the same locationwithinin the header as the checksum field in UDP packets,enablingaiding hardware assisted checksum generation and verification. Note that since the checksum covers the source and destination addresses in the IP header, it must be recomputed on HIP-aware NATboxes.devices. 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.25.1.3 HIPparametersFragmentation Support A HIP implementation must support IP fragmentation / reassembly. Fragment reassembly MUST be implemented in both IPv4 and IPv6, but fragment generation MUST be implemented only in IPv4 (IPv4 stacks and networks will usually do this by default) and SHOULD be implemented in IPv6. In IPv6 networks, the minimum MTU is larger, 1280 bytes, than in IPv4 networks. The larger MTU size is usually sufficient for most HIPParameterspackets, and therefore fragment generation may not be needed. If a host expects to send HIP packets that areusedlarger than the minimum IPv6 MTU, it MUST implement fragment generation even for IPv6. In IPv4 networks, HIP packets may encounter low MTUs along their routed path. Since HIP does not provide a mechanism tocarryuse multiple IP datagrams for a single HIP packet, support for path MTU discovery does not bring any value to HIP in IPv4 networks. HIP-aware NAT devices MUST perform any IPv4 reassembly/fragmentation. All HIP implementations MUST employ a reassembly algorithm that is sufficiently resistant to DoS attacks. 5.1.4 Solving thepublic key associated withPuzzle This subsection describes thesender's HIT, together with other related securitypuzzle solving details. In R1, the values I andother information. The HIP Parameters consists of ordered parameters, encodedK are sent inTLV format.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: i) The length of the data to be hashed is 48 bytes. ii) All the data in the hash input MUST be in network byte order. iii) The order of the Initiator and Responder HITs are different in the R1 and I2 packets, see Section 5.1. Care must be taken to copy the values in right order to the hash input. The following procedure describes the processing steps involved, assuming that the Responder chooses to precompute the R1 packets: Precomputation by the Responder: Sets up the puzzle difficulty K. Creates a signed R1 and caches it. Responder: Selects a suitable cached R1. Generates a random number I. Sends I and K in an R1. Saves I and K for a Delta time. Initiator: Generates repeated attempts to solve the puzzle until a matching J is found: Ltrunc( SHA-1( I | HIT-I | HIT-R | J ), K ) == 0 Sends I and J in an 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 5.2 HIP Parameters The HIP Parameters are used to carry the public key associated with the sender's HIT, together with related security and other information. They consist of ordered parameters, encoded in TLV format. The following parameter types are currently defined. +-----------------+-------+----------+------------------------------+ | TLV | Type | Length | Data | +-----------------+-------+----------+------------------------------+ | R1_COUNTER |2128 | 12 | System Boot Counter | | | | | | | PUZZLE |5257 | 12 | K and Random #I | | | | | | | SOLUTION |7321 | 20 | K, Random #I and puzzle | | | | | solution J | | | | | | | SEQ |11385 | 4 | Update packet ID number | | | | | | | ACK |13449 | variable | Update packet ID number | | | | | | | DIFFIE_HELLMAN |15513 | variable | public key | | | | | | | HIP_TRANSFORM |17577 | variable | HIP Encryption and Integrity | | | | | Transform | | | | | | | ENCRYPTED |21641 | variable | Encrypted part of I2or CER | | | | | packetspacket | | | | | | | HOST_ID |35705 | variable | Host Identity with Fully | | | | | Qualified Domain Name or NAI | | | | | | |CERTCERT | 768 | variable | HI Certificate; used to | | | | | transfer certificates. Usage | | | | | defined in a separate |64|variable|HI Certificate| | document. | | | | | | | NOTIFY |256832 | variable | Informational data | | | | | | | ECHO_REQUEST |1022897 | variable | Opaque data to be echoed | | | | | back; under signature | | | | | | | ECHO_RESPONSE |1024961 | variable | Opaque data echoed back; | | | | | under signature | | | | | | | HMAC |6524561505 | 20 | HMAC based message | | | | | authentication code, with | | | | | key material from | | | | | HIP_TRANSFORM | | | | | | | HMAC_2 |6524761569 | 20 | HMAC based message | | | | | authentication code, with | | | | | key material from | | | | | HIP_TRANSFORM | | | | | | | HIP_SIGNATURE_2 |6527761633 | variable | Signature of the R1 packet | || | | | |HIP_SIGNATURE |6527961697 | variable | Signature of the packet | | | | | | | ECHO_REQUEST |6528163661 | variable | Opaque data to be echoed | | | | |backback; after signature | | | | | | | ECHO_RESPONSE |6528363425 | variable | Opaque data echoed back; | | | | | after signature | +-----------------+-------+----------+------------------------------+6.2.1Because the ordering (from lowest to highest) of HIP parameters is strictly enforced, the parameter type values for existing parameters have been spaced to allow for future protocol extensions. Parameters numbered between 0-1023 are used in HIP handshake and update procedures and are covered by signatures. Parameters numbered between 1024-2047 are reserved. Parameters numbered between 2048- 4095 are used for parameters related to HIP transform types. Parameters numbered between 4096 and (2^16 - 2^12) 61439 are reserved. Parameters numbered beteween 61440-62463 are used for signatures and signed MACs. Parameters numbered between 62464-63487 are used for parameters that fall outside of the signed area of the packet. Parameters numbered between 63488-64511 are used for rendezvous and other relaying services. Parameters numbered between 64512-65535 are reserved. 5.2.1 TLVformatFormat TheTLV encodedTLV-encoded parameters are described in the following subsections. The type-field value also describes the order of these fields in the packet, except for type values from 2048 to 4095 which are reserved for new transport forms. The parameters MUST be includedintoin the packetsosuch thatthetheir 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. Parameters using type values from 2048 up to 4095 are transport formats. Currently, one transport format is defined: the ESP transport format[23].[24]. The order of these parameters does not follow the order of their type value, but they are put in the packet in order of preference.First oneThe first of the transport formats it the most preferred, and so on. All of 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 padding is added, the Length field MUST NOT include the padding. Any added padding bytes MUST beset zerozeroed by the sender,butand theircontentvalues SHOULD NOT be checkedonby thereceiving end.receiver. 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 theparameterparameter. 16 bits long, C-bit being part of the Type code. 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. It MAY send an ICMP or NOTIFY, as defined in Section4.4.4.3. 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.25.2.2 Definingnew parametersNew 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 bythetype code, thereby 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 Section13. 6.2.39 for allocation rules regarding type codes. 5.2.3 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 | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type2128 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 fieldinverbatim) by the Initiator in the I2.6.2.45.2.4 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 | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type5257 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 andana 64-bit puzzle random integer #I. The Puzzle Lifetime indicates the time during which the puzzle solution isvalidvalid, and sets a time limitfor initiatorwhichitshould notexceedbe exceeded by the Initiator whiletryingit attempts to solve the puzzle. The lifetime is indicated as a power of 2 using the formula 2^(Lifetime-32) seconds. A puzzle MAY be augmentedby includingwith an ECHO_REQUEST parameterto an R1. Theincluded in the R1; the contents of the ECHO_REQUEST are then echoed back in the ECHO_RESPONSE, allowing the Responder to use the included information as a part of its puzzle processing. The Opaque and Random #I field are not covered by the HIP_SIGNATURE_2 parameter.6.2.55.2.5 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 | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type7321 Length 20 K K is the number of verified bits Reserved zero when sent, ignored when received OpaqueCopiedcopied 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 an 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.6.2.65.2.6 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 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type15513 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. The384-bit384- bit group is defined in AppendixE.F. To avoid unnecessary failures during the base exchange, the rest of the groups SHOULD be implemented in hosts where resources are adequate.6.2.75.2.7 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 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type17577 Length length in octets, excluding Type, Length, and padding Transform-ID Defines the HIP Suite to be used The following Suite-IDs are defined([20],[24]):([21],[26]): XXX: Deprecate MD5 in the light of recent development? Suite-ID Value RESERVED 0 AES-CBC with HMAC-SHA1 1 3DES-CBC with HMAC-SHA1 2 3DES-CBC with HMAC-MD5 3 BLOWFISH-CBC with HMAC-SHA1 4 NULL-ENCRYPT with HMAC-SHA1 5 NULL-ENCRYPT with HMAC-MD5 6 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. The Responder lists supported and desired Suite-IDs in order of preference in the R1, up to the maximum of six Suite-IDs. In the I2, the Initiator MUST choose and insert only one of the corresponding Suite-IDs that will be used for generating the I2. Mandatory implementations: AES-CBC with HMAC-SHA1 and NULL-ENCRYPTION with HMAC-SHA1.6.2.85.2.8 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 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type35705 Length length in octets, excluding Type, Length, and Padding HI Length Length of the Host Identity in octets DI-type type of the following Domain Identifier field DI Length length of the FQDN or NAI in octets Host Identity actual host identity Domain Identifier the identifier of the sender 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 AccessIdentifier, in binary format. The format of the NAI is login@FQDN.Identifier [22] 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.9 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 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 certificateIf there isdefined in [15]. 6.2.10no Domain Identifier, i.e. the DI-type field is zero, also the DI Length field is set to zero. 5.2.9 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 | | | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type6524561505 Length 20 HMAC 160 low order bits of the HMAC computed over the HIP packet, excluding the HMAC parameter and any followingHIP_SIGNATUREparameters, such as HIP_SIGNATURE, HIP_SIGNATURE_2, ECHO_REQUEST, orHIP_SIGNATURE_2 parameters.ECHO_RESPONSE. 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 Section8.3.1 6.2.116.3.1 5.2.10 HMAC_2 The TLV structure is the same as in Section6.2.10.5.2.9. The fields are: Type6524761569 Length 20 HMAC 160 low order bits of the HMAC computed over the HIP packet, excluding the HMAC parameter and any followingHIP_SIGNATURE or HIP_SIGNATURE_2parameters such as HIP_SIGNATURE, HIP_SIGNATURE_2, ECHO_REQUEST, or ECHO_RESPONSE, 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 Section8.3.1 6.2.126.3.1 5.2.11 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 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type65279 (2^16-2^8-1)61697 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_SIGNATURETLV fieldparameter and anyTLVsparameters 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 Section6.2.8.5.2.8. The signature in the Signature field is encoded using the proper method depending on the signature algorithm (e.g. according to[14][15] in case of RSA, or according to [13] in case of DSA). The HIP_SIGNATURE calculation and verification process is presented in Section8.3.2 6.2.136.3.2 5.2.12 HIP_SIGNATURE_2 The TLV structure is the same as in Section6.2.12.5.2.11. The fields are: Type65277 (2^16-2^8-3)61633 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_2TLV fieldparameter and anyTLVsparameters thatfollow the HIP_SIGNATURE_2 TLV.follow. 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 Section8.3.2. 6.2.146.3.2. 5.2.13 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 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type11385 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 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.155.2.14 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 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type13449 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.6.2.165.2.15 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 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type21641 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 algorithmasdata as defined in HIP transform. Padding Any Padding, if necessary, to make the TLV a multiple of 8 bytes. The ENCRYPTED parameter encapsulates another TLV, the encrypteddatadata, which is also in TLVformat itself.format. Consequently, the first fields in thecontentsencapsulated parameter(s) 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 requiresBoth thelength ofENCRYPTED parameter and thedata to be encrypted toencapsulated TLV(s) MUST bea multiple ofpadded. The padding needed for thecipher algorithm block size, thereby necessitating padding, and ifENCRYPTED parameter is referred as theencryption algorithm does not specify"outer" padding. Correspondingly, the paddingcontents, then an implementation MUST appendfor theTLVparameter(s) encapsulated within the ENCRYPTED parameterthatisto be encrypted with an additional padding, so thatreferred as thelength of"inner" padding. The inner padding follows exactly theresulting cleartext is a multiplerules ofthe cipher block size length. Such a padding MUST be constructed as specified in [19]Section2.4. On5.2.1. The outer padding also follows theother hand, ifsame rules but with an exception. Namely, some algorithms require that the data to be encryptedis alreadymust be a multiple of the cipher algorithm blocksize, or ifsize. In this case, theencryption algorithm does specify padding as per [19] Section 2.4, then such additionalouter paddingSHOULD NOT be added. The Length field in the inside, to be encrypted TLV does notMUST include extra padding, as specified by thepadding.encryption algorithm. TheLength field insize of the extra padding is selected so that the the length of theoutsideENCRYPTEDTLVis thelengthminimum value that is both multiple of eight and thedata aftercipher block size. The encryption(includingalgorithm may specify padding bytes other than zero; for example, AES [33] uses theReserved field,PKCS5 padding scheme [14] (see section 6.1.1) where theIV field, andremaining n bytes to fill theoutput fromblock each have theencryption process specified for that suite, but not any additional external padding).value n. 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.175.2.16 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 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type256832 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. 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 theresponder.Responder. NO_HIP_PROPOSAL_CHOSEN 16 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 theresponder.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 TheresponderResponder 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 TheresponderResponder 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 TheresponderResponder 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 TheresponderResponder has received your I2 but had to queue the I2 for processing. The puzzle was correctly solved and theresponderResponder 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.185.2.17 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) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type6528163661 or1022897 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; Type1022897 ECHO_REQUEST is covered and Type6528163661 isnot. 6.2.19not covered. A HIP packet can contain only one ECHO_REQUEST parameter. 5.2.18 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) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type6528363425 or1024961 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; Type1024961 ECHO_RESPONSE is covered and Type6528363425 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 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. 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 the5.3 HIPheader. 6.3.2 Other problems withPackets There are eight basic HIP packets. Four are for the HIPheaderbase exchange, one is for updating, one is for sending notifications, andpacket structure If a HIP implementation receivestwo for closing a HIPpacket that hasassociation. Packets consist of the fixed header as described in Section 5.1, followed by the parameters. The parameter part, in turn, consists of zero or more TLV coded parameters. In addition to the base packets, otherunrecoverable problemspackets 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 theheaderfollowing operations: () parameter x{y} operation x on content y <x>i x exists i times [] optional parameter x | y x orpacket format, it MAY respond, rate limited, with an ICMP packet with type Parameter Problem,y In thePointer pointing tofuture, an OPTIONAL upper layer payload MAY follow the HIP header. The Next Header fieldthat failed to passin theformat checks. However, an implementation MUST NOT send an ICMP messageheader indicates if there is additional data following theChecksum fails; instead, itHIP header. The HIP packet, however, MUSTsilently dropNOT be fragmented. This limits thepacket. 6.3.3 Invalid Cookie Solution If a HIP implementation receives an I2 packet that has an invalid cookie solution,size of thebehaviour depends onpossible additional data in theunderlying version of IP. If IPv6 is used,packet. 5.3.1 I1 - theimplementation SHOULD respond with an ICMPHIP 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 packetwith type Parameter Problem,contains only thePointer pointing tofixed HIP header. Valid control bits: none The Initiator gets thebeginningResponder's HIT either from a DNS lookup of thePuzzle solution #J field inResponder's FQDN, from some other repository, or from a local table. If theSOLUTION payload inInitiator does not know theHIP message. If IPv4 is used,Responder's HIT, it may attempt opportunistic mode by using NULL (all zeros) as theimplementation MAY respond with an ICMP packet withResponder's HIT. If thetype Parameter Problem, copying enough of bytes formInitiator sends a NULL as theI2 messageResponder'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 sothat the SOLUTION parameter fits ineasy tothe ICMP message, the Pointer pointingspoof even if it were signed, no attempt is made tothe beginningadd to its generation or processing cost. Implementations MUST be able to handle a storm ofthe Puzzle solution #J field, as in the IPv6 case. Note, however,received I1 packets, discarding those with common content that arrive within a small time delta. 5.3.2 R1 - theresulting ICMPv4 message exceeds the typical ICMPv4 message size as defined in [2]. 6.3.4 Non-existingHIPassociation If aResponder Packet The HIPimplementation receives a CLOSE, or UPDATE packet, or any other packet whose handling requires an existing association, that has either a Receiver or Senderheader values for the R1 packet: Header: Packet Type = 2 SRC HIT = Responder's HITthat does not match with any existingDST HIT = Initiator's HIT IP ( HIPassociation,( [ R1_COUNTER, ] PUZZLE, DIFFIE_HELLMAN, HIP_TRANSFORM, HOST_ID, [ ECHO_REQUEST, ] HIP_SIGNATURE_2 ) [, ECHO_REQUEST ]) Valid control bits: C, A If theimplementation MAY respond, rate limited, withResponder HI is anICMP packet with the type Parameter Problem,anonymous one, thePointer pointing toA control MUST be set. The Initiator HIT MUST match the one received in I1. If thebeginning ofResponder has multiple HIs, thefirstResponder HITthat does not match. A hostused MUSTNOT 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 definematch Initiator's request. If theappropriate rules for sending or not sending this kind of ICMP replies. 7. HIP Packets There are nine basic HIP packets. Four are forInitiator used opportunistic mode, theHIP base exchange, oneResponder may select freely among its HIs. The R1 generation counter isfor updating, oneused to determine the currently valid generation of puzzles. The value isfor sending certificates, one for sending notifications,increased periodically, andtwo for closing a HIP association. Packets consist of the fixed headerit is RECOMMENDED that it is increased at least asdescribed in Section 6.1, followed by the parameters. The parameter part, in turn, consists of zero or more TLV coded parameters. In additionoften as solutions tothe base packets, other packets types will be defined later in separate specifications. For example, support for mobilityold puzzles are no longer accepted. The Puzzle contains a random #I andmulti-homing is not included in this specification. Packet representation usesthefollowing operations: () parameter x{y} operation x on content y <x>i x exists i times [] optional parameter x | y x or y Indifficulty K. The difficulty K is thefuture, an OPTIONAL upper layer payload MAY follownumber of bits that theHIP header. The payload proto fieldInitiator must get zero in theheader indicates if therepuzzle. The random #I isadditional data followingnot covered by theHIP header. The HIP packet, however, MUST NOTsignature and must befragmented. This limitszeroed during thesize ofsignature calculation, allowing thepossible additional data insender to select and set thepacket. 7.1 I1 -#I into a pre-computed R1 just prior sending it to theHIP initiator packetpeer. TheHIP header valuesDiffie-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 I1packet: Header: Packet Type = 1 SRC HIT = Initiator's HIT DST HIT = Responder's HIT, or NULL IP ( HIP () )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 [19] with HMAC-SHA-1-96 [6]. TheI1 packetECHO_REQUEST containsonlydata that thefixed HIP header. Valid control bits: none The Initiator getssender wants to receive unmodified in theResponder's HITcorresponding response packet in the ECHO_RESPONSE parameter. The ECHO_REQUEST can be eitherfrom a DNS lookup ofcovered by theResponder's FQDN, from some other repository,signature, or it can be left out froma local table. Ifit. In theInitiator does not knowfirst case, theResponder's HIT, it may attempt opportunistic mode by using NULL (all zeros) asECHO_REQUEST gets Type number 897 and in theResponder's HIT. Iflatter case 63661. The signature is calculated over the whole HIP envelope, after setting the Initiatorsend a NULLHIT, header checksum as well as theResponder's HIT, it MUST be ableOpaque field and the Random #I in the PUZZLE parameter temporarily tohandle all MUSTzero, andSHOULD algorithms fromexcluding any TLVs that follow the signature, as described in Section3, 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 able5.2.12. This allows the Responder tohandle a storm ofuse precomputed R1s. The Initiator SHOULD validate this signature. It SHOULD check that the Responder HI receivedI1 packets, discarding thosematches withcommon content that arrive within a small time delta. 7.2 R1the one expected, if any. 5.3.3 I2 - the Second HIPresponder packetInitiator Packet The HIP header values for theR1I2 packet: Header:PacketType =23 SRC HIT =Responder'sInitiator's HIT DST HIT =Initiator'sResponder's HIT IP ( HIP ([ R1_COUNTER, ] PUZZLE,[R1_COUNTER,] SOLUTION, DIFFIE_HELLMAN, HIP_TRANSFORM, ENCRYPTED { HOST_ID } or HOST_ID,[ ECHO_REQUEST, ] HIP_SIGNATURE_2 )[ ECHO_RESPONSE ,] HMAC, HIP_SIGNATURE [,ECHO_REQUEST ])ECHO_RESPONSE] ) ) Valid control bits: C, A TheR1 packet may be followed by one or more CER packets. In this case, the C-bit in the control fieldHITs used MUSTbe set.match the ones used previously. If theresponderInitiator HI is an anonymous one, the A control MUST be set. Theinitiator HIT MUST matchInitiator MAY include an unmodified copy of theoneR1_COUNTER parameter received inI1. If the Responder has multiple HIs, the responder HIT used MUST match Initiator's request. If the Initiator used opportunistic mode,theResponder may select freely among its HIs. Thecorresponding R1generation counter is used to determinepacket into thecurrently 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.I2 packet. ThePuzzleSolution containsathe random#I# I from R1 and thedifficulty K.computed # J. Thedifficultylow order Kis the number ofbitsthat 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 numberofdifferent Cookies for a given Diffie-Hellman value, the R1 packets can be pre-computed and delivered as quickly as I1 packets arrive. Athe SHA-1(I | ... | J) MUST be zero. The Diffie-Hellman value is ephemeral. If precomputed, a scavenger process should clean up unusedDHs and Cookies.DHs. The HIP_TRANSFORM contains the single encryption and integrityalgorithms supportedtransform selected by theResponderInitiator, that will be used to protect the HIexchange,exchange. The chosen transform MUST correspond to one offered by the Responder in theorder of preference.R1. All implementations MUST support the AES[10] with HMAC-SHA-1-96 [6].transform [19]. TheECHO_REQUESTInitiator's HI MAY be encrypted using the HIP_TRANSFORM encryption algorithm. The keying material is derived from the Diffie-Hellman exchanged as defined in Section 6.4. The ECHO_RESPONSE containsdata thatthesender wants to receivethe unmodifiedinOpaque data copied from the correspondingresponse packet in the ECHO_RESPONSE parameter. TheECHO_REQUEST TLV. The ECHO_RESPONSE can be either covered by thesignature,HMAC and SIGNATURE orit can be left out from it.not covered. In thefirstformer case, theECHO_REQUESTECHO_RESPONSE gets Type number1022 and961, in the lattercase 65281.it is 63425. The HMAC is calculated over whole HIP envelope, excluding any TLVs after the HMAC, as described in Section 6.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 5.2.11. The Responder MUST validate this signature. It MAY use either the HI in the packet or the HI acquired by some other means. 5.3.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 ( 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 overthewhole HIPenvelope, 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.13. This allows the Responder to use precomputed R1s.envelope. The InitiatorSHOULDMUST validatethis signature. It SHOULD check thatboth theresponder HI received matches withHMAC and theone expected, if any. 7.3 I2signature. 5.3.5 UPDATE - thesecondHIPinitiatorUpdate Packet Support for the UPDATE packet is MANDATORY. The HIP header values for theI2UPDATE packet: Header: Packet Type =36 SRC HIT =Initiator'sSender's HIT DST HIT =Responder'sRecipient's HIT IP ( HIP ([R1_COUNTER,] SOLUTION, DIFFIE_HELLMAN, HIP_TRANSFORM, ENCRYPTED { HOST_ID }, [ ECHO_RESPONSE ,][SEQ, ACK, ] 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.None TheInitiator MAY include an unmodified copy of the R1_COUNTER parameter received in the corresponding R1UPDATE packetinto the I2 packet. The Solutioncontainsthe random # I from R1mandatory HMAC andthe computed # J.HIP_SIGNATURE parameters, and other optional parameters. Thelow order K bits of the SHA-1(I | ... | J) MUST be zero.UPDATE packet contains zero or one SEQ parameter. TheDiffie-Hellman value is ephemeral. If precomputed,presence of ascavenger process should clean up unused DHs. The HIP_TRANSFORM contains the encryption and integrity used to protect the HI exchange selected bySEQ parameter indicates that theInitiator. All implementationsreceiver MUSTsupport the AES transform [10]. The Initiator's HI is encrypted usingack theHIP_TRANSFORM encryption algorithm. The keying materialUPDATE. An UPDATE that does not contain a SEQ parameter isderived from the Diffie-Hellman exchanged as defined in Section 9. The ECHO_RESPONSEsimply 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 theunmodified Opaque data copied fromUPDATE 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 correspondingECHO_REQUEST TLV.ACK value in reply. Received ACKs that are redundant are ignored. TheECHO_RESPONSE can be either covered by the signature, or it can be left out from it.UPDATE packet may contain both a SEQ and an ACK parameter. Inthe firstthis case, theECHO_RESPONSE gets Type number 1024 and in the latter case 65283. The HMACACK iscalculated over whole HIP envelope, excluding any TLVs afterbeing piggybacked on an outgoing UPDATE. In general, UPDATEs carrying SEQ SHOULD be acked upon completion of theHMAC, as described in Section 8.3.1. The Responder MUST validateprocessing of theHMAC. The signature is calculated over whole HIP envelope, excluding any TLVs afterUPDATE. A host MAY choose to hold theHIP_SIGNATURE, as describedUPDATE carrying ACK for a short period of time to allow for the possibility of piggybacking the ACK parameter, inSection 6.2.12.a manner similar to TCP delayed acknowledgments. A sender MAY choose to forego reliable transmission of a particular UPDATE (e.g., it becomes overcome by events). TheRespondersemantics are such that the receiver MUSTvalidate this signature. Itacknowledge the UPDATE but the sender MAYuse eitherchoose to not care about receiving theHIACK. UPDATEs MAY be retransmitted without incrementing SEQ. If the same subset of parameters is included in multiple UPDATEs with different SEQs, thepacket orhost MUST ensure that receiver processing of theHI acquired by some other means. 7.4 R2parameters multiple times will not result in a protocol error. 5.3.6 NOTIFY - thesecondHIPresponderNotify Packet The NOTIFY packet is OPTIONAL. The NOTIFY packet MAY be used to provide information to a peer. Typically, NOTIFY is used to indicate some type of protocol error or negotiation failure. The HIP header values for theR2NOTIFY packet: Header: Packet Type =47 SRC HIT =Responder'sSender's HIT DST HIT =Initiator's HITRecipient's HIT, or zero if unknown IP ( HIP( HMAC_2, HIP_SIGNATURE )(<NOTIFY>i, [HOST_ID, ] 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.None ThesignatureNOTIFY packet iscalculated over whole HIP envelope. The Initiator MUST validate both the HMAC and the signature. 7.5 CERused to carry one or more NOTIFY parameters. 5.3.7 CLOSE - the HIPCertificate Packet The CERassociation closing packetis 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 forCERthe CLOSE packet: Header: Packet Type =58 SRC HIT =Announcer'sSender's HIT DST HIT = Recipient's HIT IP ( HIP (<CERT>i , HIP_SIGNATURE ) ) or IP ( HIP ( ENCRYPTED { <CERT>i },ECHO_REQUEST, HMAC, HIP_SIGNATURE ) ) Valid control bits:None Certificatesnone The sender MUST include an ECHO_REQUEST used to validate CLOSE_ACK received in response, and both an HMAC and a signature (calculated over theCER packet MAY be encrypted.whole HIP envelope). Theencryption algorithm is provided inreceiver peer MUST validate both the HMAC and the signature if it has a HIPtransform ofassociation state, and MUST reply with a CLOSE_ACK containing an ECHO_REPLY corresponding to theprevious (R1 or I2) packet. 7.6 UPDATEreceived ECHO_REQUEST. 5.3.8 CLOSE_ACK - the HIPUpdateClosing Acknowledgment PacketSupport for the UPDATE packet is MANDATORY.The HIP header values for theUPDATECLOSE_ACK packet: Header: Packet Type =69 SRC HIT = Sender's HIT DST HIT = Recipient's HIT IP ( HIP ([SEQ, ACK, ]ECHO_REPLY, HMAC, HIP_SIGNATURE ) ) Valid control bits:Nonenone TheUPDATE packet contains mandatorysender MUST include both an HMAC andHIP_SIGNATURE parameters, and other optional parameters. The UPDATE packet contains zero or one SEQ parameter. The presence of a SEQ parameter indicates thatsignature (calculated over the whole HIP envelope). The receiver peer MUSTackvalidate both theUPDATE. An UPDATE that does not contain a SEQ parameter is simply an ACK of a previous UPDATEHMAC anditself 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 containthelast 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 bothsignature. 5.4 ICMP Messages When aSEQ and an ACK parameter. In this case, the ACK is being piggybacked on an outgoing UPDATE. In general, UPDATEs carrying SEQ SHOULD be acked upon completionHIP implementation detects a problem with an incoming packet, and it either cannot determine the identity of theprocessingsender of theUPDATE. A hostpacket or does not have any existing HIP association with the sender of the packet, it MAYchoose to holdrespond with an ICMP packet. Any such replies MUST be rate limited as described in [4]. In most cases, theUPDATE carrying ACKICMP packet will have the Parameter Problem type (12 fora short period of time to allowICMPv4, 4 for ICMPv6), with thepossibility of piggybackingPointer field pointing to theACK parameter, in a manner similarfield that caused the ICMP message toTCP delayed acknowledgments. A sender MAY choosebe generated. 5.4.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 toforego reliable transmission ofthe VER./RES. byte in the HIP header. 5.4.2 Other Problems with the HIP Header and Packet Structure If aparticular UPDATE (e.g.,HIP implementation receives a HIP packet that has other unrecoverable problems in the header or packet format, itbecomes overcome by events). The semantics are suchMAY respond, rate limited, with an ICMP packet with type Parameter Problem, the Pointer pointing to the field that failed to pass thereceiverformat checks. However, an implementation MUSTacknowledgeNOT send an ICMP message if theUPDATE butChecksum fails; instead, it MUST silently drop thesender MAY choose to not care about receivingpacket. 5.4.3 Invalid Cookie Solution If a HIP implementation receives an I2 packet that has an invalid cookie solution, theACK. UPDATEs MAY be retransmitting without incrementing SEQ. Ifbehavior depends on thesame subsetunderlying version ofparametersIP. If IPv6 isincluded in multiple UPDATEsused, the implementation SHOULD respond withdifferent SEQs,an ICMP packet with type Parameter Problem, thehost MUST ensure that receiver processingPointer pointing to the beginning of theparameters multiple times will not resultPuzzle solution #J field in the SOLUTION payload ina protocol error. 7.7 NOTIFY -the HIPNotify Packet The NOTIFY packetmessage. If IPv4 isOPTIONAL. The NOTIFY packetused, the implementation MAYbe used to provide information to a peer. Typically, NOTIFY is used to indicate somerespond with an ICMP packet with the type Parameter Problem, copying enough ofprotocol error or negotiation failure. The HIP header values forbytes from theNOTIFY packet: Header: Packet Type = 7 SRC HIT = Sender's HIT DST HIT = Recipient's HIT, or zero if unknown IP ( HIP (<NOTIFY>i, [HOST_ID, ] HIP_SIGNATURE) ) Valid control bits: None The NOTIFY packet is used to carry one or more NOTIFY parameters. 7.8 CLOSE -I2 message so that theHIP association closing packet The HIP header values forSOLUTION parameter fits into theCLOSE packet: Header: Packet Type = 8 SRC HIT = Sender's HIT DST HIT = Recipient's HIT IP ( HIP ( ECHO_REQUEST, HMAC, HIP_SIGNATURE ) ) Valid control bits: none The sender MUST include an ECHO_REQUEST usedICMP message, the Pointer pointing tovalidate CLOSE_ACK receivedthe 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 inresponse, and both an HMAC and[2]. 5.4.4 Non-existing HIP Association If asignature (calculated over the wholeHIPenvelope). The receiver peer MUST validate both the HMAC and the signature if itimplementation 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 HIPassociation state, and MUST replyassociation, the implementation MAY respond, rate limited, witha CLOSE_ACK containinganECHO_REPLY correspondingICMP packet with the type Parameter Problem, the Pointer pointing to thereceived ECHO_REQUEST. 7.9 CLOSE_ACK -theHIP closing acknowledgment packet The HIP header values forbeginning of theCLOSE_ACK packet: Header: Packet Type = 9 SRC HIT = Sender's HIT DST HIT = Recipient'sfirst HITIP ( HIP ( ECHO_REPLY, HMAC, HIP_SIGNATURE ) ) Valid control bits: none The senderthat does not match. A host MUSTinclude bothNOT reply with such anHMAC and signature (calculated over the whole HIP envelope). The receiver peer MUST validate bothICMP if it receives any of theHMACfollowing messages: I1, R2, I2, R2, and NOTIFY. When introducing new packet types, a specification SHOULD define thesignature. 8.appropriate rules for sending or not sending this kind of ICMP replies. 6. PacketprocessingProcessing Each host is assumed to have a single HIP protocol implementation that manages the host's HIP associations and handles requests for new ones. Each HIP association is governed by a conceptual state machine, with states defined above in Section5.4.4.4. The HIP implementation can simultaneously maintain HIP associations with more than one host. Furthermore, the HIP implementation may have more than one active HIP association with another host; in this case, HIP associations are distinguished by their respective HITs. It is not possible to have more than one HIPassociationsassociation between any given pair of HITs. Consequently, the only way for two hosts to have more than one parallel association is to use different HITs, at least at one end. The processing of packets depends on the state of the HIP association(s) with respect to the authenticated or apparent originator of the packet. A HIP implementation determines whether it has an active association with the originator of the packet based on the HITs. In the case of user data carried in a specific transport format, the transport format document specifies how the incoming packets are matched with the active associations.8.16.1 Processingoutgoing application dataOutgoing Application Data In a HIP host, an application can send application level data using HITs orLSIslocal scope identifiers (LSIs) as source and destination identifiers. The HITs and LSIs may be specified via a backwards compatible API (see[29])[32]) or a completely new API. The exact format and method for transferring the data from the source HIP host to the destination HIP host is defined in the corresponding transport format document. The actual data is transmitted in the network using the appropriate source and destination IP addresses. Here, we specify the processing rules only for the base case where both hosts have only single usable IP addresses; the multi-address multi-homing case will be specified separately. If the IPv4 or IPv6 backward compatible APIs and therefore LSIs are supported, it is assumed that the LSIs will be converted into proper HITs somewhere in the stack. The exact location of the conversion is an implementation specific issue and not discussed here. The following conceptual algorithm discusses only HITs, with the assumption that the LSI-to-HIT conversion takes place somewhere. The following steps define the conceptual processing rules for outgoing datagrams destined to a HIT. 1. If the datagram has a specified source address, it MUST be a HIT. If it is not, the implementation MAY replace the source address with a HIT. Otherwise it MUST drop the packet. 2. If the datagram has an unspecified source address, the implementation must choose a suitable source HIT for the datagram.In selecting a proper local HIT, the implementation SHOULD consult the table of currently active HIP sessions, and preferably select a HIT that already has an active session with the target HIT.3. If there is no active HIP session with the given < source, destination > HIT pair, one must be created by running thebase exchange. Thebase exchange. While waiting for the base exchange to complete, the implementation SHOULD queue at least one packet per HIP session to be formed, and it MAY queue more than one. 4. Once there is an active HIP session for the given < source, destination > HIT pair, the outgoing datagram is passed to transport handling. The possible transport formats are defined in separate documents, of which the ESP transport format for HIP is mandatory for all HIP implementations. 5.TheBefore sending the packet, the HITs in the datagram are replaced with suitable IP addresses. For IPv6, the rules defined in [16] SHOULD be followed. Note that this HIT-to-IP-address conversion step MAY also be performed at some other point in the stack, e.g., before wrapping the packet into the output format.8.26.2 Processingincoming application dataIncoming Application Data The transport format and method (defined in separate specifications) determines the format in which incoming HIP packets arrive to the host. The following steps define the conceptual processing rules for incoming datagrams. The specific transport format and method specifications define in more detail the packet processing, related to the method. 1. The incoming datagram is mapped to an existing HIP association, typically using some information from the packet. For example, such mapping may be based onIPsecESP Security Parameter Index(SPI) or a protocol port number.(SPI). 2. The specific transport format is unwrapped, in a way depending on the transport format, yielding a packet that looks like a standard (unencrypted) IP packet. If possible, this step SHOULD also verify that the packet was indeed (once) sent by the remote HIP host, as identified by the HIP association. 3. The IP addresses in the datagram are replaced with the HITs associated with the HIP association. Note that thisIP-address-to-HITIP-address- to-HIT conversion step MAY also be performed at some other point in the stack. 4. The datagram is delivered to the upper layer. Demultiplexing the datagram the right upper layer socket is based on the HITs (orLSIs). 8.3 HMAC and SIGNATURE calculation and verification The following subsections define the actions for processing HMAC, HIP_SIGNATURE and HIP_SIGNATURE_2 TLVs. 8.3.1 HMAC calculation The following process applies both to the HMAC and HMAC_2 TLVs. When processing HMAC_2, the difference is that the HMAC calculation includes pseudo HOST_ID field containing the Responder's information as sent in the R1 packet earlier. The HMAC TLV is defined in Section 6.2.10 and HMAC_2 TLV in Section 6.2.11. HMAC calculation and verification process: Packet sender: 1. Create the HIP packet, without the HMAC or any possible HIP_SIGNATURE or HIP_SIGNATURE_2 TLVs. 2. In case of HMAC_2 calculation, add a HOST_ID (Responder) TLV to the packet. 3. Calculate the Length field in the HIP header. 4. Compute the HMAC. 5. In case of HMAC_2, remove the HOST_ID TLV from the packet. 6. Add the HMAC TLV to the packet and any HIP_SIGNATURE or HIP_SIGNATURE_2 TLVs that may follow. 7. Recalculate the Length field in the HIP header. Packet receiver: 1. Verify the HIP header Length field. 2. Remove the HMAC or HMAC_2 TLV, and if the packet contains any HIP_SIGNATURE or HIP_SIGNATURE_2 fields, remove them too, saving the contents if they will be needed later. 3. In case of HMAC_2, build and add a HOST_ID TLV (with Responder information) to the packet. 4. Recalculate the HIP packet length in the HIP header and clear the Checksum field (set it to all zeros). 5. Compute theLSIs). 6.3 HMAC andverify it against the received HMAC. 6. In case of HMAC_2, remove the HOST_ID TLV fromSIGNATURE Calculation and Verification The following subsections define thepacket before further processing. 8.3.2 Signature calculationactions for processing HMAC, HIP_SIGNATURE and HIP_SIGNATURE_2 TLVs. 6.3.1 HMAC Calculation The following process applies both to theHIP_SIGNATUREHMAC andHIP_SIGNATURE_2HMAC_2 TLVs. When processingHIP_SIGNATURE_2,HMAC_2, theonlydifference is thatinstead of HIP_SIGNATURE TLV,theHIP_SIGNATURE_2 TLV is used, andHMAC calculation includes a pseudo HOST_ID field containing theInitiator's HIT and PUZZLE OpaqueResponder's information as sent in the R1 packet earlier. Both the Initiator andRandom #I fields are cleared (setthe Responder should take some care when verifying or calculating the HMAC_2. Specifically, the Responder should preserve other parameters than the HOST_ID when sending the R2. Also, the Initiator has toall zeros) before computingpreserve thesignature.HOST_ID exactly as it was received in the R1 packet. TheHIP_SIGNATUREHMAC TLV is defined in Section6.2.125.2.9 andthe HIP_SIGNATURE_2HMAC_2 TLV in Section6.2.13. Signature5.2.10. HMAC calculation and verification process: Packet sender: 1. Create the HIPpacketpacket, without theHIP_SIGNATURE TLVHMAC or anyTLVs that follow the HIP_SIGNATURE TLV. 2. Calculate the Length field in the HIP header. 3. Compute the signature. 4. Add the HIP_SIGNATURE TLV to the packet. 5. Add any TLVs that follow thepossible HIP_SIGNATURETLV. 6. Recalculate the Length field in the HIP header. Packet receiver: 1. Verify the HIP header Length field.or HIP_SIGNATURE_2 TLVs. 2.Save the contentsIn case ofthe HIP_SIGNATURE TLV and any TLVs following the HIP_SIGNATUREHMAC_2 calculation, add a HOST_ID (Responder) TLVand remove them fromto the packet. 3.Recalculate the HIP packet Length in the HIP header and clear the Checksum field (set it to all zeros). 4. Compute the signature and verify it against the received signature. The verification can use eitherCalculate the Length field in theHI received from aHIPpacket,header. 4. Compute theHIHMAC. 5. In case of HMAC_2, remove the HOST_ID TLV froma DNS query, iftheFQDN has been received either inpacket. 6. Add theHOST_ID or inHMAC TLV to theCER packet,packet and any HIP_SIGNATURE orone received by some other means. 8.4 Initiation of a HIP exchange An implementationHIP_SIGNATURE_2 TLVs that mayoriginate a HIP exchange to another host based on a local policy decision, usually triggered by an application datagram,follow. 7. Recalculate the Length field inmuchthesame way that an IPsec IKE key exchange can dynamically create a Security Association. Alternatively, a system may initiate aHIPexchange if it has rebooted or timed out, or otherwise lost itsheader. Packet receiver: 1. Verify the HIPstate, as described in Section 5.3. The implementation prepares an I1 packet and sends it toheader Length field. 2. Remove theIP address that corresponds toHMAC or HMAC_2 TLV, and if thepeer host. The IP address ofpacket contains any HIP_SIGNATURE or HIP_SIGNATURE_2 fields, remove them too, saving thepeer host may be obtained via conventional mechanisms, such as DNS lookup. The I1contentsare specified in Section 7.1. The selection of which host identity to use,if they will be needed later. 3. In case of HMAC_2, build and add ahost has more than oneHOST_ID TLV (with Responder information) tochoose from, is typically a policy decision. The following steps definetheconceptual processing rules for initiating a HIP exchange: 1.packet. TheInitiator gets the Responder's HIT andHOST_ID TLV should be identical to the oneor more addresses eitherpreviously received froma DNS lookup oftheresponder's FQDN, from some other repository, or from a local table. IfResponder. 4. Recalculate theinitiator does not knowHIP packet length in theresponder's HIT, it may attempt opportunistic mode by using NULL (all zeros) asHIP header and clear theresponder's HIT. 2. The Initiator sends an I1Checksum field (set it toone ofall zeros). 5. Compute theResponder's addresses. The selectionHMAC and verify it against the received HMAC. 6. In case ofwhich address to use is a local policy decision. 3. Upon sending an I1,HMAC_2, remove thesender shall transitionHOST_ID TLV from the packet before further processing. 6.3.2 Signature Calculation The following process applies both tostate I1-SENT, start a timer whose timeout value should be larger thantheworst-case anticipated RTT,HIP_SIGNATURE andshall increment a timeout counter associated with the I1. 4. Upon timeout,HIP_SIGNATURE_2 TLVs. When processing HIP_SIGNATURE_2, thesender SHOULD retransmitonly difference is that instead of HIP_SIGNATURE TLV, theI1HIP_SIGNATURE_2 TLV is used, andrestartthetimer, upInitiator's HIT and PUZZLE Opaque and Random #I fields are cleared (set toa maximum of I1_RETRIES_MAX tries. 8.4.1 Sending multiple I1sall zeros) before computing the signature. The HIP_SIGNATURE TLV is defined inparallel ForSection 5.2.11 and thesake of minimizingHIP_SIGNATURE_2 TLV in Section 5.2.12. Signature calculation and verification process: Packet sender: 1. Create thesession establishment latency, an implementation MAY sendHIP packet without thesame I1 to more than one ofHIP_SIGNATURE TLV or any TLVs that follow theResponder's addresses. However, it MUST NOT send to more than three (3) addressesHIP_SIGNATURE TLV. 2. Calculate the Length field and zero the Checksum field inparallel. Furthermore, upon timeout,theimplementation MUST refrain from sendingHIP header. 3. Compute thesame I1 packet to multiple addresses. These limitations are placed ordersignature. 4. Add the HIP_SIGNATURE TLV toavoid congestion ofthenetwork, and potential DoS attackspacket. 5. Add any TLVs thatmight happen, e.g., because someone claims to have hundreds or thousands of addresses. Asfollow theResponder is not guaranteed to distinguishHIP_SIGNATURE TLV. 6. Recalculate theduplicate I1's it receives at several of its addresses (because it avoids to store states when it answers back an R1),Length field in theInitiator may receive several duplicate R1's. The Initiator SHOULD then selectHIP header, and calculate theinitial preferred destination address usingChecksum field. Packet receiver: 1. Verify thesource addressHIP header Length field. 2. Save the contents of theselected received R1,HIP_SIGNATURE TLV anduseany TLVs following thepreferred address as a source address forHIP_SIGNATURE TLV and remove them from theI2. Processing rules for received R1s are discussed in Section 8.6. 8.4.2 Processing incoming ICMP Protocol Unreachable messages A host may receive an ICMP Destination Protocol Unreachable message as a response to sending an HIP I1packet.Such a packet may be an indication that3. Recalculate thepeer does not support HIP, or it may be an attempt to launch an attack by makingHIP packet Length in theInitiator believe thatHIP header and clear theResponder does not support HIP. When a system receives an ICMP Destination Protocol Unreachable message while it is waiting for an R1,Checksum field (set itMUST NOT terminateto all zeros). 4. Compute thewait. It MAY continue as ifsignature and verify ithad notagainst the received signature. The verification can use either theICMP message, and sendHI received from afew more I1s. Alternatively, it MAY takeHIP packet, theICMP message asHI from ahint thatDNS query, if thepeer most probably does not support HIP,FQDN has been received in the HOST_ID packet, or one received by some other means. 6.4 HIP KEYMAT Generation HIP keying material is derived from the Diffie-Hellman Kij produced during the HIP base exchange. The Initiator has Kij during the creation of the I2 packet, andreturn to state UNASSOCIATED earlier than otherwise. However, at minimum,the Responder has Kij once itMUST continue waiting for an R1 for a reasonable time before returning to UNASSOCIATED. 8.5 Processing incoming I1 packets An implementation SHOULD reply to an I1 with an R1 packet, unlessreceives theimplementationI2 packet. This isunable or unwilling to setup a HIP association. Ifwhy I2 can already contain encrypted information. The KEYMAT is derived by feeding Kij and theimplementationHITs into the following operation; the | operation denotes concatenation. KEYMAT = K1 | K2 | K3 | ... where K1 = SHA-1( Kij | sort(HIT-I | HIT-R) | I | J | 0x01 ) K2 = SHA-1( Kij | K1 | 0x02 ) K3 = SHA-1( Kij | K2 | 0x03 ) ... K255 = SHA-1( Kij | K254 | 0xff ) K256 = SHA-1( Kij | K255 | 0x00 ) etc. Sort(HIT-I | HIT-R) isunable to setup a HIP association,defined as thehost SHOULD send an ICMP Destination Protocol Unreachable, Administratively Prohibited, message tonetwork byte order concatenation of theI1 source address. Iftwo HITs, with theimplementation is unwilling to setup a HIP association,smaller HIT preceding thehost MAY ignorelarger HIT, resulting from theI1. This latter case may occur during a DoS attack such as an I1 flood. The implementation MUST be able to handle a stormnumeric comparison ofreceived I1 packets, discarding those with common contentthe two HITs interpreted as positive (unsigned) 128-bit integers in network byte order. I and J values are from the puzzle and its solution thatarrive within a small time delta. A spoofed I1 can resultwere exchanged inan R1 attack on a system. AnR1sender MUSTand I2 messages when this HIP association was set up. Both hosts havea mechanism to rate limit R1stoan address. Under no circumstances doesstore I and J values for the HIPstate machine transition upon sending an R1. The following steps define the conceptual processing rulesassociation forresponding to an I1 packet: 1.future use. Theresponder MUST check that the responder HITinitial keys are drawn sequentially in thereceived I1 is either one of its own HITs, or NULL. 2. If the responderorder that isin ESTABLISHED state, the responder MAY respond to this with an R1 packet, prepare to drop existing SAs and stay at ESTABLISHED state. 3. If the implementation chooses to respond to the I1 with and R1 packet, it creates a new R1 or selects a precomputed R1 according todetermined by theformatnumeric comparison of the two HITs, with comparison method described inSection 7.2. 4. The R1 MUST containthereceived responder HIT, unlessprevious paragraph. HOST_g denotes thereceived HIT is NULL, in which casehost with theResponder SHOULD select agreater HITthat is constructed withvalue, and HOST_l theMUST algorithm in Section 3, which is currently RSA. Other than that, selectinghost with the lower HITis a local policy matter. 5.value. Theresponder sends the R1 to the source IP addressdrawing order for initial keys: HIP-gl encryption key for HOST_g's outgoing HIP packets HIP-gl integrity (HMAC) key for HOST_g's outgoing HIP packets HIP-lg encryption key (currently unused) for HOST_l's outgoing HIP packets HIP-lg integrity (HMAC) key for HOST_l's outgoing HIP packets The number ofthe I1 packet. 8.5.1 R1 Management All compliant implementations MUST produce R1 packets. An R1 packet MAY be precomputed. An R1 packet MAY be reusedbits drawn fortime Delta T, which is implementation dependent. R1 information MUST not be discarded until Delta S after T. Time Sa given algorithm is thedelay needed for"natural" size of thelast I2 to arrive back tokeys. For the mandatory algorithms, theresponder.following sizes apply: AES 128 bits SHA-1 160 bits NULL 0 bits 6.5 Initiation of a HIP Exchange An implementationMAY keep state about received I1s and match the received I2s againstmay originate a HIP exchange to another host based on a local policy decision, usually triggered by an application datagram, in much the same way that an IPsec IKE key exchange can dynamically create a Security Association. Alternatively, a system may initiate a HIP exchange if it has rebooted or timed out, or otherwise lost its HIP state, asdiscusseddescribed in Section4.1.1. 8.5.2 Handling malformed messages If an4.5.4. The implementationreceives a malformedprepares an I1message,packet and sends itSHOULD NOT respond with a NOTIFY message, asto the IP address that corresponds to the peer host. The IP address of the peer host may be obtained via conventional mechanisms, suchpractice could open up a potential denial-of-service danger. Instead, it MAY respond with an ICMP packet,asdefinedDNS lookup. The I1 contents are specified in Section6.3. 8.6 Processing incoming R1 packets A system receiving an R1 MUST first check5.3.1. The selection of which host identity toseeuse, ifita host hassent an I1more than one to choose from, is typically a policy decision. The following steps define theoriginatorconceptual processing rules for initiating a HIP exchange: 1. The Initiator gets the Responder's HIT and one or more addresses either from a DNS lookup of theR1 (i.e.,Responder's FQDN, from some other repository, or from a local table. If the Initiator does not know the Responder's HIT, it may attempt opportunistic mode by using NULL (all zeros) as the Responder's HIT. 2. The Initiator sends an I1 to one of the Responder's addresses. The selection of which address to use isina local policy decision. 3. Upon sending an I1, the sender shall transition to stateI1-SENT). If so, itI1-SENT, start a timer whose timeout value should be larger than the worst-case anticipated RTT, and shall increment a timeout counter associated with the I1. 4. Upon timeout, the sender SHOULDprocessretransmit theR1 as described below, send an I2,I1 andgorestart the timer, up tostate I2-SENT, settingatimer to protectmaximum of I1_RETRIES_MAX tries. 6.5.1 Sending Multiple I1s in Parallel For theI2. Ifsake of minimizing thesystem is in state I2-SENT, itsession establishment latency, an implementation MAYrespondsend the same I1 toan R1 ifmore than one of theR1 has a larger R1 generation counter; if so,Responder's addresses. However, itshould drop its state dueMUST NOT send toprocessingmore than three (3) addresses in parallel. Furthermore, upon timeout, theprevious R1 and start overimplementation MUST refrain fromstate I1-SENT. Ifsending thesystem is in any other state with respectsame I1 packet tothat host, it SHOULD silently drop the R1. When sendingmultipleI1s, an initiator SHOULD wait for a small amountaddresses. These limitations are placed order to avoid congestion oftime afterthefirst R1 receptionnetwork, and potential DoS attacks that might happen, e.g., because someone claims toallow possibly multiple R1shave hundreds or thousands of addresses. As the Responder is not guaranteed toarrive, anddistinguish the duplicate I1's itSHOULD respondreceives at several of its addresses (because it avoids to store states when it answers back anR1 among the set withR1), thelargest R1 generation counter.Initiator may receive several duplicate R1's. Thefollowing steps defineInitiator SHOULD then select theconceptual processinginitial preferred destination address using the source address of the selected received R1, and use the preferred address as a source address for the I2. Processing rules forresponding to an R1 packet: 1.received R1s are discussed in Section 6.7. 6.5.2 Processing Incoming ICMP Protocol Unreachable Messages Asystem receivinghost may receive anR1 MUST first checkICMP Destination Protocol Unreachable message as a response tosee if it has sentsending an HIP I1to the originator of the R1 (i.e., it haspacket. Such aHIP association that is in state I1-SENT andpacket may be an indication thatis associated with the HITs intheR1). If so,peer does not support HIP, or itshould processmay be an attempt to launch an attack by making theR1 as described below. 2. Otherwise, ifInitiator believe that the Responder does not support HIP. When a system receives an ICMP Destination Protocol Unreachable message while it isin any other state than I1-SENT or I2-SENT with respect to the HITs included in thewaiting for an R1, itSHOULD silently dropMUST NOT terminate theR1wait. It MAY continue as if it had not received the ICMP message, andremain insend a few more I1s. Alternatively, it MAY take thecurrent state. 3. IfICMP message as a hint that theHIP associationpeer most probably does not support HIP, and return to stateis I1-SENT or I2-SENT, the received Initiator's HITUNASSOCIATED earlier than otherwise. However, at minimum, it MUSTcorrespondcontinue waiting for an R1 for a reasonable time before returning tothe HIT used in the original,UNASSOCIATED. 6.6 Processing Incoming I1and the Responder's HIT MUST correspondPackets An implementation SHOULD reply tothe one used, unless thean I1contained a NULL HIT. 4. The system SHOULD validate thewith an R1signature before applying further packet processing, accordingpacket, unless the implementation is unable or unwilling toSection 6.2.13. 5.setup a HIP association. If theHIP association stateimplementation isI1-SENT, and multiple valid R1s are present,unable to setup a HIP association, thesystemhost SHOULDselect from among the R1s withsend an ICMP Destination Protocol Unreachable, Administratively Prohibited, message to thelargest R1 generation counter. 6.I1 source address. If theHIP association stateimplementation isI2-SENT,unwilling to setup a HIP association, thesystemhost MAYreenter state I1-SENT and processignore the I1. This latter case may occur during a DoS attack such as an I1 flood. The implementation MUST be able to handle a storm of received I1 packets, discarding those with common content that arrive within a small time delta. A spoofed I1 can result in an R1if it hasattack on alargersystem. An R1generation counter thansender MUST have a mechanism to rate limit R1s to an address. It is RECOMMENDED that theR1 respondedHIP state machine does not transition upon sending an R1. The following steps define the conceptual processing rules for responding topreviously. 7.an I1 packet: 1. TheR1 packet may haveResponder MUST check that theC bit set --Responder HIT inthis case, the system should anticipatethereceiptreceived I1 is either one ofHIP CER packets that contain the host identity corresponding to the responder's HIT. 8. The R1 packet may haveits own HITs, or NULL. 2. If theA bit set --Responder is inthis case,ESTABLISHED state, thesystemResponder MAYchooserespond torefuse it by dropping thethis with an R1and returningpacket, prepare tostate UNASSOCIATED. The system SHOULD consider droppingdrop existing SAs and stay at ESTABLISHED state. 3. If theR1 only ifResponder is in I1-SENT state, itusedmust make aNULLcomparison between the sender's HITin I1.and its own HIT. If theA bitsender's HIT isset,greater than its own HIT, it should drop theResponder'sI1 and stay at I1- SENT. If the sender's HIT isanonymous andsmaller than its own HIT, it shouldnot be stored. 9.send R1 and stay at I1-SENT. Thesystem SHOULD attempt to validate theHITagainstcomparison goes similarly as in Section 6.4. 4. If thereceived Host Identity. 10. The system MUST storeimplementation chooses to respond to thereceivedI1 with an R1generation counter for future reference. 11. The system attemptspacket, it creates a new R1 or selects a precomputed R1 according tosolvethecookie puzzleformat described inR1.Section 5.3.2. 5. ThesystemR1 MUSTterminate the search after exceeding the remaining lifetime ofcontain thepuzzle. Ifreceived Responder HIT, unless thecookie puzzlereceived HIT isnot successfully solved, the implementation may either resend I1 within the retry bounds or abandon the HIP exchange. 12. The system computes standard Diffie-Hellman keying material according to the public value and Group ID providedNULL, in which case theDIFFIE_HELLMAN parameter. The Diffie-Hellman keying material KijResponder SHOULD select a HIT that isused for key extraction as specifiedconstructed with the MUST algorithm in Section9. If the received Diffie-Hellman Group ID3, which isnot supported, the implementation may either resend I1 within the retry bounds or abandoncurrently RSA. Other than that, selecting theHIP exchange. 13.HIT is a local policy matter. 6. Thesystem selectsResponder sends theHIP transform fromR1 to thechoices presented insource IP address of the I1 packet. 6.6.1 R1 Management All compliant implementations MUST produce R1 packets. An R1 packetand uses the selected values subsequently when generating and using encryption keys, and when sending the I2. If the proposed alternatives areMAY be precomputed. An R1 packet MAY be reused for time Delta T, which is implementation dependent. R1 information MUST notacceptable tobe discarded until Delta S after T. Time S is thesystem, it may either resend I1 withindelay needed for theretry bounds or abandonlast I2 to arrive back to theHIP exchange. 14. The system initializedResponder. An implementation MAY keep state about received I1s and match theremaining variables inreceived I2s against theassociatedstate,including Update ID counters. 15. The system prepares and sends an I2,asdescribeddiscussed in Section7.3. 16. The system4.1.1. 6.6.2 Handling Malformed Messages If an implementation receives a malformed I1 message, it SHOULDstartNOT respond with atimer whose timeout value should be larger than the worst-case anticipated RTT, and MUST incrementNOTIFY message, as such practice could open up atimeout counter associatedpotential denial-of-service danger. Instead, it MAY respond with an ICMP packet, as defined in Section 5.4. 6.7 Processing Incoming R1 Packets A system receiving an R1 MUST first check to see if it has sent an I1 to theI2. The senderoriginator of the R1 (i.e., it is in state I1-SENT). If so, it SHOULDretransmitprocess theI2 upon a timeoutR1 as described below, send an I2, andrestart the timer, upgo to state I2-SENT, setting a timer toa maximum of I2_RETRIES_MAX tries. 17.protect the I2. If the system is in stateI1-SENT,I2-SENT, itshall transitionMAY respond to an R1 if the R1 has a larger R1 generation counter; if so, it should drop its state due to processing the previous R1 and start over from stateI2-SENT.I1-SENT. If the system is in any otherstate, it remains in the current state. 8.6.1 Handling malformed messages If an implementation receives a malformed R1 message,state with respect to that host, itMUSTSHOULD silently drop thepacket. Sending a NOTIFY or ICMP would not help, as the sender of the R1 typically doesn't have any state. An implementationR1. When sending multiple I1s, an Initiator SHOULD wait forsome more time for a possible good R1, after which it MAY try again by sendinganew I1 packet. 8.7 Processing incoming I2 packets Upon receiptsmall amount ofan I2, the system MAY perform initial checks to determine whether the I2 corresponds to a recent R1 that has been sent out, if the Responder keeps such state. For example, the sender could check whethertime after theI2 is from an address or HIT that has recently received an R1 from it. Thefirst R1may have had Opaque data included that was echoed back in the I2. If the I2 is consideredreception tobe suspect,allow possibly multiple R1s to arrive, and itMAY be silently discarded by the system. Otherwise, the HIP implementationSHOULDprocess the I2. This includes validation of the cookie puzzle solution, generating the Diffie-Hellman key, decrypting the Initiator's Host Identity, verifying the signature, creating state, and finally sendingrespond to anR2.R1 among the set with the largest R1 generation counter. The following steps define the conceptual processing rules for responding to anI2R1 packet: 1.TheA systemMAY perform checks to verify that the I2 corresponds to a recently sent R1. Such checks are implementation dependent. See Appendix C for a description ofreceiving anexample implementation. 2. The systemR1 MUST first checkthat the Responder's HIT correspondstoonesee if it has sent an I1 to the originator ofits own HITs. 3.the R1 (i.e., it has a HIP association that is in state I1-SENT and that is associated with the HITs in the R1). If so, it should process the R1 as described below. 2. Otherwise, if the system is in any other state than I1-SENT or I2-SENT with respect to theR2-SENT state,HITs included in the R1, itMAY check ifSHOULD silently drop thenewly received I2R1 and remain in the current state. 3. If the HIP association state issimilarI1-SENT or I2-SENT, the received Initiator's HIT MUST correspond to the HIT used in the original, I1 and the Responder's HIT MUST correspond to the onethat triggered movingused, unless the I1 contained a NULL HIT. 4. The system SHOULD validate the R1 signature before applying further packet processing, according toR2-SENT.Section 5.2.12. 5. Ifso, itthe HIP association state is I1-SENT, and multiple valid R1s are present, the system SHOULD select from among the R1s with the largest R1 generation counter. 6. If the HIP association state is I2-SENT, the system MAYretransmitreenter state I1-SENT and process the received R1 if it has apreviously sent R2, resetlarger R1 generation counter than the R1 responded to previously. 7. The R1 packet may have theR2-SENT timer, and stayA bit set -- inR2-SENT. 4. Ifthis case, the systemis in any other state,MAY choose to refuse it by dropping the R1 and returning to state UNASSOCIATED. The system SHOULDcheck thatconsider dropping theechoedR1generation counteronly if it used a NULL HIT inI2 is within the acceptable range. Implementations MUST accept puzzles from the current generation and MAY accept puzzles from earlier generations.I1. If thenewly received I2A bit isoutside the accepted range,set, theI2Responder's HIT isstale (perhaps replayed)anonymous andSHOULDshould not bedropped. 5.stored. 8. The systemMUSTSHOULD attempt to validate thesolutionHIT against the received Host Identity. 9. The system MUST store the received R1 generation counter for future reference. 10. The system attempts to solve the cookie puzzleby computing the SHA-1 hash describedinSection 7.3. 6.R1. TheI2system MUSThave a single value interminate theHIP_TRANSFORM parameter, which MUST match onesearch after exceeding the remaining lifetime of thevalues offered topuzzle. If theInitiator incookie puzzle is not successfully solved, theR1 packet. 7.implementation may either resend I1 within the retry bounds or abandon the HIP exchange. 11. The systemmust derivecomputes standard Diffie-Hellman keying materialKij based onaccording to the public value and Group ID provided in the DIFFIE_HELLMAN parameter.This keyThe Diffie-Hellman keying material Kij is usedto derive the HIP association keys,for key extraction asdescribedspecified in Section9.6.4. If the received Diffie-Hellman Group ID isunsupported,not supported, theI2 packet is silently dropped. 8.implementation may either resend I1 within the retry bounds or abandon the HIP exchange. 12. Theencrypted HOST_ID decrypted bysystem selects the HIP transform from the choices presented in the R1 packet and uses theInitiatorselected values subsequently when generating and using encryptionkey defined in Section 9.keys, and when sending the I2. If thedecrypted data isproposed alternatives are notan HOST_ID parameter,acceptable to theI2 packet is silently dropped. 9. The implementation SHOULD also verify thatsystem, it may either resend I1 within theInitiator's HIT inretry bounds or abandon theI2 corresponds toHIP exchange. 13. The system initialized theHost Identity sentremaining variables in theI2. 10.associated state, including Update ID counters. 14. The systemMUST verify the HMAC according to the proceduresprepares and sends an I2, as described in Section6.2.10. 11.5.3.3. 15. The system SHOULD start a timer whose timeout value should be larger than the worst-case anticipated RTT, and MUSTverifyincrement a timeout counter associated with theHIP_SIGNATURE according to Section 6.2.12I2. The sender SHOULD retransmit the I2 upon a timeout andSection 7.3. 12. Ifrestart thechecks above are valid, thentimer, up to a maximum of I2_RETRIES_MAX tries. 16. If the systemproceeds with further I2 processing; otherwise,is in state I1-SENT, itdiscardsshall transition to state I2-SENT. If theI2 andsystem is in any other state, it remains in thesamecurrent state.13. The I2 packet may have6.7.1 Handling Malformed Messages If an implementation receives a malformed R1 message, it MUST silently drop theC bit set -- in this case,packet. Sending a NOTIFY or ICMP would not help, as the sender of the R1 typically doesn't have any state. An implementation SHOULD wait for some more time for a possible good R1, after which it MAY try again by sending a new I1 packet. 6.8 Processing Incoming I2 Packets Upon receipt of an I2, the systemshould anticipateMAY perform initial checks to determine whether thereceipt of HIP CER packetsI2 corresponds to a recent R1 thatcontainhas been sent out, if thehost identity corresponding toResponder keeps such state. For example, the sender could check whether theresponder's HIT. 14. TheI2packetis from an address or HIT that has recently received an R1 from it. The R1 may havethe A bit set --had Opaque data included that was echoed back inthis case,thesystem MAY chooseI2. If the I2 is considered torefusebe suspect, it MAY be silently discarded bydroppingtheI2 and returning to state UNASSOCIATED. Ifsystem. Otherwise, theA bit is set,HIP implementation SHOULD process the I2. This includes validation of the cookie puzzle solution, generating the Diffie-Hellman key, decrypting the Initiator'sHIT is anonymousHost Identity, verifying the signature, creating state, andshould not be stored. 15.finally sending an R2. Thesystem initialized the remaining variables infollowing steps define theassociated state, including Update ID counters. 16. Upon successfulconceptual processingofrules for responding to an I2in states UNASSOCIATED, I1-SENT, I2-SENT, and R2-SENT, an R2 is sent andpacket: 1. The system MAY perform checks to verify that thestate machine transitionsI2 corresponds tostate ESTABLISHED. 17. Upon successful processinga recently sent R1. Such checks are implementation dependent. See Appendix C for a description of anI2 in state ESTABLISHED,example implementation. 2. The system MUST check that theold HIP association is dropped and a newResponder's HIT corresponds to one of its own HITs. 3. If the system isinstalled, an R2 is sent, andin thestate machine transitions to R2-SENT. 18. Upon transitioning to R2-SENT, start a timer. LeaveR2-SENT state, it MAY check ifeitherthetimer expires (allowing for maximal retransmission of I2s), some data has beennewly receivedonI2 is similar to theincoming HIP association, or an UPDATE packet has been received (or some other packet that indicatesone thatthe peer has movedtriggered moving toESTABLISHED). 8.7.1 Handling malformed messagesR2- SENT. Ifan implementation receivesso, it MAY retransmit amalformed I2 message, the behaviour SHOULD depend on how much checkspreviously sent R2, reset themessage has already passed.R2-SENT timer, and stay in R2-SENT. 4. If thepuzzle solutionsystem is in themessage has already been checked,I2-SENT state, it makes a comparison between its local and sender's HITs (similarly as in Section 6.4). If theimplementation SHOULD reportlocal HIT is smaller than theerror by responding with a NOTIFYsender's HIT, it should drop the I2 packet.OtherwiseOtherwise, theimplementation MAY respondsystem should process the received I2 packet. 5. To avoid the possibility to end up withan ICMP message as defined in Section 6.3. 8.8 Processing incoming R2 packets An R2different session keys due to symmetric operation of the peer nodes, the Diffie-Hellman key, I, and J selection is also based on the HIT comparison. If the local HIT is smaller than the peer HIT, the system uses peer Diffie-Hellman key and nonce I from the R1 packet receivedin states UNASSOCIATED, I1-SENT, ESTABLISHED, or REKEYING results inearlier. The local Diffie-Hellman key and nonce J are taken from the I2 packet sent to the peer earlier. Otherwise, it uses peer Diffie-Hellman key and nonce J from theR2 being droppedjust arrived I2. The local Diffie-Hellman key and nonce I are thestate machine stayingones that it sent ealier in thesame state.R1 packet. 6. Ifan R2the system isreceivedin any other stateI2-SENT,than R2-SENT, it SHOULDbe processed. The following steps define the conceptual processing rules for incoming R2 packet: 1. The system MUST verifycheck that theHITsechoed R1 generation counter inuse correspond toI2 is within theHITs that wereacceptable range. Implementations MUST accept puzzles from the current generation and MAY accept puzzles from earlier generations. If the newly receivedin R1. 2.I2 is outside the accepted range, the I2 is stale (perhaps replayed) and SHOULD be dropped. 7. The system MUSTverifyvalidate theHMAC_2 accordingsolution to theprocedurescookie puzzle by computing the SHA-1 hash described in Section6.2.11. 3.5.3.3. 8. ThesystemI2 MUSTverifyhave a single value in theHIP signature accordingHIP_TRANSFORM parameter, which MUST match one of the values offered to theproceduresInitiator inSection 6.2.12. 4. If any ofthechecks above fail, there is a high probability of an ongoing man-in-the-middle or other security attack.R1 packet. 9. The systemSHOULD act accordingly,must derive Diffie-Hellman keying material Kij based onits local policy. 5. If the system is in any other state than I2-SENT, the R2 is silently dropped. 6. Upon successful processing oftheR2, the state machine moves to state ESTABLISHED. 8.9 Sending UPDATE packets A host sends an UPDATE packet when it wants to update some information related to a HIP association. There are a number of likely situations, e.g. mobility management and rekeying of an existing ESP Security Association. The following paragraphs definepublic value and Group ID in theconceptual rules for sending an UPDATE packetDIFFIE_HELLMAN parameter. This key is used to derive thepeer. Additional steps can be definedHIP association keys, as described inother documents whereSection 6.4. If theUPDATEDiffie-Hellman Group ID is unsupported, the I2 packet isused. 1.silently dropped. 10. Thesystem increments its own Update ID valueencrypted HOST_ID decrypted byone. 2. The system creates an UPDATE packet that containsthe Initiator encryption key defined in Section 6.4. If the decrypted data is not aSEQ parameter withHOST_ID parameter, thecurrent value of Update ID. The UPDATEI2 packetmayis silently dropped. 11. The implementation SHOULD alsoinclude an ACK ofverify that theUpdate ID foundInitiator's HIT in thereceived UPDATE SEQ parameter, if any. 3.I2 corresponds to the Host Identity sent in the I2. 12. The systemsendsMUST verify thecreated UPDATE packet and starts an UPDATE timer.HMAC according to the procedures in Section 5.2.9. 13. Thedefault value forsystem MUST verify thetimer is 2 * RTT estimate. 4.HIP_SIGNATURE according to Section 5.2.11 and Section 5.3.3. 14. If theUPDATE timer expires,checks above are valid, then theUPDATE is resent. The UPDATE can be resent UPDATE_RETRY_MAX times.system proceeds with further I2 processing; otherwise, it discards the I2 and remains in the same state. 15. TheUPDATE timer SHOULD be exponentially backed off for subsequent retransmissions. 8.10 Receiving UPDATE packets When aI2 packet may have the A bit set -- in this case, the systemreceives an UPDATE packet, its processing depends onMAY choose to refuse it by dropping the I2 and returning to state UNASSOCIATED. If thestate ofA bit is set, theHIP associationInitiator's HIT is anonymous and should not be stored. 16. The system initialized thepresence of and values ofremaining variables in theSEQ and ACK parameters. Typically,associated state, including Update ID counters. 17. Upon successful processing of anUPDATE message also carries optional parameters whose handling is definedI2 inseparate documents. 1. If therestates UNASSOCIATED, I1- SENT, I2-SENT, and R2-SENT, an R2 isno corresponding HIP association,sent and theimplementation MAY reply withstate machine transitions to state R2-SENT. 18. Upon successful processing of anICMP Parameter Problem, as specifiedI2 inSection 6.3.4. 2. Ifstate ESTABLISHED, the old HIP association isin the ESTABLISHED statedropped andthe SEQ parametera new one ispresent, the UPDATEinstalled, an R2 isprocessedsent, andreplied as described in Section 8.10.1. 3. Additionally (or alternatively),the state machine transitions to R2-SENT. 19. Upon transitioning to R2-SENT, start a timer. Move to ESTABLISHED if some data has been received on theassociation is inincoming HIP association, or an UPDATE packet has been received (or some other packet that indicates that theESTABLISHED state and there ispeer has moved to ESTABLISHED). If the timer expires (allowing for maximal retransmissions of I2s), move to UNASSOCIATED. 6.8.1 Handling Malformed Messages If anACK (of outstanding Update ID)implementation receives a malformed I2 message, the behavior SHOULD depend on how much checks the message has already passed. If the puzzle solution in theUPDATE,message has already been checked, theUPDATE is processedimplementation SHOULD report the error by responding with a NOTIFY packet. Otherwise the implementation MAY respond with an ICMP message asdescribeddefined in Section8.10.2. 8.10.1 Handling a SEQ paramaeter in a5.4. 6.9 Processing Incoming R2 Packets An R2 receivedUPDATE message 1. If the Update IDin states UNASSOCIATED, I1-SENT, ESTABLISHED, or REKEYING results in thereceived SEQ is smaller than the stored Update ID for the peer host, the packet MUST BER2 being droppedas a duplicate. 2. Ifand theUpdate IDstate machine staying in thereceived SEQsame state. If an R2 isequal toreceived in state I2-SENT, it SHOULD be processed. The following steps define thestored Update IDconceptual processing rules forthe host, the packet is treated as a retransmission.incoming R2 packet: 1. TheHMAC verification (next step)system MUSTNOT be skipped. (A byte-by-byte comparison of the received and a store packet would be OK, though.) It is recommendedverify thata host cachethelast packet that was ackedHITs in use correspond toavoidthecost of generating a new ACK packet to respond to a replayed UPDATE.HITs that were received in R1. 2. The system MUSTacknowledge, again, such (apparent) UPDATE message retransmissions but SHOULD also consider rate-limiting such retransmission responsesverify the HMAC_2 according toguard against replay attacks.the procedures in Section 5.2.10. 3. The system MUST verify theHMAC inHIP signature according to theUPDATE packet.procedures in Section 5.2.11. 4. If any of theverification fails, the packet MUST be dropped. 4.checks above fail, there is a high probability of an ongoing man-in-the-middle or other security attack. The systemMAY verify the SIGNATURE in the UPDATE packet. If the verification fails, the packetSHOULDbe dropped and an error message logged.act accordingly, based on its local policy. 5. Ifa new SEQ parameter is being processed,the systemMUST record the Update IDis in any other state than I2-SENT, thereceived SEQ parameter, for replay protection.R2 is silently dropped. 6.AnUpon successful processing of the R2, the state machine moves to state ESTABLISHED. 6.10 Sending UPDATE Packets A host sends an UPDATEacknowledgementpacketwith ACK parameter is preparedwhen it wants to update some information related to a HIP association. There are a number of likely situations, e.g. mobility management andsendrekeying of an existing ESP Security Association. The following paragraphs define the conceptual rules for sending an UPDATE packet to the peer.8.10.2 Handling an ACK parameterAdditional steps can be defined ina receivedother documents where the UPDATE packet is used. 1. The system increments its own Update ID value by one. 2. The system creates an UPDATE packet that contains a SEQ parameter withACK must match to an earlier sent UPDATE packet. If no match is found,thepacket MUST be dropped. 2.current value of Update ID. Thesystem MUST verifyUPDATE packet may also include an ACK of theHMACUpdate ID found inthea received UPDATEpacket. If the verification fails, the packet MUST be dropped.SEQ parameter, if any. 3. The systemMAY verify the SIGNATURE insends the created UPDATEpacket. If the verification fails, thepacketSHOULD be droppedand starts anerror message logged. 4. The correspondingUPDATEtimer is stopped (see Section 8.9) so thattimer. The default value for thenow acknowledged UPDATE is no longer retransmitted. 8.11 Processing CER packets Processing CER packets is OPTIONAL, and currently undefined. 8.12 Processing NOTIFY packets Processing NOTIFY packetstimer isOPTIONAL. If processed, any errors noted by the NOTIFY parameter SHOULD be taken into account by2 * RTT estimate. 4. If theHIP state machine (e.g., by terminating a HIP handshake), andUPDATE timer expires, theerrorUPDATE is resent. The UPDATE can be resent UPDATE_RETRY_MAX times. The UPDATE timer SHOULD belogged. 8.13 Processing CLOSE packetsexponentially backed off for subsequent retransmissions. 6.11 Receiving UPDATE Packets Whenthe host receives a CLOSE message it responds withaCLOSE_ACK message and moves to CLOSED state. (The authenticity of the CLOSE message is verified using both HMAC and SIGNATURE). Thissystem receives an UPDATE packet, its processingapplies whether or notdepends on theHIP associationstateis CLOSING in order to handle CLOSE messages from both ends crossing in flight. Theof the HIP associationis not discarded before the host moves from the UNASSOCIATED state. Onceand theclosing process has started, any need to send data packets will trigger creatingpresence of andestablishingvalues ofa new HIP association, starting with sendingthe SEQ and ACK parameters. Typically, anI1.UPDATE message also carries optional parameters whose handling is defined in separate documents. 1. If there is no corresponding HIP association, the implementation MAY replyto a CLOSEwith an ICMP Parameter Problem, as specified in Section6.3.4. 8.14 Processing CLOSE_ACK packets When a host receives a CLOSE_ACK message it verifies that it5.4.4. 2. If the association is inCLOSING or CLOSEDthe ESTABLISHED state andthattheCLOSE_ACK was in response toSEQ parameter is present, the UPDATE is processed and replied as described in Section 6.11.1. 3. Additionally (or alternatively), if the association is in the ESTABLISHED state and there is an ACK (of outstanding Update ID) in the UPDATE, the UPDATE is processed as described in Section 6.11.2. 6.11.1 Handling a SEQ paramaeter in a received UPDATE message 1. If the Update ID in the received SEQ is smaller than the stored Update ID for theCLOSE (usingpeer host, theincluded ECHO_REPLYpacket MUST BE dropped as a duplicate. 2. If the Update ID inresponsethe received SEQ is equal to thesent ECHO_REQUEST). The CLOSE_ACK uses HMAC and SIGNATUREstored Update ID forverification. The state is discarded whenthestate changes to UNASSOCIATED and, after that, NOTIFYhost, the packet issenttreated as aresponse toretransmission. The HMAC verification (next step) MUST NOT be skipped. (A byte-by-byte comparison of the received and aCLOSE message. 8.15 Dropping HIP associations A HIP implementationstored packet would be OK, though.) It isfree to drop a HIP association at any time, based on its own policy. Ifrecommended that aHIPhostdecides to drop a HIP association, it deletes the corresponding HIP state, including the keying material. The implementation MUST also dropcache thepeer's R1 generation counter value, unless a local policy explicitly defineslast packet that was acked to avoid thevaluecost ofthat particular host is stored. An implementationgenerating a new ACK packet to respond to a replayed UPDATE. The system MUSTNOT store R1 generation counters by default,acknowledge, again, such (apparent) UPDATE message retransmissions butstoring R1 generation counter values, if done,SHOULD also consider rate-limiting such retransmission responses to guard against replay attacks. 3. The system MUSTbe configured by explicit HITs. 9. HIP KEYMAT HIP keying material is derived fromverify theDiffie-Hellman Kij produced duringHMAC in theHIP base exchange.UPDATE packet. If the verification fails, the packet MUST be dropped. 4. TheInitiator has Kij duringsystem MAY verify thecreation ofSIGNATURE in theI2 packet, andUPDATE packet. If theResponder has Kij once it receivesverification fails, theI2 packet. This is why I2 can already contain encrypted information. The KEYMAT is derived by feeding Kijpacket SHOULD be dropped and an error message logged. 5. If a new SEQ parameter is being processed, theHITs intosystem MUST record thefollowing operation;Update ID in the| operation denotes concatenation. KEYMAT = K1 | K2 | K3 | ... where K1 = SHA-1( Kij | sort(HIT-I | HIT-R) | 0x01 ) K2 = SHA-1( Kij | K1 | 0x02 ) K3 = SHA-1( Kij | K2 | 0x03 ) ... K255 = SHA-1( Kij | K254 | 0xff ) K256 = SHA-1( Kij | K255 | 0x00 ) etc. Sort(HIT-I | HIT-R)received SEQ parameter, for replay protection. 6. An UPDATE acknowledgement packet with ACK parameter isdefined as the network byte order concatenation ofprepared and sent to thetwo HITs,peer. 6.11.2 Handling an ACK Parameter in a Received UPDATE Packet 1. The UPDATE packet with ACK must match with an earlier sent UPDATE packet. If no match is found, thesmaller HIT precedingpacket MUST be dropped. 2. The system MUST verify thelarger HIT, resulting fromHMAC in thenumeric comparison ofUPDATE packet. If thetwo HITs interpreted as positive (unsigned) 128-bit integers in network byte order.verification fails, the packet MUST be dropped. 3. Theinitial keys are drawn sequentiallysystem MAY verify the SIGNATURE in theorderUPDATE packet. If the verification fails, the packet SHOULD be dropped and an error message logged. 4. The corresponding UPDATE timer is stopped (see Section 6.10) so that the now acknowledged UPDATE isdeterminedno longer retransmitted. 6.12 Processing NOTIFY Packets Processing NOTIFY packets is OPTIONAL. If processed, any errors noted by thenumeric comparison ofNOTIFY parameter SHOULD be taken into account by thetwo HITs, with comparison method described inHIP state machine (e.g., by terminating a HIP handshake), and theprevious paragraph. HOST_g denoteserror SHOULD be logged. 6.13 Processing CLOSE Packets When the host receives a CLOSE message it responds withthe greater HIT value,a CLOSE_ACK message andHOST_lmoves to CLOSED state. (The authenticity of thehost withCLOSE message is verified using both HMAC and SIGNATURE). This processing applies whether or not thelower HIT value. The drawing order for initial keys: HIP-gl encryption key for HOST_g's outgoing HIP packets HIP-gl integrity (HMAC) key for HOST_g's outgoing HIP packets HIP-lg encryption key (currently unused) for HOST_l's outgoingHIPpackets HIP-lg integrity (HMAC) key for HOST_l's outgoing HIP packetsassociation state is CLOSING in order to handle CLOSE messages from both ends crossing in flight. Thenumber of bits drawn for a given algorithmHIP association is not discarded before the"natural" size of the keys. Forhost moves from themandatory algorithms,UNASSOCIATED state. Once thefollowing sizes apply: AES 128 bits SHA-1 160 bits NULL 0 bits 10.closing process has started, any need to send data packets will trigger creating and establishing of a new HIPFragmentation Support Aassociation, starting with sending an I1. If there is no corresponding HIP association, the implementationmust support IP fragmentation / reassembly. Fragment reassembly MUST be implementedMAY reply to a CLOSE with an ICMP Parameter Problem, as specified inboth IPv4 and IPv6, but fragment generation MUST be implemented onlySection 5.4.4. 6.14 Processing CLOSE_ACK Packets When a host receives a CLOSE_ACK message it verifies that it is inIPv4 (IPv4 stacks and networks will usually do this by default)CLOSING or CLOSED state andSHOULD be implementedthat the CLOSE_ACK was inIPv6. Inresponse to theIPv6 world,CLOSE (using theminimum MTU is larger, 1280 bytes, thanincluded ECHO_REPLY in response to theIPv4 world.sent ECHO_REQUEST). Thelarger MTU size is usually sufficient for most HIP packets,CLOSE_ACK uses HMAC andtherefore fragment generation may not be needed. If a host expects to send HIP packets that are larger than the minimum IPv6 MTU, it MUST implement fragment generation evenSIGNATURE forIPv6. Inverification. The state is discarded when theIPv4 world,state changes to UNASSOCIATED and, after that, NOTIFY is sent as a response to a CLOSE message. 6.15 Dropping HIPpackets may encounter low MTUs along their routed path. SinceAssociations A HIPdoes not provide a mechanismimplementation is free touse multiple IP datagrams fordrop asingleHIPpacket, support of path MTU discovery does not bringassociation at anyvaluetime, based on its own policy. If a HIP host decides to drop a HIPinassociation, it deletes theIPv4 world. HIP-aware NAT systems MUST perform any IPv4 reassembly/fragmentation. Allcorresponding HIPimplementationsstate, including the keying material. The implementation MUST also drop the peer's R1 generation counter value, unless a local policy explicitly defines that the value of that particular host is stored. An implementation MUST NOT store R1 generation counters by default, but storing R1 generation counter values, if done, MUSTemploy a reassembly algorithm that is sufficiently resistant against DoS attacks. 11.be configured by explicit HITs. 7. HIP Policies There are a number of variables that will influence the HIP exchanges that each host must support. All HIP implementations MUST support more than one simultaneous HIs, at least one of which SHOULD be reserved for anonymous usage. Although anonymous HIs will be rarely used asresponderResponder HIs, they will be common for Initiators. Support for more than two HIs is RECOMMENDED. Many Initiators would want to use a different HI for different Responders. The implementations SHOULD provide for an ACL ofinitiatorInitiator HIT toresponderResponder HIT. This ACL SHOULD also include preferred transform and local lifetimes. For HITs with HAAs, wildcarding SHOULD be supported. Thus if a Community of Interest, like Banking, getsan RAA,a HAA, a single ACL could be used. A global wildcard would represent the general policy to be used. Policy selection would be from most specific to most general. The value of K used in the HIP R1 packet can also vary by policy. K should never be greater than 20, but for trusted partners it could be as low as 0. Responders would need a similar ACL, representing which hosts they accept HIP exchanges, and the preferred transform and local lifetimes. Wildcarding SHOULD be supported for this ACL also.12.8. Security Considerations HIP is designed to provide secure authentication of hosts. HIP also attempts to limit the exposure of the host to variousdenial-of-servicedenial-of- service and man-in-the-middle (MitM) attacks. In so doing, HIP itself is subject to its own DoS and MitM attacks that potentially could be more damaging to a host's ability to conduct business as usual. Denial-of-service attacks take advantage of the cost of start of state for a protocol on the Responder compared to the 'cheapness' on the Initiator. HIP makes no attempt to increase the cost of the start of state on the Initiator, but makes an effort to reduce the cost to the Responder. This is done by having the Responder start the 3-way exchange instead of the Initiator, making the HIP protocol 4 packets long. In doing this, packet 2 becomes a 'stock' packet that the Responder MAY use many times. The duration of use is a paranoia versus throughput concern. Using the same Diffie-Hellman values and random puzzle #I has some risk. This risk needs to be balanced against a potential storm of HIP I1 packets. This shifting of the start of state cost to the Initiator in creating the I2 HIP packet, presents another DoS attack. The attacker spoofs the I1 HIP packet and the Responder sends out the R1 HIP packet. This could conceivably tie up the'initiator''Initiator' with evaluating the R1 HIP packet, and creating the I2 HIP packet. The defense against this attack is to simply ignore any R1 packet where a corresponding I1 was not sent. A second form of DoS attack arrives in the I2 HIP packet. Once the attacking Initiator has solved the puzzle, it can send packets with spoofed IP source addresses with either invalid encrypted HIP payload component or a bad HIP signature. This would take resources in the Responder's part to reach the point to discover that the I2 packet cannot be completely processed. The defense against this attack is after N bad I2 packets, the Responder would discard any I2s that contain the given Initiator HIT. Thus will shut down the attack. The attacker would have to request another R1 and use that to launch a new attack. The Responder could up the value of K while under attack. On the downside, valid I2s might get dropped too. A third form of DoS attack is emulating the restart of state after a reboot of one of the partners. A host restarting would send an I1 to a peer, which would respond with an R1 even if it were in the ESTABLISHED state. If theI1 were spoofed,I1 were spoofed, the resulting R1 would be received unexpectedly by the spoofed host and would be dropped, as in the first case above. A fourth form of DoS attack is emulating the end of state. HIP relies on timers plus a CLOSE/CLOSE_ACK handshake to explicitly signals the end of a state. Because both CLOSE and CLOSE_ACK messages contain an HMAC, an outsider cannot close a connection. The presence of an additional SIGNATURE allows middle-boxes to inspect these messages and discard the associated state (for e.g., firewalling, SPI-based NATing, etc.). However, the optional behavior of replying to CLOSE with an ICMP Parameter Problem packet (as described in Section 5.4.4) might allow an IP spoofer sending CLOSE messages to launch reflection attacks. A fifth form of DoS attack is replaying R1s to cause the Initiator to solve stale puzzles and become out of synchronization with the Responder. The R1 generation counter is a monotonically increasing counter designed to protect against this attack, as described in section Section 4.1.3. Man-in-the-middle attacks are difficult to defend against, without third-party authentication. A skillful MitM could easily handle all parts of HIP; but HIP indirectly provides the following protection from a MitM attack. If the Responder's HI is retrieved from a signed DNS zone, a certificate, or through some other secure means, the Initiator can use this to validate theresultingR1would be received unexpectedly byHIP packet. Likewise, if thespoofed host and would be dropped, asInitiator's HI is in a secure DNS zone, a trusted certificate, or otherwise securely available, thefirst case above. A fourth form of DoS attack is emulatingResponder can retrieve it after it gets theend of state.I2 HIPrelies on timers plus a CLOSE/CLOSE_ACK handshake to explicitly signals the end of a state. Because both CLOSEpacket andCLOSE_ACK messages containvalidate that. However, since anHMAC,Initiator may choose to use anoutsider cannot closeanonymous HI, it knowingly risks aconnection.MitM attack. Thepresence ofResponder may choose not to accept a HIP exchange with anadditional SIGNATURE allows middle-boxesanonymous Initiator. If an Initiator wants toinspect these messages and discard the associated state (for e.g., firewalling, SPI-based NATing, etc.). However,use opportunistic mode, it is vulnerable to man-in-the-middle attacks. Furthermore, theoptional behavior of replyingavailable HI types are limited toCLOSEthe MUST implement algorithms, as per Section 3. Hence, if a future specification deprecates the current MUST implement algorithm(s) and replaces it (them) with some new one(s), backward compatibility cannot be preserved. Since not all hosts will ever support HIP, ICMP 'Destination Protocol Unreachable' are to be expected and present a DoS attack. Against an Initiator, the attack would look like the Responder does not support HIP, but shortly after receiving the ICMPParameter Problem packet (as described in Section 6.3.4) might allowmessage, the Initiator would receive a valid R1 HIP packet. Thus to protect from this attack, anIP spoofer sending CLOSE messagesInitiator should not react tolaunch reflection attacks.an ICMP message until a reasonable delta time to get the real Responder's R1 HIP packet. Afifth form of DoSsimilar attack against the Responder isreplaying R1s to causemore involved. First an ICMP message is expected if theinitiator to solve stale puzzlesI1 was a DoS attack andbecome outthe real owner ofsynchronization withtheresponder.spoofed IP address does not support HIP. TheR1 generation counter is a monotonically increasing counter designed to protect againstResponder SHOULD NOT act on thisattack, as described in section Section 4.1.3. Man-in-the-middle attacks are difficultICMP message todefend against, without third-party authentication. A skillful MitM could easily handle all parts of HIP; but HIP indirectly providesremove thefollowing protectionminimal state froma MitM attack. IftheResponder's HI is retrieved from a signed DNS zone,R1 HIP packet (if it has one), but wait for either acertificate,valid I2 HIP packet orthrough some other secure means,theInitiator can use this to validatenatural timeout of the R1 HIP packet. This is to allow for a sophisticated attacker that is trying to break up the HIP exchange. Likewise,iftheInitiator's HIInitiator should ignore any ICMP message while waiting for an R2 HIP packet, deleting state only after a natural timeout. 9. IANA Considerations This document defines a new IP Protocol number to be used for HIP. This protocol has been assigned the number < To Be Assigned by IANA -- for testing purposes, the protocol number 99 is currently used >. This document also creates a set of new name spaces. These are described below. Packet Type The 8-bit Packet Type field in asecure DNS zone, a trusted certificate, or otherwise securely available, the Responder can retrieve it after it gets the I2HIP protocol packetand validate that. However, since an Initiator may choose to use an anonymous HI, it knowingly risks a MitM attack. The Responder may choose not to acceptdescribes the type of a HIPexchange with an anonymous Initiator. If an initiator wants to use opportunistic mode, itprotocol message. It isvulnerable to man-in-the-middle attacks. Furthermore, the available HI types are limited to the MUST implement algorithms, as perdefined in Section3. Hence, if a future specification deprecates the5.1. The currentMUST implement algorithm(s) and replaces it (them) with some new one(s), backward compatibility cannot be preserved. Since not all hosts will ever support HIP, ICMP 'Destination Protocol Unreachable'values areto be expecteddefined in Section 5.3.1 through Section 5.3.8 andpresentare listed below: * I1 is 1. * R1 is 2. * I2 is 3. * R2 is 4. * UPDATE is 6. * NOTIFY is 7. * CLOSE is 8. * CLOSE_ACK is 9. New values are assigned through IETF Consensus [10]. HIP Version The four bit Version field in aDoS attack. Against an Initiator,HIP protocol packet describes theattack would look likeversion of theResponder does not support HIP, but shortly after receivingHIP protocol. It is defined in Section 5.1. The only currently defined value is 1. New values are assigned through IETF Consensus. HIT Type The three bit HIT Type values appear in theICMP message,Sender's HIT Type and Destinations's HIT Type fields theInitiator would receive a valid R1 HIP packet. Thus to protect from this attack, an Initiator should not react to an ICMP message untilControls field in areasonable delta time to get the real Responder's R1HIP protocol packet.A similar attack againstThey are defined in in Section 5.1 and theRespondercurrently defined values are listed below: * Type 1 HIT ismore involved. First an ICMP message1. * Type 2 HIT isexpected if2. * Values 0 and 7 are reserved. New values either from theI1 wasunassigned or reserved space are assigned through IETF Consensus. Parameter Type The 16 bit Type field in aDoS attack andHIP parameters describes thereal ownertype of thespoofed IP address does not support HIP.parameter. It is defined in Section 5.2.1. TheResponder SHOULD NOT act on this ICMP message to remove the minimal state from the R1 HIP packet (if it has one), but waitcurrent values are defined in Section 5.2.3 through Section 5.2.18 and are listed below: * R1_COUNTER is 128. * PUZZLE is 257. * SOLUTION is 321. * SEQ is 385. * ACK is 449. * DIFFIE_HELLMAN is 513. * HIP_TRANSFORM is 577. * ENCRYPTED is 641. * HOST_ID is 705. * CERT is 768. * NOTIFY is 832. * ECHO_REQUEST is 897. * ECHO_RESPONSE is 961. * HMAC is 61505. * HMAC_2 is 61569. * HIP_SIGNATURE_2 is 61633. * HIP_SIGNATURE is 61697. * ECHO_REQUEST is 63661. * ECHO_RESPONSE is 63425. The type codes 0 through 1023 and 61440 through 65535 are reserved foreitherfuture base protocol extensions, and are assigned through IETF Consensus. The type codes 32768 through 49141 are reserved for experimentation and private use. Types SHOULD be selected in avalid I2 HIP packet orrandom fashion from this range, thereby reducing thenatural timeoutprobability of collisions. A method employing genuine randomness (such as flipping a coin) SHOULD be used. All other type codes are assigned through First Come First Served, with Specification Required [10]. Group ID The eight bit Group ID values appear in theR1 HIP packet. ThisDIFFIE_HELLMAN parameter, defined in Section 5.2.6. The currently defined values are listed below: * 384-bit group isto allow for a sophisticated attacker that1. * OAKLEY well known group 1 istrying to break up the HIP exchange. Likewise,2. * 1536-bit MODP group is 3. * 3072-bit MODP group is 4. * 6144-bit MODP group is 5. * 8192-bit MODP group is 6. * Value 0 is reserved. New values either from theInitiator should ignore any ICMP message while waiting for an R2 HIP packet, deleting state only afterreserved or unassigned space are assigned through IETF Consensus. Suite ID The 16 bit Suite ID values in anatural timeout. 13. IANA Considerations IANA hasHIP_TRANSFORM parameter are defined in Section 5.2.7. The currently defined values are listed below: * AES-CBC with HMAC-SHA1 is 1. * 3DES-CBC with HMAC-SHA1 is 2. * 3DES-CBC with HMAC-MD5 is 3. * BLOWFISH-CBC with HMAC-SHA1 is 4. * NULL-ENCRYPT with HMAC-SHA1 is 5. * NULL-ENCRYPT with HMAC-MD5 is 6. * Value 0 is reserved. New values either from the reserved or unassigned space are assignedIP Protocol number TBD to HIP. IANA needs to create registries for:through IETF Consensus. DI-Type The four bit DI-Type values in a HOST_ID parameter are defined in Section 5.2.8. The currently defined values are listed below: * None included is 0. * FQDN is 1.HIP packet types* NAI is 2.HIPNew values are assigned through IETF Consensus. Notify Message Type The 16 bit Notify Message Type field in a NOTIFY parametertypesis defined in Section 5.2.16. The currently defined values are listed below: * UNSUPPORTED_CRITICAL_PARAMETER_TYPE is 1. * INVALID_SYNTAX is 7. * NO_DH_PROPOSAL_CHOSEN is 14. * INVALID_DH_CHOSEN is 15. * NO_HIP_PROPOSAL_CHOSEN is 16. * INVALID_HIP_TRANSFORM_CHOSEN is 17. * AUTHENTICATION_FAILED is 24. * CHECKSUM_FAILED is 26. * HMAC_FAILED is 28. * ENCRYPTION_FAILED is 32. * INVALID_HIT is 40. * BLOCKED_BY_POLICY is 42. * SERVER_BUSY_PLEASE_RETRY is 44. New values are assigned through First Come First Served, with Specification Required. 10. Acknowledgments The drive to create HIP came to being after attending the MALLOC meeting at the 43rd IETF meeting. Baiju Patel and Hilarie Orman really gave the original author, Bob Moskowitz, the assist to get HIP beyond 5 paragraphs of ideas. It has matured considerably since the early drafts thanks to extensive input from IETFers. Most importantly, its design goals are articulated and are different from other efforts in this direction. Particular mention goes to the members of the NameSpace Research Group of the IRTF. Noel Chiappa provided the framework for LSIs and Keith Moore the impetus to provide resolvability. Steve Deering provided encouragement to keep working, as a solid proposal can act as a proof of ideas for a research group. Many others contributed; extensive security tips were provided by Steve Bellovin. Rob Austein kept the DNS parts on track. Paul Kocher taught Bob Moskowitz how to make the cookie exchange expensive for the Initiator to respond, but easy for the Responder to validate. Bill Sommerfeld supplied the Birthday concept, which later evolved into the R1 generation counter, to simplify reboot management. Erik Nordmark supplied CLOSE-mechanism for closing connections. Rodney Thayer and Hugh Daniels provide extensive feedback. In the early times of this draft, John Gilmore kept Bob Moskowitz challenged to provide something of value. During the later stages of this document, when the editing baton was transfered to Pekka Nikander, the input from the early implementors were invaluable. Without having actual implementations, this document would not be on the level it is now. In the usual IETF fashion, a large number of people have contributed to the actual text or ideas. The list of these people include Jeff Ahrenholz, Francis Dupont, Derek Fawcus, George Gross, Andrew McGregor, Julien Laganier, Miika Komu, Mika Kousa, Jan Melen, Henrik Petander, Michael Richardson, Tim Shepard, Jorma Wall, and Jukka Ylitalo. Our apologies to anyone whose name is missing. Once the HIP Working Group was founded in early 2004, a number of changes were introduced through the working group process. Most notably, the original draft was split in two, one containing the base exchange and the other one defining how to use ESP.15.Some modifications to the protocol proposed by Aura et al. [29] were added at a later stage. 11. References15.111.1 NormativereferencesReferences [1] Postel, J., "User Datagram Protocol", STD 6, RFC 768, August 1980. [2] Postel, J., "Internet Control Message Protocol", STD 5, RFC 792, September 1981. [3] Mockapetris, P., "Domain names - implementation and specification", STD 13, RFC 1035, November 1987. [4] Conta, A. and S. Deering, "Internet Control Message Protocol (ICMPv6) for the Internet Protocol Version 6 (IPv6)", RFC 1885, December 1995. [5] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. [6] Madson, C. and R. Glenn, "The Use of HMAC-SHA-1-96 within ESP and AH", RFC 2404, November 1998. [7] Maughan, D., Schneider,M.M., and M. Schertler, "Internet Security Association and Key Management Protocol (ISAKMP)", RFC 2408, November 1998. [8] Harkins, D. and D. Carrel, "The Internet Key Exchange (IKE)", RFC 2409, November 1998. [9] Orman, H., "The OAKLEY Key Determination Protocol", RFC 2412, November 1998. [10]Pereira, R.Narten, T. andR. Adams, "The ESP CBC-Mode Cipher Algorithms",H. Alvestrand, "Guidelines for Writing an IANA Considerations Section in RFCs", BCP 26, RFC2451, November2434, October 1998. [11] Deering, S. and R. Hinden, "Internet Protocol, Version 6 (IPv6) Specification", RFC 2460, December 1998. [12] Eastlake, D., "Domain Name System Security Extensions", RFC 2535, March 1999. [13] Eastlake, D., "DSA KEYs and SIGs in the Domain Name System (DNS)", RFC 2536, March 1999. [14] Kaliski, B., "PKCS #5: Password-Based Cryptography Specification Version 2.0", RFC 2898, September 2000. [15] Eastlake, D., "RSA/SHA-1 SIGs and RSA KEYs in the Domain Name System (DNS)", RFC 3110, May 2001.[15] Housley, R., Polk, W., Ford, W. and D. Solo, "Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile", RFC 3280, April 2002.[16] Draves, R., "Default Address Selection for Internet Protocol version 6 (IPv6)", RFC 3484, February 2003. [17] Hinden, R. and S. Deering, "Internet Protocol Version 6 (IPv6) Addressing Architecture", RFC 3513, April 2003. [18] Kivinen, T. and M. Kojo, "More Modular Exponential (MODP) Diffie-Hellman groups for Internet Key Exchange (IKE)", RFC 3526, May 2003. [19] Frankel, S., Glenn, R., and S. Kelly, "The AES-CBC Cipher Algorithm and Its Use with IPsec", RFC 3602, September 2003. [20] Kent, S., "IP Encapsulating Security Payload (ESP)",Internet-Draft draft-ietf-ipsec-esp-v3-05,draft-ietf-ipsec-esp-v3-05 (work in progress), April 2003.[20][21] Kaufman, C., "Internet Key Exchange (IKEv2) Protocol",Internet-Draft draft-ietf-ipsec-ikev2-07,draft-ietf-ipsec-ikev2-07 (work in progress), April 2003.[21] Moskowitz, R., "Host Identity Protocol Architecture", Internet-Draft draft-moskowitz-hip-arch-03, May 2003.[22] Aboba, B., "The Network Access Identifier", draft-ietf-radext-rfc2486bis-03 (work in progress), December 2004. [23] NIST, "FIPS PUB 180-1: Secure Hash Standard", April 1995.[23][24] Jokela, P., Moskowitz,R.R., and P. Nikander, "Using ESP transport format with HIP",Internet-Draft draft-jokela-hip-esp-00,draft-jokela-hip-esp-00 (work in progress), January 2005.15.211.2 Informativereferences [24]References [25] Moskowitz, R., "Host Identity Protocol Architecture", draft-moskowitz-hip-arch-03 (work in progress), May 2003. [26] Bellovin, S. and W. Aiello, "Just Fast Keying (JFK)",Internet-Draft draft-ietf-ipsec-jfk-04,draft-ietf-ipsec-jfk-04 (work in progress), July 2002.[25] Moskowitz, R. and P.[27] Nikander,"UsingP. and J. Laganier, "Host Identity Protocol (HIP) Domain Name System (DNS)with Host Identity Protocol (HIP)", Internet-Draft draft-nikander-hip-dns-00 (to be issued), June 2003. [26]Extensions", draft-ietf-hip-dns-00 (work in progress), October 2004. [28] Nikander, P., "SPI assisted NAT traversal (SPINAT) with Host Identity Protocol (HIP)",Internet-Draftdraft-nikander-hip-nat-00 (to beissued),issued) (work in progress), June 2003.[27][29] Aura, T., Nagarajan, A., and A. Gurtov, "Analysis of the HIP Base Exchange Protocol", in Proceedings of 10th Australasian Conference on Information Security and Privacy, July 2003. [30] Crosby, SA. and DS. Wallach, "Denial of Service via Algorithmic Complexity Attacks", in Proceedings of Usenix Security Symposium 2003, Washington, DC., August 2003.[28][31] Nikander, P., "A Bound End-to-End Tunnel (BEET) mode for ESP",Internet-Draftdraft-nikander-esp-beet-mode-00(expired),(expired) (work in progress), Oct 2003.[29][32] Henderson, T., "Using HIP with Legacy Applications",Internet-Draft draft-henderson-hip-applications-00.txt,draft-henderson-hip-applications-00.txt (work in progress), Feb 2005. [33] NIST, "FIPS PUB 197: Advanced Encryption Standard", Nov 2001. Authors' Addresses Robert Moskowitz ICSAlabs, a Division of TruSecure Corporation 1000 Bent Creek Blvd, Suite 200 Mechanicsburg, PA USA Email: rgm@icsalabs.com Pekka Nikander Ericsson Research NomadicLab JORVAS FIN-02420 FINLAND Phone: +358 9 299 1 Email: pekka.nikander@nomadiclab.com Petri Jokela Ericsson Research NomadicLab JORVAS FIN-02420 FINLAND Phone: +358 9 299 1 Email: petri.jokela@nomadiclab.com Thomas R. Henderson The Boeing Company P.O. Box 3707 Seattle, WA USA Email: thomas.r.henderson@boeing.com Appendix A. Probabilities of HITcollisionsCollisions The birthday paradox sets a bound for the expectation of collisions. It is based on the square root of the number of values. A 64-bit hash, then, would put the chances of a collision at 50-50 with 2^32 hosts (4 billion). A 1% chance of collision would occur in a population of 640M and a .001% collision chance in a 20M population. A 128 bit hash will have the same .001% collision chance in a 9x10^16 population. Appendix B. Probabilities in thecookie calculationCookie Calculation A question: Is it guaranteed that the Initiator is able to solve the puzzle in this way when the K value is large? Answer: No, it is not guaranteed. But it is not guaranteed even in the old mechanism, since the Initiator may start far away from J and arrive to J after far too many steps. If we wanted to make sure that the Initiator finds a value, we would need to give some hint of a suitable J, and I don't think we want to do that. In general, if we model the hash function with a random function, the probability that one iteration gives are result with K zero bits is 2^-K. Thus, the probability that one iteration does _not_ give K zero bits is (1 - 2^-K). Consequently, the probability that 2^K iterations does not give K zero bits is (1 - 2^-K)^(2^K). Since my calculus starts to be rusty, I made a small experiment and found out that lim (1 - 2^-k)^(2^k) = 0.36788 k->inf lim (1 - 2^-k)^(2^(k+1)) = 0.13534 k->inf lim (1 - 2^-k)^(2^(k+2)) = 0.01832 k->inf lim (1 - 2^-k)^(2^(k+3)) = 0.000335 k->inf Thus, if hash functions were random functions, we would need about 2^(K+3) iterations to make sure that the probability of a failure is less than 1% (actually less than 0.04%). Now, since my perhaps flawed understanding of hash functions is that they are "flatter" than random functions, 2^(K+3) is probably an overkill. OTOH, the currently suggested 2^K is clearly too little.Appendix C. Using responder cookies As mentioned in Section 4.1.1, the Responder may delay state creation and still reject most spoofed I2s by using a number of pre-calculated R1s and a local selection function. This appendix defines one possible implementation in detail. The purpose of this appendix is to give the implementors an idea on how to implement the mechanism. The method described in this appendix SHOULD NOT be used in any real implementation. If the implementation is based on this appendix, it SHOULD contain some local modification that makes an attacker's task harder. The basic idea is to create a cheap, varying local mapping function f: f( IP-I, IP-R, HIT-I, HIT-R ) -> cookie-index That is, given the Initiator's and Responder's IP addresses and HITs, the function returns an index to a cookie. When processing an I1, the cookie is embedded in an pre-computed R1, and the Responder simply sends that particular R1 to the Initiator. When processing an I2, the cookie may still be embedded in the R1, or the R1 may be deprecated (and replaced with a new one), but the cookie is still there. If the received cookie does not match with the R1 or saved cookie, the I2 is simply dropped. That prevents the Initiator from generating spoofed I2s with a probability that depends on the number of pre-computed R1s. As a concrete example, let us assume that the Responder has an array of R1s. Each slot in the array contains a timestamp, an R1, and an old cookie that was sent in the previous R1 that occupied that particular slot. TheAppendix C. Using Responderreplaces one R1Cookies As mentioned inthe array every few minutes, thereby replacing all the R1s gradually. To create a varying mapping function,Section 4.1.1, the Respondergeneratesmay delay state creation and still reject most spoofed I2s by using arandomnumberevery few minutes. The octets in the IP addresses and HITs are XORed together,of pre-calculated R1s andfinally the resulta local selection function. This appendix defines one possible implementation in detail. The purpose of this appendix isXORed with the random number. Using pseudo-code, the function looks liketo give thefollowing. Pre-computation: r1 := random number Index computation: index := r1 XOR hit_r[0] XOR hit_r[1] XOR ... XOR hit_r[15] index := index XOR hit_i[0] XOR hit_i[1] XOR ... XOR hit_i[15] index := index XOR ip_r[0] XOR ip_r[1] XOR ... XOR ip_r[15] index := index XOR ip_i[0] XOR ip_i[1] XOR ... XOR ip_i[15] The index givesimplementors an idea on how to implement theslot used inmechanism. If thearray. Itimplementation ispossiblebased on this appendix, it MAY contain some local modification that makes anInitiator receives an I1, and while it is computing I2, theattacker's task harder. The Responderdeprecates an R1 and/or choosescreates anew random number for the mapping function. Therefore thesecret value S, that it regenerates periodically. The Respondermustneeds to remember two latest values of S. Each time thecookies used in deprecated R1s and the previous random number. To check an received I2, theS is regenerated, R1 generation counter value is incremented by one. The Respondercan usegenerates asimple algorithm, expressed in pseudo-code as follows. If I2.hit_r does not match my_hits, drop the packet. index := compute_index(current_random_number, I2) If current_cookie[index] == I2.cookie, go to cookie check. If previous_cookie[index] == I2.cookie, go to cookie check. index := compute_index(previous_random_number, I2) If current_cookie[index] == I2.cookie, go to cookie check. If previous_cookie[index] == I2.cookie, go to cookie check. Droppre-signed R1 packet.cookie_check: V := Ltrunc( SHA-1( I2.I, I2.hit_i, I2.hit_r, I2.J ), K ) if V != 0, dropThe signature for pre-generated R1s must be recalculated when thepacket. WheneverDiffie-Hellman key is recomputed or when theResponder receives an I2 that fails onR1_COUNTER value changes due to S value regeneration. When theindex check, it can simply dropInitiator sends the I1 packetonfor initializing a connection, thefloorResponder gets the HIT andforget about it. New I2s withIP address from thesame or other spoofed parameters will get dropped with a reasonable probabilitypacket, andminimal effort. If a Responder receivesgenerates anI2 that passesI-value for theindex check but fails oncookie. The I value is set to thepuzzle check, it should create a state indicating this. After two or three failurespre- signed R1 packet. I value calculation: I = Ltrunc( SHA-1 ( S | HIT-I | HIT-R | IP-I | IP-R ), 64) From an incoming I2 packet, the Respondershould cease checkinggets thepuzzle but droprequired information to validate thepackets directly. This savespuzzle: HITs, IP addresses, and theResponder frominformation of theSHA-1 calculations. Such block should not last long, however, or there would be a danger that a legitimate Initiator could be blockedused S value fromgetting connections. A key for the success ofthedefined scheme is thatR1_COUNTER. Using these values, themapping function must be considerably cheaper than computing SHA-1. It also must detect any changes inResponder can regenerate theIP addresses,I, andpreferably most changes in the HITs. Checkingverify it against theHITs is not that essential, though, since HITs are includedI received in thecookie computation, too. The effectivity ofI2 packet. If themethodI values match, it canbe varied by varyingverify thesize ofsolution using I, J, and difficulty K. If the I values do not match, the I2 is dropped. cookie_check: V := Ltrunc( SHA-1( I2.I | I2.hit_i | I2.hit_r | I2.J ), K ) if V != 0, drop thearray containing pre-computed R1s.packet If thearraypuzzle solution islarge,correct, theprobability that an I2 withI and J values are stored for later use. They are used as input material when keying material is generated. The Responder SHOULD NOT keep state about failed puzzle solutions. Appendix D. Generating aspoofed IP address orHIThappens to map tofrom a HI The following pseudo-codes illustrate thesame slot is fairly slow. However,process to generate alarge array means that each R1 hasHIT from afairly long life time, thereby allowing an attacker to utilize one solved puzzleHI 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 alonger time.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.RSA.n_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 ) hit_128 := low_order_bits ( digest, 120 ) hit_haa := concatenate ( HAA, low_order_bits ( digest, 64 ) ) AppendixD.E. ExamplechecksumsChecksums for HIPpacketsPackets The HIP checksum for HIP packets is specified in Section 6.1.2. Checksums for TCP and UDP packets running over HIP-enabled security associations are specified in Section 3.5. The examples below use IP addresses of 192.168.0.1 and 192.168.0.2 (and their respectiveIPv4-compatibleIPv4- compatible IPv6 formats), and type 1 HITs with the first two bits "01" followed by 124 zeroes followed by a decimal 1 or 2, respectively.D.1E.1 IPv6 HIPexampleExample (I1) Source Address: ::c0a8:0001 Destination Address: ::c0a8:0002 Upper-Layer Packet Length: 40 0x28 Next Header: 99 0x63 Payload Protocol: 59 0x3b Header Length: 4 0x04 Packet Type: 1 0x01 Version: 1 0x1 Reserved: 0 0x0 Control: 0 0x0000 Checksum: 49672 0xc208 Sender's HIT: 4000::0001 Receiver's HIT: 4000::0002D.2E.2 IPv4 HIPpacketPacket (I1) The IPv4 checksum value for the same example I1 packet is the same as the IPv6 checksum (since the checksums due to the IPv4 and IPv6 pseudo-header components are the same).D.3E.3 TCPsegmentSegment Regardless of whether IPv6 or IPv4 is used, the TCP and UDP sockets use the IPv6 pseudo-header format [8], with the HITs used in place of the IPv6 addresses. Sender's HIT: 4000::0001 Receiver's HIT: 4000::0002 Upper-Layer Packet Length: 20 0x14 Next Header: 6 0x06 Source port: 32769 0x8001 Destination port: 22 0x0016 Sequence number: 1 0x00000001 Acknowledgment number: 0 0x00000000 Header length: 20 0x14 Flags: SYN 0x02 Window size: 5840 0x16d0 Checksum: 54519 0xd4f7 Urgent pointer: 0 0x0000 AppendixE.F. 384-bitgroupGroup This 384-bit group is defined only to be used with HIP. NOTE: The security level of this group is very low! The encryption may be broken in a very short time, even real-time. It should be used only when the host is not powerful enough (e.g. some PDAs) and when security requirements are low (e.g. during normal web surfing). This prime is: 2^384 - 2^320 - 1 + 2^64 * { [ 2^254 pi] + 5857 } Its hexadecimal value is: FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08 8A67CC74 020BBEA6 3B13B202 FFFFFFFF FFFFFFFF The generator is: 2. Intellectual Property Statement The IETF takes no position regarding the validity or scope of any Intellectual Property Rights or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; nor does it represent that it has made any independent effort to identify any such rights. Information on the procedures with respect to rights in RFC documents can be found in BCP 78 and BCP 79. Copies of IPR disclosures made to the IETF Secretariat and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users of this specification can be obtained from the IETF on-line IPR repository at http://www.ietf.org/ipr. The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology that may be required to implement this standard. Please address the information to the IETF at ietf-ipr@ietf.org. Disclaimer of Validity This document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Copyright Statement Copyright (C) The Internet Society (2005). This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights. Acknowledgment Funding for the RFC Editor function is currently provided by the Internet Society.