[RFCs/IDs] [Plain Text] [Tracker] [WG] [Email] [Diff1] [Diff2] [Nits]

Versions: 00 01 02 03 04 05 06 07 08 09 10 RFC 5201

Network Working Group                                       R. Moskowitz
Internet-Draft                         ICSAlabs, a Division of TruSecure
Intended status: Informational                               Corporation
Expires: August 5, 2007                                      P. Nikander
                                                      P. Jokela (editor)
                                            Ericsson Research NomadicLab
                                                            T. Henderson
                                                      The Boeing Company
                                                        February 1, 2007


                         Host Identity Protocol
                         draft-ietf-hip-base-07

Status of this Memo

   By submitting this Internet-Draft, each author represents that any
   applicable patent or other IPR claims of which he or she is aware
   have been or will be disclosed, and any of which he or she becomes
   aware will be disclosed, in accordance with Section 6 of BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF), its areas, and its working groups.  Note that
   other groups may also distribute working documents as Internet-
   Drafts.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   The list of current Internet-Drafts can be accessed at
   http://www.ietf.org/ietf/1id-abstracts.txt.

   The list of Internet-Draft Shadow Directories can be accessed at
   http://www.ietf.org/shadow.html.

   This Internet-Draft will expire on August 5, 2007.

Copyright Notice

   Copyright (C) The Internet Society (2007).









Moskowitz, et al.        Expires August 5, 2007                 [Page 1]

Internet-Draft           Host Identity Protocol            February 2007


Abstract

   This memo specifies the details of the Host Identity Protocol (HIP).
   HIP allows consenting hosts to securely establish and maintain shared
   IP-layer state, allowing separation of the identifier and locator
   roles of IP addresses, thereby enabling continuity of communications
   across IP address changes.  HIP is based on a Sigma-compliant Diffie-
   Hellman key exchange, using public-key identifiers from a new Host
   Identity name space for mutual peer authentication.  The protocol is
   designed to be resistant to Denial-of-Service (DoS) and Man-in-the-
   middle (MitM) attacks, and when used together with another suitable
   security protocol, such as Encapsulated Security Payload (ESP), it
   provides integrity protection and optional encryption for upper layer
   protocols, suchs as TCP and UDP.


Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   5
     1.1.  A New Name Space and Identifiers  . . . . . . . . . . . .   5
     1.2.  The HIP Base Exchange . . . . . . . . . . . . . . . . . .   6
     1.3.  Memo structure  . . . . . . . . . . . . . . . . . . . . .   7
   2.  Terms and Definitions . . . . . . . . . . . . . . . . . . . .   8
     2.1.  Requirements Terminology  . . . . . . . . . . . . . . . .   8
     2.2.  Notation  . . . . . . . . . . . . . . . . . . . . . . . .   8
     2.3.  Definitions . . . . . . . . . . . . . . . . . . . . . . .   8
   3.  Host Identifier (HI) and its Representations  . . . . . . . .  10
     3.1.  Host Identity Tag (HIT) . . . . . . . . . . . . . . . . .  10
     3.2.  Generating a HIT from a HI  . . . . . . . . . . . . . . .  11
   4.  Protocol Overview . . . . . . . . . . . . . . . . . . . . . .  12
     4.1.  Creating a HIP Association  . . . . . . . . . . . . . . .  12
       4.1.1.  HIP Puzzle Mechanism  . . . . . . . . . . . . . . . .  13
       4.1.2.  Puzzle exchange . . . . . . . . . . . . . . . . . . .  14
       4.1.3.  Authenticated Diffie-Hellman Protocol . . . . . . . .  15
       4.1.4.  HIP Replay Protection . . . . . . . . . . . . . . . .  16
       4.1.5.  Refusing a HIP Exchange . . . . . . . . . . . . . . .  17
       4.1.6.  HIP Opportunistic Mode  . . . . . . . . . . . . . . .  17
     4.2.  Updating a HIP Association  . . . . . . . . . . . . . . .  18
     4.3.  Error Processing  . . . . . . . . . . . . . . . . . . . .  18
     4.4.  HIP State Machine . . . . . . . . . . . . . . . . . . . .  19
       4.4.1.  HIP States  . . . . . . . . . . . . . . . . . . . . .  20
       4.4.2.  HIP State Processes . . . . . . . . . . . . . . . . .  21
       4.4.3.  Simplified HIP State Diagram  . . . . . . . . . . . .  28
     4.5.  User Data Considerations  . . . . . . . . . . . . . . . .  30
       4.5.1.  TCP and UDP Pseudo-header Computation for User Data .  30
       4.5.2.  Sending Data on HIP Packets . . . . . . . . . . . . .  30
       4.5.3.  Transport Formats . . . . . . . . . . . . . . . . . .  30
       4.5.4.  Reboot and SA Timeout Restart of HIP  . . . . . . . .  30



Moskowitz, et al.        Expires August 5, 2007                 [Page 2]

Internet-Draft           Host Identity Protocol            February 2007


     4.6.  Certificate Distribution  . . . . . . . . . . . . . . . .  31
   5.  Packet Formats  . . . . . . . . . . . . . . . . . . . . . . .  32
     5.1.  Payload Format  . . . . . . . . . . . . . . . . . . . . .  32
       5.1.1.  Checksum  . . . . . . . . . . . . . . . . . . . . . .  33
       5.1.2.  HIP Controls  . . . . . . . . . . . . . . . . . . . .  33
       5.1.3.  HIP Fragmentation Support . . . . . . . . . . . . . .  34
     5.2.  HIP Parameters  . . . . . . . . . . . . . . . . . . . . .  35
       5.2.1.  TLV Format  . . . . . . . . . . . . . . . . . . . . .  37
       5.2.2.  Defining New Parameters . . . . . . . . . . . . . . .  39
       5.2.3.  R1_COUNTER  . . . . . . . . . . . . . . . . . . . . .  40
       5.2.4.  PUZZLE  . . . . . . . . . . . . . . . . . . . . . . .  41
       5.2.5.  SOLUTION  . . . . . . . . . . . . . . . . . . . . . .  42
       5.2.6.  DIFFIE_HELLMAN  . . . . . . . . . . . . . . . . . . .  43
       5.2.7.  HIP_TRANSFORM . . . . . . . . . . . . . . . . . . . .  44
       5.2.8.  HOST_ID . . . . . . . . . . . . . . . . . . . . . . .  45
       5.2.9.  HMAC  . . . . . . . . . . . . . . . . . . . . . . . .  46
       5.2.10. HMAC_2  . . . . . . . . . . . . . . . . . . . . . . .  47
       5.2.11. HIP_SIGNATURE . . . . . . . . . . . . . . . . . . . .  47
       5.2.12. HIP_SIGNATURE_2 . . . . . . . . . . . . . . . . . . .  48
       5.2.13. SEQ . . . . . . . . . . . . . . . . . . . . . . . . .  48
       5.2.14. ACK . . . . . . . . . . . . . . . . . . . . . . . . .  49
       5.2.15. ENCRYPTED . . . . . . . . . . . . . . . . . . . . . .  50
       5.2.16. NOTIFICATION  . . . . . . . . . . . . . . . . . . . .  51
       5.2.17. ECHO_REQUEST_SIGNED . . . . . . . . . . . . . . . . .  54
       5.2.18. ECHO_REQUEST_UNSIGNED . . . . . . . . . . . . . . . .  55
       5.2.19. ECHO_RESPONSE_SIGNED  . . . . . . . . . . . . . . . .  55
       5.2.20. ECHO_RESPONSE_UNSIGNED  . . . . . . . . . . . . . . .  56
     5.3.  HIP Packets . . . . . . . . . . . . . . . . . . . . . . .  56
       5.3.1.  I1 - the HIP Initiator Packet . . . . . . . . . . . .  57
       5.3.2.  R1 - the HIP Responder Packet . . . . . . . . . . . .  58
       5.3.3.  I2 - the Second HIP Initiator Packet  . . . . . . . .  60
       5.3.4.  R2 - the Second HIP Responder Packet  . . . . . . . .  61
       5.3.5.  UPDATE - the HIP Update Packet  . . . . . . . . . . .  62
       5.3.6.  NOTIFY - the HIP Notify Packet  . . . . . . . . . . .  63
       5.3.7.  CLOSE - the HIP Association Closing Packet  . . . . .  63
       5.3.8.  CLOSE_ACK - the HIP Closing Acknowledgment Packet . .  64
     5.4.  ICMP Messages . . . . . . . . . . . . . . . . . . . . . .  64
       5.4.1.  Invalid Version . . . . . . . . . . . . . . . . . . .  65
       5.4.2.  Other Problems with the HIP Header and Packet
               Structure . . . . . . . . . . . . . . . . . . . . . .  65
       5.4.3.  Invalid Puzzle Solution . . . . . . . . . . . . . . .  65
       5.4.4.  Non-existing HIP Association  . . . . . . . . . . . .  65
   6.  Packet Processing . . . . . . . . . . . . . . . . . . . . . .  66
     6.1.  Processing Outgoing Application Data  . . . . . . . . . .  66
     6.2.  Processing Incoming Application Data  . . . . . . . . . .  67
     6.3.  Solving the Puzzle  . . . . . . . . . . . . . . . . . . .  68
     6.4.  HMAC and SIGNATURE Calculation and Verification . . . . .  69
       6.4.1.  HMAC Calculation  . . . . . . . . . . . . . . . . . .  69



