Re: [TLS] HSM-friendly Key Computation

Michael StJohns <> Sun, 19 April 2015 18:49 UTC

Return-Path: <>
Received: from localhost ( []) by (Postfix) with ESMTP id 620331A8F39 for <>; Sun, 19 Apr 2015 11:49:55 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -2.6
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 ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id LtQLzrItgB-c for <>; Sun, 19 Apr 2015 11:49:53 -0700 (PDT)
Received: from ( []) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 7B2F61A8F33 for <>; Sun, 19 Apr 2015 11:49:53 -0700 (PDT)
Received: by qgfi89 with SMTP id i89so43576542qgf.1 for <>; Sun, 19 Apr 2015 11:49:52 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=bawt2J2DbpIKSmA3iecHmVNx1k7LNjQ/sNFs+B0ZMS8=; b=j9Mfcpmzhz5B7KsqaQ3srJGFnsM5pypmy/C+KLNFBkLRAt6RTHkG/HgtNaJWt5xHwR Pwkc4+4+ZYXluTFpaWTHH4KFf0LvaxyLMXge5jtWnjpWEOsp/7fOFq5MgiAtAxrBei6f ReLK087aU4KZ6iuape1jdUfw1tIobB7YkffeBx8UqWJ4aTtSzCmu7u8GztEYtQ3WfkXb wh/kEMSMdlutAn/eN27Q/4H9RykSfcGOlVuQsVAiGcoSCqiuxiroUeUiWBQTtn9kqUci wxFDOs6l7Y4/EDY1aHTgt9GdcyxoYOzEu0zZu3xmWEieT9LAsMR4tUSS+65F+ecEmlpY TWug==
X-Gm-Message-State: ALoCoQkJw/lXHi2Uu8HuPz5/az+PhlYEC+ydZXBRmhNNboZgH2NA+jJeknGx36FtoBDVqlcNixqC
X-Received: by with SMTP id k34mr22871227qkh.12.1429469392694; Sun, 19 Apr 2015 11:49:52 -0700 (PDT)
Received: from ?IPv6:2601:a:2a00:84:a9e1:16a3:552:1db4? ([2601:a:2a00:84:a9e1:16a3:552:1db4]) by with ESMTPSA id z14sm10313735qge.7.2015. for <> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Apr 2015 11:49:52 -0700 (PDT)
Message-ID: <>
Date: Sun, 19 Apr 2015 14:49:58 -0400
From: Michael StJohns <>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
MIME-Version: 1.0
References: <> <>
In-Reply-To: <>
Content-Type: text/plain; charset="windows-1252"; format="flowed"
Content-Transfer-Encoding: 7bit
Archived-At: <>
Subject: Re: [TLS] HSM-friendly Key Computation
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: Sun, 19 Apr 2015 18:49:55 -0000

On 4/19/2015 12:22 AM, Peter Gutmann wrote:
> Russ Housley <> writes:
>> If one wants to implement the cryptographic functions in a Hardware Security
>> Module (HSM), this structure is far from ideal.
> Weelll... it's far from ideal if you want to use traditional/historic PKCS #11
> mechanisms, but since a new PRF will need updated HSM support anyway

And that's where we differ I think.
> it
> shouldn't be any problem to accommodate it, and now that PKCS #11 is being
> managed by OASIS rather than RSADSI/EMC and things have got moving again in
> advancing the spec, it shouldn't be that big a deal.  If you look at how
> CKM_TLS_PRF works, it's a significant change from how C_DeriveKey() normally
> functions that was made in order to accommodate how TLS wants to do things.
> For the TLS 2.0 (a.k.a. 1.3) PRF the PKCS #11 folks can make the same
> accommodation.  It's an issue for the HSM vendors to adapt, not the TLS spec
> to adapt.

It's not exactly that.   If you go back and look at PKCS11 2.20 , you'll 
note that they just placed the TLS/SSL  functionality in by rote - 
mainly by hacking the PKCS11 mechanism construct to provide a way of 
outputting multiple keys.

There are actually SSL mechanisms:


And TLS mechanisms


They also handily provided the CKM_TLS_PRF  mechanism which basically 
allowed you to extract ANY key stream material from a given master 
secret (since all the bytes from a call using this mechanism were 
provided nicely packaged in the place specified in the mechanism 
structure).  But that was as was requested by TLS implementers and 
probably didn't get enough vetting by the security deep thinkers.

are insecure in that they allow trivial extraction of material from a 
derived key stream.   That is an artifact of multiple things:  how the 
TLS KDF function is currently defined, the use of key exporters with out 
a model for cryptographic separation; the use of TLS specific functions.

PKCS11 tries to fix the worst of these in the new version when it added 
support for TLS1.2: 2.40 deprecates CKM_TLS_PRF, adds a CKM_TLS_MAC 
function for signing the finished messages, deprecates 
is a CKM_TLS12_KEY_AND_MAC_DERIVE, but it comes with a black box 
warning.  Its there only because the current AEAD suites require a 
source of session nonce information and they get it from the IV production.

What I would love to see for TLS1.3 is NO TLS specific mechanisms being 
added to PKCS11.    That if we still sign the finished message, we use a 
true MAC function.  That if we derive keys, we use a bog standard KDF.  
That we stomp on every TLS specific twist unless there is a specific 
security need to keep TLS secure.

At this point the set of KDFs in PKCS11 is very protocol specific and 
constitute a good part of the non-common mechanisms.  Most of the rest 
seem to relate to one family or another (e.g. suite b, GOST, etc).  It 
would be great if we could pick a standardized KDF of family of KDFs for 
the IETF and not go through this again.


> Peter.
> _______________________________________________
> TLS mailing list