<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc version 1.7.8 (Ruby 2.6.10) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-mahy-mls-ratchet-tree-options-00" category="info" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.20.1 -->
  <front>
    <title abbrev="Ratchet tree options in MLS">Ways to convey the Ratchet Tree in Messaging Layer Security</title>
    <seriesInfo name="Internet-Draft" value="draft-mahy-mls-ratchet-tree-options-00"/>
    <author initials="R." surname="Mahy" fullname="Rohan Mahy">
      <organization>Unaffiliated</organization>
      <address>
        <email>rohan.ietf@gmail.com</email>
      </address>
    </author>
    <date year="2024" month="March" day="21"/>
    <area>sec</area>
    <workgroup>MLS</workgroup>
    <keyword>ratchet_tree</keyword>
    <keyword>ratchet tree</keyword>
    <keyword>GroupInfo</keyword>
    <keyword>PartialGroupInfo</keyword>
    <abstract>
      <?line 39?>

<t>The Messaging Layer Security (MLS) protocol needs to share its
<tt>ratchet_tree</tt> object to welcome new clients into a group and in
external joins. While, the protocol only defines a mechanism for sharing
the entire tree, most implementations use various optimizations to avoid
sending this structure repeatedly in large groups. This draft explores ways
to convey these improvements in a standardized way and to convey parts of a
GroupInfo object that are not visible to an intermediary server.</t>
    </abstract>
    <note removeInRFC="true">
      <name>About This Document</name>
      <t>
        Status information for this document may be found at <eref target="https://datatracker.ietf.org/doc/draft-mahy-mls-ratchet-tree-options/"/>.
      </t>
      <t>
        Discussion of this document takes place on the
        MLS Working Group mailing list (<eref target="mailto:mls@ietf.org"/>),
        which is archived at <eref target="https://mailarchive.ietf.org/arch/browse/mls/"/>.
        Subscribe at <eref target="https://www.ietf.org/mailman/listinfo/mls/"/>.
      </t>
      <t>Source for this draft and an issue tracker can be found at
        <eref target="https://github.com/rohanmahy/mls-ratchet-tree-options/"/>.</t>
    </note>
  </front>
  <middle>
    <?line 49?>

<section anchor="introduction">
      <name>Introduction</name>
      <t>In the Messaging Layer Security (MLS) protocol <xref target="RFC9420"/>, the members of
a group are organized into a ratchet tree, the full representation of which
is described in the <tt>ratchet_tree</tt> extension. The protocol specifies that
the full <tt>ratchet_tree</tt> can be included in Welcome messages or shared
externally, but describes no concrete way to convey externally.
Likewise, when non-member clients want to join a group, they can do so using
an external commit. They require the GroupInfo and the <tt>ratchet_tree</tt>.</t>
      <t>Many MLS implementations allow external commits to get the GroupInfo from a
central server. In the MIMI architecture <xref target="I-D.barnes-mimi-arch"/>, this server
is called the hub, and for brevity we will use that term generically to refer
to any central server that provides either GroupInfo or <tt>ratchet_tree</tt>
objects to new members (i.e. welcomed clients or external joining clients).</t>
      <t>When handshake messages (commits and proposals) are sent as <tt>PublicMessage</tt>s,
the hub can construct its own version of the <tt>ratchet_tree</tt> and most of the
GroupInfo object as proposals and commits arrive.</t>
    </section>
    <section anchor="conventions-and-definitions">
      <name>Conventions and Definitions</name>
      <t>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"/> <xref target="RFC8174"/> when, and only when, they
appear in all capitals, as shown here.</t>
      <?line -18?>

<t>This document assumes familiarity with terms and structs from the MLS specification (<xref target="RFC9420"/>).</t>
    </section>
    <section anchor="conveying-the-ratchet-tree">
      <name>Conveying the Ratchet Tree</name>
      <t>The ratchet tree can be conveyed inline in its entirety. Alternatively,
this document describes how it can be referred to by reference, or
"patched".</t>
      <sourcecode type="tls"><![CDATA[
enum {
  reserved(0),
  full(1),
  byReference(2),
  delta(3),
  (255)
} RatchetTreeRepresentation;

struct {
  RatchetTreeRepresentation representation;
  select (representation) {
    case full:
      Node ratchet_tree<V>;
    case byReference:
      /* an HTTPS URL */
      opaque ratchet_tree_url<V>;
      opaque tree_signature<V>;
    case delta:
      NodeChanges node_changes;
  };
} RatchetTreeOption;
]]></sourcecode>
      <ul spacing="normal">
        <li>
          <t><tt>full</tt> indicates that the complete <tt>ratchet_tree</tt> extension is included in
the RatchetTreeOption object.</t>
        </li>
        <li>
          <t><tt>byReference</tt> indicates that the <tt>ratchet_tree</tt> is available from the <tt>ratchet_tree_url</tt>.</t>
        </li>
        <li>
          <t><tt>delta</tt> indicates that the new <tt>ratchet_tree</tt> differs from the previous
