<?xml version='1.0' encoding='utf-8'?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" version="3" category="info" docName="draft-yang-tls-tls13-sm-suites-06" indexInclude="true" ipr="trust200902" number="8998" prepTime="2021-03-10T12:16:02" scripts="Common,Latin" sortRefs="true" submissionType="independent" symRefs="true" tocDepth="3" tocInclude="true" xml:lang="en">
  <link href="https://datatracker.ietf.org/doc/draft-yang-tls-tls13-sm-suites-06" rel="prev"/>
  <link href="https://dx.doi.org/10.17487/rfc8998" rel="alternate"/>
  <link href="urn:issn:2070-1721" rel="alternate"/>
  <front>
    <title abbrev="SM Cipher Suites for TLS 1.3">ShangMi (SM) Cipher Suites for TLS 1.3</title>
    <seriesInfo name="RFC" value="8998" stream="independent"/>
    <author initials="P." surname="Yang" fullname="Paul Yang">
      <organization showOnFrontPage="true">Ant Group</organization>
      <address>
        <postal>
          <street>No. 77 Xueyuan Road</street>
          <city>Hangzhou</city>
          <code>310000</code>
          <country>China</country>
        </postal>
        <phone>+86-571-2688-8888</phone>
        <email>kaishen.yy@antfin.com</email>
      </address>
    </author>
    <date month="03" year="2021"/>
    <area>Security</area>
    <workgroup>TLS</workgroup>
    <keyword>cryptography</keyword>
    <keyword>encryption</keyword>
    <keyword>authentication</keyword>
    <keyword>network security</keyword>
    <abstract pn="section-abstract">
      <t indent="0" pn="section-abstract-1">This document specifies how to use the ShangMi (SM) cryptographic
algorithms with Transport Layer Security (TLS) protocol version 1.3.</t>
      <t indent="0" pn="section-abstract-2">The use of these algorithms with TLS 1.3 is not endorsed by the
IETF.  The SM algorithms are becoming mandatory in China, so
this document provides a description of how to use the SM algorithms
with TLS 1.3 and specifies a profile of TLS 1.3 so that
implementers can produce interworking
implementations.</t>
    </abstract>
    <boilerplate>
      <section anchor="status-of-memo" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.1">
        <name slugifiedName="name-status-of-this-memo">Status of This Memo</name>
        <t indent="0" pn="section-boilerplate.1-1">
            This document is not an Internet Standards Track specification; it is
            published for informational purposes.
        </t>
        <t indent="0" pn="section-boilerplate.1-2">
            This is a contribution to the RFC Series, independently of any
            other RFC stream.  The RFC Editor has chosen to publish this
            document at its discretion and makes no statement about its value
            for implementation or deployment.  Documents approved for
            publication by the RFC Editor are not candidates for any level of
            Internet Standard; see Section 2 of RFC 7841.
        </t>
        <t indent="0" pn="section-boilerplate.1-3">
            Information about the current status of this document, any
            errata, and how to provide feedback on it may be obtained at
            <eref target="https://www.rfc-editor.org/info/rfc8998" brackets="none"/>.
        </t>
      </section>
      <section anchor="copyright" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.2">
        <name slugifiedName="name-copyright-notice">Copyright Notice</name>
        <t indent="0" pn="section-boilerplate.2-1">
            Copyright (c) 2021 IETF Trust and the persons identified as the
            document authors. All rights reserved.
        </t>
        <t indent="0" pn="section-boilerplate.2-2">
            This document is subject to BCP 78 and the IETF Trust's Legal
            Provisions Relating to IETF Documents
            (<eref target="https://trustee.ietf.org/license-info" brackets="none"/>) in effect on the date of
            publication of this document. Please review these documents
            carefully, as they describe your rights and restrictions with
            respect to this document.
        </t>
      </section>
    </boilerplate>
    <toc>
      <section anchor="toc" numbered="false" removeInRFC="false" toc="exclude" pn="section-toc.1">
        <name slugifiedName="name-table-of-contents">Table of Contents</name>
        <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1">
          <li pn="section-toc.1-1.1">
            <t indent="0" keepWithNext="true" pn="section-toc.1-1.1.1"><xref derivedContent="1" format="counter" sectionFormat="of" target="section-1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-introduction">Introduction</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.1.2">
              <li pn="section-toc.1-1.1.2.1">
                <t indent="0" keepWithNext="true" pn="section-toc.1-1.1.2.1.1"><xref derivedContent="1.1" format="counter" sectionFormat="of" target="section-1.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-the-sm-algorithms">The SM Algorithms</xref></t>
              </li>
              <li pn="section-toc.1-1.1.2.2">
                <t indent="0" keepWithNext="true" pn="section-toc.1-1.1.2.2.1"><xref derivedContent="1.2" format="counter" sectionFormat="of" target="section-1.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-terminology">Terminology</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.2">
            <t indent="0" pn="section-toc.1-1.2.1"><xref derivedContent="2" format="counter" sectionFormat="of" target="section-2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-algorithm-identifiers">Algorithm Identifiers</xref></t>
          </li>
          <li pn="section-toc.1-1.3">
            <t indent="0" pn="section-toc.1-1.3.1"><xref derivedContent="3" format="counter" sectionFormat="of" target="section-3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-algorithm-definitions">Algorithm Definitions</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.3.2">
              <li pn="section-toc.1-1.3.2.1">
                <t indent="0" pn="section-toc.1-1.3.2.1.1"><xref derivedContent="3.1" format="counter" sectionFormat="of" target="section-3.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-tls-versions">TLS Versions</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.2">
                <t indent="0" pn="section-toc.1-1.3.2.2.1"><xref derivedContent="3.2" format="counter" sectionFormat="of" target="section-3.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-authentication">Authentication</xref></t>
                <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.3.2.2.2">
                  <li pn="section-toc.1-1.3.2.2.2.1">
                    <t indent="0" pn="section-toc.1-1.3.2.2.2.1.1"><xref derivedContent="3.2.1" format="counter" sectionFormat="of" target="section-3.2.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-sm2-signature-scheme">SM2 Signature Scheme</xref></t>
                  </li>
                </ul>
              </li>
              <li pn="section-toc.1-1.3.2.3">
                <t indent="0" pn="section-toc.1-1.3.2.3.1"><xref derivedContent="3.3" format="counter" sectionFormat="of" target="section-3.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-key-exchange">Key Exchange</xref></t>
                <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.3.2.3.2">
                  <li pn="section-toc.1-1.3.2.3.2.1">
                    <t indent="0" pn="section-toc.1-1.3.2.3.2.1.1"><xref derivedContent="3.3.1" format="counter" sectionFormat="of" target="section-3.3.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-hello-messages">Hello Messages</xref></t>
                  </li>
                  <li pn="section-toc.1-1.3.2.3.2.2">
                    <t indent="0" pn="section-toc.1-1.3.2.3.2.2.1"><xref derivedContent="3.3.2" format="counter" sectionFormat="of" target="section-3.3.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-certificaterequest">CertificateRequest</xref></t>
                  </li>
                  <li pn="section-toc.1-1.3.2.3.2.3">
                    <t indent="0" pn="section-toc.1-1.3.2.3.2.3.1"><xref derivedContent="3.3.3" format="counter" sectionFormat="of" target="section-3.3.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-certificate">Certificate</xref></t>
                  </li>
                  <li pn="section-toc.1-1.3.2.3.2.4">
                    <t indent="0" pn="section-toc.1-1.3.2.3.2.4.1"><xref derivedContent="3.3.4" format="counter" sectionFormat="of" target="section-3.3.4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-certificateverify">CertificateVerify</xref></t>
                  </li>
                </ul>
              </li>
              <li pn="section-toc.1-1.3.2.4">
                <t indent="0" pn="section-toc.1-1.3.2.4.1"><xref derivedContent="3.4" format="counter" sectionFormat="of" target="section-3.4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-key-scheduling">Key Scheduling</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.5">
                <t indent="0" pn="section-toc.1-1.3.2.5.1"><xref derivedContent="3.5" format="counter" sectionFormat="of" target="section-3.5"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-cipher">Cipher</xref></t>
                <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.3.2.5.2">
                  <li pn="section-toc.1-1.3.2.5.2.1">
                    <t indent="0" pn="section-toc.1-1.3.2.5.2.1.1"><xref derivedContent="3.5.1" format="counter" sectionFormat="of" target="section-3.5.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-aead_sm4_gcm">AEAD_SM4_GCM</xref></t>
                  </li>
                  <li pn="section-toc.1-1.3.2.5.2.2">
                    <t indent="0" pn="section-toc.1-1.3.2.5.2.2.1"><xref derivedContent="3.5.2" format="counter" sectionFormat="of" target="section-3.5.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-aead_sm4_ccm">AEAD_SM4_CCM</xref></t>
                  </li>
                </ul>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.4">
            <t indent="0" pn="section-toc.1-1.4.1"><xref derivedContent="4" format="counter" sectionFormat="of" target="section-4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-iana-considerations">IANA Considerations</xref></t>
          </li>
          <li pn="section-toc.1-1.5">
            <t indent="0" pn="section-toc.1-1.5.1"><xref derivedContent="5" format="counter" sectionFormat="of" target="section-5"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-security-considerations">Security Considerations</xref></t>
          </li>
          <li pn="section-toc.1-1.6">
            <t indent="0" pn="section-toc.1-1.6.1"><xref derivedContent="6" format="counter" sectionFormat="of" target="section-6"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-references">References</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.6.2">
              <li pn="section-toc.1-1.6.2.1">
                <t indent="0" pn="section-toc.1-1.6.2.1.1"><xref derivedContent="6.1" format="counter" sectionFormat="of" target="section-6.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-normative-references">Normative References</xref></t>
              </li>
              <li pn="section-toc.1-1.6.2.2">
                <t indent="0" pn="section-toc.1-1.6.2.2.1"><xref derivedContent="6.2" format="counter" sectionFormat="of" target="section-6.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-informative-references">Informative References</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.7">
            <t indent="0" pn="section-toc.1-1.7.1"><xref derivedContent="Appendix A" format="default" sectionFormat="of" target="section-appendix.a"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-test-vectors">Test Vectors</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.7.2">
              <li pn="section-toc.1-1.7.2.1">
                <t indent="0" pn="section-toc.1-1.7.2.1.1"><xref derivedContent="A.1" format="counter" sectionFormat="of" target="section-a.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-sm4-gcm-test-vectors">SM4-GCM Test Vectors</xref></t>
              </li>
              <li pn="section-toc.1-1.7.2.2">
                <t indent="0" pn="section-toc.1-1.7.2.2.1"><xref derivedContent="A.2" format="counter" sectionFormat="of" target="section-a.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-sm4-ccm-test-vectors">SM4-CCM Test Vectors</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.8">
            <t indent="0" pn="section-toc.1-1.8.1"><xref derivedContent="" format="none" sectionFormat="of" target="section-appendix.b"/><xref derivedContent="" format="title" sectionFormat="of" target="name-contributors">Contributors</xref></t>
          </li>
          <li pn="section-toc.1-1.9">
            <t indent="0" pn="section-toc.1-1.9.1"><xref derivedContent="" format="none" sectionFormat="of" target="section-appendix.c"/><xref derivedContent="" format="title" sectionFormat="of" target="name-authors-address">Author's Address</xref></t>
          </li>
        </ul>
      </section>
    </toc>
  </front>
  <middle>
    <section anchor="intro" numbered="true" toc="include" removeInRFC="false" pn="section-1">
      <name slugifiedName="name-introduction">Introduction</name>
      <t indent="0" pn="section-1-1">This document describes two new cipher suites, a signature algorithm and a
