<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE rfc SYSTEM "rfc2629.dtd">

<rfc category="std" ipr="trust200902" updates="7296, 7815"  docName="draft-ietf-ipsecme-ikev2-prf-plus-02">

<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>

<?rfc toc="yes" ?>
<?rfc symrefs="yes" ?>
<?rfc sortrefs="no"?>
<?rfc iprnotified="no" ?>
<?rfc strict="yes" ?>

    <front>
        <title abbrev="Variable-Length Output PRFs in IKEv2">Use of Variable-Length Output Pseudo-Random Functions (PRFs) in the Internet Key Exchange Protocol Version 2 (IKEv2)</title>
        <author initials='V.' surname="Smyslov" fullname='Valery Smyslov'>
            <organization>ELVIS-PLUS</organization>
            <address>
                <postal>
                    <street>PO Box 81</street>
                    <city>Moscow (Zelenograd)</city>
                    <code>124460</code>
                    <country>RU</country>
                </postal>
                <phone>+7 495 276 0211</phone>
                <email>svan@elvis.ru</email>
            </address>
        </author>
        <date/>


        <abstract>
            <t> This document specifies the use of variable-length output Pseudo-Random Functions (PRFs) 
            in the Internet Key Exchange Protocol Version 2 (IKEv2). Current IKEv2 specification relies
            on traditional PRFs with fixed output length for key derivation and uses iterative application of a PRF (called "prf+")
            in cases when longer output is required. Appearance of PRFs that can output as much 
            bits as requested allows to streamline the key derivation functions of IKEv2.
            </t>

            <t> This document updates RFC 7296 and RFC 7815 for the cases when variable-length output 
            Pseudo-Random Functions are used in IKEv2 and its extensions.
            </t>
        </abstract>
    </front>

    <middle>
        <section title="Introduction">
            <t> The Internet Key Exchange protocol version 2 (IKEv2) <xref target="RFC7296" /> is used 
            in the IP Security (IPsec) architecture for the Security Association (SA) parameters negotiation
            and for establishing an authenticated shared secret. As part of the SA parameters negotiation
            a Pseudo-Random Function (PRF) is agreed upon. Keying materials for established
            SAs are then derived from the shared secret using the negotiated PRF.
            </t>

            <t> For the purpose of deriving variable-size keying material to accomodate the use of cryptographic
            algorithms with different properties, a construction called "prf+" is used in IKEv2. This construction 
            servers the role of a Key Deriation Function (KDF) in IKEv2 and is defined
            in Section 2.13 of IKEv2 <xref target="RFC7296" /> (also repeated unchanged in Section 2.1 of Minimal IKEv2 <xref target="RFC7815" />) 
            and is provided here for convenience:

<figure align="center">
    <artwork align="left"><![CDATA[
   prf+ (K,S) = T1 | T2 | T3 | T4 | ...

   where:
   T1 = prf (K, S | 0x01)
   T2 = prf (K, T1 | S | 0x02)
   T3 = prf (K, T2 | S | 0x03)
   T4 = prf (K, T3 | S | 0x04)
]]></artwork>
</figure>

            This construction allows to get more output bits than the output length of the negotiated PRF
            by applying it iteratively.
            </t>

            <t> Modern achievements in cryptography bore new class of cryptographic primitives - 
            PRFs with variable-length output. These functions are able to produce as many pseudorandom bits as requested in one call.
            One example of such PRFs is KMAC <xref target="SP-800-185" />.
            </t>

            <t> When variable-length output PRFs are considered for the use in IKEv2 for the key derivation purposes,
            it is possible either to keep the prf+ construction always performung exactly one iteration with the PRF producing the needed number 
            of output bits at once, or to remove the prf+ construction completely and replace it with a single call to the PRF, that would
            also produce the needed number of output bits. This is discussed in Section 9.2 of <xref target="I-D.ietf-ipsecme-sha3" /> for the case of KMAC.
            </t>

            <t> Since it is envisioned that more variable-length output PRFs could appear in future, 
            this specification aims to establish a uniform approach for using them in IKEv2.
            This document updates IKEv2 by changing the definition
            of "prf+" given in in Section 2.13 of <xref target="RFC7296" /> for the case
            when when variable-length output Pseudo-Random Functions are employed.
            </t>
        </section>

        <section anchor="mustshouldmay" title="Terminology and Notation">
            <t> The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", 
            "RECOMMENDED", "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>
        </section>

        <section anchor="prfplus" title="Use of Variable-Length Output PRFs in IKEv2">
            <t> When new Pseudo-Random Function is defined for IKEv2, the corresponding document 
            describing its use in the protocol must specify whether this PRF has fixed or variable output length.
            For a variable-length output PRF the document must specify a preferred key size
            if this PRF has variable-size key.
            </t>

            <t> When a variable-length output Pseudo-Random Function is negotiated in IKEv2 by means of the 
            "Pseudo-random Function (PRF)" transform, then the following rules have affect.
            </t>

            <ol>
                <li><t> When such a PRF is used in the context of "prf", then its output length is set
                to the preferred key size of this PRF.
                </t></li>

                <li><t> When such a PRF is used in the context of "prf+", then the construction defined in Section 2.13 of <xref target="RFC7296" /> is replaced 
                with the following definition:

