<?xml version="1.0" encoding="UTF-8"?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" category="std" consensus="true" docName="draft-sipos-cose-gmac-00" ipr="trust200902" submissionType="IETF" symRefs="true" tocInclude="true" version="3" xml:lang="en">
  <front>
    <title abbrev="COSE GMAC">AES-GMAC for COSE</title>
    <seriesInfo name="Internet-Draft" value="draft-sipos-cose-gmac-00"/>
    <author fullname="Brian Sipos" initials="B." surname="Sipos">
      <organization abbrev="JHU/APL">The Johns Hopkins University Applied Physics Laboratory</organization>
      <address>
        <postal>
          <street>11100 Johns Hopkins Rd.</street>
          <city>Laurel</city>
          <region>MD</region>
          <code>20723</code>
          <country>United States of America</country>
        </postal>
        <email>brian.sipos+ietf@gmail.com</email>
      </address>
    </author>
    <date/>
    <area>Security</area>
    <workgroup>CBOR Object Signing and Encryption</workgroup>
    <keyword>GMAC</keyword>
    <abstract>
      <t>
This document registers COSE algorithm code points for using the Advanced Encryption Standard (AES) in Galois/Counter Mode (GCM) to generate a Message Authentication Code (AES-GMAC).
The security strength provided by these registrations is identical to existing COSE registrations for AES-GCM authenticated encryption.
      </t>
    </abstract>
  </front>
  <middle>
    <section>
      <name>Introduction</name>
      <t>
The base COSE specification <xref target="RFC9052"/> defines a container for Message Authentication Code (MAC) parameters and results.
This container is parameterized on an algorithm identifier used to verify the MAC result.
This document defines new fully specified algorithm identifiers for the use of Advanced Encryption Standard (AES) in Galois/Counter Mode (GCM) to generate a MAC (AES-GMAC) as defined in <xref target="NIST-SP800-38D"/>.
      </t>
      <t>
Unlike the use of AES-GMAC in CMS <xref target="RFC9044"/> and IPsec <xref target="RFC4543"/>, the COSE algorithm identifiers are "fully specified" meaning they rely on no extra parameters (<em>e.g.</em>, tag length) to determine their exact operation.
      </t>
      <section>
        <name>Scope</name>
        <t>
This document does not define any new algorithms it only defines code points in a COSE registry so that the AES-GMAC can be used in that security environment with specific combinations of parameters.
        </t>
        <t>
To avoid confusion, the AES-GMAC algorithm family specified in this document is unrelated to the "AES-MAC" algorithm family from <xref section="3.2" target="RFC9053"/>.
	</t>
      </section>
      <section>
        <name>Terminology</name>
        <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>
      </section>
    </section>
    <section anchor="sec-algo-gmac">
      <name>The AES-GMAC Family</name>
      <t>
While the general GMAC algorithm can be used with any underlying authenticated encryption with additional data (AEAD) block cipher, this document focuses on its use with the AES-GCM cipher.
      </t>
      <t>
The AES-GMAC defined in <xref target="NIST-SP800-38D"/> has a set of parameters associated with its use.
For the sake of adhering to COSE best practice about fully specifying what gets assigned an "algorithm" code point, AES-GMAC will be treated as an <em>algorithm family</em> with a single code point referring to the algorithm itself along with a specific set of parameter values.
      </t>
      <t>
The parameters associated with AES-GMAC are: key length and tag length.
This document restricts the allocated code points to the commonly used key lengths of 128, 192, and 256-bits, a fixed IV length of 96 bits (the recommended default), and restricts the use of a single tag length of 128 bits, which happens to be the longest possible tag length, as indicated in <xref target="tab-fam-aesgmac"/>.
Future allocations can define the use of AES-GMAC with shortened tag lengths.
      </t>
      <t>
One required input for AES-GMAC is an initialization vector (IV) which is already provided by the header parameter "IV" from the "COSE Header Parameters" registry of <xref target="IANA-COSE"/>.
The use of the AES-GMAC algorithms in COSE <bcp14>SHALL</bcp14> be combined with the IV header parameter in the same COSE layer.
A valid IV for these algorithms <bcp14>SHALL</bcp14> be exactly 96 bits (12 octets) in length.
The combination of key and IV <bcp14>SHALL</bcp14> be unique for each created MAC.
The IV generation mechanism <bcp14>SHALL</bcp14> be deterministic (not random).
The specifics of that mechanism are left to an implementation.
      </t>
      <t>
These IV and tag lengths are consistent with the COSE use of AES-GCM encryption in <xref section="4.1" target="RFC9053"/>.
      </t>
      <table anchor="tab-fam-aesgmac">
        <name>Registered AES-GMAC combinations</name>
        <thead>
          <tr>
            <th>COSE Value</th>
            <th>Algorithm</th>
            <th>Key Length</th>
            <th>IV Length</th>
            <th>Tag Length</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>
              <cref>TBA1</cref>
            </td>
            <td>AES-GMAC</td>
            <td>128</td>
            <td>96</td>
            <td>128</td>
          </tr>
          <tr>
            <td>
              <cref>TBA2</cref>
            </td>
            <td>AES-GMAC</td>
            <td>192</td>
            <td>96</td>
            <td>128</td>
          </tr>
          <tr>
            <td>
              <cref>TBA3</cref>
            </td>
            <td>AES-GMAC</td>
            <td>256</td>
            <td>96</td>
            <td>128</td>
          </tr>
        </tbody>
      </table>
      <t>