key exchange mechanism for the Transport Layer
Security (TLS) protocol version 1.3 (TLS 1.3) (<xref target="RFC8446" format="default" sectionFormat="of" derivedContent="RFC8446"/>).
These all utilize several ShangMi (SM) cryptographic algorithms
to fulfill the authentication and confidentiality requirements of TLS 1.3.
      The new cipher suites are as follows (see also <xref target="proposed" format="default" sectionFormat="of" derivedContent="Section 2"/>):</t>
      <sourcecode name="" type="" markers="false" pn="section-1-2">
   CipherSuite TLS_SM4_GCM_SM3 = { 0x00, 0xC6 };
   CipherSuite TLS_SM4_CCM_SM3 = { 0x00, 0xC7 };
</sourcecode>
      <t indent="0" pn="section-1-3">For a more detailed
introduction to SM cryptographic algorithms, please see <xref target="sm-algos" format="default" sectionFormat="of" derivedContent="Section 1.1"/>.
These cipher suites follow the TLS 1.3 requirements. Specifically,
all the cipher suites use SM4 in either Galois/Counter (GCM) mode
or Counter with CBC-MAC (CCM) mode to meet the needs of TLS 1.3 to have an encryption algorithm that is Authenticated Encryption with Associated Data (AEAD) capable.
The key exchange mechanism utilizes Elliptic Curve Diffie-Hellman
Ephemeral (ECDHE) over the SM2 elliptic curve, and the signature algorithm combines
the SM3 hash function and the SM2 elliptic curve signature scheme.</t>
      <t indent="0" pn="section-1-4">For details about how these mechanisms negotiate shared encryption
keys, authenticate the peer(s), and protect the record structure, please see
<xref target="definitions" format="default" sectionFormat="of" derivedContent="Section 3"/>.</t>
      <t indent="0" pn="section-1-5">The cipher suites, signature algorithm, and key exchange mechanism
defined in this document are not recommended by the IETF. The SM
algorithms are becoming mandatory in China, so this document
provides a description of how to use them with TLS 1.3 and specifies
a profile of TLS 1.3 so that implementers can produce interworking
implementations.</t>
      <section anchor="sm-algos" numbered="true" toc="include" removeInRFC="false" pn="section-1.1">
        <name slugifiedName="name-the-sm-algorithms">The SM Algorithms</name>
        <t indent="0" pn="section-1.1-1">Several different SM
