Re: [TLS] Alert after sending ServerHello

Martin Thomson <martin.thomson@gmail.com> Wed, 26 April 2017 12:00 UTC

Return-Path: <martin.thomson@gmail.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 56106129B49 for <tls@ietfa.amsl.com>; Wed, 26 Apr 2017 05:00:24 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.7
X-Spam-Level:
X-Spam-Status: No, score=-2.7 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.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 mTVQT5APHoJS for <tls@ietfa.amsl.com>; Wed, 26 Apr 2017 05:00:23 -0700 (PDT)
Received: from mail-lf0-x233.google.com (mail-lf0-x233.google.com [IPv6:2a00:1450:4010:c07::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 A4A1C129B6A for <tls@ietf.org>; Wed, 26 Apr 2017 05:00:22 -0700 (PDT)
Received: by mail-lf0-x233.google.com with SMTP id t144so106614076lff.1 for <tls@ietf.org>; Wed, 26 Apr 2017 05:00:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=W5M6GpUByhIz9K4ytxOozY32qY19rhXVoJhaLsleoOA=; b=dT6HfaZDj0s4soEdifjwTEf3csDwDZ+EoVMmOmL9y6ClDTpudUo17svpD39l7rIi10 ctB99yOTPJ5D8PaWFoXjaaOhDVWOFJj4OMZfiFJ4c8JiveU/UmD/gtv+XJ09dRjqsz5J c9YNpkdxAEXUxxEj2AOICsRu+H8pOmJzuP1N5Rwtia7E42wwpNbQ+gQDzMp1h7V0uV6W AZchVlZHRppHC83x0byyU9oLd5I9csN6j2HoQ3BT5+LhJ+ynqY36a6t84qjip1ISyIzE LLNyC9oPz0HokVh5k8UD+/4c88ulDI017K9qo1LLqldWlqbBxCvBdu5WAUxX5loGp+dL Ezhw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=W5M6GpUByhIz9K4ytxOozY32qY19rhXVoJhaLsleoOA=; b=W1XgJN0iGXgh8JZGMwOnpr3dr7p8iLAx8uQCCNH0i10sy1CwhkUWKyJ/zaNRzabyQI tyjIZz7dhbYnCxqbTQkVVzxWIQdntMG4QVI5MGv/BJ1IPIwRTNOqW5iq05iH67ldpODH Z3LFxdAh3s3pq/1lZkRTFfu9Fv6TXqaI+wA2ts6jhOlMYMvKruGdRChuQD7y0+B7izs9 eroPgDqvX70Vpx/lmYpUi9dBZ7mLGbO45TinxMTQQlis/Sbn//L7af7U0uhPjiI0m0xW IDdZjsGON3+KV6AnCSzq7L0XJvnxd3SPPF25ovp1hSTL++bJNzrQpjUsOed0EIFk+37I /tVQ==
X-Gm-Message-State: AN3rC/6o9TupI0opj3IVv/hpOxfgbeCBnqvH4nU/ENubQ4KtPS2Dk3hi frzjvK0I/Lbnyrg+AOojsYML1a3pmw==
X-Received: by 10.25.79.27 with SMTP id d27mr10594383lfb.76.1493208020534; Wed, 26 Apr 2017 05:00:20 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.46.83.2 with HTTP; Wed, 26 Apr 2017 05:00:19 -0700 (PDT)
In-Reply-To: <20170426071952.GA29159@LK-Perkele-V2.elisa-laajakaista.fi>
References: <EAF9D3D6-A87D-450D-BCFB-36F8CDC8B14F@symantec.com> <CABkgnnW9M2Jx77vBtUiGH1y67f6XKbAygOQg_EptqkApxhkZPw@mail.gmail.com> <20170426071952.GA29159@LK-Perkele-V2.elisa-laajakaista.fi>
From: Martin Thomson <martin.thomson@gmail.com>
Date: Wed, 26 Apr 2017 22:00:19 +1000
Message-ID: <CABkgnnU9ixu0baO+0N2vUeSrGd+PMi0e2dZt2uVYr9DMk6Wc=w@mail.gmail.com>
To: Ilari Liusvaara <ilariliusvaara@welho.com>
Cc: "tls@ietf.org" <tls@ietf.org>
Content-Type: text/plain; charset="UTF-8"
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/eG5OlUFsZfzAb2qOZg2uf0sRBgc>
Subject: Re: [TLS] Alert after sending ServerHello
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.22
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: Wed, 26 Apr 2017 12:00:24 -0000

On 26 April 2017 at 17:19, Ilari Liusvaara <ilariliusvaara@welho.com> wrote:
> AFAIK, the only situations where client can abort sending 0-RTT data
> is noticing lack of server EarlyData extension (so server isn't
> listening anyway), or if the entiere handshake is aborted.. Doing it
> in other situations leads to subtle race conditions.

NSS stops sending 0-RTT as soon as it processes EncryptedExtensions.
It also stops if it receives a HelloRetryRequest.  In both cases you
know that the server is trial decrypting and so it will correctly
handle more 0-RTT data, but there is no point sending more if you know
that it is junk.

>> In effect, we assume that the entire flight is processed atomically
>> and generate errors based on that.  Only when the entire flight is
>> processed cleanly do we install keys and respond.
>
> My implementation processes message-by-message. So it installs the
> client handshake keys after ServerHello.

NSS processes message-by-message, but the we just delay installing the
client handshake keys.  This allows us to get the most out of 0-RTT,
but has this small downside.

>> This is a pain for us, we don't have the code that Ilari talks about,
>> so some of our tests end up hitting decode errors on the server, but
>> it's been manageable thus far.
>
> The code I was talking about was handling the special case that the
> server might receive either encrypted or unencrypted alert in response
> to its flight. And the difference it makes is just what error is
> declared as abort reason.

Yeah, it's totally manageable, but there are a few small warts in the
tests (which match the sent alert on one side with the received alert
on the other side in the normal case).