<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE rfc SYSTEM "rfc2629bis.dtd">
<?rfc toc="yes"?>
<?rfc tocdepth="3"?>
<?rfc symrefs="yes"?>
<?rfc compact="yes"?>
<?rfc strict="yes"?>
<rfc ipr="trust200902"
     docName="draft-jakma-ospf-integrity-00"
     updates="2328"
     submissionType="IETF"
     xml:lang="en"
     category="std"
>
  <front>
    <title abbrev="OSPF Integrity Checks">
        Stronger, Automatic Integrity Checks for OSPF Packets
    </title>
    
    <author initials="P." fullname="Paul Jakma" surname="Jakma">
      <organization abbrev="DCS, Uni. of Glasgow">
      School of Computing Science, University of Glasgow</organization>
      <address>
        <postal>
          <street>Lilybank Gardens</street>
          <city>Glasgow</city>
          <code>G12 8QQ</code>
          <country>Scotland</country>
        </postal>
        <email>paulj@dcs.gla.ac.uk</email>
      </address>
    </author>

<author fullname="Manav Bhatia" initials="M.B." surname="Bhatia">
      <organization>Alcatel-Lucent</organization>
      <address>
        <postal>
          <street></street>
          <city>Bangalore</city>
          <code></code>
          <region></region>
          <country>India</country>
        </postal>
        <phone></phone>
        <email>manav.bhatia@alcatel-lucent.com</email>
      </address>
    </author>

    <date year="2010" month="October" />
    <area>Routing</area>
    <workgroup>Open Shortest Path First IGP Working Group</workgroup>
    <keyword>RFC</keyword>
    <keyword>OSPF</keyword>
    <keyword>CRC</keyword>
    <keyword>Checksum</keyword>
    <keyword>Authentication</keyword>
    <abstract>
      <t>This document describes an extension to OSPFv2 and OSPFv3 to allow
         a stronger integrity check to be applied to the protocol packets,
         than the default OSPF checksum, which is known to be weak. 
         </t>
      <t>The extension allows OSPF speakers to negotiate the use of
         a CRC integrity check, as a new psuedo-authentication type.</t>
    </abstract>
 </front>

 <middle>
    <section title="Requirements Language">
      <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 title="Introduction" anchor="intro">
      <t>The integrity of Open Shortest Path First versions
         2 (OSPFv2)<xref target="RFC2328"/>
         and 3 (OSPFv3)<xref target="RFC5340"/>
         packets is protected either through
         the standard internet protocol checksum, or through some
         cryptographic integrity scheme within OSPF, or, more rarely,
         through IPSec. This provides a check against errors that can not
         be caught by the link-layer integrity checks, e.g.
         errors in lower layers of the software stack or in
         hardware of the host.
      </t><t>
         The internet protocol checksum is known to have
         weaknesses<xref target="partridge"/>.
         In particular it can not detect re-ordered words and certain patterns
         of bit flips. If stronger integrity checks are desired, the only
         option is to use cryptographic HMACs, either with MD5 (all conforming
         <xref target="RFC2328"/> implementations) or, if supported, 
         the stronger algorithms
         specified by <xref target="RFC5709"/>. There are some disadvantages
         though to using the existing support for cryptographic HMACs
         purely for integrity checking. The algorithms require more computation,
         which may be noticable on less powerful and/or energy-sensitive
         platforms. Additionally, the need to configure key material is an
         additional administrative burden.
      </t><t>
         This documents extends OSPF to allow for the automatic and backward 
         compatible use of stronger integrity checks. Backward compatibility
         implies the default null authentication type must be used and extended.
      </t>
    </section>
    <section title="Stronger Checksum mechanism for OSPFv2">
    <t>The null authentication mode of OSPFv2 is extended to make use
            of the authentication data field of the OSPFv2 packet header.
            Where previously this field was ignored for null authentication,
            now an OPTIONAL "Null Authentication Data" structure is recognised
            there.
         </t><t>
            Implementations MUST provide a means to disable this extension,
            in case there are non-conforming RFC2328 implementations. 
            Implementations MAY wish to generate a CRC32 checksum by default
            via this extension, and SHOULD attempt to verify any received,
            regardless of whether they generate the same or not.
         </t>
    <section title="Null Authentication Data">
         
         <figure title='Figure 1: Null Authentication Data'>
	 <artwork align='center'><![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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          Checksum Type        |      0xA5     |  Data Length  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                            Ignored                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]>
	</artwork>
         </figure>
<t>The authentication data field in the standard OSPFv2 packet header is
   redefined as shown above, when null authentication is used.
   The new field definitions are as follows:	
</t><t>
<list style="hanging" hangIndent="4">
<t hangText="Checksum Type:"><vspace/>
    This field indicates the new checksum algorithm that the
    routers must use and is described in detail in the later sections.  </t>
