Re: [TLS] Extensions "supported_groups" and "key_share" in TLS 1.3

Ilari Liusvaara <ilariliusvaara@welho.com> Thu, 26 November 2015 19:15 UTC

Return-Path: <ilariliusvaara@welho.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 01CFE1A8AC4 for <tls@ietfa.amsl.com>; Thu, 26 Nov 2015 11:15:31 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.6
X-Spam-Level:
X-Spam-Status: No, score=-2.6 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham
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 CJ5fmlqI1wyQ for <tls@ietfa.amsl.com>; Thu, 26 Nov 2015 11:15:28 -0800 (PST)
Received: from filtteri6.pp.htv.fi (filtteri6.pp.htv.fi [213.243.153.189]) by ietfa.amsl.com (Postfix) with ESMTP id 280C81A8AC3 for <tls@ietf.org>; Thu, 26 Nov 2015 11:15:28 -0800 (PST)
Received: from localhost (localhost [127.0.0.1]) by filtteri6.pp.htv.fi (Postfix) with ESMTP id A647E56F7C4; Thu, 26 Nov 2015 21:15:26 +0200 (EET)
X-Virus-Scanned: Debian amavisd-new at pp.htv.fi
Received: from smtp5.welho.com ([213.243.153.39]) by localhost (filtteri6.pp.htv.fi [213.243.153.189]) (amavisd-new, port 10024) with ESMTP id ocKmbEkMnrnK; Thu, 26 Nov 2015 21:15:26 +0200 (EET)
Received: from LK-Perkele-V2 (87-92-35-116.bb.dnainternet.fi [87.92.35.116]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp5.welho.com (Postfix) with ESMTPSA id 62E855BC005; Thu, 26 Nov 2015 21:15:26 +0200 (EET)
Date: Thu, 26 Nov 2015 21:15:25 +0200
From: Ilari Liusvaara <ilariliusvaara@welho.com>
To: Xuelei Fan <xuelei.fan@vimino.com>
Message-ID: <20151126191525.GB3728@LK-Perkele-V2.elisa-laajakaista.fi>
References: <CAAgBOhuOPB=jxO=WWHmy_y7ARY5qfdK2x4xC9t-Z-vn0UU5Paw@mail.gmail.com> <20151126142632.GA3582@LK-Perkele-V2.elisa-laajakaista.fi> <CAAgBOhtG7vKx6Bro9+Qp2Gbcz8sitatYKEL=R5tW8ix7rSeMqw@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline
In-Reply-To: <CAAgBOhtG7vKx6Bro9+Qp2Gbcz8sitatYKEL=R5tW8ix7rSeMqw@mail.gmail.com>
User-Agent: Mutt/1.5.24 (2015-08-30)
Sender: ilariliusvaara@welho.com
Archived-At: <http://mailarchive.ietf.org/arch/msg/tls/UFcpklD0jl-CmC8VFH0EgVMrjU4>
Cc: "tls@ietf.org" <tls@ietf.org>
Subject: Re: [TLS] Extensions "supported_groups" and "key_share" in TLS 1.3
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, 26 Nov 2015 19:15:31 -0000

On Thu, Nov 26, 2015 at 11:37:12PM +0800, Xuelei Fan wrote:
> > This wouldn't work if one had to downnegotiate TLS 1.2. That is going to
> > happen A LOT.
> >
> > I think, "supported_groups" extension still can be sent for TLS 1.2, but
> can be ignored for TLS 1.3.  And "key_share" extension can be extended to
> support TLS 1.2 and previous versions.

Given the slowness even _security_ _fix_ extensions get deployed,
planning any sort of transition is not IMO a good idea.

> > Also, one can support curve, but not prefer to send share on it (the
> > server can call for it, at cost of extra RTT).
> >
> The scenarios may be not effective because of the extra RTT.  As if the
> client want to negotiate the curve, it may be more effective to provide the
> key information in the beginning.  Or, maybe the generation of the key
> exchange information is more expensive?

Yes, generating key exchanges can be expensive (even if it is cheaper
for each group then performing the actual key exchange). Especially for
P-384, P-521 and larger DH groups.

Also, the shares can get large if many are sent. "Xmas tree" client
keyshare is 3384 bytes by quick calculation (whereas the one containing
P-256 and X25519 is just 109). That's many times the rest of the
ClientHello, and might already cause problems.

Better plan might be to guess, as the cost of wrong guess is mostly
just 1 RTT.

> > Plus, some of the curves are of special purpose and won't ever have
> > shares.
> >
> I missed this point.  Is it possible to update the shares to tolerate the
> special purpose?  For example, allowing empty shares.

The current grammar does not allow empty value, so it is free. But
considering one needs supported_groups for backward compat., one can
just rely on that to signal that group is supported but no share is
given.

> 
> > Also, IIRC, if client has no shares, it omits key_share. If server wants
> > FS cipher suite, it then has to signal retry.
> >
> That's may be the point I missed, too.  Where and when the shares come
> from?  Looks like there are two cases:
> 1. client generate the shares and wrap them in the initial ClientHello
> message.
> 2. client omits the key_share, but still request for (EC)DHE cipher suites.
> If server want to negotiate (EC)DHE cipher suite, need an extra RTT.
> Client generate the shares on server request.

I actually looked at the Editors's Copy. The description is a mess: It
seemingly first requires key_share extension, even for the first
ClientHello... Now, that extension can't be empty... And then proceeds
to say to omit it if client has no shares to send... Which looks like
it is mutually contradictionary.

> I think the cases answer my confusing of the two extensions.  Suppose, if
> the shares can be optional, maybe it is easier to use key_share only.  If
> client has no shares, using key_share with no shares (function as
> supported_groups); if client has shares, using key_share with shares.

I think two extensions are needed for backward compatiblity: One needs
to use supported_groups, but one can't extend it, so two extension it
is.

TLS 1.3 (without 0-RTT) is supposed to be possible to downnegotiate at
least to TLS 1.2.
 
> > > The "supported_groups" extension defines the groups, while the
> > "key_share"
> > > extension defines both the groups and the key exchange information.  Both
> > > extension has its own preferences for the supported named groups.  It's
> > > easy to get conflicted if the two preferences are not consistent.  The
> > > "key_share" extension contains the information of the supported named
> > > groups.  So, the information can be used to indicate the client supported
> > > named groups.  Maybe, for TLS 1.3, it is not necessary to use the
> > > "supported_groups" extension any more.
> >
> > The only way to be conflicted would be to send key share for group not in
> > supported_groups. Sending supported_group for group not in key_shares is
> > not a conflict[1].
> >
> The preferences may be not consistent, too.  For example, the
> supported_groups prefer ffdhe2048, but the key_share prefer ffdhe4096.
> Using two preferences would make the implementation inconsistent between
> vendors if no clearly specification about the preference of the two.

Only supported_groups are perference-ordered. Key_shares is unordered,
with special exception for retry (the added group always goes last).
 
> > [1] In fact, I expect many clients to send shares for P-256 and X25519,
> > plus offer P-384 and X448 (without shares unless requested).
> >
> >
> I like this scenarios more.  It might be more clear if TLS 1.3 support
> this scenarios, but not the scenarios that sending shares before
> requested.  For the TLS vendors, client implementation may only consider
> one option. While a server implementation need to consider both, the effort
> doubles.

Basically, with some groups, sending on request is the only workable
option, given how slow or large some shares are.

Now, if PQ key exchanges were added, things would get worse, because
those methods tend to either have large keys or slow key exchange/
generation.



-Ilari