cryptographic algorithms are used to integrate with TLS 1.3,
including SM2 for authentication, SM4 for
encryption, and SM3 as the hash function.</t>
        <t indent="0" pn="section-1.1-2">SM2 is a set of cryptographic algorithms based on elliptic curve cryptography, including a digital
        signature, public key encryption and key exchange scheme.

	In this document, only
the SM2 digital signature algorithm and basic key exchange scheme are involved, which have already been added
to ISO/IEC 14888-3:2018 <xref target="ISO-SM2" format="default" sectionFormat="of" derivedContent="ISO-SM2"/> (as well as to <xref target="GBT.32918.2-2016" format="default" sectionFormat="of" derivedContent="GBT.32918.2-2016"/>).
SM4 is a block cipher defined in <xref target="GBT.32907-2016" format="default" sectionFormat="of" derivedContent="GBT.32907-2016"/> and now is being standardized
by ISO to ISO/IEC 18033-3:2010 <xref target="ISO-SM4" format="default" sectionFormat="of" derivedContent="ISO-SM4"/>. SM3 is a hash function that produces an output of 256 bits. SM3 has already been accepted by ISO in
ISO/IEC 10118-3:2018 <xref target="ISO-SM3" format="default" sectionFormat="of" derivedContent="ISO-SM3"/> and has also been described by <xref target="GBT.32905-2016" format="default" sectionFormat="of" derivedContent="GBT.32905-2016"/>.</t>
      </section>
      <section anchor="term" numbered="true" toc="include" removeInRFC="false" pn="section-1.2">
        <name slugifiedName="name-terminology">Terminology</name>
        <t indent="0" pn="section-1.2-1">
    The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
    "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
    described in BCP 14 <xref target="RFC2119" format="default" sectionFormat="of" derivedContent="RFC2119"/> <xref target="RFC8174" format="default" sectionFormat="of" derivedContent="RFC8174"/> 
    when, and only when, they appear in all capitals, as shown here.
        </t>
        <t indent="0" pn="section-1.2-2">Although this document is not an IETF Standards Track publication, it
adopts the conventions for normative language to provide clarity of
instruction to the implementer and to indicate requirement levels
for compliant TLS 1.3 implementations.</t>
      </section>
    </section>
    <section anchor="proposed" numbered="true" toc="include" removeInRFC="false" pn="section-2">
      <name slugifiedName="name-algorithm-identifiers">Algorithm Identifiers</name>
      <t indent="0" pn="section-2-1">The cipher suites defined here have the following identifiers:</t>
      <sourcecode name="" type="" markers="false" pn="section-2-2">
   CipherSuite TLS_SM4_GCM_SM3 = { 0x00, 0xC6 };
   CipherSuite TLS_SM4_CCM_SM3 = { 0x00, 0xC7 };
</sourcecode>
      <t indent="0" pn="section-2-3">To accomplish a TLS 1.3 handshake, additional objects have been introduced along with
the cipher suites as follows:</t>
      <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-2-4">
        <li pn="section-2-4.1">The combination of the SM2 signature algorithm and SM3 hash function used in the Signature Algorithm
extension is defined in <xref target="RFC8446" sectionFormat="of" section="B.3.1.3" format="default" derivedLink="https://rfc-editor.org/rfc/rfc8446#appendix-B.3.1.3" derivedContent="RFC8446"/>:</li>
      </ul>
      <sourcecode name="" type="" markers="false" pn="section-2-5">
      SignatureScheme sm2sig_sm3 = { 0x0708 };
</sourcecode>
      <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-2-6">
        <li pn="section-2-6.1">The SM2 elliptic curve ID used in the Supported Groups extension is defined in <xref target="RFC8446" sectionFormat="of" section="B.3.1.4" format="default" derivedLink="https://rfc-editor.org/rfc/rfc8446#appendix-B.3.1.4" derivedContent="RFC8446"/>:</li>
      </ul>
      <sourcecode name="" type="" markers="false" pn="section-2-7">
      NamedGroup curveSM2 = { 41 };
</sourcecode>
    </section>
    <section anchor="definitions" numbered="true" toc="include" removeInRFC="false" pn="section-3">
      <name slugifiedName="name-algorithm-definitions">Algorithm Definitions</name>
      <section anchor="tls-versions" numbered="true" toc="include" removeInRFC="false" pn="section-3.1">
        <name slugifiedName="name-tls-versions">TLS Versions</name>
        <t indent="0" pn="section-3.1-1">The new cipher suites defined in this document are only applicable to TLS 1.3.
Implementations of this document <bcp14>MUST NOT</bcp14> apply these cipher suites to any older
versions of TLS.</t>
      </section>
      <section anchor="authentication" numbered="true" toc="include" removeInRFC="false" pn="section-3.2">
        <name slugifiedName="name-authentication">Authentication</name>
        <section anchor="sm2-signature-scheme" numbered="true" toc="include" removeInRFC="false" pn="section-3.2.1">
          <name slugifiedName="name-sm2-signature-scheme">SM2 Signature Scheme</name>
          <t indent="0" pn="section-3.2.1-1">The Chinese government requires the use of the SM2 signature algorithm.
This section specifies the use of the SM2 signature algorithm
	  as the authentication method for a TLS 1.3 handshake.</t>
          <t indent="0" pn="section-3.2.1-2">The SM2 signature algorithm is defined in <xref target="ISO-SM2" format="default" sectionFormat="of" derivedContent="ISO-SM2"/>. The SM2 signature algorithm is
based on elliptic curves. The SM2 signature algorithm uses a fixed elliptic curve
parameter set defined in <xref target="GBT.32918.5-2017" format="default" sectionFormat="of" derivedContent="GBT.32918.5-2017"/>. This curve is named "curveSM2" and has been assigned the value 41, as shown in <xref target="proposed" format="default" sectionFormat="of" derivedContent="Section 2"/>. Unlike other public key algorithms based on elliptic curve cryptography like the Elliptic Curve Digital Signature Algorithm (ECDSA), SM2 <bcp14>MUST NOT</bcp14> select other elliptic curves.
But it is acceptable to write test cases that use other elliptic curve parameter
sets for SM2; see Annex F.14 of <xref target="ISO-SM2" format="default" sectionFormat="of" derivedContent="ISO-SM2"/> as a reference.</t>
          <t indent="0" pn="section-3.2.1-3">Implementations of the signature scheme and key exchange mechanism defined in this document <bcp14>MUST</bcp14> conform to
