<?xml version="1.0" encoding="US-ASCII"?>
<!-- This template is for creating an Internet Draft using xml2rfc,
     which is available here: http://xml.resource.org. -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [

<!ENTITY RFC0768  PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.0768.xml'>

<!ENTITY RFC2119  PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml'>

<!ENTITY RFC2460  PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2460.xml'>

<!ENTITY RFC4960  PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.4960.xml'>

<!ENTITY DRAFT-hip-base PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml3/reference.I-D.ietf-hip-base.xml'>

<!ENTITY DRAFT-hip-nat-traversal PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml3/reference.I-D.ietf-hip-nat-traversal.xml'>

<!ENTITY DRAFT-hip-rvs PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml3/reference.I-D.ietf-hip-rvs.xml'>

<!ENTITY DRAFT-hip-hop PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml3/reference.I-D.matthews-p2psip-hip-hop.xml'>

]>
	<rfc category="info" ipr="full3978" docName="draft-dawkins-hip-checksum-coverage-00"> 

  	<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>

  	<?rfc toc="yes" ?>

  	<?rfc symrefs="yes" ?>

 	<?rfc sortrefs="yes"?>

  	<?rfc iprnotified="no" ?>

  	<?rfc strict="yes" ?>

	<?rfc compact="no" ?>

<front>
  <title abbrev="HIP Checksum Coverage">Proposed Host Identity Protocol (HIP) Checksum Coverage</title>

  <author initials="X.F." surname="Jiang" fullname="XingFeng Jiang">
    <organization abbrev="Huawei">Huawei Technologies </organization>
    <address>
      <postal>
	  <street> Huihong Mansion,No.91 Baixia Rd </street>
	  <city> Nanjing </city> <region> Jiangsu </region>
	  <code> 210001 </code> <country> P. R. China</country> </postal>
      <phone> +86(25)84565462 </phone>
      <email> jiang.x.f@huawei.com </email>
    </address>
  </author>

  <author initials="P." surname="Matthews" fullname="Philip Matthews">
    <organization abbrev="Avaya">Avaya</organization>
    <address>
      <postal>
	  <street> 100 Innovation Drive</street>
	  <city> Ottawa </city> <region> Ontario </region>
	  <code>K2K 3G7</code> <country>Canada</country> </postal>
      <phone>+1 613 592 4343 x224</phone>
      <email> philip_matthews@magma.ca </email>
    </address>
  </author>

  <author initials="S." surname="Dawkins" fullname="Spencer Dawkins" role="editor">
    <organization abbrev="Huawei (USA)">Huawei Technologies (USA)</organization>
    <address>
      <postal>
	  <street> 1547 Rivercrest Blvd.</street>
	  <city> Allen</city> <region>TX </region>
	  <code>75002 </code> <country>USA</country> </postal>
      <phone>+1 214 755 3870</phone>
      <email>spencer@mcsr-labs.org </email>
    </address>
  </author>  
  
  <date month="November" year="2007" />

  <area>RAI</area>
  <workgroup>Network Working Group</workgroup>

<abstract>
	<t>This specification suggests two changes to the Host Identity Protocol (HIP) checksum calculation. 	
	Specifically, only the HIP header and payload fields would be included in the checksum calculation, and 
	the CRC32c algorithm would be used to compute the checksum. The HIP version number would be incremented if these
	suggestions are accepted, to reflect a different checksum algorithm. </t>
</abstract>
</front>

<middle>

<section anchor="intro" title="Introduction">

	<t>This specification suggests two changes to the Host Identity Protocol (HIP) checksum calculation.
		Each of these changes should be considered separately:</t>
		<t><list style="numbers">
			<t>A change to the checksum coverage in HIP, and </t>
			<t>Replacing the 16-bit checksum with a CRC32c checksum.</t>
		</list></t>
		<t>The HIP version number would be incremented if these suggestions are accepted, 
		to reflect a different checksum algorithm.</t>
	
	<t>The checksum calculation described in this specification is used only when HIP is carried directly
		over IP. Considerations for checksum calculations when an intervening transport protocol is used
		are left to <xref target='I-D.ietf-hip-nat-traversal' />.
	</t>
</section>

<section anchor="terms" title="Terminology used in this document">

	<t>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 <xref target='RFC2119' />. </t>

</section>

