<?xml version="1.0" encoding="US-ASCII"?>
<?rfc linefile="1:/tmp/CGI11956.1"?>
<?rfc linefile="1:/tmp/CGI11956.1"?>
<?rfc toc="yes"?>
<!-- generate a table of contents -->
<?rfc symrefs="yes"?>
<!-- use anchors instead of numbers for references -->
<?rfc sortrefs="yes" ?>
<!-- alphabetize the references -->
<?rfc compact="yes" ?>
<!-- conserve vertical whitespace -->
<?rfc subcompact="no" ?>
<!-- but keep a blank line between list items -->

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
        <!ENTITY RFC2119 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
        <!ENTITY RFC3602 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3602.xml">
        <!ENTITY RFC3686 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3686.xml">
        <!ENTITY RFC4104 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4104.xml">
        <!ENTITY RFC4303 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4303.xml">
        <!ENTITY RFC4309 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4309.xml">
        <!ENTITY RFC4434 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4434.xml">
        <!ENTITY RFC7296 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7296.xml">
        ]>

<rfc category="std"
     docName="draft-mglt-6lo-aes-implicit-iv-01.txt"
     ipr="trust200902">
    <front>
        <title abbrev="Implicit IV">Implicit IV for AES-CBC, AES-CTR, AES-CCM and AES-GCM </title>
        <author fullname="Daniel Migault" initials="D." surname="Migault" role="editor">
            <organization>Ericsson</organization>
            <address>
                <postal>
         <street>8400 boulevard Decarie</street>
          <city>Montreal, QC H4P 2N2</city>
          <country>Canada</country>
        </postal>
        <!--<phone>+33 1 45 29 60 52</phone> -->
        <email>mglt.ietf@gmail.com</email>

            </address>
        </author>

        <author fullname="Tobias Guggemos" initials="T." surname="Guggemos" role="editor">
            <organization>LMU Munich</organization>
            <address>
                <postal>
                    <street>Am Osteroesch 9</street>
                    <city>87637 Seeg</city>
                    <region>Bavaria</region>
                    <country>Germany</country>
                </postal>
                <phone/>
                <facsimile/>
                <email>tobias.guggemos@gmail.com</email>
                <uri/>
            </address>
        </author>
        <date/>
        <area>INTERNET</area>

        <workgroup>IPSECME</workgroup>

        <abstract>
            <t>IPsec ESP with AES-CBC, AES-CTR, AES-CCM or AES-GCM sends an IV in each IP packet, which represents 8 or 16 additional bytes.</t>
            <t>In some context, such as IoT, the cost of sending bytes over computing these bytes is generally in favor of the computation. As a result, it would be better to compute the IV on each party then to send it.</t> 
            <t>The document describes how to the IV can be generated instead of being sent. This document limits the IV generation for AES-CBC, AES-CTR, AES-CCM and AES-GCM but can be used for additional cryptographic mode and suites.</t>
        </abstract>
    </front>

    <middle>

        <section title="Requirements notation">
            <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">
              <t>Using AES in one of the AES-CBC <xref target="RFC3602"/>, AES-CTR <xref target="RFC3686"/> encryption mode, or in one of the AES-CCM <xref target="RFC4309"/> and AES-GCM <xref target="RFC4104"/> combined requires the specification of an IV for each ESP packet. Currently this IV is sent in each ESP packet <xref target="RFC4303"/>.</t>

              <t>IoT devices present new characteristics over traditional devices. One of them is that the balance between extra computation and extra byte sent over the wire is most of the time in favor of extra computation. For such devices, embedding the IV in each packet constitutes an extra cost over computing the IV of each associated packet.</t>

              <t>Depending on the the AES mode, the IV can be of different sizes and have different properties. AES-CBC needs a 16 byte IV. This IV MUST be chosen at random and MUST be unpredictable. In addition IV MUST NOT be generated with low Hamming distance (like counter) for example -- <xref target="RFC3602"/> Section 3. AES-CTR and AES-CCM need an 8 byte IV. This IV MUST be unique (<xref target="RFC3686"/> Section 2.1). Finally, AES-GCM requires 8 byte IV, that must be unique for a given key -- <xref target="RFC4104"/> Section 2.</t>   

              <t>This document defines how for each of the AES-CBC, AES-CTR, AES-CCM and AES-GCM, the IV can be computed by each peer instead of being included in the ESP packet.</t>
 

              <t>This document limits its scope to AES as most of devices in the IoT have hardware acceleration for AES, and use AES. However, the description may be extended to additional crypto suites.</t>
        </section>

        <section anchor="sec:terminology" title="Terminology">
            <t>
                <list hangIndent="3" style="hanging">
                    <t hangText="-">IoT: Internet of Things</t>
                    <t hangText="-">IV: Initialization Vector</t>
                </list>
            </t>
        </section>

        <section anchor="sec-aes-cbc" title="Implicit IV with AES CBC">
            <t>With AES-CBC, the IV is 16 bytes, random and unpredictable. In this document, the binding between IV and ESP packet is performed using the Sequence Number or the Extended Sequence Number. A clear text payload is derived from the Sequence Number or the Extended Sequence Number. In order to generate the IV randomly, AES is used as a random permutation. A dedicated 16 byte key is used for each peer. key_iv_initiator (resp. key_iv_responder) is used to derive the IV emitted by the initiator (resp. the responder).</t>

       <t>Keys key_iv_initiator and key_iv_responder MUST be agreed prior IPsec packets are exchanged. When IKEv2 <xref target="RFC7296"/> is used these keys are derived from the KEYMAT. key_iv_initiator is the first key generated, followed by key_iv_responder.</t>
 
