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

Hugo Krawczyk <> Tue, 28 April 2015 05:49 UTC

Return-Path: <>
Received: from localhost ( []) by (Postfix) with ESMTP id B82861A00F1 for <>; Mon, 27 Apr 2015 22:49:10 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -0.977
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 ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id yfq-BfUgfmnN for <>; Mon, 27 Apr 2015 22:49:08 -0700 (PDT)
Received: from ( [IPv6:2a00:1450:4010:c04::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 285811A00CF for <>; Mon, 27 Apr 2015 22:49:08 -0700 (PDT)
Received: by lbcga7 with SMTP id ga7so98915010lbc.1 for <>; Mon, 27 Apr 2015 22:49:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; 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 with SMTP id a1mr13286945lah.9.1430200146472; Mon, 27 Apr 2015 22:49:06 -0700 (PDT)
MIME-Version: 1.0
Received: by with HTTP; Mon, 27 Apr 2015 22:48:35 -0700 (PDT)
In-Reply-To: <>
References: <> <> <> <> <> <> <> <> <> <> <>
From: Hugo Krawczyk <>
Date: Tue, 28 Apr 2015 01:48:35 -0400
X-Google-Sender-Auth: HKLRc2ymbMXBPPq1bTDaBJlOAD0
Message-ID: <>
To: Michael StJohns <>
Content-Type: multipart/alternative; boundary="089e0160b7d4b035be0514c26b8d"
Archived-At: <>
Cc: "" <>
Subject: Re: [TLS] confirming the room’s consensus: adopt HKDF PRF for TLS 1.3
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." <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-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

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
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.


On Sun, Apr 26, 2015 at 4:52 PM, Michael StJohns <>

>  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