<section anchor="background" title="Background for this Proposal" >

	<t>In section 5.1.1, the HIP base protocol draft <xref target='I-D.ietf-hip-base' />
		now specifies the following: </t>

	<t><list style="empty">
		<t>

   Since the checksum covers the source and destination addresses in the
   IP header, it must be recomputed on HIP-aware NAT devices.
		</t>
		<t>
   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.
		</t>
		<t>
   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.
		</t>

	</list></t>

	<t>Although the use of pseudo-headers in transport checksums has been universal practice for decades,
		this design choice is proving problematic for several applications that 
		perform HIP-level packet relays. For example:
	</t>	

	<t><list style="symbols">

		<t>There are two active proposals in the HIP working group itself 
			that require forwarding of HIP packets, 
			"Host Identity Protocol (HIP) Rendezvous Extension" (<xref target='I-D.ietf-hip-rvs' />) and
			"HIP Extensions for the Traversal of Network Address Translators" 
			(<xref target='I-D.ietf-hip-nat-traversal' />). 
		</t>

		<t>Other HIP applications would also benefit. For example,
			the HIP-HOP proposal in the P2PSIP working group 
			(<xref target='I-D.matthews-p2psip-hip-hop' />)includes a
			mechanism that allows intermediate peers to route HIP packets
			between peers that does not have an active direct connection (for various reasons,
			including but not limited to NAT traversal issues). 
		</t>
	</list></t>

	<t> Although a HIP-level relay is attractive for these mechanisms, the HIP packet
		checksum is recomputed at each relay, because the source and destination 
		IP addresses are currently included in the pseudo-header covered by the HIP checksum. 
	</t>

	<t>In addition to the checksum
		calculation overhead at each relay, intermediate recalculation means that
		checksum protection only covers the part of the path to the next HIP-aware device 
		that recalculates the checksum.
	</t>

	<t>We also note that excluding the source and destination IP addresses from the HIP checksum calculation 
		would improve the ability of HIP connections to survive interface selection
		changes, would better accommodate multihoming, and would better detect checksum failures in scenarios
		where intermediate nodes forward at the HIP layer. For example, in 
		<xref target='I-D.ietf-hip-nat-traversal' />, checksums are recalculated when packets traverse
		HIP-aware NATs (so checksums do not protect the packets over an entire end-to-end path) and 
		checksums are set to 0 when packets traverse HIP-unaware NATs 
		(so that checksums are disabled completely).
	</t>

</section>

<section anchor="coverage" title="Changes to Checksum Coverage">

	<t>This specification recommends removing pseudo-header fields from the checksum calculation, so that
		the checksum does not need to be recalculated when pseudo-header field values change. Most
		important (and probably most controversial) is the removal of source and destination IP addresses
		from the checksum calculation.
	</t>

	<t>The only bytes included in the checksum calculation are the HIP header and HIP payload bytes.
	</t>

	<t>The resulting checksum does protect the HIP header and HIP payload, but does not protect the pseudo-header
		fields associated with the HIP header and HIP payload. The resulting checksum is "end-to-end" - it
		protects the HIP header and HIP payload for packets that traverse HIP relays, where the current
		checksum calculation does not - it is recalculated at each HIP relay, so errors at intermediate HIP
		relays may not be caught if the checksum was recalculated after the error was introduced at the HIP relay.
	</t>

	<t>We believe that removal of the source and destination IP addresses from the transport checksum calculation
		is a reasonable change to the HIP protocol. If these fields are exluded from the transport checksum 
		calculation, we see no reason to include other IP-level fields as part of a transport pseudo-header
		in the checksum calculation. 
	</t>

</section>