<t hangText="Magic:"><vspace/>
     This field is set to 0xA5. This magic, in combination with
     the OSPF and IP packet lengths, signals the use of this extension.</t>
<t hangText="Data Length:"><vspace/>
      The length in 4-octet words of the extended checksum data block
       appended to the OSPFv2 packet.
</t>
</list></t>
      </section>
</section>
  <section title="Stronger Checksum mechanism for OSPFv3">
	<t> OSPFv3 uses IPSec for protection and does not  carry any
	   authentication information in its headers. Thus it is not possible
       to overload the Null Authentication type as was done in case of OSPFv2.
	</t>
	<section title="EC-Bit in Options Field">
	 <t> A new EC-bit (EC stands for Extended Checksum) is introduced
       into the OSPFv3 Options field. Routers MUST set the EC-bit in all
       OSPFv3 packets to indicate that the packet is carrying the new
       extended checksum data.
	 </t>
<figure title='Figure 2: OSPFv3 Options Field'>
	 <artwork align='center'><![CDATA[
  0                   1                         2
   0 1 2 3 4 5 6 7 8 9 0 1 2 3  4  5 6 7  8  9  0  1  2  3
   +-+-+-+-+-+-+-+-+-+-+-+-+-+--+-+--+-+-+--+--+--+--+--+--+
   | | | | | | | | | | | | | |EC|L|AF|*|*|DC| R| N|MC| E|V6|
   +-+-+-+-+-+-+-+-+-+-+-+-+-+--+-+--+-+-+--+--+--+--+--+--+
]]>
	</artwork>
         </figure>
	</section>
  <section title="Extended Checksum Data Block">
  <t>  The data block for carrying extended checksum in OSPFv3 is formatted as 
     described below.
