Re: [TLS] Application layer interactions and API guidance

Eric Rescorla <ekr@rtfm.com> Fri, 07 October 2016 22:04 UTC

Return-Path: <ekr@rtfm.com>
X-Original-To: tls@ietfa.amsl.com
Delivered-To: tls@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 91A8412946A for <tls@ietfa.amsl.com>; Fri, 7 Oct 2016 15:04:58 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=rtfm-com.20150623.gappssmtp.com
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 BrhJjYp-5CCl for <tls@ietfa.amsl.com>; Fri, 7 Oct 2016 15:04:56 -0700 (PDT)
Received: from mail-yb0-x233.google.com (mail-yb0-x233.google.com [IPv6:2607:f8b0:4002:c09::233]) (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 04368129431 for <tls@ietf.org>; Fri, 7 Oct 2016 15:04:56 -0700 (PDT)
Received: by mail-yb0-x233.google.com with SMTP id 191so20537358ybv.3 for <tls@ietf.org>; Fri, 07 Oct 2016 15:04:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rtfm-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=alhqZgBF9ulCAzVakJlMiIC7NKZeQsPLRob44WDIJJU=; b=wi9Uqt6xGBZ7YgEk22kHX015vOpWJlyIfl6IAR3GfdBMYHmWpo1RNEhyb3RREe4rVY tu5df1UsRm68WrSNN25pQLKV5CKX2Jn8j/ppmifDgeHqopg5a0cVdvMVJYBgMqIjHVqH AW6M6+j3sCaSY5OTtfi3OXK4ndwUWq5Wzmcy/2dZmFC0Eh3ZJ7vCgLQcXxqI9+x2D4yG FpCeTKM4zq63LAJmufU4c5sZbUGbaIrRrNgR6a+fSxK5UDKKlwWXy9VU6mejoxINEps7 c0ygGQhGdO4/UftYmGpkemVwCpkHLwmb/UiNXaoLE4SLKjkxzVL1A2D27QnoTBhTQTmT yKfA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=alhqZgBF9ulCAzVakJlMiIC7NKZeQsPLRob44WDIJJU=; b=IQC9fdyQl30TKSL9FsjguCLelW4xF35PdZhn0SSIP7zVFeboxev0OQvIKaB4ZWpXgu L+h6/1+gGxYoPSY0J9lAu6OvCGsP24G9eEKk1Iyk7Uk+oTl+0p02UVWkrEFYIHiBGWRg 8VbRPJoU4ZpR4Uwt1WzdtAG2fhyz4Cxa/En4YB6hAqOnPYD8hgmSfIqns8CR5CAtMAcT VtNCb4fqxpNKniqlzZpF+FZ3bTQzfxp1PQtkwGj+XiVXrsBr9db0hMfKQc+co4c3R/s1 YsLBFpDrVQgH7HRWLD2ctjqBvwfjSUtkDEsdzrVHyecq+8mItcd6RGXJh8P6G/edU002 KXmw==
X-Gm-Message-State: AA6/9Rl3yFVHRAxxyYE5jgxlZxJTnmLaaE5ZR5cgSwXob1aWLs1Jum/UfT+vaaBBXDKxlWhyqCgvGOZmTlEnzg==
X-Received: by 10.37.103.139 with SMTP id b133mr18085654ybc.107.1475877895187; Fri, 07 Oct 2016 15:04:55 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.129.75.212 with HTTP; Fri, 7 Oct 2016 15:04:14 -0700 (PDT)
In-Reply-To: <20161007220028.GA10288@LK-Perkele-V2.elisa-laajakaista.fi>
References: <CACsn0c=B0dVGaXKawW5DJCUfJfqFFHkk_cZCzjzKs53n4UKLpg@mail.gmail.com> <20160924054730.GB7594@LK-Perkele-V2.elisa-laajakaista.fi> <CACsn0cnpEq_00R37WZOm39dg9dXKSkpNjGt3FWg0uLgTEkwtRw@mail.gmail.com> <20161007220028.GA10288@LK-Perkele-V2.elisa-laajakaista.fi>
From: Eric Rescorla <ekr@rtfm.com>
Date: Fri, 07 Oct 2016 15:04:14 -0700
Message-ID: <CABcZeBNU0HVqkZm6zb63xZzf4+ZQjXb8CacuYH77Fe_=dfFPhw@mail.gmail.com>
To: Ilari Liusvaara <ilariliusvaara@welho.com>
Content-Type: multipart/alternative; boundary="001a1142f87aad066b053e4d9990"
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/NOQ4qM-jxINsOYEqA1Hy2jm9w6s>
Cc: "tls@ietf.org" <tls@ietf.org>
Subject: Re: [TLS] Application layer interactions and API guidance
X-BeenThere: tls@ietf.org
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." <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: Fri, 07 Oct 2016 22:04:58 -0000

On Fri, Oct 7, 2016 at 3:00 PM, Ilari Liusvaara <ilariliusvaara@welho.com>
wrote:

> On Fri, Oct 07, 2016 at 01:41:14PM -0700, Watson Ladd wrote:
> > On Fri, Sep 23, 2016 at 10:47 PM, Ilari Liusvaara
> > <ilariliusvaara@welho.com> 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).
>

Can you explain why that is?

-Ekr



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
> principal.
>
> 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.
>
>
> -Ilari
>
> _______________________________________________
> TLS mailing list
> TLS@ietf.org
> https://www.ietf.org/mailman/listinfo/tls
>