Moskowitz, et al.        Expires August 5, 2007                 [Page 3]

Internet-Draft           Host Identity Protocol            February 2007


       6.4.2.  Signature Calculation . . . . . . . . . . . . . . . .  70
     6.5.  HIP KEYMAT Generation . . . . . . . . . . . . . . . . . .  71
     6.6.  Initiation of a HIP Exchange  . . . . . . . . . . . . . .  72
       6.6.1.  Sending Multiple I1s in Parallel  . . . . . . . . . .  73
       6.6.2.  Processing Incoming ICMP Protocol Unreachable
               Messages  . . . . . . . . . . . . . . . . . . . . . .  74
     6.7.  Processing Incoming I1 Packets  . . . . . . . . . . . . .  74
       6.7.1.  R1 Management . . . . . . . . . . . . . . . . . . . .  75
       6.7.2.  Handling Malformed Messages . . . . . . . . . . . . .  75
     6.8.  Processing Incoming R1 Packets  . . . . . . . . . . . . .  76
       6.8.1.  Handling Malformed Messages . . . . . . . . . . . . .  78
     6.9.  Processing Incoming I2 Packets  . . . . . . . . . . . . .  78
       6.9.1.  Handling Malformed Messages . . . . . . . . . . . . .  80
     6.10. Processing Incoming R2 Packets  . . . . . . . . . . . . .  80
     6.11. Sending UPDATE Packets  . . . . . . . . . . . . . . . . .  81
     6.12. Receiving UPDATE Packets  . . . . . . . . . . . . . . . .  82
       6.12.1. Handling a SEQ parameter in a received UPDATE
               message . . . . . . . . . . . . . . . . . . . . . . .  83
       6.12.2. Handling an ACK Parameter in a Received UPDATE
               Packet  . . . . . . . . . . . . . . . . . . . . . . .  83
     6.13. Processing NOTIFY Packets . . . . . . . . . . . . . . . .  84
     6.14. Processing CLOSE Packets  . . . . . . . . . . . . . . . .  84
     6.15. Processing CLOSE_ACK Packets  . . . . . . . . . . . . . .  84
     6.16. Dropping HIP Associations . . . . . . . . . . . . . . . .  85
   7.  HIP Policies  . . . . . . . . . . . . . . . . . . . . . . . .  86
   8.  Security Considerations . . . . . . . . . . . . . . . . . . .  87
   9.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .  90
   10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . .  92
   11. References  . . . . . . . . . . . . . . . . . . . . . . . . .  93
     11.1. Normative References  . . . . . . . . . . . . . . . . . .  93
     11.2. Informative References  . . . . . . . . . . . . . . . . .  94
   Appendix A.  Using Responder Puzzles  . . . . . . . . . . . . . .  96
   Appendix B.  Generating a Public Key Encoding from a HI . . . . .  98
   Appendix C.  Example Checksums for HIP Packets  . . . . . . . . .  99
     C.1.  IPv6 HIP Example (I1) . . . . . . . . . . . . . . . . . .  99
     C.2.  IPv4 HIP Packet (I1)  . . . . . . . . . . . . . . . . . .  99
     C.3.  TCP Segment . . . . . . . . . . . . . . . . . . . . . . .  99
   Appendix D.  384-bit Group  . . . . . . . . . . . . . . . . . . . 101
   Appendix E.  OAKLEY Well-known group 1  . . . . . . . . . . . . . 102
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . . 103
   Intellectual Property and Copyright Statements  . . . . . . . . . 104










Moskowitz, et al.        Expires August 5, 2007                 [Page 4]

Internet-Draft           Host Identity Protocol            February 2007


1.  Introduction

   This memo specifies the details of the Host Identity Protocol (HIP).
   A high-level description of the protocol and the underlying
   architectural thinking is available in the separate HIP architecture
   description [I-D.ietf-hip-arch].  Briefly, the HIP architecture
   proposes an alternative to the dual use of IP addresses as "locators"
   (routing labels) and "identifiers" (endpoint, or host, identifiers).
   In HIP, public cryptographic keys, of a public/private key pair, are
   used as Host Identifiers, to which higher layer protocols are bound
   instead of an IP address.  By using public keys (and their
   representations) as host identifiers, 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") used
   between hosts to establish an IP-layer communications context, called
   HIP association, 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,
   such as.

   o  "Using ESP transport format with HIP" [I-D.ietf-hip-esp]: how to
      use Encapsulating Security Payload (ESP) for integrity protection
      and optional encryption

   o  "End-Host Mobility and Multihoming with the Host Identity
      Protocol" [I-D.ietf-hip-mm]: how to support mobility and
      multihoming in HIP

   o  "Host Identity Protocol (HIP) Domain Name System (DNS) Extensions"
      [I-D.ietf-hip-dns]: how to extend DNS to contain Host Identity
      information

   o  "Host Identity Protocol (HIP) Rendezvous Extension"
      [I-D.ietf-hip-rvs]: using a rendezvous mechanism to contact mobile
      HIP hosts

1.1.  A New Name Space and Identifiers

   The Host Identity Protocol introduces a new name space, the Host
   Identity name space.  Some ramifications of this new namespace are
   explained in the HIP architecture description [I-D.ietf-hip-arch].

   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



Moskowitz, et al.        Expires August 5, 2007                 [Page 5]

Internet-Draft           Host Identity Protocol            February 2007


   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 HIP Base Exchange

   The HIP base exchange is a two-party cryptographic protocol used to
   establish communications context between hosts.  The base exchange is
   a Sigma-compliant [KRA03] four packet exchange.  The first party is
   called the Initiator and the second party the Responder.  The four-
   packet design helps to make HIP DoS resilient.  The protocol
   exchanges Diffie-Hellman keys in the 2nd and 3rd packets, and
   authenticates the parties in the 3rd and 4th packets.  Additionally,
   the Responder starts a puzzle exchange in the 2nd packet, with the
   Initiator completing it in the 3rd packet before the Responder stores
   any state from the exchange.

   The exchange can use the Diffie-Hellman output to encrypt the Host
   Identity of the Initiator in packet 3 (although Aura et al.  [AUR03]
   notes that such operation may interfere with packet-inspecting
   middleboxes), or the Host Identity may 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.

   An existing HIP association can be updated using the update mechanism
   defined in this document, and when the association is no longer
   needed, it can be closed using the defined closing mechanism.

   Finally, HIP is designed as an end-to-end authentication and key
   establishment protocol, to be used with Encapsulated Security Payload
   (ESP) [I-D.ietf-hip-esp] and other end-to-end security protocols.
   The base protocol does not cover all the fine-grained policy control
   found in Internet Key Exchange IKE RFC2409 [RFC2409] that allows IKE
   to support complex gateway policies.  Thus, HIP is not a replacement
   for IKE.



Moskowitz, et al.        Expires August 5, 2007                 [Page 6]

Internet-Draft           Host Identity Protocol            February 2007


1.3.  Memo structure

   The rest of this memo is structured as follows.  Section 2 defines
   the central keywords, notation, and terms used throughout the rest of
   the document.  Section 3 defines the structure of the Host Identity
   and its various representations.  Section 4 gives an overview of the
   HIP base exchange protocol.  Section 5 and Section 6 define the
   detail packet formats and rules for packet processing.  Finally,
   Section 7, Section 8, and Section 9 discuss policy, security, and
   IANA considerations, respectively.









