Implementations creating and validating AES-GMAC values <bcp14>SHALL</bcp14> validate that the key type, key length, and algorithm are correct and appropriate for the entities involved.
	</t>
      <t>
When using a COSE key for these algorithms, the following checks are made:
	</t>
      <ul>
        <li>The "kty" field <bcp14>MUST</bcp14> be present.</li>
        <li>The "kty" field <bcp14>MUST</bcp14> be "Symmetric".</li>
        <li>If the "alg" field is present, it <bcp14>MUST</bcp14> match the algorithm being used.</li>
        <li>If the "key_ops" field is present, it <bcp14>MUST</bcp14> include "MAC create" when creating an authentication tag.</li>
        <li>If the "key_ops" field is present, it <bcp14>MUST</bcp14> include "MAC verify" when verifying an authentication tag.</li>
      </ul>
    </section>
    <section>
      <name>Security Considerations</name>
      <t>
This document does not define any new modes of operation for the GMAC algorithm, and so does not introduce any new security considerations.
All of the applicable considerations from <xref target="NIST-SP800-38D"/> apply when the algorithm is used in COSE.
      </t>
      <t>
The requirement to use non-random IV generation in <xref target="sec-algo-gmac"/> is meant to satisfy the critical constraint on GMAC (and nonce-based MACs generally) described in Chapter 10 of <xref target="PR2011"/> to guarantee the uniqueness of the combination of key and IV.
Whether the mechanism is a simple counter, a determistic PRF, or something else does not affect the constraint to be non-random.
      </t>
    </section>
    <section anchor="sec-iana">
      <name>IANA Considerations</name>
      <t>
This section provides guidance to the Internet Assigned Numbers Authority (IANA) regarding registration of code points in accordance with BCP 26 <xref target="RFC1155"/>.
      </t>
      <section anchor="sec-iana-cose">
        <name>COSE Algorithms</name>
        <t>
A new set of entries have been added to the "COSE Algorithms" registry <xref target="IANA-COSE"/> with the following parameters.
        </t>
        <section>
          <name>AES-GMAC 128/128</name>
          <dl newline="false">
            <dt>Name:</dt>
            <dd>AES-GMAC 128/128</dd>
            <dt>Value:</dt>
            <dd>
              <cref>TBA1</cref>
            </dd>
            <dt>Description:</dt>
            <dd>AES-GMAC with 128-bit key and 128-bit tag</dd>
            <dt>Capabilities:</dt>
            <dd>[kty]</dd>
            <dt>Change controller:</dt>
            <dd>IESG</dd>
            <dt>Reference:</dt>
            <dd>[This document]</dd>
            <dt>Recommended:</dt>
            <dd>Yes</dd>
          </dl>
        </section>
        <section>
          <name>AES-GMAC 192/128</name>
          <dl newline="false">
            <dt>Name:</dt>
            <dd>AES-GMAC 192/128</dd>
            <dt>Value:</dt>
            <dd>
              <cref>TBA2</cref>
            </dd>
            <dt>Description:</dt>
            <dd>AES-GMAC with 192-bit key and 128-bit tag</dd>
            <dt>Capabilities:</dt>
            <dd>[kty]</dd>
            <dt>Change controller:</dt>
            <dd>IESG</dd>
            <dt>Reference:</dt>
            <dd>[This document]</dd>
            <dt>Recommended:</dt>
            <dd>Yes</dd>
          </dl>
        </section>
        <section>
          <name>AES-GMAC 256/128</name>
          <dl newline="false">
            <dt>Name:</dt>
            <dd>AES-GMAC 256/128</dd>
            <dt>Value:</dt>
            <dd>
              <cref>TBA3</cref>
            </dd>
            <dt>Description:</dt>
            <dd>AES-GMAC with 256-bit key and 128-bit tag</dd>
            <dt>Capabilities:</dt>
            <dd>[kty]</dd>
            <dt>Change controller:</dt>
            <dd>IESG</dd>
            <dt>Reference:</dt>
            <dd>[This document]</dd>
            <dt>Recommended:</dt>
            <dd>Yes</dd>
          </dl>
        </section>
      </section>
    </section>
  </middle>
  <back>
    <displayreference target="NIST-SP800-38D" to="SP800-38D"/>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <reference anchor="IANA-COSE" target="https://www.iana.org/assignments/cose/">
          <front>
            <title>CBOR Object Signing and Encryption (COSE)</title>
            <author>
              <organization>IANA</organization>
            </author>
            <date/>
          </front>
        </reference>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.9052.xml"/>
        <reference anchor="NIST-SP800-38D" target="https://nvlpubs.nist.gov/nistpubs/legacy/sp/nistspecialpublication800-38d.pdf">
          <front>
            <title>Recommendation for Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC</title>
            <author>
              <organization>National Institute of Standards and Technology</organization>
            </author>
            <date month="November" year="2007"/>
          </front>
        </reference>
      </references>
      <references>
        <name>Informative References</name>
        <reference anchor="PR2011" target="https://www.cs.ucdavis.edu/~rogaway/papers/modes.pdf">
          <front>
            <title>Evaluation of Some Blockcipher Modes of Operation</title>
            <author fullname="Phillip Rogaway">
              <organization>University of California, Davis</organization>
              <address>
                <email>rogaway@cs.ucdavis.edu</email>
              </address>
            </author>
            <date day="10" month="February" year="2011"/>
          </front>
        </reference>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.1155.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.4543.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.9044.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.9053.xml"/>
      </references>
    </references>
  </back>
</rfc>