<figure align="center">
    <artwork align="left"><![CDATA[
   prf+ (K,S) = prf (K, S | 0x01)
]]></artwork>
</figure>

                The output length of the PRF is set to the required number of pseudorandom bits in the current context. 
                </t></li>

                <li><t> If an API to such a PRF includes additional inputs (like "customization string" for KMAC),
                then these inputs are not used (e.g. set to the empty string).
                </t></li>
            </ol>

            <t> These rules are applied to every use of "prf" and "prf+" in IKEv2, which include not only to the core IKEv2 protocol
            defined in <xref target="RFC7296" />, but also to its current and future extensions where "prf" or "prf+" are called 
            (like <xref target="RFC5106" />, <xref target="RFC5723" />, <xref target="RFC6617" />, <xref target="RFC6628" />, <xref target="RFC6631" />, 
            <xref target="RFC8784" />, <xref target="RFC9242" />, <xref target="RFC9370" />, <xref target="RFC9838" />, <xref target="RFC9867" />).
            </t>

            <aside>
                <t> These changes in the use of PRFs with variable-length output in IKEv2 do not affect the process of code point allocation 
                for these PRFs under the "Transform Type 2 - Pseudorandom Function Transform IDs" IANA registry <xref target="IKEV2-IANA-PRF" />.
                </t>
            </aside>

        </section>

        <section anchor="security" title="Security Considerations">
            <t> It is assumed that variable-output length PRFs are cryptographically strong and do not decrease
            the entropy of the input key if the output length is at least the size of the key.
            </t>
        </section>

        <section anchor="iana" title="IANA Considerations">
            <t> This specification makes no request to IANA.
            </t>
        </section>

    </middle>

    <back>
        <references title='Normative References'>
            <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml" ?>
            <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml" ?>
            <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7296.xml" ?>
        </references>

        <references title='Informative References'>
            <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7815.xml" ?>
            <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5106.xml" ?>
            <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5723.xml" ?>
            <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6617.xml" ?>
            <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6628.xml" ?>
            <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6631.xml" ?>
            <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8784.xml" ?>
            <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.9242.xml" ?>
            <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.9370.xml" ?>
            <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.9838.xml" ?>
            <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.9867.xml" ?>
            <reference anchor="IKEV2-IANA-PRF" target="https://www.iana.org/assignments/ikev2-parameters/ikev2-parameters.xhtml#ikev2-parameters-6">
                <front>
                    <title>Internet Key Exchange Version 2 (IKEv2) Parameters, Transform Type 2 - Pseudorandom Function Transform IDs</title>
                    <author>
                        <organization>IANA</organization>
                    </author>
                    <date />
                </front>
            </reference>
            <reference anchor="SP-800-185">
              <front>
                <title>SHA-3 derived functions: cSHAKE, KMAC, TupleHash and ParallelHash</title>
                <author fullname="John Kelsey" initials="J." surname="Kelsey">
                  <organization/>
                </author>
                <author fullname="Shu-jen Change" initials="S." surname="Change">
                  <organization/>
                </author>
                <author fullname="Ray Perlner" initials="R." surname="Perlner">
                  <organization/>
                </author>
                <date month="December" year="2016"/>
              </front>
              <seriesInfo name="DOI" value="10.6028/nist.sp.800-185"/>
            <refcontent>National Institute of Standards and Technology</refcontent>
            </reference>

            <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-ipsecme-sha3.xml" ?>
        </references>

        <section title="Acknowledgements" numbered="false">
            <t> This document was inspired  by draft-salter-ipsecme-sha3 "Use of SHA-3 in the Internet Key Exchange Protocol Version 2 (IKEv2) and IPsec".
            Wang Xi and Thom Wiggers made security-relevant proposals regarding cryptographic separation of "prf" and "prf+".
            </t>
        </section>

    </back>
</rfc>