what <xref target="GBT.32918.5-2017" format="default" sectionFormat="of" derivedContent="GBT.32918.5-2017"/> requires; that is to say, the only valid elliptic curve
parameter set for the SM2 signature algorithm (a.k.a. curveSM2) is defined as follows:</t>
          <dl indent="3" newline="false" spacing="normal" pn="section-3.2.1-4">
            <dt pn="section-3.2.1-4.1">curveSM2:</dt>
            <dd pn="section-3.2.1-4.2">A prime field of 256 bits.</dd>
          </dl>
          <t indent="0" pn="section-3.2.1-5">y<sup>2</sup> = x<sup>3</sup> + ax + b</t>
          <sourcecode name="" type="" markers="false" pn="section-3.2.1-6">
   p  = FFFFFFFE FFFFFFFF FFFFFFFF FFFFFFFF
        FFFFFFFF 00000000 FFFFFFFF FFFFFFFF
   a  = FFFFFFFE FFFFFFFF FFFFFFFF FFFFFFFF
        FFFFFFFF 00000000 FFFFFFFF FFFFFFFC
   b  = 28E9FA9E 9D9F5E34 4D5A9E4B CF6509A7
        F39789F5 15AB8F92 DDBCBD41 4D940E93
   n  = FFFFFFFE FFFFFFFF FFFFFFFF FFFFFFFF
        7203DF6B 21C6052B 53BBF409 39D54123
   Gx = 32C4AE2C 1F198119 5F990446 6A39C994
        8FE30BBF F2660BE1 715A4589 334C74C7
   Gy = BC3736A2 F4F6779C 59BDCEE3 6B692153
        D0A9877C C62A4740 02DF32E5 2139F0A0
</sourcecode>
          <t indent="0" pn="section-3.2.1-7">The SM2 signature algorithm requests an identifier value when generating or verifying
a signature. In all uses except when a client of a server needs to verify a peer's
SM2 certificate in the Certificate message, an implementation of this document
<bcp14>MUST</bcp14> use the following ASCII string value as the SM2 identifier when doing a
TLS 1.3 key exchange:</t>
          <sourcecode name="" type="" markers="false" pn="section-3.2.1-8">
   TLSv1.3+GM+Cipher+Suite
</sourcecode>
          <t indent="0" pn="section-3.2.1-9">If either a client or a server needs to verify the peer's SM2 certificate
contained in the Certificate message, then the following ASCII string value <bcp14>MUST</bcp14> be
used as the SM2 identifier according to <xref target="GMT.0009-2012" format="default" sectionFormat="of" derivedContent="GMT.0009-2012"/>:</t>
          <sourcecode name="" type="" markers="false" pn="section-3.2.1-10">
   1234567812345678
</sourcecode>
          <t indent="0" pn="section-3.2.1-11">Expressed as octets, this is:</t>
          <sourcecode name="" type="" markers="false" pn="section-3.2.1-12">
   0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
   0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38
</sourcecode>
          <t indent="0" pn="section-3.2.1-13">In practice, the SM2 identifier used in a certificate signature depends on the
certificate authority (CA) who signs that certificate. CAs may choose values other than the ones mentioned
above. Implementations of this document <bcp14>SHOULD</bcp14> confirm this information by themselves.</t>
        </section>
      </section>
      <section anchor="kx" numbered="true" toc="include" removeInRFC="false" pn="section-3.3">
        <name slugifiedName="name-key-exchange">Key Exchange</name>
        <section anchor="hello-messages" numbered="true" toc="include" removeInRFC="false" pn="section-3.3.1">
          <name slugifiedName="name-hello-messages">Hello Messages</name>
          <t indent="0" pn="section-3.3.1-1">The use of the algorithms defined by this document is negotiated during
the TLS handshake with information exchanged in the Hello messages.</t>
          <section anchor="clienthello" numbered="true" toc="exclude" removeInRFC="false" pn="section-3.3.1.1">
            <name slugifiedName="name-clienthello">ClientHello</name>
            <t indent="0" pn="section-3.3.1.1-1">To use the cipher suites defined by this document, a TLS 1.3 client includes
the new cipher suites in the "cipher_suites"
array of the ClientHello structure defined in <xref target="RFC8446" sectionFormat="of" section="4.1.2" format="default" derivedLink="https://rfc-editor.org/rfc/rfc8446#section-4.1.2" derivedContent="RFC8446"/>.</t>
            <t indent="0" pn="section-3.3.1.1-2">Other requirements of this TLS 1.3 profile on the extensions of
ClientHello message are as follows:</t>
            <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-3.3.1.1-3">
              <li pn="section-3.3.1.1-3.1">For the supported_groups extension, "curveSM2" <bcp14>MUST</bcp14> be included.</li>
              <li pn="section-3.3.1.1-3.2">For the signature_algorithms extension, "sm2sig_sm3" <bcp14>MUST</bcp14> be included.</li>
              <li pn="section-3.3.1.1-3.3">For the signature_algorithms_cert extension (if present), "sm2sig_sm3" <bcp14>MUST</bcp14> be included.</li>
              <li pn="section-3.3.1.1-3.4">For the key_share extension, a KeyShareEntry for the "curveSM2" group <bcp14>MUST</bcp14> be included.</li>
            </ul>
          </section>
          <section anchor="serverhello" numbered="true" toc="exclude" removeInRFC="false" pn="section-3.3.1.2">
            <name slugifiedName="name-serverhello">ServerHello</name>
            <t indent="0" pn="section-3.3.1.2-1">If a TLS 1.3 server receives a ClientHello message containing the algorithms
defined in this document, it <bcp14>MAY</bcp14> choose to use them. If
so, then the server <bcp14>MUST</bcp14> put one of the new cipher suites defined in this
document into its ServerHello's "cipher_suites" array and eventually send it
to the client side.</t>
            <t indent="0" pn="section-3.3.1.2-2">A TLS 1.3 server's choice of what cipher suite to use depends on the configuration
of the server. For instance, a TLS 1.3 server may or not be configured to include the
new cipher suites defined in this document. Typical TLS 1.3
server applications also provide a mechanism that configures the cipher suite
preference on the server side. If a server is not configured to use the cipher suites
defined in this document, it <bcp14>SHOULD</bcp14> choose another cipher suite in the list that
the TLS 1.3 client provides; otherwise, the server <bcp14>MUST</bcp14> abort the handshake with
an "illegal_parameter" alert.</t>
            <t indent="0" pn="section-3.3.1.2-3">The following extension <bcp14>MUST</bcp14> conform to the new requirements:</t>
            <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-3.3.1.2-4">
              <li pn="section-3.3.1.2-4.1">For the key_share extension, a KeyShareEntry with SM2-related values <bcp14>MUST</bcp14> be added
if the server wants to conform to this profile.</li>
            </ul>
          </section>
        </section>
        <section anchor="certificaterequest" numbered="true" toc="include" removeInRFC="false" pn="section-3.3.2">
          <name slugifiedName="name-certificaterequest">CertificateRequest</name>
          <t indent="0" pn="section-3.3.2-1">If a CertificateRequest message is sent by the server to require the client
to send its certificate for authentication purposes, for conformance to this
profile, the following is <bcp14>REQUIRED</bcp14>:</t>
          <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-3.3.2-2">
            <li pn="section-3.3.2-2.1">The only valid signature algorithm present in "signature_algorithms" extension
