<?xml version="1.0" encoding="US-ASCII"?>
<?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 [
<!ENTITY RFC2119 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC8174 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8174.xml">
<!ENTITY RFC7296 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7296.xml">
<!ENTITY RFC7383 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7383.xml">
<!ENTITY RFC9242 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.9242.xml">
<!ENTITY RFC9329 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.9329.xml">
<!ENTITY I-D.tjhai-ikev2-beyond-64k-limit PUBLIC "" "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.tjhai-ikev2-beyond-64k-limit.xml">
<!ENTITY I-D.josefsson-mceliece PUBLIC "" "https://bib.ietf.org/public/rfc/bibxml3/reference.I-D.josefsson-mceliece.xml">
]>

<rfc category="std" docName="draft-nir-ipsecme-big-payload-07" ipr="trust200902"  updates="7296" submissionType="IETF" consensus="true">
    <front>
        <title abbrev="Big IKE Payloads">A Larger Internet Key Exchange version 2 (IKEv2) Payload</title>
        <author initials="Y." surname="Nir" fullname="Yoav Nir">
            <organization>Dell Technologies</organization>
            <address>
                <postal>
                    <street>9 Andrei Sakharov St</street>
                    <city>Haifa</city>
                    <code>3190500</code>
                    <country>Israel</country>
                </postal>
                <email>ynir.ietf@gmail.com</email>
            </address>
        </author>
        <date/>
        <area>Security</area>
        <workgroup>IPsecME</workgroup>
        <abstract>
            <t> The messages of the Internet Key Exchange version 2 (IKEv2) protocol are made up of payloads. The 
              current protocol limits each of these payloads to 64KB by having a 2-byte length field.  While this is 
              usually enough, several of the payloads may need to be larger. </t>
            <t> This document updates RFC 7296 by defining an extension that allows larger payloads.</t>
        </abstract>
    </front>
    <middle>
        <section anchor="intro" title="Introduction">
            <t> The IKEv2 document (<xref target="RFC7296" />)  defines the IKE header in section 3.1. The IKE header
              includes a 4-byte length field, allowing for IKE messages of up to 4 GB. While the standard transport for
              IKEv2 is UDP, which is limited to 64KB packets even with IP-layer fragmentation, an extension called 
              IKEv2 Message Fragmentation (<xref target="RFC7383"/>) allows for larger messages.</t>
            <t> Using TLS for IKEv2, as defined in <xref target="RFC9329"/>, could support arbitrarily-large messages,
              but the format defined in section 3.1 of that document limits each IKE message size to 64 KB, so message
              fragmentation will be necessary even when running over TCP.</t>
            <t> Section 3.2 of the IKEv2 specification defines the generic payload header, which has a 16-bit Payload 
              Length field, limiting the size of an individual payload to 64 KB. For reference, here's a copy of the 
              generic payload header:</t>
            <figure> 
              <artwork><![CDATA[
                        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 Payload  |C|  RESERVED   |         Payload Length        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                ]]></artwork>
            </figure>
            <t> Some of the payloads defined in RFC 7296 could potentially be bigger than that. For example:</t>
            <ul>
              <li> The CERT payload, defined in section 3.6, may contain various kinds of content, including X.509
                certificates and Certificate Revocation Lists. The sizes of these structures are not bounded and there
                are such structures in the wild that far exceed 64KB.</li>
              <li> The KE (Key Exchange) payload contains data that is defined by the Diffie-Hellman Group number.
                While the original D-H groups defined in RFC 7296 were limited to 1 KB, some of the candidates for
                post-quantum key exchange require much larger buffers. For example, classic McEliece 
                (<xref target="I-D.josefsson-mceliece"/>) requires the transmission of public keys greater than 100KB.</li>
              <li> The Authentication payload depends on the authentication scheme, and some post-quantum schemes such
                as Sphics+ require very long signatures.</li>
            </ul>
            <t> This document defines using larger payloads within IKEv2 by increasing the Payload Length field to 4 
              bytes, signaling this through the use of one of the RESERVED bits in the payload header.</t>
            <section anchor="mustshouldmay" title="Requirements and Other 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
                    BCP 14 <xref target="RFC2119"/> <xref target="RFC8174" /> when, and only when, they appear
                    in all capitals, as shown here.</t>
                <t> The term "extended length payload header" is a revised payload header as described in <xref 
                  target="revised-payload-header"/> with the L bit set, and the term "extended length payload" is any 
                  payload that has such a header, even if its length does not exceed 64KB.</t>
            </section>
        </section> 
        <section anchor="details" title="Protocol Details">
            <section anchor="defails-negotiation" title="Negotiating The Extension">
              <t> This IKE peers negotiate this extension via Notify payloads in the IKE_SA_INIT exchange. Sending this
                Notify payload means that the sender can process the extended length payload headers defined in <xref 
                target="revised-payload-header"/>. This payload is sent by both Initiator and Responder. It is possible
                that one peer sends this Notify and the other does not.  In such a case, the peer than sent the Notify
                MUST still process extended length payloads, and MUST NOT send such payloads to the peer. The details
                of the Notify are as follows:</t>
              <ul>
                <li> The "L" bit (see <xref target="revised-payload-header"/>) is set to zero.</li>
                <li> The Payload Length field is set to 8 - the minimal length of a Notify payload.</li>
                <li> The Protocol ID is set to zero as described in section 3.10 of RFC 7296.</li>
                <li> The SPI size is set to zero, like all other IKE SA-related Notify payloads.</li>
                <li> The Notify Message Type is set to xxxxx, the value to-be-assigned by IANA to the 
                  LARGE_PAYLOAD_SUPPORTED status type.</li>
              </ul>
            </section>
            <section anchor="revised-payload-header" title="Revised Payload Header">
              <t> The Payload header from section 3.2 of RFC 7296 is revised as follows:</t>
              <figure> 
                <artwork><![CDATA[
                        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 Payload  |C|L| RESERVED  |         Payload Length        
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      continued...                 |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   
                  ]]></artwork>
              </figure>
              <t> The two changes are the addition of the L (or  Large) bit, and the change in the length of the 
                Payload Length field.  When the L bit is set, the Payload Length field is 4 bytes long. When the L bit 
                is zero, the Payload Length field is 2 bytes long, just as in RFC 7296.</t>
              <t> Upon receiving a payload with the Large bit set, the receiver MUST verify that the remaining length
                of the packet is sufficient for the payload length promised in the Payload Length field.  If not, an 
                INVALID_SYNTAX error message type is returned. If the length is sufficient, the receiver MUST process
                the incoming payload just like any other. The receiver MUST NOT reject a payload that had the extended
                length field just because it was not needed.</t>
            </section>
            <section anchor="when-to-send" title="Sending an Extended-Length Payload">
              <t> Peers MUST NOT send an extended-length payload before receiving the LARGE_PAYLOAD_SUPPORTED status 
                type. So the IKE_SA_INIT request cannot have an extended-length payload. The IKE_SA_INIT response could 
                have such a payload, but as the fragmentation extension (<xref target="RFC7383"/>) does not apply to 
                the IKE_SA_INIT exchange, extended-length payloads that are actually long cannot be sent.  For this 
                reason and to simplify implementations, extended-length payloads MUST NOT be used in IKE_SA_INIT.</t>
              <t> If big payloads are required for the initial exchange, such as a post-quantum KE payload, 
                it is RECOMMENDED that implementations use the Intermediate Exchange (<xref target="RFC9242"/>).</t>
            </section>
        </section>
        <section anchor="iana" title="IANA Considerations">
            <t> IANA is requested to assign a Notify Message Type from the status types registry with name 
              LARGE_PAYLOAD_SUPPORTED and this document as reference.</t>
        </section>
        <section anchor="sec" title="Security Considerations">
            <t> The extension described in this document allows larger payloads to be sent within the IKEv2 protocol.
              Care must be taken when updating existing implementation to remove assumptions about the length of 
              payloads and to check inputs in ways that were not necessary before.</t>
            <t> Similarly, assumptions about the amount of content that fits in a single payload need to be revised. 
              For example, a DELETE payload without an extended length can hold up to 16,382 SPIs. This is no longer
              true with an extended length payload, and it can reach 65,535 SPIs and a total length of 262,150 
              bytes. Implementations may still impose so-called "sanity" limits on input and choose to reject payloads
              with an unreasonable amount of data. This is no different from RFC 7296.</t>
            <t> Other than such software issues, this extension does not provide the IKEv2 implementation with any new 
              kind of data, and the existing considerations for <xref target="RFC7296"/>, <xref target="RFC7383"/>, and
              <xref target="RFC9242"/> still apply and are sufficient.</t> 
        </section>
        <section title="Acknowledgements">
            <t> The idea for writing this came from reading the document proposing an alternative solution, <xref 
              target="I-D.tjhai-ikev2-beyond-64k-limit" />. I preferred a solution that does not involve yet another layer 
              of fragmentation, because with fragmenting the individual payloads into smaller payloads, the 
              fragmentation of the entire IKE message using <xref target="RFC7383"/> is still required.</t>
        </section>
    </middle>
    <back>
        <references title="Normative References">
            &RFC2119;
            &RFC8174;
            &RFC7296;
            &RFC7383;
        </references>
        <references title="Informative References">
            &RFC9242;
            &RFC9329;
            &I-D.tjhai-ikev2-beyond-64k-limit;
            &I-D.josefsson-mceliece;
        </references>
    </back>
</rfc>
