Re: [Cfrg] RGLC on draft-irtf-cfrg-randomness-improvements-05

"Martin Thomson" <mt@lowentropy.net> Tue, 09 July 2019 09:44 UTC

Return-Path: <mt@lowentropy.net>
X-Original-To: cfrg@ietfa.amsl.com
Delivered-To: cfrg@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 9421C1203A1 for <cfrg@ietfa.amsl.com>; Tue, 9 Jul 2019 02:44:48 -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, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=lowentropy.net header.b=VPCy7kzy; dkim=pass (2048-bit key) header.d=messagingengine.com header.b=uffj/UCf
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 K7iwLAsRb8H7 for <cfrg@ietfa.amsl.com>; Tue, 9 Jul 2019 02:44:44 -0700 (PDT)
Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id ADF581200B6 for <cfrg@irtf.org>; Tue, 9 Jul 2019 02:44:44 -0700 (PDT)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id DBA63220FF; Tue, 9 Jul 2019 05:44:43 -0400 (EDT)
Received: from imap2 ([10.202.2.52]) by compute1.internal (MEProxy); Tue, 09 Jul 2019 05:44:43 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lowentropy.net; h=mime-version:message-id:in-reply-to:references:date:from:to :cc:subject:content-type:content-transfer-encoding; s=fm2; bh=GX zuUuKj0KmgrUFIybArBfrdXxx4CGNoGcUQvlTA6Ro=; b=VPCy7kzyRJ/dSHccmu fV7pTwMHCo2tBYz5p62p3y6jfb3Nyw/3zszFHwXFYp912OAJ29MykS+RzuSw9Xkf bKRkTdM5wGI6gDJdq0X4uUe6bDZv3XPWCDUGzqcMCH8t5w9LPYrAsmRrFw4O0bJf Lm7lN7HyhXXiZ96tH+wV3pamvc4TlBhdaKMAniw/SbL9cTAh80bSjq2IVa2frz1J NBX8aJ4U50aQrEWV2F4X357duErE4xMBzNEbZNlpNlTfOzFpTTiRcVXP58RY5vEi vYDmMoUWgTIUn/HNNTeE6wCt2BItfOL7myOqer0v/DPw1R9maz+d39kZ28g06FRb zhVg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=GXzuUuKj0KmgrUFIybArBfrdXxx4CGNoGcUQvlTA6 Ro=; b=uffj/UCfJg+Pe1kSF1iKiSG0IeAAgnAvOnY1oO3goB0ANcWX6MXi3lDTC TQsdTLNHKbEUqSQTmif7eAbU+ze9muUeHxyrEbCfpIHUE3rtzxdIiK3YKXrrQ1kc xPY3ESAlWecc3zCigbMT8+Jb649BFygCil/enkYWNC7tpdojPOuH8xt7Turl/bN+ CN9Y8usiUkN7CMs5A9NrUZs4Jim/R0uMvXgsHyvA36G+dTxNBgrBC/s3mbb0JKzH 8+KfZ6WJtZG3zi+qxLV6mkix5+vAu77wgvJ2RRhSGVtFRIi6NiV/7XZNTIiVC5ge Bmj+0eVK5xdYpF5PTk7vhIZVRRveQ==
X-ME-Sender: <xms:C2IkXQNcNQY5vbaTOKq77ewdgjnHnxEu2a_14ngheD5pmMIIZVjHUw>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrgedvgddvudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtgfesthhqredtreerjeenucfhrhhomhepfdforghr thhinhcuvfhhohhmshhonhdfuceomhhtsehlohifvghnthhrohhphidrnhgvtheqnecuff homhgrihhnpehirggtrhdrohhrghenucfrrghrrghmpehmrghilhhfrhhomhepmhhtsehl ohifvghnthhrohhphidrnhgvthenucevlhhushhtvghrufhiiigvpedt
X-ME-Proxy: <xmx:C2IkXYRdHSmimkX-pVj8ahF0voWGVa5JNeR1tD7pCjFhp9qfYDbneQ> <xmx:C2IkXc2I6Cjc5JU4ykKq-fNj3FZtP2HDzc5Li7iVyCRcAUM0c_w0HQ> <xmx:C2IkXeRMoQni8iUodyjnZqHg2X7Uf_5HFIZ_XKCk6ADAl-J_WvPTKA> <xmx:C2IkXaw0KPg6C8gnaaXLn-Ae06glSoOnyh0qcrv-u298OeTEftVBIQ>
Received: by mailuser.nyi.internal (Postfix, from userid 501) id 67186E0368; Tue, 9 Jul 2019 05:44:43 -0400 (EDT)
X-Mailer: MessagingEngine.com Webmail Interface
User-Agent: Cyrus-JMAP/3.1.6-731-g19d3b16-fmstable-20190627v1
Mime-Version: 1.0
Message-Id: <075a991b-df0b-4af6-8f1d-25cd963b4f7d@www.fastmail.com>
In-Reply-To: <CAMr0u6mr6arqQ15oM0BcL0gWJSzbwEyS2BBL7dgJkd00yhE8YA@mail.gmail.com>
References: <3644133e-93c2-e5bf-b39b-04e4423becc5@isode.com> <4fd28f76-0bde-4c91-8ddc-2b3fab0b298e@www.fastmail.com> <CAMr0u6mV0Zs29tpTZ-KEGi713xDNLiQehVdA53HgOpx4Dbyruw@mail.gmail.com> <5518f189-b680-4e24-99f6-7cd6ae1ad116@www.fastmail.com> <CAMr0u6mr6arqQ15oM0BcL0gWJSzbwEyS2BBL7dgJkd00yhE8YA@mail.gmail.com>
Date: Tue, 09 Jul 2019 19:44:43 +1000
From: "Martin Thomson" <mt@lowentropy.net>
To: "Stanislav V. Smyshlyaev" <smyshsv@gmail.com>
Cc: CFRG <cfrg@irtf.org>
Content-Type: text/plain;charset=utf-8
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/cfrg/kTNeVhFl5JPHQiC7SVr-DlyNDDQ>
Subject: Re: [Cfrg] RGLC on draft-irtf-cfrg-randomness-improvements-05
X-BeenThere: cfrg@irtf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
List-Unsubscribe: <https://www.irtf.org/mailman/options/cfrg>, <mailto:cfrg-request@irtf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cfrg/>
List-Post: <mailto:cfrg@irtf.org>
List-Help: <mailto:cfrg-request@irtf.org?subject=help>
List-Subscribe: <https://www.irtf.org/mailman/listinfo/cfrg>, <mailto:cfrg-request@irtf.org?subject=subscribe>
X-List-Received-Date: Tue, 09 Jul 2019 09:44:49 -0000