epoch. The changes are described in the <tt>node_changes</tt>.</t>
        </li>
      </ul>
      <sourcecode type="tls"><![CDATA[
struct {
  unit32 index;
  Node node;
} NodePlusIndex;

struct {
  uint32 removed_nodes<V>;
  NodePlusIndex updated_nodes<V>;
  Node new_nodes<V>;
} NodeChanges
]]></sourcecode>
      <t>To describe changes between two ratchet trees in the NodeChanges "patch"
format, first make a list of node indexes of nodes that have been completely
removed, next make a list of nodes that were completely replaced and their
node indexes, finally make a list of new nodes which were added after the
right-most node in the tree.</t>
    </section>
    <section anchor="conveying-the-groupinfo">
      <name>Conveying the GroupInfo</name>
      <t>In some systems the GroupInfo is sent to a hub with a full <tt>ratchet_tree</tt>
extension always included with every commit. This is used in systems where
the hub may or may not track the membership of the group, but does not keep the entire <tt>ratchet_tree</tt> data structure. As group size increases, the size
of the <tt>ratchet_tree</tt> extension in the GroupInfo scales roughly linearly.
Even using <tt>basic</tt> credentials, this object gets large quickly. If <tt>x509</tt> credentials are used, the size increases much more rapidly, and if a post-quantum ciphersuite (for example <xref target="I-D.mahy-mls-xwing"/>) is used, the
size will increase even more rapidly with each new member.</t>
      <t>In some systems that require unencrypted handshake messages, the hub tracks
commits as they are sent and constructs changes to the <tt>ratchet_tree</tt> as
each handshake is accepted. The hub could also recreate a GroupInfo from
inspecting unencrypted handshake messages with the exception of the
GroupInfo signature and the GroupInfo extensions. This document defines a
<tt>PartialGroupInfo</tt> struct that contains these missing items. It can be
included with a commit and any referenced proposals to reconstruct a
GroupInfo and <tt>ratchet_tree</tt> from the GroupInfo and <tt>ratchet_tree</tt> included
in the previous epoch.</t>
      <sourcecode type="tls"><![CDATA[
enum {
  no_ratchet_tree(0),
  present(1),
  removed(2),
  added(3),
  (255)
} RatchetTreePresence;

struct {
  RatchetTreePresence ratchet_tree_presence;
  /* GroupInfo extensions excluding ratchet_tree */
  Extension group_info_extensions<V>;
  opaque Signature<V>;
} PartialGroupInfo;
]]></sourcecode>
      <t>The value of the <tt>ratchet_tree_presence</tt> is defined as follows:</t>
      <ul spacing="normal">
        <li>
          <t><tt>no_ratchet_tree</tt>: the <tt>ratchet_tree</tt> extension appears in neither the
current nor previous epochs.</t>
        </li>
        <li>
          <t><tt>present</tt>: there is a <tt>ratchet_tree</tt> extension in both the current and
previous epochs.</t>
        </li>
        <li>
          <t><tt>removed</tt>: there was a <tt>ratchet_tree</tt> extension in the previous epoch
but none in the current epoch.</t>
        </li>
        <li>
          <t><tt>added</tt>: there is a <tt>ratchet_tree</tt> extension in the current epoch
but there was none in the previous epoch.</t>
        </li>
      </ul>
      <t>The <tt>group_info_extensions</tt> object is the list of GroupInfo