<bcp14>MUST</bcp14> be "sm2sig_sm3". That is to say, if the server chooses to conform to this profile,
the signature algorithm for the client's certificate <bcp14>MUST</bcp14> use the SM2/SM3 procedure specified by this document.</li>
          </ul>
        </section>
        <section anchor="certificate" numbered="true" toc="include" removeInRFC="false" pn="section-3.3.3">
          <name slugifiedName="name-certificate">Certificate</name>
          <t indent="0" pn="section-3.3.3-1">When a server sends the Certificate message containing the server certificate
to the client side, several new rules are added that will affect the certificate
selection:</t>
          <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-3.3.3-2">
            <li pn="section-3.3.3-2.1">The public key in the certificate <bcp14>MUST</bcp14> be a valid SM2 public key.</li>
            <li pn="section-3.3.3-2.2">The signature algorithm used by the CA to sign the current certificate <bcp14>MUST</bcp14> be
"sm2sig_sm3".</li>
            <li pn="section-3.3.3-2.3">The certificate <bcp14>MUST</bcp14> be capable of signing; e.g., the digitalSignature bit
of X.509's Key Usage extension is set.</li>
          </ul>
        </section>
        <section anchor="certificateverify" numbered="true" toc="include" removeInRFC="false" pn="section-3.3.4">
          <name slugifiedName="name-certificateverify">CertificateVerify</name>
          <t indent="0" pn="section-3.3.4-1">In the CertificateVerify message, the signature algorithm <bcp14>MUST</bcp14> be "sm2sig_sm3",
indicating that the hash function <bcp14>MUST</bcp14> be SM3 and the signature algorithm <bcp14>MUST</bcp14> be
SM2.</t>
        </section>
      </section>
      <section anchor="key-scheduling" numbered="true" toc="include" removeInRFC="false" pn="section-3.4">
        <name slugifiedName="name-key-scheduling">Key Scheduling</name>
        <t indent="0" pn="section-3.4-1">As described in <xref target="sm-algos" format="default" sectionFormat="of" derivedContent="Section 1.1"/>, SM2 is actually a set of cryptographic
algorithms, including one key exchange protocol that defines methods such as
key derivation function, etc. This document does not define an SM2 key exchange
protocol, and an SM2 key exchange protocol <bcp14>SHALL NOT</bcp14> be used in the key exchange
steps defined in <xref target="kx" format="default" sectionFormat="of" derivedContent="Section 3.3"/>. Implementations of this document <bcp14>MUST</bcp14> always conform to
what TLS 1.3 <xref target="RFC8446" format="default" sectionFormat="of" derivedContent="RFC8446"/> and its successors require regarding the key derivation and
related methods.</t>
      </section>
      <section anchor="cipher" numbered="true" toc="include" removeInRFC="false" pn="section-3.5">
        <name slugifiedName="name-cipher">Cipher</name>
        <t indent="0" pn="section-3.5-1">The new cipher suites introduced in this document add two new AEAD encryption
algorithms, AEAD_SM4_GCM and AEAD_SM4_CCM, which stand for SM4 cipher in Galois/Counter
mode and SM4 cipher <xref target="GBT.32907-2016" format="default" sectionFormat="of" derivedContent="GBT.32907-2016"/> in Counter with CBC-MAC mode, respectively.
The hash function for both cipher suites is SM3 (<xref target="ISO-SM3" format="default" sectionFormat="of" derivedContent="ISO-SM3"/>).</t>
        <t indent="0" pn="section-3.5-2">This section defines the AEAD_SM4_GCM and AEAD_SM4_CCM AEAD algorithms in a
style similar to what <xref target="RFC5116" format="default" sectionFormat="of" derivedContent="RFC5116"/> used to define AEAD ciphers based on the AES cipher.</t>
        <section anchor="aeadsm4gcm" numbered="true" toc="include" removeInRFC="false" pn="section-3.5.1">
          <name slugifiedName="name-aead_sm4_gcm">AEAD_SM4_GCM</name>
          <t indent="0" pn="section-3.5.1-1">The AEAD_SM4_GCM authenticated encryption algorithm works as specified in <xref target="GCM" format="default" sectionFormat="of" derivedContent="GCM"/>,
using SM4 as the block cipher, by providing the key, nonce, plaintext, and
associated data to that mode of operation. An authentication tag conforming to
the requirements of TLS 1.3 as specified in <xref target="RFC8446" sectionFormat="of" section="5.2" format="default" derivedLink="https://rfc-editor.org/rfc/rfc8446#section-5.2" derivedContent="RFC8446"/> <bcp14>MUST</bcp14> be constructed using
the details in the TLS record header. The additional data input that forms the
authentication tag <bcp14>MUST</bcp14> be the TLS record header. The AEAD_SM4_GCM ciphertext is formed by
appending the authentication tag provided as an output to the GCM encryption
operation to the ciphertext that is output by that operation. AEAD_SM4_GCM has 
four inputs: an SM4 key, an initialization vector (IV), a plaintext content, and optional 
additional authenticated data (AAD). AEAD_SM4_GCM generates two outputs: a ciphertext 
and message authentication code (also called an authentication tag). To have a common 
set of terms for AEAD_SM4_GCM and AEAD_SM4_CCM, the AEAD_SM4_GCM IV is referred to as a 
nonce in the remainder of this document. A simple test vector of AEAD_SM4_GCM and 
AEAD_SM4_CCM is given in <xref target="test-vectors" format="default" sectionFormat="of" derivedContent="Appendix A"/> of this document.</t>
          <t indent="0" pn="section-3.5.1-2">The nonce is generated by the party performing the authenticated encryption operation.
Within the scope of any authenticated encryption key, the nonce value <bcp14>MUST</bcp14> be unique.
That is, the set of nonce values used with any given key <bcp14>MUST NOT</bcp14> contain any duplicates.
Using the same nonce for two different messages encrypted with the same key
destroys the security properties of GCM mode. To generate the nonce, implementations of this document
<bcp14>MUST</bcp14> conform to TLS 1.3 (see <xref target="RFC8446" sectionFormat="comma" section="5.3" format="default" derivedLink="https://rfc-editor.org/rfc/rfc8446#section-5.3" derivedContent="RFC8446"/>).</t>
          <t indent="0" pn="section-3.5.1-3">The input and output lengths are as follows:</t>
          <ul empty="true" bare="false" indent="3" spacing="normal" pn="section-3.5.1-4">
            <li pn="section-3.5.1-4.1">The SM4 key length is 16 octets.</li>
            <li pn="section-3.5.1-4.2">The max plaintext length is 2<sup>36</sup> - 31 octets.</li>
            <li pn="section-3.5.1-4.3">The max AAD length is 2<sup>61</sup> - 1 octets.</li>
            <li pn="section-3.5.1-4.4">The nonce length is 12 octets.</li>
            <li pn="section-3.5.1-4.5">The authentication tag length is 16 octets.</li>
            <li pn="section-3.5.1-4.6">The max ciphertext length is 2<sup>36</sup> - 15 octets.</li>
          </ul>
          <t indent="0" pn="section-3.5.1-5">A security analysis of GCM is available in <xref target="MV04" format="default" sectionFormat="of" derivedContent="MV04"/>.</t>
        </section>
        <section anchor="aeadsm4ccm" numbered="true" toc="include" removeInRFC="false" pn="section-3.5.2">
          <name slugifiedName="name-aead_sm4_ccm">AEAD_SM4_CCM</name>
          <t indent="0" pn="section-3.5.2-1">The AEAD_SM4_CCM authenticated encryption algorithm works as specified in <xref target="CCM" format="default" sectionFormat="of" derivedContent="CCM"/>
