<?xml version="1.0"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd"[
 <!ENTITY RFC2119 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml'>
 <!ENTITY RFC5246 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.5246.xml'>
]>

<?rfc toc="yes" symrefs="yes"?>

<rfc ipr="trust200902" docName="draft-agl-tls-padding-02">
  <front>
    <title abbrev="TLS Padding Extension">A TLS padding extension</title>
    <author initials="A." surname="Langley" fullname="Adam Langley">
      <organization>Google Inc</organization>
      <address>
        <email>agl@google.com</email>
      </address>
    </author>

    <date month="Nov" year="2013" />
    <area>Security</area>
    <abstract>
      <t>
        This memo describes the a TLS extension that can be used to pad ClientHello messages to a desired size.
      </t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction" anchor="intro">
      <t>
        Successive <xref target="RFC5246">TLS</xref> versions have added support for more cipher suites and, over time, more TLS extensions have been defined. This has caused the size of the TLS ClientHello to grow and the additional size has caused some implementation bugs to come to light. At least one of these implementation bugs can be ameliorated by making the ClientHello even larger.
      </t>

      <t>
        This memo describes a TLS extension that can be used to pad a ClientHello to a desired size in order to avoid implementation bugs caused by certain ClientHello sizes.
      </t>
    </section>

    <section title="Requirements Notation">
      <t>
        The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
        "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
        document are to be interpreted as described in <xref
          target="RFC2119">RFC 2119</xref>.
      </t>
    </section>

    <section title="Padding Extension">
      <t>
        A new extension type ("<spanx style="verb">padding(TBD)</spanx>") is defined and MAY be included by the client in its ClientHello message.
      </t>

      <figure>
        <artwork align="left">enum {
        padding(TBD), (65535)
} ExtensionType</artwork>
      </figure>

      <t>
        The client MUST fill the padding extension completely with zero bytes, although the padding extension may be empty.
      </t>

      <t>
        The server MUST NOT echo the extension.
      </t>
    </section>

    <section title="Example usage">
      <t>
        As an example, consider a client that wishes to avoid sending a ClientHello with a record size between 256 and 511 bytes (inclusive). This case is considered because at least one TLS implementation is known to hang the connection when such a ClientHello record is received.
      </t>

      <t>
        After building a ClientHello as normal, the client can add four to the length (to account for the handshake protocol overhead) and test whether the resulting length falls into that range. If it does, a padding extension can be added in order to push the length to (at least) 512 bytes.
      </t>

      <t>
        Note that if the original ClientHello size was between 505 and 508 bytes then, with the handshake overhead, the record would be between 509 and 511 bytes long. Since it's not possible for an extension to take less than four bytes of space, the additional padding would have to expand the ClientHello record past 512 bytes in these cases.
      </t>
    </section>

    <section title="Security Considerations">
      <t>
        The contents of the padding extension could be used as a side-channel. In order to prevent this, the contents are required to be all zeros, although the length of the extension can still be used as a much smaller side-channel. Servers MAY verify that the extension is either empty or contains only zero bytes, in order to enforce this.
      </t>
    </section>

    <section title="IANA Considerations">
      <t>
        IANA is requested to assign an extension value for the padding extension from its ExtensionType registry.
      </t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      &RFC2119;
      &RFC5246;
    </references>
  </back>
</rfc>