Moskowitz, et al.        Expires August 5, 2007                 [Page 7]

Internet-Draft           Host Identity Protocol            February 2007


2.  Terms 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 [RFC2119].

2.2.  Notation

   [x]   indicates that x is optional.

   {x}   indicates that x is encrypted.

   X(y)   indicates that y is a parameter of X.

   <x>i   indicates that x exists i times.

   -->   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.

2.3.  Definitions

   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.

   Maximum Segment Lifetime (MSL):   Maximum time that a TCP segment is
      expected to spend in the network.

   Exchange Complete (EC):   Time that the host spends at the R2-SENT
      before it moves to ESTABLISHED state.  The time is n * I2
      retransmission timeout, where n is about I2_RETRIES_MAX.

   HIT Hash Algorithm:   hash algorithm used to generate a Host Identity
      Tag (HIT) from the Host Identity public key.  Currently SHA-1
      [FIPS95] is used.







Moskowitz, et al.        Expires August 5, 2007                 [Page 8]

Internet-Draft           Host Identity Protocol            February 2007


   Responder's HIT Hash Algorithm (RHASH):   hash algorithm used for
      various hash calculations in this document.  The algorithm is the
      same as is used to generate the Responder's HIT.  RHASH can be
      determined by inspecting the Prefix of the ORCHID (HIT).  The
      Prefix value has a one-to-one mapping to a hash function.

   Opportunistic mode:   HIP base exchange where the Responder's HIT is
      not a priori known to the Initiator.











































Moskowitz, et al.        Expires August 5, 2007                 [Page 9]

Internet-Draft           Host Identity Protocol            February 2007


3.  Host Identifier (HI) and its Representations

   In this section, the properties of the Host Identifier and Host
   Identifier Tag are discussed, and the exact format for them is
   defined.  In HIP, 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 [I-D.ietf-hip-arch] for more details about
   the difference between an identity and the corresponding identifier.

   HIP implementations MUST support the Rivest Shamir Adelman (RSA/SHA1)
   [RFC3110] public key algorithm, and SHOULD support the Digital
   Signature Algorithm (DSA) [RFC2536] algorithm; other algorithms MAY
   be supported.

   A hashed encoding 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.

   Carrying HIs and HITs in the header of user data packets would
   increase the overhead of packets.  Thus, it is not expected that they
   are carried in every packet, but other methods are used to map the
   data packets to the corresponding HIs.  In some cases, this makes it
   possible to use HIP without any additional headers in the user data
   packets.  For example, if ESP is used to protect data traffic, the
   Security Parameter Index (SPI) carried in the ESP header can be used
   to map the encrypted data packet to the correct HIP association.

3.1.  Host Identity Tag (HIT)

   The Host Identity Tag is a 128 bits long value -- a hashed encoding
   of the Host Identifier.  There are two advantages of using a hashed
   encoding 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.

   "An IPv6 Prefix for Overlay Routable Cryptographic Hash Identifiers
   (ORCHID)" [I-D.laganier-ipv6-khi] has been specified to store 128-bit
   hash based identifier called Overlay Routable Cryptographic Hash
   Identifiers (ORCHID) under a prefix, proposed to be allocated from
   the IPv6 address block as defined in [I-D.laganier-ipv6-khi].  The



Moskowitz, et al.        Expires August 5, 2007                [Page 10]

Internet-Draft           Host Identity Protocol            February 2007


   Host Identity Tag is a type of ORCHID, based on a SHA-1 hash of the
   host identity (Section 2 of [I-D.laganier-ipv6-khi]).

3.2.  Generating a HIT from a HI

   The HIT MUST be generated according to the ORCHID generation method
   described in [I-D.laganier-ipv6-khi] using a context ID value of
   0xF0EF F02F BFF4 3D0F E793 0C3C 6E61 74EA (this tag value has been
   generated randomly by the editor of this specification), and an input
   encoding the Host Identity field (see Section 5.2.8) present in a HIP
   payload packet.  The hash algorithm SHA-1 has to be used when
   generating HITs with this context ID.  If a new ORCHID hash algorithm
   is needed in the future for HIT generation, a new version of HIP has
   to be specified with a new ORCHID context ID associated with the new
   hash algorithm.

   For Identities that are either RSA or DSA public keys, this input
   consists of the public key encoding 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/SHA1 and DSA.  Hence, either of the following
   applies:

      The RSA public key is encoded as defined in RFC3110 [RFC3110]
      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 and the
      preceding HI fields including the exponent (e).  Thus, the data to
      be hashed has the same length as the HI.  The fields MUST be
      encoded in network byte order, as defined in RFC3110 [RFC3110].

      The DSA public key is encoded as defined in RFC2536 [RFC2536]
      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
      [RFC2536].  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 [RFC2536].

   In Appendix B the public key encoding generation process is
   illustrated using pseudo-code.









Moskowitz, et al.        Expires August 5, 2007                [Page 11]

Internet-Draft           Host Identity Protocol            February 2007


4.  Protocol Overview

   The following material is an overview of the HIP protocol operation,
   and does not contain all details of the packet formats or the packet
   processing steps.  Section 5 and Section 6 describe in more detail
   the packet formats and packet processing steps, respectively, and are
   normative in case of any conflicts with this section.

   The protocol number for Host Identity Protocol will be assigned by
   IANA.  For testing purposes, the protocol number 253 is currently
   used.  This number has been reserved by IANA for experimental use
   (see [RFC3692]).

   The HIP payload (Section 5.1) header could be carried in every IP
   datagram.  However, since HIP headers are relatively large (40
   bytes), it is desirable to 'compress' the HIP header so that the HIP
   header only occurs in control packets used to establish or change HIP
   association state.  The actual method for header 'compression' and
   for matching data packets with existing HIP associations (if any) is
   defined in separate documents, describing transport formats and
   methods.  All HIP implementations MUST implement, at minimum, the ESP
   transport format for HIP [I-D.ietf-hip-esp].

4.1.  Creating a HIP Association

   By definition, the system initiating a HIP exchange is the Initiator,
   and the peer is the Responder.  This distinction is forgotten once
   the base exchange completes, and either party can become the
   Initiator in future communications.

   The HIP base exchange serves to manage the establishment of state
   between an Initiator and a Responder.  The first packet, I1,
   initiates the exchange, and the last three packets, R1, I2, and R2,
   constitute an authenticated Diffie-Hellman [DIF76] 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.  If other cryptographic 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.  Note that in some cases it may
   be possible to replace this trigger packet by some other form of a
   trigger, in which case the protocol starts with the Responder sending
   the R1 packet.

   The second packet, R1, starts the actual exchange.  It contains a



Moskowitz, et al.        Expires August 5, 2007                [Page 12]

Internet-Draft           Host Identity Protocol            February 2007


   puzzle-- a cryptographic challenge that the Initiator must solve
   before continuing the exchange.  The level of difficulty of the
   puzzle can be adjusted based on level of trust with the Initiator,
   current load, or other factors.  In addition, the R1 contains the
   initial Diffie-Hellman parameters and a signature, covering part of
   the message.  Some fields are left outside the signature to support
   pre-created R1s.

   In the I2 packet, the Initiator must display the solution to the
   received puzzle.  Without a correct solution, the I2 message is
   discarded.  The I2 also contains a Diffie-Hellman parameter that
   carries needed information for the Responder.  The packet is signed
   by the sender.

   The R2 packet finalizes the base exchange.  The packet is signed.

   The base exchange is illustrated below.  The term "key" refers to the
   host identity public key, and "sig" represents a signature using such
   a key.  The packets contain other parameters 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 puzzle
                                              check sig
                            R2: sig
                  <--------------------------
    check sig                                 compute D-H


4.1.1.  HIP Puzzle Mechanism

   The purpose of the HIP puzzle 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
   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.




Moskowitz, et al.        Expires August 5, 2007                [Page 13]

Internet-Draft           Host Identity Protocol            February 2007


   The Puzzle mechanism has been explicitly designed to give space for
   various implementation options.  It allows a Responder implementation
   to completely delay session specific state creation until a valid I2
   is received.  In such a case a correctly formatted I2 can be rejected
   only once the Responder has checked its validity by computing one
   hash function.  On the other hand, the design also allows a Responder
   implementation to keep state about received I1s, 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 puzzle 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 puzzle in
   the I2 matches with the puzzle 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 a viable approach may be to create
   a piece of local state, and remember that the puzzle check has
   previously failed.  See Appendix A for one possible implementation.
   Implementations SHOULD include sufficient randomness to the algorithm
   so that algorithmic complexity attacks become impossible [CRO03].

   The Responder can set the puzzle difficulty for Initiator, based on
   its level of trust of the Initiator.  Because the puzzle is not
   included in the signature calculation, the Responder can use pre-
   calculated R1 packets and include the puzzle just before sending the
   R1 to 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.

