[TLS] Proposal: don't change keys between handshake and application layer

Eric Rescorla <ekr@rtfm.com> Thu, 18 February 2016 03:50 UTC

Return-Path: <ekr@rtfm.com>
X-Original-To: tls@ietfa.amsl.com
Delivered-To: tls@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 921D61B3368 for <tls@ietfa.amsl.com>; Wed, 17 Feb 2016 19:50:16 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 1.358
X-Spam-Level: *
X-Spam-Status: No, score=1.358 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, J_CHICKENPOX_72=0.6, LONGWORDS=2.035] autolearn=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ICtG1UlXO24L for <tls@ietfa.amsl.com>; Wed, 17 Feb 2016 19:50:14 -0800 (PST)
Received: from mail-yw0-x230.google.com (mail-yw0-x230.google.com [IPv6:2607:f8b0:4002:c05::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 671531B3389 for <tls@ietf.org>; Wed, 17 Feb 2016 19:50:14 -0800 (PST)
Received: by mail-yw0-x230.google.com with SMTP id e63so30667332ywc.3 for <tls@ietf.org>; Wed, 17 Feb 2016 19:50:14 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rtfm-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to:content-type; bh=3oiOC3ykC9xPdyDYqUQBYYv60RiDuG/0gEw/cC3xePI=; b=ZjfFzIjoptAwF6Dw/Y81SVNbCVpKgXRQUyaHU4/zF8HIPpyKLkIryBRc7MMWD7Nikg fukYouNAlC45CxX0LNeuOuWAapPI2rvekawbCnb4w6WCl+jk6CDayV/NKA09JMEYMQ/j Ih5ilwcEE9d748v3DZwxHTBFdfjiqURuOwtmeXGkDQZWs1XzTBZwGHeAKk4ejPr0kdrk MtetgCnzpAuwJFYxXKPxhytHSY6aMEhrqURWOvk4JBunfDKVRFIBfMQQkcBIY+9E70Te z0oOxBR4s01R4FI4s9RcmSIBQLTOV9KRHdMdMKiQQmVQtb4QcFqF3tIMl9gxcWoGEWeJ f61w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-type; bh=3oiOC3ykC9xPdyDYqUQBYYv60RiDuG/0gEw/cC3xePI=; b=WsywcFQR3sqTpdoojYvt2XnTGC23rDaynPbaIr0dnTHRoDKzYAw0bhDqw5kHwOTCB3 S8eOTsp3kUGvOTGC7921913dQFLRc9w86lzh6FDFrtdNYEWZ/39w/nA54D2SQxsHWC9W oDmtglMZXiXzHdx192KLYNCoXl/lAONEVuAdh4HPoiQrwgdGJkyuvv/xjnlIIrPOCOBN c17u4df2Jimqhwb+pgf5iNmHR5x8FIUbDuloL8rhD7RY1ehti4b6f1X5Pd3a9sfjXMXi 1eVgyA/Dx5+3N2sf+VgGyZxS6oBy5kZrZo9V3+CNqh9fZDEryudTBt8mHuQg2LNZG/yP iRPA==
X-Gm-Message-State: AG10YOT8GrawvD8iIt1vwcvrJPXQvGieFvTDTqzFplPX+0BPoNpLmxsYaKMFp12scjxy8PrA2Cc6AtJKNIylYA==
X-Received: by 10.129.38.135 with SMTP id m129mr2982636ywm.155.1455767413765; Wed, 17 Feb 2016 19:50:13 -0800 (PST)
MIME-Version: 1.0
Received: by 10.13.249.5 with HTTP; Wed, 17 Feb 2016 19:49:33 -0800 (PST)
From: Eric Rescorla <ekr@rtfm.com>
Date: Wed, 17 Feb 2016 20:49:33 -0700
Message-ID: <CABcZeBNFDO-RckTMgsBcfsLEo2KGHE0LV4_J-=XAMu1JrEZwDg@mail.gmail.com>
To: "tls@ietf.org" <tls@ietf.org>
Content-Type: multipart/alternative; boundary="001a1141618c92eaf3052c0343ec"
Archived-At: <http://mailarchive.ietf.org/arch/msg/tls/rgiTKwRb23T7iKjlkAQAt112ipY>
Subject: [TLS] Proposal: don't change keys between handshake and application layer
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: "This is the mailing list for the Transport Layer Security working group of the IETF." <tls.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/tls>, <mailto:tls-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/tls/>
List-Post: <mailto:tls@ietf.org>
List-Help: <mailto:tls-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/tls>, <mailto:tls-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 18 Feb 2016 03:50:16 -0000

Hi folks,

TL;DR.
I propose that we should not change keys between the handshake
and application traffic keys.

DETAILS
As we try to finalize the drafts and implementations are starting to
emerge, it's worth looking for opportunities to simplify. This is the
first of several messages suggesting areas where we may have made
things too general/complicated and now that we can look at
simplifying. The following suggestion comes out of conversations with
Karthik Bhargavan, Antoine Delignat-Lavaud, Cedric Fournet, Christian
Huitema, Markus Kohlweiss, Martin Thomson, Santiago Zanella and
others.

The general idea is that there is no strong security reason to change
change keys between handshake and traffic in the same phase (e.g.,
between the 1-RTT handshake and traffic keys, so we should simplify by
not doing so.)  This is something that implementers have asked for,
especially for DTLS (so you don't need to have three contexts in one
flight) and we have resisted, nominally for security reasons but
really over concerns about analysis.

There are three basic security reasons why one might want to change
keys:

- To add additional secret information.
- To bind in additional context.
- For PFS.

None of these apply at the handshake/traffic transition: We don’t have
any more secret material at this point in TLS 1.3 (SS and ES are both
known at the time that the handshake keys must be generated.) It is
not necessary to bind in the additional context to the traffic keys
(though see below about resumption) because it is tied to the keys
via the Finished messages. We know how to do security proofs
for this (those exist for 1.2).  There’s no reason to have different
PFS for the handshake versus the application traffic.

We can simplify matters by adopting a schedule more like the following:


Key Class     Input           Handshake Context         Specific
              Secrets         /Transcript               Keys
---------------------------------------------------------------------------------
0-RTT Keys    SS              ClientHello +             client write keys
                               ServerConfiguration +    client finished keys
                               ServerCertificate +
                               CertificateRequest

1-RTT Keys    SS, ES          ClientHello,              client/server write
keys
                              ServerHello               client/server
finished keys


Final Keys    SS, ES          Complete transcript
                              through client finished   exporter master
secret
                                                        resumption master
secret
                                                        [Maybe
traffic_secret_1]


Note that it is very important that the Resumption Master Secret
include the server certificate (otherwise you get Triple Handshake)
but you shouldn'tt need that for the initial handshake traffic keys.

This is clearly simpler and also has the advantage that you do fewer
expansions with different combinations of transcript messages. It's
a very simple change to the specification and to implementations.
It also allows a somewhat simpler key schedule (see the next message
in this series).

There are two potential objections here:
- It’s a change, how do we know it’s OK?
- Doesn’t this make analysis harder?

There are intuitive reasons to believe that it is OK (this is very
similar to what TLS 1.2 does with the resumption secret being derived
as with Extended Master Secret), and there are teams actively adapting
their analysis to verify that they are OK. Obviously, it might not be
OK and we should not finalize this change until we have some analysis.
I'll let Karthik, Cedric, etc. speak to the progress on that and
perhaps we can discuss more at TRON.

There is a sense in which it makes analysis harder in that the
cryptographic (as opposed to symbolic) proofs are better adapted to
assuming that the keys being output by the handshake are never used
for any handshake purpose. However, there are techniques for making
this work with plausible assumptions about how TLS will use the keys
(mainly that only TLS will be allowed to send traffic with the TLS
internal keys and that everything else will only get access to
Exported keys) [1].

One more important note: for DHE-PSK mode, it is important to have the
traffic encrypted under both SS and ES (I.e., both PSK and DHE) but
that’s not presently true for the handshake data (which is only
encrypted under ES). So, this will also require at least some change
to the key schedule to accommodate that. However, those changes are
relatively straightforward.

Comments, please.
-Ekr


[1] Another alternative here would be to generate separate keys for
handshake and application traffic but do so at the same time, so that
there is only one derivation stage. This simplifies the specification
and implementation somewhat, but not as much as having handshake
and application traffic.