extensions, omitting any <tt>ratchet_tree</tt> extension (if present). The only
other GroupInfo extension defined in the base protocol is <tt>external_pub</tt>,
the public key of the external commiter. The <tt>group_info_extensions</tt> is often an empty list.</t>
      <t>The <tt>Signature</tt> in the PartialGroupInfo is the signature produced by the committer (represented by leaf index in the GroupInfo as the <tt>signer</tt>).</t>
    </section>
    <section anchor="security-considerations">
      <name>Security Considerations</name>
      <t>TODO Security</t>
    </section>
    <section anchor="iana-considerations">
      <name>IANA Considerations</name>
      <t>This document has no IANA actions.</t>
    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references anchor="sec-normative-references">
        <name>Normative References</name>
        <reference anchor="RFC9420">
          <front>
            <title>The Messaging Layer Security (MLS) Protocol</title>
            <author fullname="R. Barnes" initials="R." surname="Barnes"/>
            <author fullname="B. Beurdouche" initials="B." surname="Beurdouche"/>
            <author fullname="R. Robert" initials="R." surname="Robert"/>
            <author fullname="J. Millican" initials="J." surname="Millican"/>
            <author fullname="E. Omara" initials="E." surname="Omara"/>
            <author fullname="K. Cohn-Gordon" initials="K." surname="Cohn-Gordon"/>
            <date month="July" year="2023"/>
            <abstract>
              <t>Messaging applications are increasingly making use of end-to-end security mechanisms to ensure that messages are only accessible to the communicating endpoints, and not to any servers involved in delivering messages. Establishing keys to provide such protections is challenging for group chat settings, in which more than two clients need to agree on a key but may not be online at the same time. In this document, we specify a key establishment protocol that provides efficient asynchronous group key establishment with forward secrecy (FS) and post-compromise security (PCS) for groups in size ranging from two to thousands.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="9420"/>
          <seriesInfo name="DOI" value="10.17487/RFC9420"/>
        </reference>
        <reference anchor="RFC2119">
          <front>
            <title>Key words for use in RFCs to Indicate Requirement Levels</title>
            <author fullname="S. Bradner" initials="S." surname="Bradner"/>
            <date month="March" year="1997"/>
            <abstract>
              <t>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="RFC8174">
          <front>
            <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
            <author fullname="B. Leiba" initials="B." surname="Leiba"/>
            <date month="May" year="2017"/>
            <abstract>
              <t>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>
      </references>
      <references anchor="sec-informative-references">
        <name>Informative References</name>
        <reference anchor="I-D.barnes-mimi-arch">
          <front>
            <title>An Architecture for More Instant Messaging Interoperability (MIMI)</title>
            <author fullname="Richard Barnes" initials="R." surname="Barnes">
              <organization>Cisco</organization>
            </author>
            <date day="4" month="March" year="2024"/>
            <abstract>
              <t>   The More Instant Messaging Interoperability (MIMI) working group is
   defining a suite of protocols that allow messaging providers to
   interoperate with one another.  This document lays out an overall
   architecture enumerating the MIMI protocols and how they work
   together to enable an overall messaging experience.

              </t>
            </abstract>
          </front>
          <seriesInfo name="Internet-Draft" value="draft-barnes-mimi-arch-03"/>
        </reference>
        <reference anchor="I-D.mahy-mls-xwing">
          <front>
            <title>Messaging Layer Security Ciphersuite using XWing Key Exchange Mechanism</title>
            <author fullname="Rohan Mahy" initials="R." surname="Mahy">
              <organization>Unaffiliated</organization>
            </author>
            <date day="4" month="March" year="2024"/>
            <abstract>
              <t>   This document registers a new Messaging Layer Security (MLS)
   ciphersuite using the X-Wing hybrid post-quantum resistant /
   traditional (PQ/T) Key Exchange Mechanism (KEM).

              </t>
            </abstract>
          </front>
          <seriesInfo name="Internet-Draft" value="draft-mahy-mls-xwing-00"/>
        </reference>
        <reference anchor="I-D.robert-mimi-delivery-service">
          <front>
            <title>MIMI Delivery Service</title>
            <author fullname="Raphael Robert" initials="R." surname="Robert">
              <organization>Phoenix R&amp;D</organization>
            </author>
            <author fullname="Konrad Kohbrok" initials="K." surname="Kohbrok">
              <organization>Phoenix R&amp;D</organization>
            </author>
            <date day="6" month="November" year="2023"/>
            <abstract>
              <t>   This document describes the MIMI Delivery Service.

              </t>
            </abstract>
          </front>
          <seriesInfo name="Internet-Draft" value="draft-robert-mimi-delivery-service-06"/>
        </reference>
      </references>
    </references>
    <?line 214?>

<section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>The PartialGroupInfo was first introduced in
<xref target="I-D.robert-mimi-delivery-service"/>.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIACjS+2UAA41Z23IbNxJ9x1dgmRcpJeoWpzams0kUXzaqkiytJK8rlUqJ
4AwoIppbAIwoxqV8y37LftmebmBuJOXNi8XBTDca3ae7T8Pj8Vh44zM9kR/V
yklfyqQsHvRK+oWWV8onC+3ljdVamkKea+fUnSnu5JlaaSuvdVJb41dCzWZW
P0xaAU8CZeVNWTgWPLsWaZkUKsdGqVVzP87VYjXOMze2QWZMMuMoMz48FKay
EyiqnT8+PHx5eCxcPcuNc3jvVxX0nL69eSflF1JlrpzIkSlSXWn8U/jRnhyd
nvyIP6XFr6ubdyOhrFYTqawXy9Le39myriZsV3jhdCIS5fVdaVcTmDwvxb1e
4dN0IuRYRiNvycjes2ye/0n6TkkKD5fYxaisWxPOqyK9VVlZwO6VdqIyE/mL
L5M96UoLJXOHX6ucfvwqxIMuao19Zc9MKcOpP8J6igBrx2quTDaRcOQPRvv5
fmnvsKhsspjIhfeVmxwc0Ce0Yh70fvPRAS0czGy5dPoA0ge0m/GLejaRtlyo
guJz8Fx8DsQXUmZwl/PdNkF8Pynzg7+gIUgLoWq/KC07GW53wNC+PIck7JEy
AOaKtHWLsF4V5g9FeibyQ6Hmc5MZqEv5tQ4eYRP4uD/c0QrZJURR2hyCD/Cu
oCB3T2I8Hks1c96qBGbdAP7PwV3uICC7srIlIlhmstA65dRxC4BJGu/EtA+Y
qSxnv+nE0ydLncEQDZmlTDIDsFKC4IUKwZYAChaEfvTaFiqTv5Xwyr78uDCZ
3uOsbPcti2wlUz03hXaQz3WCIxuXS5yLbYHpgiSwi4FhZMuezEvnpcmrTOdY
VyFHa6flAwTK2nHe5tG/fCz1UJpUOOQW+cIvjJNwU534Gkotko58D1OQ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