4.1.2.  Puzzle exchange

   The Responder starts the puzzle 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 hash
   over this concatenation using RHASH algorithm.  The lowest order K
   bits of the result MUST be zeros.  The value K sets the difficulty of
   the puzzle.




Moskowitz, et al.        Expires August 5, 2007                [Page 14]

Internet-Draft           Host Identity Protocol            February 2007


   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 parameter (Section 5.2.4).  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 A for an example on how to implement this.

   Using the Opaque data field in an ECHO_REQUEST_SIGNED
   (Section 5.2.17) or in an ECHO_REQUEST_UNSIGNED parameters
   (Section 5.2.18), 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 such a secret periodically.

   It is RECOMMENDED that the Responder generates a new puzzle and a new
   R1 once every few minutes.  Furthermore, it is RECOMMENDED that the
   Responder remembers an old puzzle at least 2*Lifetime seconds after
   it has been deprecated.  These time values allow a slower Initiator
   to solve the puzzle while limiting the usability that an old, solved
   puzzle has to an attacker.

   NOTE: The protocol developers explicitly considered whether R1 should
   include a timestamp in order to protect the Initiator from replay
   attacks.  The decision was to 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.

4.1.3.  Authenticated Diffie-Hellman Protocol

   The packets R1, I2, and R2 implement a standard authenticated Diffie-
   Hellman exchange.  The Responder sends one or two public Diffie-
   Hellman keys and its public authentication key, i.e., its host
   identity, in R1.  The signature in R1 allows the Initiator to verify



Moskowitz, et al.        Expires August 5, 2007                [Page 15]

Internet-Draft           Host Identity Protocol            February 2007


   that the R1 has been once generated by the Responder.  However, since
   it is precomputed and therefore does not cover all of the packet, it
   does not protect from replay attacks.

   When the Initiator receives an R1, it gets one or two public Diffie-
   Hellman values from the Responder.  If there are two values, it
   selects the value corresponding to the strongest supported Group ID
   and computes the Diffie-Hellman session key (Kij).  It creates a HIP
   association using keying material from the session key (see
   Section 6.5), and may use the association to encrypt its public
   authentication key, i.e., host identity.  The resulting I2 contains
   the Initiator's Diffie-Hellman key and its (optionally encrypted)
   public authentication key.  The signature in I2 covers all of the
   packet.

   The Responder extracts the Initiator Diffie-Hellman public key from
   the I2, computes the Diffie-Hellman session key, creates a
   corresponding HIP association, and decrypts the Initiator's public
   authentication key.  It can then verify the signature using the
   authentication key.

   The final message, R2, is needed to protect the Initiator from replay
   attacks.

4.1.4.  HIP Replay Protection

   The HIP protocol includes the following mechanisms to protect against
   malicious replays.  Responders are protected against replays of I1
   packets by virtue of the stateless response to I1s with presigned R1
   messages.  Initiators are protected against R1 replays by a
   monotonically increasing "R1 generation counter" included in the R1.
   Responders are protected against replays or false I2s by the puzzle
   mechanism (Section 4.1.1 above), and optional use of opaque data.
   Hosts are protected against replays to R2s and UPDATEs by use of a
   less expensive HMAC verification preceding HIP signature
   verification.

   The R1 generation counter is a monotonically increasing 64-bit
   counter that may be initialized to any value.  The scope of the
   counter MAY be system-wide but SHOULD be per host identity, if there
   is more than one local host identity.  The value of this counter
   SHOULD be kept across system reboots and invocations of the HIP base
   exchange.  This counter indicates the current generation of puzzles.
   Implementations MUST accept puzzles from the current generation and
   MAY accept puzzles from earlier generations.  A system's local
   counter MUST be incremented at least as often as every time old R1s
   cease to be valid, and SHOULD never be decremented, lest the host
   expose its peers to the replay of previously generated, higher



Moskowitz, et al.        Expires August 5, 2007                [Page 16]

Internet-Draft           Host Identity Protocol            February 2007


   numbered R1s.  The R1 counter SHOULD NOT roll over.

   A host may receive more than one R1, either due to sending multiple
   I1s (Section 6.6.1) or due to a replay of an old R1.  When sending
   multiple I1s, an initiator SHOULD wait for a small amount of time (a
   reasonable time may be 2 * expected RTT) after the first R1 reception
   to allow possibly multiple R1s to arrive, and it SHOULD respond to an
   R1 among the set with the largest R1 generation counter.  If an
   Initiator is processing an R1 or has already sent an I2 (still
   waiting for R2) and it receives another R1 with a larger R1
   generation counter, it MAY elect to restart R1 processing with the
   fresher R1, as if it were the first R1 to arrive.

   Upon conclusion of an active HIP association with another host, the
   R1 generation counter associated with the peer host SHOULD be
   flushed.  A local policy MAY override the default flushing of R1
   counters on a per-HIT basis.  The reason for recommending the
   flushing of this counter is that there may be hosts where the R1
   generation counter (occasionally) decreases; e.g., due to hardware
   failure.

4.1.5.  Refusing a HIP Exchange

   A HIP aware host may choose not to accept a HIP exchange.  If the
   host's policy is to only be an Initiator, it should begin its own HIP
   exchange.  A host MAY choose to have such a policy since only the
   Initiator HI is protected in the exchange.  There is a risk of a race
   condition if each host's policy is to only be an Initiator, at which
   point the HIP exchange will fail.

   If the host's policy does not permit it to enter into a HIP exchange
   with the Initiator, it should send an ICMP 'Destination Unreachable,
   Administratively Prohibited' message.  A more complex HIP packet is
   not used here as it actually opens up more potential DoS attacks than
   a simple ICMP message.

4.1.6.  HIP Opportunistic Mode

   It is possible to initiate a HIP negotiation even if the responder's
   HI (and HIT) is unknown.  In this case the connection initializing I1
   packet contains NULL (all zeros) as the destination HIT.  This kind
   of connection setup is called opportunistic mode.

   There are multiple security issues involved with opportunistic mode
   that must be carefully addressed in the implementation.  Such a set
   up is vulnerable to, e.g., man-in-the-middle attacks, because the
   initializing node does not have any public key information about the
   peer.



Moskowitz, et al.        Expires August 5, 2007                [Page 17]

Internet-Draft           Host Identity Protocol            February 2007


   While this document defines the concept of the opportunistic mode,
   and outlines the basic signalling mechanism to trigger it; i.e., send
   an I1 with a NULL destination HIT, this document does not specify the
   details of the opportunistic mode.  Especially, its security
   properties are not discussed beyond the warning above.  It is
   expected that a separate document will describe the opportunistic
   mode in more detail, including its security properties.