using SM4 as the block cipher. AEAD_SM4_CCM has four inputs: an SM4 key, a nonce,
a plaintext, and optional additional authenticated data (AAD). AEAD_SM4_CCM
generates two outputs: a ciphertext and a message authentication code (also called
an authentication tag). The formatting and counter generation functions are as
specified in Appendix A of <xref target="CCM" format="default" sectionFormat="of" derivedContent="CCM"/>, and the values of the parameters
identified in that appendix are as follows:</t>
          <ul empty="true" bare="false" indent="3" spacing="normal" pn="section-3.5.2-2">
            <li pn="section-3.5.2-2.1">The nonce length n is 12.</li>
            <li pn="section-3.5.2-2.2">The tag length t is 16.</li>
            <li pn="section-3.5.2-2.3">The value of q is 3.</li>
          </ul>
          <t indent="0" pn="section-3.5.2-3">An authentication tag is also used in AEAD_SM4_CCM. The generation of the authentication
tag <bcp14>MUST</bcp14> conform to TLS 1.3 (See <xref target="RFC8446" sectionFormat="comma" section="5.2" format="default" derivedLink="https://rfc-editor.org/rfc/rfc8446#section-5.2" derivedContent="RFC8446"/>).
The AEAD_SM4_CCM ciphertext is formed by appending the authentication tag provided
as an output to the CCM encryption operation to the ciphertext that is output
by that operation. The input and output lengths are as follows:</t>
          <ul empty="true" bare="false" indent="3" spacing="normal" pn="section-3.5.2-4">
            <li pn="section-3.5.2-4.1">   The SM4 key length is 16 octets.</li>
            <li pn="section-3.5.2-4.2">   The max plaintext length is 2<sup>24</sup> - 1 octets.</li>
            <li pn="section-3.5.2-4.3">   The max AAD length is 2<sup>64</sup> - 1 octets.</li>
            <li pn="section-3.5.2-4.4">   The max ciphertext length is 2<sup>24</sup> + 15 octets.</li>
          </ul>
          <t indent="0" pn="section-3.5.2-5">To generate the nonce, implementations of this document <bcp14>MUST</bcp14> conform to
TLS 1.3 (see <xref target="RFC8446" sectionFormat="comma" section="5.3" format="default" derivedLink="https://rfc-editor.org/rfc/rfc8446#section-5.3" derivedContent="RFC8446"/>).</t>
          <t indent="0" pn="section-3.5.2-6">A security analysis of CCM is available in <xref target="J02" format="default" sectionFormat="of" derivedContent="J02"/>.</t>
        </section>
      </section>
    </section>
    <section anchor="iana-considerations" numbered="true" toc="include" removeInRFC="false" pn="section-4">
      <name slugifiedName="name-iana-considerations">IANA Considerations</name>
      <t indent="0" pn="section-4-1">IANA has assigned the values {0x00,0xC6} and {0x00,0xC7} with the names
"TLS_SM4_GCM_SM3" and "TLS_SM4_CCM_SM3"
to the "TLS Cipher Suites" registry with this document as reference:</t>
      <table align="center" pn="table-1">
        <thead>
          <tr>
            <th align="left" colspan="1" rowspan="1">Value</th>
            <th align="left" colspan="1" rowspan="1">Description</th>
            <th align="left" colspan="1" rowspan="1">DTLS-OK</th>
            <th align="left" colspan="1" rowspan="1">Recommended</th>
            <th align="left" colspan="1" rowspan="1">Reference</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td align="right" colspan="1" rowspan="1">0x00,0xC6</td>
            <td align="left" colspan="1" rowspan="1">TLS_SM4_GCM_SM3</td>
            <td align="left" colspan="1" rowspan="1">No</td>
            <td align="left" colspan="1" rowspan="1">No</td>
            <td align="left" colspan="1" rowspan="1">RFC 8998</td>
          </tr>
          <tr>
            <td align="right" colspan="1" rowspan="1">0x00,0xC7</td>
            <td align="left" colspan="1" rowspan="1">TLS_SM4_CCM_SM3</td>
            <td align="left" colspan="1" rowspan="1">No</td>
            <td align="left" colspan="1" rowspan="1">No</td>
            <td align="left" colspan="1" rowspan="1">RFC 8998</td>
          </tr>
        </tbody>
      </table>
      <t indent="0" pn="section-4-3">IANA has assigned the value 0x0708 with the name "sm2sig_sm3" to the
"TLS SignatureScheme" registry:</t>
      <table align="center" pn="table-2">
        <thead>
          <tr>
            <th align="right" colspan="1" rowspan="1">Value</th>
            <th align="left" colspan="1" rowspan="1">Description</th>
            <th align="left" colspan="1" rowspan="1">Recommended</th>
            <th align="left" colspan="1" rowspan="1">Reference</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td align="right" colspan="1" rowspan="1">0x0708</td>
            <td align="left" colspan="1" rowspan="1">sm2sig_sm3</td>
            <td align="left" colspan="1" rowspan="1">No</td>
            <td align="left" colspan="1" rowspan="1">RFC 8998</td>
          </tr>
        </tbody>
      </table>
      <t indent="0" pn="section-4-5">IANA has assigned the value 41 with the name "curveSM2" to the
"TLS Supported Groups" registry:</t>
      <table align="center" pn="table-3">
        <thead>
          <tr>
            <th align="right" colspan="1" rowspan="1">Value</th>
            <th align="left" colspan="1" rowspan="1">Description</th>
            <th align="left" colspan="1" rowspan="1">DTLS-OK</th>
            <th align="left" colspan="1" rowspan="1">Recommended</th>
            <th align="left" colspan="1" rowspan="1">Reference</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td align="right" colspan="1" rowspan="1">41</td>
            <td align="left" colspan="1" rowspan="1">curveSM2</td>
            <td align="left" colspan="1" rowspan="1">No</td>
            <td align="left" colspan="1" rowspan="1">No</td>
            <td align="left" colspan="1" rowspan="1">RFC 8998</td>
          </tr>
        </tbody>
      </table>
    </section>
    <section anchor="security-considerations" numbered="true" toc="include" removeInRFC="false" pn="section-5">
      <name slugifiedName="name-security-considerations">Security Considerations</name>
      <t indent="0" pn="section-5-1">At the time of writing, there are no known weak keys for SM
