Re: [TLS] Application layer interactions and API guidance

Ilari Liusvaara <> Fri, 07 October 2016 22:00 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 41AE3129418 for <>; Fri, 7 Oct 2016 15:00:40 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -4.896
X-Spam-Status: No, score=-4.896 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RP_MATCHES_RCVD=-2.996] autolearn=ham autolearn_force=no
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id yw_yVwiflwNf for <>; Fri, 7 Oct 2016 15:00:37 -0700 (PDT)
Received: from ( []) by (Postfix) with ESMTP id C149D129431 for <>; Fri, 7 Oct 2016 15:00:36 -0700 (PDT)
Received: from localhost (localhost []) by (Postfix) with ESMTP id 17BE713229; Sat, 8 Oct 2016 01:00:35 +0300 (EEST)
X-Virus-Scanned: Debian amavisd-new at
Received: from ([IPv6:::ffff:]) by localhost ( [::ffff:]) (amavisd-new, port 10024) with ESMTP id J4Q8b-gmMF2D; Sat, 8 Oct 2016 01:00:34 +0300 (EEST)
Received: from LK-Perkele-V2 ( []) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by (Postfix) with ESMTPSA id 84EF2C4; Sat, 8 Oct 2016 01:00:34 +0300 (EEST)
Date: Sat, 08 Oct 2016 01:00:28 +0300
From: Ilari Liusvaara <>
To: Watson Ladd <>
Message-ID: <>
References: <> <> <>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline
In-Reply-To: <>
User-Agent: Mutt/1.5.23 (2014-03-12)
Archived-At: <>
Cc: "" <>
Subject: Re: [TLS] Application layer interactions and API guidance
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: "This is the mailing list for the Transport Layer Security working group of the IETF." <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Fri, 07 Oct 2016 22:00:40 -0000

On Fri, Oct 07, 2016 at 01:41:14PM -0700, Watson Ladd wrote:
> On Fri, Sep 23, 2016 at 10:47 PM, Ilari Liusvaara
> <> wrote:
> >
> > Also, it is very likely that 0-RTT would need its own read API, because
> > it is pretty unlikely that existing API could be safely retrofitted
> > or even purpose-built unified API be designed that isn't just asking
> > for security problems via mixing 0-RTT and 1-RTT data.
> Yes. In particular I think the TLS state machine transitions need to
> be ordered with respect to the arrival and sending of data. The
> challenge for a multithreaded program (yes, some programs have
> multiple threads sending and receiving at once) is making this make
> sense, or even a single-threaded program where the TLS stack can
> change state at times not visible to the sending thread. Maybe there
> is some slop here, like 0-RTT can become 1-RTT on send, but this
> raises all sorts of problems for receiving. I think we need to require
> separation in the API.

0-RTT can't be allowed to become 1-RTT on send (unless it is auto-
retransmit, which needs to be disableable, as sometimes that just plain
won't work).

This impiles that the application always needs to explicitly signal
the end of 0-RTT data, even just to abort sending it.

> > (This is the reason one needs to be especially careful when combining
> > dynamic client certificates with HTTP/2... Basically, it can not be
> > done safely without coordination on application layer).
> >
> > One likely wants application protocol to be able to specify part of
> > or the entiere request context and to extract that part in the other
> > end when requesting a certificate selection. This is to allow putting
> > part of coordination data into the request itself. However, this is not
> > sufficient for e.g. HTTP/2 signaling, so more needs to be exchanged at
> > application layer.
> >
> > And then upon completion of the authentication (either successful or
> > explicitly rejected), signal the application with the new certificate
> > chain and the context the request had.
> This is going to require major changes to APIs and to the HTTP/2
> layer. It also interacts with token binding, whee! My question then
> becomes one of what we actually need: can we assume that leakage
> between authentication contexts over a single session is safe because
> all contexts represent the same principal, by restricting the usages,
> or is this overly restrictive?

Yes, it is going to reuqire such changes.

And you absolutely can not assume that all contexts present the same

And as I said, in multiplexed protocol like HTTP/2, you need application-
level coordination on top. TLS just can't do that.

> When we have multiple requests and replies in flight and the
> authentication state changes, things get nasty. If we think of TLS as
> sending a stream of events including authentication changes to the
> application, this fits the semantics of the TLS draft as I understand
> them to be, but does not necessarily fit what application protocols
> want. There might be a semantic mismatch here requiring reworking of
> one or another part.

Also, some applications presumably want the events done synchronously,
so they don't move with data reads.

Basically, post-handshake auth is heckuva nasty problem.