4.2.  Updating a HIP Association

   A HIP association between two hosts may need to be updated over time.
   Examples include the need to rekey expiring user data security
   associations, add new security associations, or change IP addresses
   associated with hosts.  The UPDATE packet is used for those and other
   similar purposes.  This document only specifies the UPDATE packet
   format and basic processing rules, with mandatory parameters.  The
   actual usage is defined in separate specifications.

   HIP provides a general purpose UPDATE packet, which can carry
   multiple HIP parameters, for updating the HIP state between two
   peers.  The UPDATE mechanism has the following properties:

      UPDATE messages carry a monotonically increasing sequence number
      and are explicitly acknowledged by the peer.  Lost UPDATEs or
      acknowledgments may be recovered via retransmission.  Multiple
      UPDATE messages may be outstanding under certain circumstances.

      UPDATE is protected by both HMAC and HIP_SIGNATURE parameters,
      since processing UPDATE signatures alone is a potential DoS attack
      against intermediate systems.

      UPDATE packets are explicitly acknowledged by the use of an
      acknowledgment parameter that echoes an individual sequence number
      received from the peer.  A single UPDATE packet may contain both a
      sequence number and one or more acknowledgment numbers (i.e.,
      piggybacked acknowledgment(s) for the peer's UPDATE).

   The UPDATE packet is defined in Section 5.3.5.

4.3.  Error Processing

   HIP error processing behavior depends on whether there exists an
   active HIP association or not.  In general, if a HIP association
   exists between the sender and receiver of a packet causing an error
   condition, the receiver SHOULD respond with a NOTIFY packet.  On the
   other hand, if there are no existing HIP associations between the
   sender and receiver, or the receiver cannot reasonably determine the
   identity of the sender, the receiver MAY respond with a suitable ICMP



Moskowitz, et al.        Expires August 5, 2007                [Page 18]

Internet-Draft           Host Identity Protocol            February 2007


   message; see Section 5.4 for more details.

   The HIP protocol and state machine is designed to recover from one of
   the parties crashing and losing its state.  The following scenarios
   describe the main use cases covered by the design.

      No prior state between the two systems.

         The system with data to send is the Initiator.  The process
         follows the standard four packet base exchange, establishing
         the HIP association.

      The system with data to send has no state with the receiver, but
      the receiver has a residual HIP association.

         The system with data to send is the Initiator.  The Initiator
         acts as in no prior state, sending I1 and getting R1.  When the
         Responder receives a valid I2, the old association is
         'discovered' and deleted, and the new association is
         established.

      The system with data to send has a 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 a user data packet that it cannot match to any HIP
         association.  The receiving host MUST discard this packet.
         Optionally, the receiving host MAY send an ICMP packet with the
         Parameter Problem type to inform about non-existing HIP
         association (see Section 5.4), and it MAY initiate a new HIP
         negotiation.  However, responding with these optional
         mechanisms is implementation or policy dependent.

4.4.  HIP State Machine

   The HIP protocol itself has little state.  In the HIP base exchange,
   there is an Initiator and a Responder.  Once the SAs are established,
   this distinction is lost.  If the HIP state needs to be re-
   established, the controlling parameters are which peer still has
   state and which has a datagram to send to its peer.  The following
   state machine attempts to capture these processes.

   The state machine is presented in a single system view, representing
   either an Initiator or a Responder.  There is not a complete overlap
   of processing logic here and in the packet definitions.  Both are
   needed to completely implement HIP.




Moskowitz, et al.        Expires August 5, 2007                [Page 19]

Internet-Draft           Host Identity Protocol            February 2007


   Implementors must understand that the state machine, as described
   here, is informational.  Specific implementations are free to
   implement the actual functions differently.  Section 6 describes the
   packet processing rules in more detail.  This state machine focuses
   on the HIP I1, R1, I2, and R2 packets only.  Other states may be
   introduced by mechanisms in other specifications (such as mobility
   and multihoming).

4.4.1.  HIP States

   +---------------------+---------------------------------------------+
   | State               | Explanation                                 |
   +---------------------+---------------------------------------------+
   | UNASSOCIATED        | State machine start                         |
   |                     |                                             |
   | I1-SENT             | Initiating base exchange                    |
   |                     |                                             |
   | I2-SENT             | Waiting to complete base exchange           |
   |                     |                                             |
   | R2-SENT             | Waiting to complete base exchange           |
   |                     |                                             |
   | ESTABLISHED         | HIP association established                 |
   |                     |                                             |
   | CLOSING             | HIP association closing, no data can be     |
   |                     | sent                                        |
   |                     |                                             |
   | CLOSED              | HIP association closed, no data can be sent |
   |                     |                                             |
   | E-FAILED            | HIP exchange failed                         |
   +---------------------+---------------------------------------------+





















Moskowitz, et al.        Expires August 5, 2007                [Page 20]

Internet-Draft           Host Identity Protocol            February 2007


4.4.2.  HIP State Processes

   System behaviour in state UNASSOCIATED, Table 2.

   +---------------------+---------------------------------------------+
   | Trigger             | Action                                      |
   +---------------------+---------------------------------------------+
   | User data to send,  | Send I1 and go to I1-SENT                   |
   | requiring a new HIP |                                             |
   | association         |                                             |
   |                     |                                             |
   | Receive I1          | Send R1 and stay at UNASSOCIATED            |
   |                     |                                             |
   | Receive I2, process | If successful, send R2 and go to R2-SENT    |
   |                     |                                             |
   |                     | If fail, stay at UNASSOCIATED               |
   |                     |                                             |
   | Receive user data   | Optionally send ICMP as defined in          |
   | for unknown HIP     | Section 5.4 and stay at UNASSOCIATED        |
   | association         |                                             |
   |                     |                                             |
   | Receive CLOSE       | Optionally send ICMP Parameter Problem and  |
   |                     | stay at UNASSOCIATED                        |
   |                     |                                             |
   | Receive ANYOTHER    | Drop and stay at UNASSOCIATED               |
   +---------------------+---------------------------------------------+

                    Table 2: UNASSOCIATED - Start state























Moskowitz, et al.        Expires August 5, 2007                [Page 21]

Internet-Draft           Host Identity Protocol            February 2007


   System behaviour in state I1-SENT, Table 3.

   +---------------------+---------------------------------------------+
   | Trigger             | Action                                      |
   +---------------------+---------------------------------------------+
   | Receive I1          | If the local HIT is smaller than the peer   |
   |                     | HIT, drop I1 and stay at I1-SENT            |
   |                     |                                             |
   |                     | If the local HIT is greater than the peer   |
   |                     | HIT, send R1 and stay at I1_SENT            |
   |                     |                                             |
   | Receive I2, process | If successful, send R2 and go to R2-SENT    |
   |                     |                                             |
   |                     | If fail, stay at I1-SENT                    |
   |                     |                                             |
   | Receive R1, process | If successful, send I2 and go to I2-SENT    |
   |                     |                                             |
   |                     | If fail, stay at I1-SENT                    |
   |                     |                                             |
   | Receive ANYOTHER    | Drop and stay at I1-SENT                    |
   |                     |                                             |
   | Timeout, increment  | If counter is less than I1_RETRIES_MAX,     |
   | timeout counter     | send I1 and stay at I1-SENT                 |
   |                     |                                             |
   |                     | If counter is greater than I1_RETRIES_MAX,  |
   |                     | go to E-FAILED                              |
   +---------------------+---------------------------------------------+

                     Table 3: I1-SENT - Initiating HIP






















Moskowitz, et al.        Expires August 5, 2007                [Page 22]

Internet-Draft           Host Identity Protocol            February 2007


   System behaviour in state I2-SENT, Table 4.

   +---------------------+---------------------------------------------+
   | Trigger             | Action                                      |
   +---------------------+---------------------------------------------+
   | 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 and local HIT is smaller than |
   |                     | the peer HIT, drop I2 and stay at I2-SENT   |
   |                     |                                             |
   |                     | If succesful and local HIT is greater than  |
   |                     | the peer HIT, send R2 and go to R2-SENT     |
   |                     |                                             |
   |                     | If fail, stay at I2-SENT                    |
   |                     |                                             |
   | Receive R2, process | If successful, go to ESTABLISHED            |
   |                     |                                             |
   |                     | If fail, stay at I2-SENT                    |
   |                     |                                             |
   | Receive ANYOTHER    | Drop and stay at I2-SENT                    |
   |                     |                                             |
   | Timeout, increment  | If counter is less than I2_RETRIES_MAX,     |
   | timeout counter     | send I2 and stay at I2-SENT                 |
   |                     |                                             |
   |                     | If counter is greater than I2_RETRIES_MAX,  |
   |                     | go to E-FAILED                              |
   +---------------------+---------------------------------------------+

                 Table 4: I2-SENT - Waiting to finish HIP


















Moskowitz, et al.        Expires August 5, 2007                [Page 23]

Internet-Draft           Host Identity Protocol            February 2007


   System behaviour in state R2-SENT, Table 5.

   +---------------------+---------------------------------------------+
   | Trigger             | Action                                      |
   +---------------------+---------------------------------------------+
   | Receive I1          | Send R1 and stay at R2-SENT                 |
   |                     |                                             |
   | Receive I2, process | If successful, send R2 and cycle at R2-SENT |
   |                     |                                             |
   |                     | If fail, stay at R2-SENT                    |
   |                     |                                             |
   | Receive R1          | Drop and stay at R2-SENT                    |
   |                     |                                             |
   | Receive R2          | Drop and stay at R2-SENT                    |
   |                     |                                             |
   | Receive data or     | Move to ESTABLISHED                         |
   | UPDATE              |                                             |
   |                     |                                             |
   | Exchange Complete   | Move to ESTABLISHED                         |
   | Timeout             |                                             |
   +---------------------+---------------------------------------------+

                 Table 5: R2-SENT - Waiting to finish HIP




























Moskowitz, et al.        Expires August 5, 2007                [Page 24]

Internet-Draft           Host Identity Protocol            February 2007


   System behaviour in state ESTABLISHED, Table 6.

   +---------------------+---------------------------------------------+
   | Trigger             | Action                                      |
   +---------------------+---------------------------------------------+
   | Receive I1          | Send R1 and stay at ESTABLISHED             |
   |                     |                                             |
   | Receive I2, process | If successful, send R2, drop old HIP        |
   | with puzzle and     | association, establish a new HIP            |
   | possible Opaque     | association, go to R2-SENT                  |
   | data verification   |                                             |
   |                     |                                             |
   |                     | If fail, stay at ESTABLISHED                |
   |                     |                                             |
   | Receive R1          | Drop and stay at ESTABLISHED                |
   |                     |                                             |
   | Receive R2          | Drop and stay at ESTABLISHED                |
   |                     |                                             |
   | Receive user data   | Process and stay at ESTABLISHED             |
   | for HIP association |                                             |
   |                     |                                             |
   | No packet           | Send CLOSE and go to CLOSING                |
   | sent/received       |                                             |
   | during UAL minutes  |                                             |
   |                     |                                             |
   | Receive CLOSE,      | If successful, send CLOSE_ACK and go to     |
   | process             | CLOSED                                      |
   |                     |                                             |
   |                     | If fail, stay at ESTABLISHED                |
   +---------------------+---------------------------------------------+

            Table 6: ESTABLISHED - HIP association established



















Moskowitz, et al.        Expires August 5, 2007                [Page 25]

Internet-Draft           Host Identity Protocol            February 2007


   System behaviour in state CLOSING, Table 7.

   +---------------------+---------------------------------------------+
   | Trigger             | Action                                      |
   +---------------------+---------------------------------------------+
   | User data to send,  | Send I1 and stay at CLOSING                 |
   | requires the        |                                             |
   | creation of another |                                             |
   | incarnation of the  |                                             |
   | HIP association     |                                             |
   |                     |                                             |
   | Receive I1          | Send R1 and stay at CLOSING                 |
   |                     |                                             |
   | Receive I2, process | If successful, send R2 and go to R2-SENT    |
   |                     |                                             |
   |                     | If fail, stay at CLOSING                    |
   |                     |                                             |
   | Receive R1, process | If successful, send I2 and go to I2-SENT    |
   |                     |                                             |
   |                     | If fail, stay at CLOSING                    |
   |                     |                                             |
   | Receive CLOSE,      | If successful, send CLOSE_ACK, discard      |
   | process             | state and go to CLOSED                      |
   |                     |                                             |
   |                     | If fail, stay at CLOSING                    |
   |                     |                                             |
   | Receive CLOSE_ACK,  | If successful, discard state and go to      |
   | process             | UNASSOCIATED                                |
   |                     |                                             |
   |                     | If fail, stay at CLOSING                    |
   |                     |                                             |
   | Receive ANYOTHER    | Drop and stay at CLOSING                    |
   |                     |                                             |
   | Timeout, increment  | If timeout sum is less than UAL+MSL         |
   | timeout sum, reset  | minutes, retransmit CLOSE and stay at       |
   | timer               | CLOSING                                     |
   |                     |                                             |
   |                     | If timeout sum is greater than UAL+MSL      |
   |                     | minutes, go to UNASSOCIATED                 |
   +---------------------+---------------------------------------------+

   Table 7: CLOSING - HIP association  has not been used for UAL minutes









Moskowitz, et al.        Expires August 5, 2007                [Page 26]

Internet-Draft           Host Identity Protocol            February 2007


   System behaviour in state CLOSED, Table 8.

   +---------------------+---------------------------------------------+
   | Trigger             | Action                                      |
   +---------------------+---------------------------------------------+
   | Datagram to send,   | Send I1, and stay at CLOSED                 |
   | requires the        |                                             |
   | creation of another |                                             |
   | incarnation of the  |                                             |
   | HIP association     |                                             |
   |                     |                                             |
   | Receive I1          | Send R1 and stay at CLOSED                  |
   |                     |                                             |
   | Receive I2, process | If successful, send R2 and go to R2-SENT    |
   |                     |                                             |
   |                     | If fail, stay at CLOSED                     |
   |                     |                                             |
   | Receive R1, process | If successful, send I2 and go to I2-SENT    |
   |                     |                                             |
   |                     | If fail, stay at CLOSED                     |
   |                     |                                             |
   | Receive CLOSE,      | If successful, send CLOSE_ACK, stay at      |
   | process             | CLOSED                                      |
   |                     |                                             |
   |                     | If fail, stay at CLOSED                     |
   |                     |                                             |
   | Receive CLOSE_ACK,  | If successful, discard state and go to      |
   | process             | UNASSOCIATED                                |
   |                     |                                             |
   |                     | If fail, stay at CLOSED                     |
   |                     |                                             |
   | Receive ANYOTHER    | Drop and stay at CLOSED                     |
   |                     |                                             |
   | Timeout (UAL+2MSL)  | Discard state and go to UNASSOCIATED        |
   +---------------------+---------------------------------------------+

    Table 8: CLOSED - CLOSE_ACK sent,  resending CLOSE_ACK if necessary














Moskowitz, et al.        Expires August 5, 2007                [Page 27]

Internet-Draft           Host Identity Protocol            February 2007


   System behaviour in state E-FAILED, Table 9.

   +---------------------+---------------------------------------------+
   | Trigger             | Action                                      |
   +---------------------+---------------------------------------------+
   | Wait for            | Go to UNASSOCIATED. Re-negotiation is       |
   | implementation      | possible after moving to UNASSOCIATED       |
   | specific time       | state.                                      |
   +---------------------+---------------------------------------------+

    Table 9: E-FAILED - HIP failed  to establish association with peer

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.


































Moskowitz, et al.        Expires August 5, 2007                [Page 28]

Internet-Draft           Host Identity Protocol            February 2007


                                +-+        +---------------------------+
           I1 received, send R1 | |        |                           |
                                | v        v                           |
            Datagram to send  +--------------+  I2 received, send R2   |
              +---------------| UNASSOCIATED |---------------+         |
      Send I1 |               +--------------+               |         |
              v                                              |         |
         +---------+  I2 received, send R2                   |         |
   +---->| I1-SENT |---------------------------------------+ |         |
   |     +---------+                                       | |         |
   |          |                 +------------------------+ | |         |
   |          | R1 received,    | I2 received, send R2   | | |         |
   |          v send I2         |                        v v v         |
   |     +---------+            |                   +---------+        |
   |  +->| I2-SENT |------------+                   | R2-SENT |<----+  |
   |  |  +---------+                                +---------+     |  |
   |  |          |                                     |            |  |
   |  |          |                                 data|            |  |
   |  |receive   |                                   or|            |  |
   |  |R1, send  |                           EC timeout| receive I2,|  |
   |  |I2        |R2 received +--------------+         |     send R2|  |
   |  |          +----------->| ESTABLISHED  |<-------+|            |  |
   |  |                       +--------------+                      |  |
   |  |                         |    |     |  receive I2, send R2   |  |
   |  |        recv+------------+    |     +------------------------+  |
   |  |      CLOSE,|                 |                              |  |
   |  |        send|   No packet sent|                              |  |
   |  |   CLOSE_ACK|   /received for |                   timeout    |  |
   |  |            |   UAL min, send |    +---------+<-+ (UAL+MSL)  |  |
   |  |            |           CLOSE +--->| CLOSING |--+ retransmit |  |
   |  |            |                      +---------+    CLOSE      |  |
   +--|------------|----------------------+ | |  | |                |  |
   |  +------------|------------------------+ |  | +----------------+  |
   |  |            |              +-----------+  +------------------|--+
   |  |            +------------+ | receive CLOSE,   CLOSE_ACK      |  |
   |  |                         | | send CLOSE_ACK   received or    |  |
   |  |                         | |                  timeout        |  |
   |  |                         | |                  (UAL+MSL)      |  |
   |  |                         v v                                 |  |
   |  |                        +--------+  receive I2, send R2      |  |
   |  +------------------------| CLOSED |---------------------------+  |
   +---------------------------+--------+       /----------------------+
   Datagram to send, send I1     ^ |   \-------/  timeout (UAL+2MSL),
                                 +-+              move to UNASSOCIATED
                  CLOSE received, send CLOSE_ACK






Moskowitz, et al.        Expires August 5, 2007                [Page 29]

Internet-Draft           Host Identity Protocol            February 2007


4.5.  User Data Considerations

4.5.1.  TCP and UDP Pseudo-header Computation for User Data

   When computing TCP and UDP checksums on user data packets that flow
   through sockets bound to HITs, the IPv6 pseudo-header format
   [RFC2460] MUST be used, even if the actual 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 HIP payloads is computed differently; see
   Section 5.1.1.

4.5.2.  Sending Data on HIP Packets

   A future version of this document may define how to include user data
   on various HIP packets.  However, currently the HIP header is a
   terminal header, and not followed by any other headers.

4.5.3.  Transport Formats

   The actual data transmission format, used for user data after the HIP
   base exchange, is not defined in this document.  Such transport
   formats and methods are described in separate specifications.  All
   HIP implementations MUST implement, at minimum, the ESP transport
   format for HIP [I-D.ietf-hip-esp].

   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 and SA Timeout Restart of HIP

   Simulating a loss of state is a potential DoS attack.  The following
   process has been crafted to manage state recovery without presenting
   a DoS opportunity.

   If a host reboots or the HIP association times out, it has lost its
   HIP state.  If the host that lost state has a datagram to send to the
   peer, it simply restarts the HIP base exchange.  After the base
   exchange has completed, the Initiator can create a new SA and start
   sending data.  The peer does not reset its state until it receives a
   valid I2 HIP packet.

   If a system receives a user data packet that cannot be matched to any
   existing HIP association, it is possible that it has lost the state
   and its peer has not.  It MAY send an ICMP packet with the Parameter



Moskowitz, et al.        Expires August 5, 2007                [Page 30]

Internet-Draft           Host Identity Protocol            February 2007


   Problem type, the Pointer pointing to the referred HIP-related
   association information.  Reacting to such traffic depends on the
   implementation and the environment where the implementation is used.

   If the host, that apparently has lost its state, decides to restart
   the HIP base exchange, it sends an I1 packet to the peer.  After the
   base exchange has been completed successfully, the Initiator can
   create a new HIP association and the peer drops its OLD SA and
   creates a new one.

4.6.  Certificate Distribution

   HIP base specification does not define how to use certificates or how
   to transfer them between hosts.  These functions are defined in a
   separate specification.  A parameter type value, meant to be used for
   carrying certificates, is reserved, though: CERT, Type 768; see
   Section 5.2.


































Moskowitz, et al.        Expires August 5, 2007                [Page 31]

Internet-Draft           Host Identity Protocol            February 2007


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 |0| Packet Type |  VER. | RES.|1|
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |          Checksum             |           Controls            |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                Sender's Host Identity Tag (HIT)               |
   |                                                               |
   |                                                               |
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |               Receiver's Host Identity Tag (HIT)              |
   |                                                               |
   |                                                               |
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   /                        HIP Parameters                         /
   /                                                               /
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


   The HIP header is logically an IPv6 extension header.  However, this
   document does not describe processing for Next Header values other
   than decimal 59, IPPROTO_NONE, the IPv6 no next header value.  Future
   documents MAY do so.  However, current 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 parameters included in the
   Parameters field, independent of the individual parameter maximum
   lengths.

   The Packet Type indicates the HIP packet type.  The individual packet
   types are defined in the relevant sections.  If a HIP host receives a



Moskowitz, et al.        Expires August 5, 2007                [Page 32]

Internet-Draft           Host Identity Protocol            February 2007


   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 three bits are reserved for future use.  They MUST be
   zero when sent, and they SHOULD be ignored when handling a received
   packet.

   The two fixed bits in the header are reserved for potential SHIM6
   compatibility [I-D.ietf-shim6-proto].  For implementations adhering
   (only) to this specification, they MUST be set as shown when sending
   and MUST be ignored when receiving.  This is to ensure optimal
   forward compatibility.  Note that implementations that implement
   other compatible specifications in addition to this specification,
   the corresponding rules may well be different.  For example, in the
   case that the forthcoming SHIM6 protocol happens to be compatible
   with this specification, an implementation that implements both this
   specification and the SHIM6 protocol may need to check these bits in
   order to determine how to handle the packet.

   The HIT fields are always 128 bits (16 bytes) long.

5.1.1.  Checksum

   Since the checksum covers the source and destination addresses in the
   IP header, it must be recomputed on HIP-aware NAT devies.

   If IPv6 is used to carry the HIP packet, the pseudo-header [RFC2460]
   contains the source and destination IPv6 addresses, HIP packet length
   in the pseudo-header length field, a zero field, and the HIP protocol
   number (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 [RFC0768] 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 (see Section 4), and the length
   is calculated as in the IPv6 case.

5.1.2.  HIP Controls

   The HIP Controls section conveys information about the structure of
   the packet and capabilities of the host.



Moskowitz, et al.        Expires August 5, 2007                [Page 33]

Internet-Draft           Host Identity Protocol            February 2007


   The following fields have been defined:

      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      | | | | | | | | | | | | | | | |A|
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   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.

   The rest of the fields are reserved for future use and MUST be set to
   zero on sent packets and ignored on received packets.

5.1.3.  HIP Fragmentation Support

   A HIP implementation must support IP fragmentation / reassembly.
   Fragment reassembly MUST be implemented in both IPv4 and IPv6, but
   fragment generation is REQUIRED to be implemented in IPv4 (IPv4
   stacks and networks will usually do this by default) and RECOMMENDED
   to 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 HIP packets, and therefore 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 even for IPv6.

   In IPv4 networks, HIP packets may encounter low MTUs along their
   routed path.  Since HIP does not provide a mechanism to use 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 have to be careful while employing a
   reassembly algorithm so that the algorithm is sufficiently resistant
   to DoS attacks.

   Because certificate chains can cause the packet to be fragmented and
   fragmentation can open implementation to denial of service attacks
   [KAU03], it is strongly recommended that the separate document
   specifying the certificate usage in HIP Base Exchange defines the
   usage of "Hash and URL" formats rather than including certificates in
   exchanges.  With this, most problems related to DoS attacks with
   fragmentation can be avoided.







Moskowitz, et al.        Expires August 5, 2007                [Page 34]

Internet-Draft           Host Identity Protocol            February 2007


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.











































Moskowitz, et al.        Expires August 5, 2007                [Page 35]

Internet-Draft           Host Identity Protocol            February 2007


   +------------------------+-------+----------+-----------------------+
   | TLV                    | Type  | Length   | Data                  |
   +------------------------+-------+----------+-----------------------+
   | R1_COUNTER             | 128   | 12       | System Boot Counter   |
   |                        |       |          |                       |
   | PUZZLE                 | 257   | 12       | K and Random #I       |
   |                        |       |          |                       |
   | SOLUTION               | 321   | 20       | K, Random #I and      |
   |                        |       |          | puzzle solution J     |
   |                        |       |          |                       |
   | SEQ                    | 385   | 4        | Update packet ID      |
   |                        |       |          | number                |
   |                        |       |          |                       |
   | ACK                    | 449   | variable | Update packet ID      |
   |                        |       |          | number                |
   |                        |       |          |                       |
   | DIFFIE_HELLMAN         | 513   | variable | public key            |
   |                        |       |          |                       |
   | HIP_TRANSFORM          | 577   | variable | HIP Encryption and    |
   |                        |       |          | Integrity Transform   |
   |                        |       |          |                       |
   | ENCRYPTED              | 641   | variable | Encrypted part of I2  |
   |                        |       |          | packet                |
   |                        |       |          |                       |
   | HOST_ID                | 705   | variable | Host Identity with    |
   |                        |       |          | Fully Qualified       |
   |                        |       |          | Domain Name or NAI    |
   |                        |       |          |                       |
   | CERT                   | 768   | variable | HI Certificate; used  |
   |                        |       |          | to transfer           |
   |                        |       |          | certificates. Usage   |
   |                        |       |          | defined in a separate |
   |                        |       |          | document.             |
   |                        |       |          |                       |
   | NOTIFICATION           | 832   | variable | Informational data    |
   |                        |       |          |                       |
   | ECHO_REQUEST_SIGNED    | 897   | variable | Opaque data to be     |
   |                        |       |          | echoed back; under    |
   |                        |       |          | signature             |
   |                        |       |          |                       |
   | ECHO_RESPONSE_SIGNED   | 961   | variable | Opaque data echoed    |
   |                        |       |          | back; under signature |
   |                        |       |          |                       |
   | HMAC                   | 61505 | variable | HMAC based message    |
   |                        |       |          | authentication code,  |
   |                        |       |          | with key material     |
   |                        |       |          | from HIP_TRANSFORM    |
   |                        |       |          |                       |



Moskowitz, et al.        Expires August 5, 2007                [Page 36]

Internet-Draft           Host Identity Protocol            February 2007


   | HMAC_2                 | 61569 | variable | HMAC based message    |
   |                        |       |          | authentication code,  |
   |                        |       |          | with key material     |
   |                        |       |          | from HIP_TRANSFORM.   |
   |                        |       |          | Compared to HMAC, the |
   |                        |       |          | HOST_ID parameter is  |
   |                        |       |          | included in HMAC_2    |
   |                        |       |          | calculation.          |
   |                        |       |          |                       |
   | HIP_SIGNATURE_2        | 61633 | variable | Signature of the R1   |
   |                        |       |          | packet                |
   |                        |       |          |                       |
   | HIP_SIGNATURE          | 61697 | variable | Signature of the      |
   |                        |       |          | packet                |
   |                        |       |          |                       |
   | ECHO_REQUEST_UNSIGNED  | 63661 | variable | Opaque data to be     |
   |                        |       |          | echoed back; after    |
   |                        |       |          | signature             |
   |                        |       |          |                       |
   | ECHO_RESPONSE_UNSIGNED | 63425 | variable | Opaque data echoed    |
   |                        |       |          | back; after signature |
   +------------------------+-------+----------+-----------------------+

   Because the ordering (from lowest to highest) of HIP parameters is
   strictly enforced (see Section 5.2.1), 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 between 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.  TLV Format

   The TLV-encoded parameters are described in the following
   subsections.  The type-field value also describes the order of these
   fields in the packet, except for type values from 2048 to 4095 which
   are reserved for new transport forms.  The parameters MUST be
   included in the packet such that their types form an increasing
   order.  If the parameter can exist multiple times in the packet, the
   type value may be the same in consecutive parameters.  If the order
   does not follow this rule, the packet is considered to be malformed



Moskowitz, et al.        Expires August 5, 2007                [Page 37]

Internet-Draft           Host Identity Protocol            February 2007


   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 [I-D.ietf-hip-esp].  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.  The 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.
   Any added padding bytes MUST be zeroed by the sender, and their
   values SHOULD NOT be checked by the 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 the parameter. 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



Moskowitz, et al.        Expires August 5, 2007                [Page 38]

Internet-Draft           Host Identity Protocol            February 2007


   NOTIFY, as defined in Section 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.

5.2.2.  Defining New Parameters

   Future specifications may define new parameters as needed.  When
   defining new parameters, care must be taken to ensure that the
   parameter type values are appropriate and leave suitable space for
   other future extensions.  One must remember that the parameters MUST
   always be arranged in the increasing order by type code, thereby
   limiting the order of parameters (see Section 5.2.1).

   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.  Implementations operating in a
       mode adhering to this specification MUST disable the sending of
       new critical parameters.  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.  See section Section 9 for allocation rules regarding type codes.














Moskowitz, et al.        Expires August 5, 2007                [Page 39]

Internet-Draft           Host Identity Protocol            February 2007


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                                |
      |                                                               |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

      Type           128
      Length         12
      R1 generation
      counter        The current generation of valid puzzles


   The R1_COUNTER parameter contains an 64-bit unsigned integer in
   network byte order, indicating the current generation of valid
   puzzles.  The sender is supposed to increment this counter
   periodically.  It is RECOMMENDED that the counter value is
   incremented at least as often as old PUZZLE values are deprecated so
   that SOLUTIONs to them are no longer accepted.

   The R1_COUNTER parameter is optional.  It SHOULD be included in the
   R1 (in which case it is covered by the signature), and if present in
   the R1, it MAY be echoed (including the Reserved field verbatim) by
   the Initiator in the I2.





















Moskowitz, et al.        Expires August 5, 2007                [Page 40]

Internet-Draft           Host Identity Protocol            February 2007


5.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                                           |
      |                                                               |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

      Type           257
      Length         12
      K              K is the number of verified bits
      Lifetime       Puzzle lifetime 2^(value-32) seconds
      Opaque         Data set by the Responder, indexing the puzzle
      Random #I      random number


   Random #I is represented as 64-bit integer, K and Lifetime as 8-bit
   integer, all in network byte order.

   The PUZZLE parameter contains the puzzle difficulty K and a 64-bit
   puzzle random integer #I. The Puzzle Lifetime indicates the time
   during which the puzzle solution is valid, and sets a time limit
   which should not be exceeded by the Initiator while it 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 augmented with
   an ECHO_REQUEST_SIGNED or an ECHO_REQUEST_UNSIGNED parameter included
   in the R1; the contents of the echo request are then echoed back in
   the ECHO_RESPONSE_SIGNED or in the ECHO_RESPONSE_UNSIGNED, 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.













Moskowitz, et al.        Expires August 5, 2007                [Page 41]

Internet-Draft           Host Identity Protocol            February 2007


5.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                                   |
      |                                                               |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

      Type           321
      Length         20
      K              K is the number of verified bits
      Reserved       zero when sent, ignored when received
      Opaque         copied unmodified from the received PUZZLE
                     parameter
      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.



















Moskowitz, et al.        Expires August 5, 2007                [Page 42]

Internet-Draft           Host Identity Protocol            February 2007


5.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 Length      | Public Value  /
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      /                                                               |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |   Group ID    |      Public Value Length      | Public Value  /
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      /                               |            padding            |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

      Type           513
      Length         length in octets, excluding Type, Length, and
                     padding
      Group ID       defines values for p and g
      Public Value   length of the following Public Value in octets
      Length
      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 [RFC3526].  The OAKLEY
   well known group 1 is defined in Appendix E.

   The sender can include at most two different Diffie-Hellman public
   values in the DIFFIE_HELLMAN parameter.  This gives the possibility
   e.g. for a server to provide a weaker encryption possibility for a
   PDA host that is not powerful enough.  It is RECOMMENDED that the
   Initiator, receiving more than one public values selects the stronger
   one, if it supports it.

   A HIP implementation MUST implement 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).  It



Moskowitz, et al.        Expires August 5, 2007                [Page 43]

Internet-Draft           Host Identity Protocol            February 2007


   is REQUIRED that the default configuration allows Group ID 1 usage,
   but it is RECOMMENDED that applications that need stronger security
   turn Group ID 1 support off.  Equipment powerful enough SHOULD
   implement also group ID 5.  The 384-bit group is defined in
   Appendix D.

   To avoid unnecessary failures during the base exchange, the rest of
   the groups SHOULD be implemented in hosts where resources are
   adequate.

5.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            |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |            Suite-ID #1        |          Suite-ID #2          |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |            Suite-ID #n        |             Padding           |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

      Type           577
      Length         length in octets, excluding Type, Length, and
                     padding
      Suite-ID       Defines the HIP Suite to be used

   The following Suite-IDs are defined ([RFC4307],[RFC2451]):

         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

   The sender of a HIP transform parameter MUST make sure that there are
   no more than six (6) HIP Suite-IDs in one HIP transform parameter.
   Conversely, a recipient MUST be prepared to handle received transport
   parameters that contain more than six Suite-IDs by accepting the
   first six Suite-IDs and dropping the rest.  The limited number of
   transforms sets the maximum size of HIP_TRANSFORM parameter.  As the
   default configuration, the HIP_TRANSFORM parameter MUST contain at
   least one of the mandatory Suite-IDs.  There MAY be a configuration
   option that allows the administrator to override this default.



Moskowitz, et al.        Expires August 5, 2007                [Page 44]

Internet-Draft           Host Identity Protocol            February 2007


   The Responder lists supported and desired Suite-IDs in order of
   preference in the R1, up to the maximum of six Suite-IDs.  The
   Initiator MUST choose only one of the corresponding Suite-IDs.  That
   Suite-ID will be used for generating the I2.

   Mandatory implementations: AES-CBC with HMAC-SHA1 and NULL-ENCRYPTION
   with HMAC-SHA1.

5.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            |