Thanks for educating me Stanislav.  That all makes sense.  

We made a number of design choices in TLS 1.3 that might seem to the uneducated (which includes me), like compromises.  All of these were in the spirit of making formal analysis more tractable.

I now understand both the use of H() and the weaker guarantees that we are asking of Extract(); we might intuit simpler designs or stronger properties, but those would only be intuitions.

Cheers,
Martin

On Tue, Jul 9, 2019, at 19:32, Stanislav V. Smyshlyaev wrote:
> Dear Martin,
> 
> >> A new nit: you should probably include the usual RFC 2119/8174 boilerplate. You use MUST and such.
> Right, thanks!
> 
> >> I'd wait until LC ends and batch any changes :) 
> Yes, that's the way we plan to do this (2 weeks of RGLC will end before 
> the submission is available again :) ).
> 
> >> A secure PRF for just salt implies that the PRF property doesn't apply to IKM. But to a degree we are treating both inputs equally here. If G(L) is non-uniform, we expect to use entropy from Sig(...) to cover any deficit, and vice-versa.
> >> And when you say preserve uniformness, HKDF-Extract won't preserve 
> any non-uniformity of its inputs. Taking non-uniform input and 
> producing uniform output is one of its main features. So I don't quite 
> understand the second part of your text as formulated. 
> Of course, having a function, which is a PRF for both inputs and 
> preserves uniformness for both inputs would be great. But that will be 
> a very restrictive requirement, which can be really difficult to gain 
> and prove. 
> 
> Moreover, it is not necessary to obtain the desirable properties of the 
> construction.
> If you look at the security properties, which are declared (and proven) 
> for the construction (see three points at the end of Section 1 in the 
> draft), you'll see that we don't really treat both inputs equally: we 
> assume that either the CSPRNG is not broken (and in that case we just 
> want not to make things worse by our construction – without promising 
> that we'll improve the "almost perfect" CSPRNG), or we can't rely on 
> CSPRNG, but the key "sk" is unknown for an adversary (and in that case 
> we forget about the CSPRNG - it may give constant outputs or, even 
> worse, may be controlled by an adversary). 
> Moreover, I'd like to draw your attention to the fact that the 
> signature value is the same for all calls of a single G' instance, 
> while G(L) is new for every call (thus inputs of Extract are not equal' 
> the PRF property is required for the first input, which remains 
> constant for a single G' instance).
> 
> In practice, good constructions, such as HKDF, may also do things 
> better even in some senses that are hard to formalize.
> 
> >> That leads me to my next question, which I apologize for missing 
> first time around. Why do you need to hash the signature? Is this 
> because you want to make Extract generic rather than rely on 
> HKDF-Extract? 
> In case of Sig(sk, tag1) instead of H(Sig(sk, tag1)), even in the case 
> of Extract = HKDF-Extract, a preliminary hashing doesn't necessary 
> occurs: if you use SHA-256 and ECDSA with 256-bit curve, you'll have a 
> block size of 512 bits with exactly the same size of signature input 
> (so it won't be hashed before being fed as an input to HMAC in 
> HKDF-Extract). 
> For H(Sig(sk, tag1)), in the case of HKDF, for H with an output length 
> less or equal than the block length of a hash in HKDF, there won't be 
> any additional hashing (e.g. if you build HKDF on SHA-256 and use the 
> same SHA-256 as H), so I don't see any practical problems here. I 
> apologize if I miss something here. 
> 
> From the theoretical point of view, that hashing is needed, since in 
> the security proof (while assessing one of the security properties) in 
> https://eprint.iacr.org/2018/1057.pdf we assume that the first input is 
> indistinguishable from random for an adversary (this is a basic 
> assumption when we deal with PRFs). For Sig(...) that's not correct for 
> all usual signature primitives - and we don't want the security proof 
> be made for a construction that is "slightly" different from the 
> described one (all of us know what happens when we prove security for 
> something "slightly" different).
> The practical reason for that hashing is the following. As you know, a 
> signature key is compromised for ECDSA-like constructions if that the 
> value of a signature is obtained by an adversary, provided the RNG used 
> by signature implementation is broken (Sony PS3 ECDSA bug, etc.). Thus 
> in those cases we must treat the value of Sig(sk, tag1) as a secret.
> Suppose that one ignores the recommendations in the draft and 1) uses 
> some valuable long-term key as sk, 2) relies on the same (potentially 
> broken) entropy source (e.g., for ECDSA), as used for CSPRNG. In that 
> case, hashing of signature output before caching it for the following 
> usage protects against leakage of a key due to side-channel attacks 
> against a cached value ("H(Sig(sk, tag1))" is used many times, for each 
> invocation of G' - so if some side channel exists, the value can be 
> leaked).
> 
> 
> Kind regards,
> Stanislav
> 
> вт, 9 июл. 2019 г. в 09:46, Martin Thomson <mt@lowentropy.net>et>:
> > On Tue, Jul 9, 2019, at 15:34, Stanislav V. Smyshlyaev wrote:
> >  > «It must be a secure PRF (for salt as a key) and preserve uniformness 
> >  > of IKM (for details see [SecAnalysis])». 
> >  > It should be sufficient to avoid any confusion and point to the right 
> >  > place as well. 
> > 
> >  Would it be better to say "Extract() MUST be a secure PRF for both the salt and IKM inputs and produce a uniform output." ?
> > 
> >  A secure PRF for just salt implies that the PRF property doesn't apply to IKM. But to a degree we are treating both inputs equally here. If G(L) is non-uniform, we expect to use entropy from Sig(...) to cover any deficit, and vice-versa.
> > 
> >  And when you say preserve uniformness, HKDF-Extract won't preserve any non-uniformity of its inputs. Taking non-uniform input and producing uniform output is one of its main features. So I don't quite understand the second part of your text as formulated.
> > 
> >  That leads me to my next question, which I apologize for missing first time around. Why do you need to hash the signature? Is this because you want to make Extract generic rather than rely on HKDF-Extract?
> > 
> >  Draft-05:
> >  G'(n) = Expand(Extract(H(Sig(sk, tag1)), G(L)), tag2, n)
> >  Simplified:
> >  G'(n) = Expand(Extract(Sig(sk, tag1), G(L)), tag2, n)
> > 
> >  It seems - at least for HKDF-Extract or any function that observes the PRF relationship with respect to both inputs - that these are functionally equivalent. The only difference being that you don't have to define H and people using this technique don't have to run another iteration of the hash function. Even better, for HKDF-Extract, these are concretely the same unless Sig(...) is <= a single block of the hash function (which is possible, but not guaranteed).
> > 
> >  > We'll add this statement after the I-D submission is open again.
> > 
> >  I'd wait until LC ends and batch any changes :)
> > 
> >  A new nit: you should probably include the usual RFC 2119/8174 boilerplate. You use MUST and such.