<section anchor="proposal" title="Proposed HIP Checksum Coverage" >

	<t>This proposal uses the same checksum algorithm that is used in SCTP, except that no pseudo-header fields are
		prepended to the HIP header and payload before the checksum is calculated.
	</t>

	<t>Note that the current HIP base specification uses a 16-bit checksum field. This checksum field must be
		expanded to 32 bits, in order to accommodate the crc32c checksum (also used by SCTP). Also note that 
		a reserved field is also added to preserve 8-byte alignment, as required in <xref target='RFC2460' />
		to ensure alignment of subsequent IPv6 extension headers.
	</t>

	<t>The resulting modified header format is as follows:

		<figure><artwork><![CDATA[
    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             |           (Reserved)          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                          (Reserved)                           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                Sender's Host Identity Tag (HIT)               |
   |                                                               |
   |                                                               |
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |               Receiver's Host Identity Tag (HIT)              |
   |                                                               |
   |                                                               |
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   /                        HIP Parameters                         /
   /                                                               /
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        	]]></artwork></figure>
	</t>


	<t> The following text is taken from <xref target='RFC4960' />, with modifications (reflecting its use for HIP):
	</t>

	<t>When sending a HIP packet, the endpoint MUST strengthen the data
  			integrity of the transmission by including the crc32c checksum
  			value calculated on the packet, as described below.
	</t>
	<t>After the packet is constructed, the transmitter shall:
	</t>
		<t><list style="numbers">
		<t>Initialize the checksum field to 0's.
		</t>
		<t>Calculate the crc32c checksum of the HIP header and HIP payload.  
			Refer to appendix B of 
			<xref target='RFC4960' /> for details of the crc32c algorithm.  And,
		</t>
		<t>Put the resultant value into the checksum field, and leave the rest of the bits unchanged.
		</t>
	</list></t>
	<t>When a HIP packet is received, the receiver MUST first check the
  			crc32c checksum:
	</t>
	<t><list style="numbers">
		<t>Store the received crc32c checksum value aside,
		</t>
			<t>Replace the 32 bits of the checksum field in the received HIP
     				packet with all '0's and calculate an crc32c checksum value of
     				the HIP header and payload.  And,
		</t>
			<t>Verify that the calculated crc32c checksum is the same as the
     				received crc32c checksum.  If not, the receiver MUST treat the
     				packet as an invalid HIP packet.
		</t>
	</list></t>

	<t>The default procedure for handling invalid HIP packets is to silently discard them.
	</t>	
							
</section>

<section anchor="versioning" title="Proposed HIP Version Change">

	<t>Because this change is not backward-compatible with current HIP specifications 
		(<xref target='I-D.ietf-hip-base' />)
		or with conformant implementations to this specification, 
		we recommend changing the HIP version number from 1 to 2 for packets processed using this specification.
	</t>	

	<t>Although it is certainly possible to make this change backward-compatible by adding a version negotiation
		mechanism and continuing to use HIP Version 1 with hosts that do not respond to the negotiation mechanism,
		we believe that making this change to HIP at this time, without providing such a negotiation mechanism,
		is appropriate because

		<list style='numbers'>
                	<t>The base HIP protocol specification is still an Internet Draft, as of this writing,</t>
                	<t>The base HIP protocol specification is currently targeted at the Experimental track,
				so that the usual RFC 2026 considerations about incompatible changes to Standards-track
				protocols should not apply, and </t>
                	<t>The change is small and localized to setting/verifying the HIP version number itself, 
				plus computing and verifying the HIP checksum.</t>                	
		</list>
	</t>

</section>

<section anchor="security" title="Security Considerations">
	<t>The following security considerations are in addition to the security considerations identified in the base
		HIP protocol specification (<xref target='I-D.ietf-hip-base' />).
	</t>
	<t> This change to the HIP checksum coverage does make source and destination IP addresses less "visible" to 
		a receiving host, but this is judged to be an acceptable risk, for these reasons:
		
		<list style="numbers">
			<t>Off-path attackers must provide two 128-bit numbers (the source and destination HITs) that
				the host under attack will recognize as legitimate HITs. If the attacker sends packets
				with HITs that the host under attack does not recognize, these packets are simply
				dropped as invalid packets - a MUST in <xref target='I-D.ietf-hip-base' />. 
				Given that each of the two numbers is self-cerifying because it is the 
				hash of a public key, this attack is seen as computationally hard.</t>
			<t>On-path attackers who are able to learn valid source and destination HITs, in order to forge
				packets that might be used for denial of service attacks, etc. can already do much worse
				than forge packets - they can simply drop packets, or execute denial of service attacks
				on intermediate devices that would forward legitimate packets in normal operation. </t>
		</list>
	</t>
</section>

<section anchor="iana" title="IANA Considerations">
	<t>The current HIP base protocol specification (<xref target='I-D.ietf-hip-base' />) includes as part of its 
		IANA considerations 
		a request that IANA create a new namespace for HIP Version
		Numbers, and add an entry for HIP Version 1. This specification defines HIP Version 2, so 
		we also request an entry in this namespace for HIP Version 2, as described in this specification.
	</t>
</section>  

</middle>

<back>

	<references title="Normative References">

		&RFC2119;

		&DRAFT-hip-base;

		&RFC4960;

	</references>

	<references title="Informative References">

		&DRAFT-hip-hop;

		&DRAFT-hip-nat-traversal;

		&DRAFT-hip-rvs;

		&RFC0768;

		&RFC2460;

	</references>
</back>
</rfc>