cryptographic algorithms SM2, SM3 and SM4, and no security issues
have been found for these algorithms.</t>
      <t indent="0" pn="section-5-2">A security analysis of GCM is available in <xref target="MV04" format="default" sectionFormat="of" derivedContent="MV04"/>.</t>
      <t indent="0" pn="section-5-3">A security analysis of CCM is available in <xref target="J02" format="default" sectionFormat="of" derivedContent="J02"/>.</t>
    </section>
  </middle>
  <back>
    <references pn="section-6">
      <name slugifiedName="name-references">References</name>
      <references pn="section-6.1">
        <name slugifiedName="name-normative-references">Normative References</name>
        <reference anchor="CCM" target="http://csrc.nist.gov/publications/nistpubs/800-38C/SP800-38C.pdf" quoteTitle="true" derivedAnchor="CCM">
          <front>
            <title>Recommendation for Block Cipher Modes of Operation: the CCM Mode for Authentication and Confidentiality</title>
            <author initials="M." surname="Dworkin">
              <organization showOnFrontPage="true">National Institute of Standards and Technology</organization>
            </author>
            <date year="2004" month="May"/>
          </front>
          <seriesInfo name="Special Publication" value="800-38C"/>
          <seriesInfo name="DOI" value="10.6028/NIST.SP.800-38C"/>
        </reference>
        <reference anchor="GCM" target="http://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf" quoteTitle="true" derivedAnchor="GCM">
          <front>
            <title>Recommendation for Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC</title>
            <author initials="M." surname="Dworkin">
              <organization showOnFrontPage="true">National Institute of Standards and Technology</organization>
            </author>
            <date year="2007" month="November"/>
          </front>
          <seriesInfo name="Special Publication" value="800-38D"/>
          <seriesInfo name="DOI" value="10.6028/NIST.SP.800-38D"/>
        </reference>
        <reference anchor="ISO-SM2" target="https://www.iso.org/standard/76382.html" quoteTitle="true" derivedAnchor="ISO-SM2">
          <front>
            <title>IT Security techniques -- Digital signatures with appendix -- Part 3: Discrete logarithm based mechanisms</title>
            <author>
              <organization showOnFrontPage="true">International Organization for Standardization</organization>
            </author>
            <date year="2018" month="November"/>
          </front>
          <seriesInfo name="ISO/IEC" value="14888-3:2018"/>
        </reference>
        <reference anchor="ISO-SM3" target="https://www.iso.org/standard/67116.html" quoteTitle="true" derivedAnchor="ISO-SM3">
          <front>
            <title>IT Security techniques -- Hash-functions -- Part 3: Dedicated hash-functions</title>
            <author>
              <organization showOnFrontPage="true">International Organization for Standardization</organization>
            </author>
            <date year="2018" month="October"/>
          </front>
          <seriesInfo name="ISO/IEC" value="10118-3:2018"/>
        </reference>
        <reference anchor="ISO-SM4" target="https://www.iso.org/standard/54531.html" quoteTitle="true" derivedAnchor="ISO-SM4">
          <front>
            <title>Information technology -- Security techniques -- Encryption algorithms -- Part 3: Block ciphers</title>
            <author>
              <organization showOnFrontPage="true">International Organization for Standardization</organization>
            </author>
            <date year="2010" month="December"/>
          </front>
          <seriesInfo name="ISO/IEC" value="18033-3:2010"/>
        </reference>
        <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119" quoteTitle="true" derivedAnchor="RFC2119">
          <front>
            <title>Key words for use in RFCs to Indicate Requirement Levels</title>
            <author initials="S." surname="Bradner" fullname="S. Bradner">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="1997" month="March"/>
            <abstract>
              <t indent="0">In many standards track documents several words are used to signify the requirements in the specification.  These words are often capitalized. This document defines these words as they should be interpreted in IETF documents.  This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="2119"/>
          <seriesInfo name="DOI" value="10.17487/RFC2119"/>
        </reference>
        <reference anchor="RFC5116" target="https://www.rfc-editor.org/info/rfc5116" quoteTitle="true" derivedAnchor="RFC5116">
          <front>
            <title>An Interface and Algorithms for Authenticated Encryption</title>
            <author initials="D." surname="McGrew" fullname="D. McGrew">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2008" month="January"/>
            <abstract>
              <t indent="0">This document defines algorithms for Authenticated Encryption with Associated Data (AEAD), and defines a uniform interface and a registry for such algorithms.  The interface and registry can be used as an application-independent set of cryptoalgorithm suites.  This approach provides advantages in efficiency and security, and promotes the reuse of crypto implementations.  [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="5116"/>
          <seriesInfo name="DOI" value="10.17487/RFC5116"/>
        </reference>
        <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174" quoteTitle="true" derivedAnchor="RFC8174">
          <front>
            <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
            <author initials="B." surname="Leiba" fullname="B. Leiba">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2017" month="May"/>
            <abstract>
              <t indent="0">RFC 2119 specifies common key words that may be used in protocol  specifications.  This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the  defined special meanings.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="8174"/>
          <seriesInfo name="DOI" value="10.17487/RFC8174"/>
        </reference>
        <reference anchor="RFC8446" target="https://www.rfc-editor.org/info/rfc8446" quoteTitle="true" derivedAnchor="RFC8446">
          <front>
            <title>The Transport Layer Security (TLS) Protocol Version 1.3</title>
            <author initials="E." surname="Rescorla" fullname="E. Rescorla">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2018" month="August"/>
            <abstract>
              <t indent="0">This document specifies version 1.3 of the Transport Layer Security (TLS) protocol.  TLS allows client/server applications to communicate over the Internet in a way that is designed to prevent eavesdropping, tampering, and message forgery.</t>
              <t indent="0">This document updates RFCs 5705 and 6066, and obsoletes RFCs 5077, 5246, and 6961.  This document also specifies new requirements for TLS 1.2 implementations.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="8446"/>
          <seriesInfo name="DOI" value="10.17487/RFC8446"/>
        </reference>
      </references>
      <references pn="section-6.2">
        <name slugifiedName="name-informative-references">Informative References</name>
        <reference anchor="GBT.32905-2016" target="http://www.gmbz.org.cn/upload/2018-07-24/1532401392982079739.pdf" quoteTitle="true" derivedAnchor="GBT.32905-2016">
          <front>
            <title>Information security technology --- SM3 cryptographic hash algorithm</title>
            <author>
              <organization showOnFrontPage="true">Standardization Administration of China</organization>
            </author>
            <date year="2017" month="March"/>
          </front>
          <seriesInfo name="GB/T" value="32905-2016"/>
        </reference>
        <reference anchor="GBT.32907-2016" target="http://www.gmbz.org.cn/upload/2018-04-04/1522788048733065051.pdf" quoteTitle="true" derivedAnchor="GBT.32907-2016">
          <front>
            <title>Information security technology -- SM4 block cipher algorithm</title>
            <author>
              <organization showOnFrontPage="true">Standardization Administration of the People's Republic of China</organization>
            </author>
            <date year="2017" month="March"/>
          </front>
          <seriesInfo name="GB/T" value="32907-2016"/>
        </reference>
        <reference anchor="GBT.32918.2-2016" target="http://www.gmbz.org.cn/upload/2018-07-24/1532401673138056311.pdf" quoteTitle="true" derivedAnchor="GBT.32918.2-2016">
          <front>
            <title>Information security technology --- Public key cryptographic algorithm SM2 based on elliptic curves --- Part 2: Digital signature algorithm</title>
            <author>
              <organization showOnFrontPage="true">Standardization Administration of the People's Republic of China</organization>
            </author>
            <date year="2017" month="March"/>
          </front>
          <seriesInfo name="GB/T" value="32918.2-2016"/>
        </reference>
        <reference anchor="GBT.32918.5-2017" target="http://www.gmbz.org.cn/upload/2018-07-24/1532401863206085511.pdf" quoteTitle="true" derivedAnchor="GBT.32918.5-2017">
          <front>
            <title>Information security technology --- Public key cryptographic algorithm SM2 based on elliptic curves --- Part 5: Parameter definition</title>
            <author>
              <organization showOnFrontPage="true">Standardization Administration of the People's Republic of China</organization>
            </author>
            <date year="2017" month="December"/>
          </front>
          <seriesInfo name="GB/T" value="32918.5-2017"/>
        </reference>
        <reference anchor="GMT.0009-2012" target="http://www.gmbz.org.cn/main/viewfile/2018011001400692565.html" quoteTitle="true" derivedAnchor="GMT.0009-2012">
          <front>
            <title>SM2 cryptography algorithm application specification</title>
            <author>
              <organization showOnFrontPage="true">State Cryptography Administration</organization>
            </author>
            <date year="2012" month="November"/>
          </front>
          <seriesInfo name="GM/T" value="0009-2012"/>
        </reference>
        <reference anchor="J02" target="https://link.springer.com/chapter/10.1007%2F3-540-36492-7_7" quoteTitle="true" derivedAnchor="J02">
          <front>
            <title>On the Security of CTR + CBC-MAC</title>
            <author initials="J." surname="Jonsson">
              <organization showOnFrontPage="true"/>
            </author>
            <date month="February" year="2003"/>
          </front>
          <seriesInfo name="DOI" value="10.1007/3-540-36492-7_7"/>
        </reference>
        <reference anchor="MV04" target="http://eprint.iacr.org/2004/193" quoteTitle="true" derivedAnchor="MV04">
          <front>
            <title>The Security and Performance of the Galois/Counter Mode of Operation</title>
            <author initials="D." surname="McGrew">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="J." surname="Viega">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2004" month="December"/>
          </front>
          <seriesInfo name="DOI" value="10.1007/978-3-540-30556-9_27"/>
        </reference>
      </references>
    </references>
    <section anchor="test-vectors" numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a">
      <name slugifiedName="name-test-vectors">Test Vectors</name>
      <t indent="0" pn="section-appendix.a-1">All values are in hexadecimal and are in network byte order (big endian).</t>
      <section anchor="sm4-gcm-test-vectors" numbered="true" toc="include" removeInRFC="false" pn="section-a.1">
        <name slugifiedName="name-sm4-gcm-test-vectors">SM4-GCM Test Vectors</name>
        <sourcecode name="" type="" markers="false" pn="section-a.1-1">
Initialization Vector:   00001234567800000000ABCD
Key:                     0123456789ABCDEFFEDCBA9876543210
Plaintext:               AAAAAAAAAAAAAAAABBBBBBBBBBBBBBBB
                         CCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDD
                         EEEEEEEEEEEEEEEEFFFFFFFFFFFFFFFF
                         EEEEEEEEEEEEEEEEAAAAAAAAAAAAAAAA
Associated Data:         FEEDFACEDEADBEEFFEEDFACEDEADBEEFABADDAD2
CipherText:              17F399F08C67D5EE19D0DC9969C4BB7D
                         5FD46FD3756489069157B282BB200735
                         D82710CA5C22F0CCFA7CBF93D496AC15
                         A56834CBCF98C397B4024A2691233B8D
Authentication Tag:      83DE3541E4C2B58177E065A9BF7B62EC
</sourcecode>
      </section>
      <section anchor="sm4-ccm-test-vectors" numbered="true" toc="include" removeInRFC="false" pn="section-a.2">
        <name slugifiedName="name-sm4-ccm-test-vectors">SM4-CCM Test Vectors</name>
        <sourcecode name="" type="" markers="false" pn="section-a.2-1">
Initialization Vector:   00001234567800000000ABCD
Key:                     0123456789ABCDEFFEDCBA9876543210
Plaintext:               AAAAAAAAAAAAAAAABBBBBBBBBBBBBBBB
                         CCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDD
                         EEEEEEEEEEEEEEEEFFFFFFFFFFFFFFFF
                         EEEEEEEEEEEEEEEEAAAAAAAAAAAAAAAA
Associated Data:         FEEDFACEDEADBEEFFEEDFACEDEADBEEFABADDAD2
CipherText:              48AF93501FA62ADBCD414CCE6034D895
                         DDA1BF8F132F042098661572E7483094
                         FD12E518CE062C98ACEE28D95DF4416B
                         ED31A2F04476C18BB40C84A74B97DC5B
Authentication Tag:      16842D4FA186F56AB33256971FA110F4
</sourcecode>
      </section>
    </section>
    <section anchor="contributors" numbered="false" toc="include" removeInRFC="false" pn="section-appendix.b">
      <name slugifiedName="name-contributors">Contributors</name>
      <contact fullname="Qin Long">
        <organization showOnFrontPage="true">Ant Group</organization>
        <address>
          <postal/>
          <email>zhuolong.lq@antfin.com</email>
        </address>
      </contact>
      <contact fullname="Kepeng Li">
        <organization showOnFrontPage="true">Ant Group</organization>
        <address>
          <postal/>
          <email>kepeng.lkp@antfin.com</email>
        </address>
      </contact>
      <contact fullname="Ke Zeng">
        <organization showOnFrontPage="true">Ant Group</organization>
        <address>
          <postal/>
          <email>william.zk@antfin.com</email>
        </address>
      </contact>
      <contact fullname="Han Xiao">
        <organization showOnFrontPage="true">Ant Group</organization>
        <address>
          <postal/>
          <email>han.xiao@antfin.com</email>
        </address>
      </contact>
      <contact fullname="Zhi Guan">
        <organization showOnFrontPage="true">Peking University</organization>
        <address>
          <postal/>
          <email>guan@pku.edu.cn</email>
        </address>
      </contact>
    </section>
    <section anchor="authors-addresses" numbered="false" removeInRFC="false" toc="include" pn="section-appendix.c">
      <name slugifiedName="name-authors-address">Author's Address</name>
      <author initials="P." surname="Yang" fullname="Paul Yang">
        <organization showOnFrontPage="true">Ant Group</organization>
        <address>
          <postal>
            <street>No. 77 Xueyuan Road</street>
            <city>Hangzhou</city>
            <code>310000</code>
            <country>China</country>
          </postal>
          <phone>+86-571-2688-8888</phone>
          <email>kaishen.yy@antfin.com</email>
        </address>
      </author>
    </section>
  </back>
</rfc>
