Re: [TLS] confirming the room’s consensus: adopt HKDF PRF for TLS 1.3

Hugo Krawczyk <hugo@ee.technion.ac.il> Tue, 28 April 2015 05:49 UTC

Return-Path: <hugokraw@gmail.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 B82861A00F1 for <tls@ietfa.amsl.com>; Mon, 27 Apr 2015 22:49:10 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.977
X-Spam-Level:
X-Spam-Status: No, score=-0.977 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FM_FORGED_GMAIL=0.622, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, MIME_8BIT_HEADER=0.3, SPF_PASS=-0.001] 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 yfq-BfUgfmnN for <tls@ietfa.amsl.com>; Mon, 27 Apr 2015 22:49:08 -0700 (PDT)
Received: from mail-lb0-x233.google.com (mail-lb0-x233.google.com [IPv6:2a00:1450:4010:c04::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 285811A00CF for <tls@ietf.org>; Mon, 27 Apr 2015 22:49:08 -0700 (PDT)
Received: by lbcga7 with SMTP id ga7so98915010lbc.1 for <tls@ietf.org>; Mon, 27 Apr 2015 22:49:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=3hg8ITCoZYQFZF2A1c38MIOxRFRMCQkjkFkwby6HlCM=; b=TNwOp8pTyhu6hUsBrY+cfgNdrA/Dn4+iSf/yVpR0/2UcNO6yWKX/MgreLK4vxqt2sS tpkqbtfLyw9bsipU5tZTC427/WYb9bkChr3+jetbzhzHsniuknuYc4bqgjhEuI0BjYZq U/QTWmAdh8kchS+uwuvH1PjrwyU9SYc6a4Fqnzr0N5/LUxEoaPwr37btHBSmS8izAQlE Hri0dI0IyCZuqRW2fd5Kb/wOkm2X0YoaqhYUf0dl8Mp4djaqTiH4LGPYYI47Tm2FBLr8 4NPMISSDHhp/d66j9s2ol2Yh5xGy0dNXCXMAlUVkhnFQIZgk0k2/jZ59o+Y/8c64+EHP A7VA==
X-Received: by 10.152.28.97 with SMTP id a1mr13286945lah.9.1430200146472; Mon, 27 Apr 2015 22:49:06 -0700 (PDT)
MIME-Version: 1.0
Sender: hugokraw@gmail.com
Received: by 10.25.78.66 with HTTP; Mon, 27 Apr 2015 22:48:35 -0700 (PDT)
In-Reply-To: <553D4FF7.8080700@nthpermutation.com>
References: <4A5C6D8F-6A28-4374-AF1F-3B202738FB1D@ieca.com> <551DDD4E.5070509@nthpermutation.com> <F7F3EB83-FEA2-477C-8810-38C49B71C977@ieca.com> <551E290D.7020207@nthpermutation.com> <55381768.8010402@nthpermutation.com> <CACsn0cm5A50dP4JDKq9R0XdB83hyzPPLQHAMnUcXFb+DCSwV7g@mail.gmail.com> <55392B08.6020304@nthpermutation.com> <CADi0yUPTixoesXkgd=HYe_+ua_+=_UfcDBSndCgdh1usTzNpzQ@mail.gmail.com> <553D3572.6040408@nthpermutation.com> <CADi0yUOnsD0Sasq7dRTbRpUm9jTg-uf+vjkkpMCxxsKXH0kqMw@mail.gmail.com> <553D4FF7.8080700@nthpermutation.com>
From: Hugo Krawczyk <hugo@ee.technion.ac.il>
Date: Tue, 28 Apr 2015 01:48:35 -0400
X-Google-Sender-Auth: HKLRc2ymbMXBPPq1bTDaBJlOAD0
Message-ID: <CADi0yUNmOYa3D1z2d+VU2tX5ad5FfiwX5MtocL2yNvdduUgNmA@mail.gmail.com>
To: Michael StJohns <msj@nthpermutation.com>
Content-Type: multipart/alternative; boundary=089e0160b7d4b035be0514c26b8d
Archived-At: <http://mailarchive.ietf.org/arch/msg/tls/Ip0h6tY65CcdcLQ15OhM6YJFGeo>
Cc: "tls@ietf.org" <tls@ietf.org>
Subject: Re: [TLS] =?utf-8?q?confirming_the_room=E2=80=99s_consensus=3A_adopt_?= =?utf-8?q?HKDF_PRF_for_TLS_1=2E3?=
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: <http://www.ietf.org/mail-archive/web/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: Tue, 28 Apr 2015 05:49:10 -0000

Mike, thanks a lot for the clear explanation!
I think I can now understand the issues you were raising. Sorry for my
ignorance.

One thing I (think I) understand now is that this discussion had little to
do with HKDF (specifically) but rather has to do with the inputs to the KDF
function defined by the calling protocol, say TLS 1.3.

We can define TLS 1.3 so that calls to HKDF will always include a info
string composed of:
label, context (say, session-hash) and the length L of the output key
material.
Now, in the HSM implementation you will read the values label and context
from the user's input but L will  be added by the HSM itself by calculating
the length of the required key. In non-HSM implementations the software
will add L.

I am perfectly ok with adding L, or any other value, to the HKDF info input
in the TLS 1.3 spec if the WG is interested in doing so.

Hugo



On Sun, Apr 26, 2015 at 4:52 PM, Michael StJohns <msj@nthpermutation.com>
wrote:

>  I'm going to slice this up a bit and answer in pieces.  Sorry - the
> messages are getting too long.
>
> On 4/26/2015 4:20 PM, Hugo Krawczyk wrote:
>
> ​I am completely lost on this length issue. Can you give me a concrete
> example where TLS 1.3 derives different keys with same label and context
> but with different output lengths? As said, in TLS 1.3 each label and
> context is used exactly once. I must be missing something in your argument
> but I just can't figure what's that.
>
>
> Hi Hugo -
>
> This isn't about TLS specifically, but about how an HSM makes sure an
> attacker can't extract TLS keys.
>
> Assume that you implement your function in an HSM as you've defined in the
> RFC - without the length term.
>
> Consider that the HSM keys may be USED by the attacker but the HSM is set
> up to prevent extraction - the keys can't be directly extracted . (See
> below for a discussion of how this might happen).  And note that for a
> generic KDF interface, you can't ensure that the attacker doesn't use the
> same label and context in his call to use the master key as we define for
> TLS.
>
> Consider that the derivation of the master secret from the pre-master
> secret can be done by both the user and the attacker, but that the attacker
> can request a key length of 1, but with the same label and context terms
> using the same pre-master secret.  Consider that the attacker designates
> this Length 1 key as an HMAC key.
>
> The attacker now uses his version of the derived key as an HMAC key and
> uses it to generate an HMAC tag over a fixed value.  He then compares this
> to 256 generated HMACs over the same fixed value but using the 256
> different possible values of the derived key from above.  When he finds a
> match between one of his 256 HMACs and the HMAC using the derived key, he
> now knows that the value of that derived key.
>
> Consider that *without the length term, a key of length 1 has as its key
> value the same first byte of any key stream of longer length generated from
> the same master key with the same label and context*.
>
> By repeating the steps above, you can extract the master secret in O(1).
>
> If the L term is mixed in by internal mechanism, there is no user
> accessible mechanism to accomplish this.  I.e. using the same secret with
> identical labels and contexts with differing requested output lengths
> produce cryptographically disjoint key material.    If you only pass this
> in as user specified material you don't get this protection.
>
> If you ask me how an attacker can "use" the keys of someone else, consider
> that most versions of PKCS11 support only a PIN based authentication, or
> authentication is done because the HSM is embedded in the system.  The
> thing I'm trying to get to is a model where I can demonstrate that key
> material may not be extracted from an HSM by an attacker, even if the
> attacker has credentials to "use" the keys.
>
> Mike
>
>