</t>
<figure title='Figure 3: OSPFv3 Options Field'>
	 <artwork align='center'><![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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          Checksum Type       |      0xA5     |   Data Length  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
~              Extended Checksum Data Block                     ~
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]>
  </artwork>
         </figure>

  <t> The Checksum Type is of two octets and indicates the new checksum 
      algorithm that the routers must use. This is described in detail in the
      later sections. The next field is a reserved magic field set to 0xA5.
      The Data length field is of two octets and carries
      the size of the entire extended checksum data block that has been appended
      to the OSPFv3 payload, specified in units of 4-octet words.
      The Extended Checksum Data Block carries the
      checksum data that the recievers will use to verify the integrity of the
      OSPFv3 protocol payload.</t>

  </section>
  </section>
     <section title="Generation">
       <t>The same steps are followed as for D.4.1 of <xref target="RFC2328"/>.
          Additionally, a 2nd integrity check algorithm is also computed over 
          the packet data, with at least the same amount of zero padding, to
          produce an "extended checksum", which is appended to the OSPFv2
          packet. Its is size accounted for in the Null Authentication Data 
          "data length" field and in the IP length, but not in the OSPFv2 packet
          header, in a similar fashion to the standard OSPFv2 cryptographic 
          authentication
          mechanism.
        </t><t>
          The "Checksum Type" and "Data Length" fields are set to the
          appropriate values for the 2nd integrity check algorithm.
        </t><t> In case of OSPFv3 the entire extended checksum block
         is appended to the OSPFv3 packet, with its size accounted for
         in the IPv6 payload length, but not in the OSPFv3 packet header.
         </t>
          <t>
          Implementations MUST append the extended checksum data, that is
          carried as part of the OSPF protocol payload, before the link local
            signaling (LLS) <xref target="RFC5613"/> block (if it exists).
		 </t>
         <figure title='Figure 4: Extended Checksum Block in OSPFv2 and OSPFv3'>
	 <artwork align='center'><![CDATA[
 +---------------------+ --              --  +---------------------+
 | IP Header           | ^               ^   | IPv6 Header         |
 | Length = HL+X+Y+Z   | | Header Length |   | Length = HL+X+Y+Z   |
 |                     | v               v   |                     |
 +---------------------+ --              --  +---------------------+
 | OSPF Header         | ^               ^   | OSPFv3 Header       |
 | Length = X          | |               |   | Length = X          |
 |                     | |               |   |                     |
 | NULL Authentication | |               |   |                     |
 | Length = Y          | |               |   |                     |
 |.....................| | X             | X |.....................|
 |                     | |               |   |                     |
 | OSPFv2 Data         | |               |   | OSPFv3 Data         |
 |                     | v               v   |                     |
 +---------------------+ --              --  +---------------------+
 |                     | ^               ^   |                     |
 | Extended Checksum   | | Y             | Y |  Extended Checksum  |
 |                     | v               v   |                     |
 +---------------------+ --              --  +---------------------+
 |                     | ^               ^   |                     |
 |  LLS Data           | | Z             | Z |  LLS Data           |
 |                     | v               v   |                     |
 +---------------------+ --              --  +---------------------+
]]>`
	</artwork>
         </figure>

      </section>
      <section title="Verification">
        <t>The packet data is padded out, as required by <xref target="RFC2328"/>.
        </t><t>
           In case of OSPFv2, the Null Authentication Data "0xA5" magic field
           is examined. If it does not match, then verification proceeds as
           per D.5.1 of
           <xref target="RFC2328"/>. If it matches, then the IP length in the
           header  MUST be verified. An incoming packet will only  
            contain a valid extended checksum if the length in the 
            IP header = length in OSPF header + "data length" in the 
            NULL Authentication header + data length in the LLS 
           <xref target="RFC5613"/> block  (if it exists). Implementations
           can trivially determine if an LLS block is being carried by
           inspecting the "L" bit in the OSPF Options field in the HELLOs and
           DDs. Implementations MUST proceed with regular checksum if these 
           numbers dont match. If they do then the IP checksum field
           of the OSPF header MUST be ignored. Instead the stronger integrity
           algorithm specified by the "Checksum Type" field is used, and
           verified against the corresponding checksum. The packet MUST be
           discarded if the computed checksum does not match with what's carried
           in the OSPF packet.
        </t> <t> In case of OSPFv3, the presence of the EC-bit in the OSPFv3
         Options field will indicate that a new checksum algorithm is being
         used. Routers MUST parse the packet till the end of the OSPFv3 payload
         till it reaches the start of the extended checksum data block. The
         processing that follows next is similar to the way its done for OSPFv2
         as explained earlier.
       </t>
      </section>
  
    <section title="Stronger Integrity Algorithm Types">
      <section title="CRC32">
        <t>The CRC32 algorithm, as used with IEEE 802.3 and defined by
           <xref target="hammond"/> is used to calculate its 4-byte digest. The
           length set in the Null Authentication Data thus will be 1.
        </t>
      </section>
      <section title="MD5-Digest">
        <t>The MD5 algorithm, as per 5ref17 of <xref target="RFC2328"/> is used
           in plain digest mode (i.e. solely over the data, unlike the HMAC mode
           used by cryptographic authentication) to calculate its 8-byte digest.
           The length set in the Null Authentication Data thus will be 2.
        </t>
      </section>
    </section>
    <section title="IANA Considerations">
    <t>OSPFv2 Null Authentication Checksum Types are maintained by the IANA.
       Extensions to OSPFv2 that require a new Checksum Type must be reviewed
       by a designated expert from the routing area. </t>
       <t> This document assigns OSPF Null Authentication Checksum 
            Types 1 and 2, for CRC32 and MD5-Digest respectively.</t>
      <t> IANA is also requested to allocate EC-bit in the OSPFv3
         "Options Registry"</t>
   </section>
   <section title="Security Considerations">
    <t>This extension does not raise any new security concerns. It only is used
       where operators have chosen not to configure cryptographic security
       mechanisms.</t>
   </section>
  </middle>
  <back>
    <references title="Normative References">
    	<?rfc include="reference.RFC.2119"?>
    	<?rfc include="reference.RFC.2328"?>
       <?rfc include="reference.RFC.5340"?>
    	<?rfc include="reference.RFC.5709"?>
    	<reference
            anchor="hammond"
            target="http://handle.dtic.mil/100.2/ADA013939">

          <front>
            <title>Development of a Transmission Error Model
                   and an Error Control Model</title>
            <author initials="J. L." surname="Hammond" 
                    fullname="J. L. Hammond, Jr.">
            </author>
            <author initials="J. E." surname="Brown" 
                    fullname="James E. Brown">
            </author>
            <author initials="S. S." surname="Lui" 
                    fullname="Stephen Shyan-Shiang Lui">
            </author>
            <date month="May" year="1975" />
         </front>
         <seriesInfo name="Technical Report"
              value="Georgia Institute of Technology"/>
        </reference>
    </references>
    <references title="Informative References">
		<?rfc include="reference.RFC.5613"?>
        <reference
            anchor="partridge"
            target="http://dx.doi.org/10.1109/90.731187">
          <front>
            <title>Performance of checksums and CRC's over real data</title>
            <author initials="J." surname="Stone" 
                    fullname="Jonathan Stone">
                    <organization>Stanford University</organization>
            </author>
            <author initials="M." surname="Greenwald" 
                    fullname="Michael Greenwald">
                    <organization>Stanford University</organization>
            </author>
            <author initials="C" surname="Partridge" 
                    fullname="Craig Partridge">
                    <organization>BBN Technologies</organization>
            </author>
            <author initials="J" surname="Hughes" 
                    fullname="James Hughes">
                    <organization>Storage Technology Corp.</organization>
            </author>
            <date year="1998" />
         </front>
         <seriesInfo name="IEEE/ACM Trans. Netw."
                     value="vol 6, num 5, pages 529-543"/>
        </reference>
    </references>
  </back>
</rfc>