<t><xref target="fig-aes-cbc-ct-sn"/> (resp. <xref target="fig-aes-cbc-ct-esn"/>) defines a clear text payload derived from a 4 byte Sequence Number (resp. a 8 byte Extended Sequence Number)</t>

            <figure anchor="fig-aes-cbc-ct-sn" title="Clear Text Payload for AES-CBC">
                    <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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
|                                                               | 
|                              Zero                             | 
|                                                               | 
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
|                      Sequence Number                          | 
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                ]]></artwork>
            </figure>
        <t>Where,
                <list hangIndent="3" style="hanging">
                    <t hangText="-">Sequence Number: the 4 byte Sequence Number carried in the ESP packet.</t>
                    <t hangText="-">Zero: a 12 byte array with all bits set to zero.</t>
                </list>
        </t>

            <figure anchor="fig-aes-cbc-ct-esn" title="Clear Text Payload for AES-CBC with Extended Sequence Number">
                    <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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
|                              Zero                             | 
|                                                               | 
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
|                         Extended                              |
|                      Sequence Number                          | 
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                ]]></artwork>
            </figure>

        <t>Where,
                <list hangIndent="3" style="hanging">
                    <t hangText="-">Extended Sequence Number: the 8 byte Extended Sequence Number of the Security Association. The 4 byte low order bytes are carried in the ESP packet.</t>
                    <t hangText="-">Zero: a 8 byte array with all bits set to zero.</t>
                </list>
        </t>

        </section>

        <section anchor="sec-aes-ctr-ccm-cgm"  title="Implicit IV with AES-CTR, AES-CCM and AES-GCM">

            <t>With AES-CTR, AES-CCM and AES-GCM, the 8 byte IV MUST NOT repeat. The binding between a ESP packet and its IV is provided using the Sequence Number or the Extended Sequence Number. <xref target="fig-aes-ctr-ccm-gcm-iv-sn"/> (resp <xref target="fig-aes-ctr-ccm-gcm-iv-esn"/>) represents the IV with a regular 4 byte Sequence Number (resp. a 8 byte Extended Sequence Number).</t>

            <figure anchor="fig-aes-ctr-ccm-gcm-iv-sn" title="IV for AES-CTR, AES-CCM and AES-GCM with 4 byte Sequence Number">
                    <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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
|                              Zero                             | 
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
|                      Sequence Number                          | 
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                ]]></artwork>
            </figure>
        <t>Where,
                <list hangIndent="3" style="hanging">
                    <t hangText="-">Sequence Number: the 4 byte Sequence Number carried in the ESP packet.</t>
                    <t hangText="-">Zero: a 4 byte array with all bits set to zero.</t>
                </list>
        </t>

            <figure anchor="fig-aes-ctr-ccm-gcm-iv-esn" title="IV for AES-CTR, AES-CCM and AES-GCM with 8 byte Extended Sequence Number">
                    <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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
|                         Extended                              |
|                      Sequence Number                          | 
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                ]]></artwork>
            </figure>

        <t>Where,
                <list hangIndent="3" style="hanging">
                    <t hangText="-">Extended Sequence Number: the 8 byte Extended Sequence Number of the Security Association. The 4 byte low order bytes are carried in the ESP packet.</t>
                </list>
        </t>
    </section>

    <section title="Security Consideration">
    <t>IV generation of the AES-CBC, AES-CTR, AES-CCM and AES-GCM have not been explicitly defined. It has been left to the implementation as long as certain security requirements are met. This document provides an explicit and normative way to generate IVs. The mechanism described in this document meets the IV security requirements of AES-CBC, AES-CTR, AES-CCM and AES-GCM.</t>
    <t>Randomness is provided by using AES. If this hypothesis is no longer valid, than most probably, none of the AES mode will be considered secure.</t>
    </section>

    <section title="IANA Considerations">
    <t>Each of the AES-CBC, AES-CTR, AES-CCM and AES-GCM crypto suite needs to have their associated cryptographic suite with implicit IV. That is to say the transforms below should be added to the Transform Type 1 - Encryption Algorithm Transform IDs:
    <list hangIndent="3" style="hanging">
        <t hangText="-">ENCR_AES_CBC_IMPLICIT_IV</t>
        <t hangText="-">ENCR_AES_CTR_IMPLICIT_IV</t>
        <t hangText="-">ENCR_AES-CCM_8_IMPLICIT_IV</t> 
        <t hangText="-">ENCR_AES-CCM_12_IMPLICIT_IV</t> 
        <t hangText="-">ENCR_AES-CCM_16_IMPLICIT_IV</t>
        <t hangText="-">AES-GCM with 8 octet ICV and implicit IV</t> 
        <t hangText="-">AES-GCM with 12 octet ICV and implicit IV</t> 
        <t hangText="-">AES-GCM with 16 octet ICV and implicit IV</t> 
    </list>
    </t>
    </section>
    
    </middle>
    <back>
        <references title="Normative References">
            &RFC2119;
            &RFC3602;
            &RFC3686;
            &RFC4104;
            &RFC4303;
            &RFC4309;
            &RFC7296;
        </references>

       
        <!--<references title="Informational References">

        </references>-->

        <section title="Document Change Log">
            <t>[draft-mglt-ipsecme-diet-esp-IV-generation-00.txt]: changing affiliation.</t>
            <t>[draft-mglt-ipsecme-diet-esp-IV-generation-00.txt]: First version published.</t>
        </section>
    </back>
</rfc>
