Re: [Curdle] AD Review: draft-ietf-curdle-cms-ecdh-new-curves-04.txt

Eric Rescorla <ekr@rtfm.com> Tue, 09 May 2017 17:51 UTC

Return-Path: <ekr@rtfm.com>
X-Original-To: curdle@ietfa.amsl.com
Delivered-To: curdle@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id AC28E129512 for <curdle@ietfa.amsl.com>; Tue, 9 May 2017 10:51:36 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=rtfm-com.20150623.gappssmtp.com
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 pRKj0zhqC8yB for <curdle@ietfa.amsl.com>; Tue, 9 May 2017 10:51:34 -0700 (PDT)
Received: from mail-yw0-x230.google.com (mail-yw0-x230.google.com [IPv6:2607:f8b0:4002:c05::230]) (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 1F0FE127076 for <curdle@ietf.org>; Tue, 9 May 2017 10:51:34 -0700 (PDT)
Received: by mail-yw0-x230.google.com with SMTP id l14so4308731ywk.1 for <curdle@ietf.org>; Tue, 09 May 2017 10:51:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rtfm-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=xtyDCVY4NKvSrBBkXoAslA8YlHLbSELC7VUtdwgy0A0=; b=L/b1MvCCG3Rd65nkCEL3utjxsdj7JCg+ekq6TSDaH0eRIBRkiMWlxzZR8se8z1Bo0/ kYUNwy8K3AE1yEckSR9xNK5DvpGM6vuVdiVuSPa0hf5QXlDMD679e92+x2KsadOxNHK+ ikilUtwNyinc6llyOblIOeJ4Hyx8Pmq54OC0aTWLGJXaECk1Py3t79sYfsou0LOXmDUi A4ZWk0oeWG23ldwvYiGjYzhBGwWepBhSoI3EO+yWsEGgiL3tNfJkOAQN9KYSPB+UUA18 e65ejJv+4MagX7IEZ9zFLzNMPP9z0WmL9BKkd+2g0XZ/2cy+J3ACnvJm2QLBOgrpgZXZ od8g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=xtyDCVY4NKvSrBBkXoAslA8YlHLbSELC7VUtdwgy0A0=; b=djyWqkdDQFsKov2H79hUIFn3P/d+GmhA4rs07WjTY0IQHER/7qHsONg+T0EMg51DER 7m9mfr4t7m8JlaW6MbdBseNly03ljaQS/bmog9X6J4yiBd8mEXC3a5uv5RQhdoeU/nWX f09I0NiM725FIOl/h73PJEWUWTkAukrqxTp/+PSzdnGKIOMRbpPz4vx6pjuVCwbB/trd c8OXTT94dowSHbomgwKxW0RiZOtNuQ2arxNBuDbh49jnukr3lJZSzXVxZPKCcpHEH7Gn L016oBv+edzXEDsf260Xmm1pn8f6O1teiAIHhaHgt2rkzEnJFlItViaZmjZW0j24n7Qa M53w==
X-Gm-Message-State: AODbwcDCW+tFBO+c9/+QQyEMwQ3KFXYVklOsPpR48UT0CEEJGCMM0PUr +kO0gseP5bq0Na4uDN1qrdKECZlew9cs
X-Received: by 10.129.5.14 with SMTP id 14mr1066838ywf.85.1494352293359; Tue, 09 May 2017 10:51:33 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.129.131.150 with HTTP; Tue, 9 May 2017 10:50:52 -0700 (PDT)
In-Reply-To: <5EEB2415-61EF-4B6E-91CA-EE2EB7C3E087@vigilsec.com>
References: <CABcZeBPCGj81Br-=C4G4PPhB+vVLGwqi94q-vH1aZVs=MTQzng@mail.gmail.com> <B61A14BA-39DD-4929-8E08-AF7BF0CB9DFE@vigilsec.com> <CABcZeBMMWbGd=SSPmtBHE6XOCRSG8q3NqtJdaMQcK5uxHsqqTA@mail.gmail.com> <5EEB2415-61EF-4B6E-91CA-EE2EB7C3E087@vigilsec.com>
From: Eric Rescorla <ekr@rtfm.com>
Date: Tue, 09 May 2017 10:50:52 -0700
Message-ID: <CABcZeBNrokQHtPpd_0XLsDHwAVyBm=WTTL4OXC63WsYqPUpjqw@mail.gmail.com>
To: Russ Housley <housley@vigilsec.com>
Cc: curdle <curdle@ietf.org>
Content-Type: multipart/alternative; boundary="001a114174689da2bc054f1b01b8"
Archived-At: <https://mailarchive.ietf.org/arch/msg/curdle/EoKM4eXxjlp2LoGve4ua6WEOdbE>
Subject: Re: [Curdle] AD Review: draft-ietf-curdle-cms-ecdh-new-curves-04.txt
X-BeenThere: curdle@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: "List for discussion of potential new security area wg." <curdle.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/curdle>, <mailto:curdle-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/curdle/>
List-Post: <mailto:curdle@ietf.org>
List-Help: <mailto:curdle-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/curdle>, <mailto:curdle-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 09 May 2017 17:51:37 -0000

On Tue, May 9, 2017 at 9:03 AM, Russ Housley <housley@vigilsec.com> wrote:

> I dropped the parts that have been resolved.
>
> > TECHNICAL
>> > S 2.
>> >    X25519 is described in Section 6.1 of [CURVES], and X448 is described
>> >    in Section 6.2 of [CURVES].  Since curve25519 and curve448 have
>> >    cofactors of 8 and 4, respectively, an input point of small order
>> >    will eliminate any contribution from the other party’s private key.
>> >    As described in Section 7 of [CURVES], implementations SHOULD detect
>> >    this situation by checking for the all-zero output.
>> >
>> > Why are you not requiring this check? SSH and TLS both do.
>>
>> RFC 7748 [CURVES] says:
>>
>>    Protocol designers using Diffie-Hellman over the curves defined in
>>    this document must not assume "contributory behaviour".  Specially,
>>    contributory behaviour means that both parties' private keys
>>    contribute to the resulting shared key.  Since curve25519 and
>>    curve448 have cofactors of 8 and 4 (respectively), an input point of
>>    small order will eliminate any contribution from the other party's
>>    private key.  This situation can be detected by checking for the all-
>>    zero output, which implementations MAY do, as specified in Section 6.
>>    However, a large number of existing implementations do not do this.
>>
>> We upgraded the MAY to a SHOULD.  We are being told that some
>> implementations will not perform this check, so it seemed wrong to go all
>> the way to MUST.
>>
>
> I'd like to push on this some, because I'm having trouble seeing why
> different IETF protocols have different needs. When you say "you are being
> told" is that an S/MIME specific point or merely the the text above?
>
>
> The text above, which I gather is about some existing implementations,
> probably libraries.  I do not know what protocols use those
> implementations, but if they are libraries they will get used with many
> different protocols.
>

Sure, but other protocols are requiring it and it seems like S/MIME could
also do so, in
the worst case at the point where Z is handed off to S/MIME.

>
>

> >    The ECC-CMS-SharedInfo entityUInfo field optionally contains
>> >    additional keying material supplied by the sending agent.  Note that
>> >    [CMS] requires implementations to accept a KeyAgreeRecipientInfo
>> >    SEQUENCE that includes the ukm field.  If the ukm field is present,
>> >    the ukm is placed in the entityUInfo field.  The ukm value need not
>> >    be longer than the key-encryption key that will be produced by the
>> >    KDF.
>> >
>> > Need not? Please clarify what the purpose is here. It seems like
>> > it's to generate a unique KEK. In that case, the security bounds
>> > are what, uniqueness?
>>
>> I suggest this wording:
>>
>>    … There is no security benefit to using a ukm value that is
>>    longer than the key-encryption key that will be produced by
>>    the KDF.
>>
>
> Hmm... I believe that this statement is true, but it also seems to be
> incomplete. I may be reasoning about this incorrectly, but it seems
> to me that the minimal security requirement is that the UKM be
> unique, but that can be achieved with a value much smaller than
> the KEK. For instance, it seems like if you have a 256-bit KEK,
> then you would still be OK with a randomly-generated 128-bit
> UKM. And if we're concerned about random collisions, then the
> usefulness bound is actually min(|KEK|, |hash compression function size|).
>
>
> Yes. The umm value needs to be different for each invocation of the KDF,
> otherwise it does not provide the assurance that different keying material
> will be produced.  Of course, an implementation will generate the umm value
> using random number generator, not track the values that are used.  Several
> years ago, there was a discussion about the size of the ukm needed.  Some
> people were suggesting crazy large values, and the point was made that
> anything beyond the SIZEOF(KEK) did not improve security.
>
> Are you asking for a sentence saying that the ukm, if present, MUST be at
> least 128 bits?
>

Sorry, I was trying to talk it over, but I'm not sure how helpful I am
being. It seems like the basic requirement is that it be unique and that if
we want to give guidance it should be on the collision probability. Do we
believe that 128 bits is enough (I do!), in which case we can just say "if
you are generating it randomly, then N bits is enough"

> S 9.
>> > This section is kinda diffident about whether the sender's
>> > ephemeral is truly ephemeral. Is this a MUST? If so, please
>> > say so.
>>
>> Section 2 already explains that the originator uses an ephemeral key pair.
>>
>
> Yes, but it doesn't have any normative language (see above on this topic).
>
>
> I see.  I’ll reword the text in Section 2 to use MUST.
>
> How about:
>
>    The originator MUST use an ephemeral public/private key pair that is
>    generated on the same elliptic curve as the public key of the
>    recipient.  The ephemeral key pair MUST be used for a single CMS
>    protected content type, and then it MUST be discarded.  The
>    originator obtains the recipient's static public key from the
>    recipient's certificate [PROFILE].
>

LGTM.


>
>
> > S 3.
>> > It would be easier to put this above the key derivation stage.
>>
>> I followed the outline used in other specifications.  I figures that the
>> implementers were fine with the previous outline.
>>
>> > Please provide some sort of reference or cross-reference for
>> > “kari"
>>
>> The kari is defined in [CMS] as one of the choices in RecipientInfo.  I
>> think that is clear from the sentence.
>>
>
> Yeah, I didn't find it super-clear. How about quoting it.
>
>
> Okay.  I suggest:
>
>    The enveloped-data content type is ASN.1 encoded using the
>    EnvelopedData syntax.  The fields of the EnvelopedData syntax MUST be
>    populated as described in Section 6 of [CMS].  The RecipientInfo
>    choice is described in Section 6.2 of [CMS], and repeated here for
>    convenience.
>
>       RecipientInfo ::= CHOICE {
>         ktri KeyTransRecipientInfo,
>         kari [1] KeyAgreeRecipientInfo,
>         kekri [2] KEKRecipientInfo,
>         pwri [3] PasswordRecipientinfo,
>         ori [4] OtherRecipientInfo }
>
>    For the recipients that use X25519 or X448 the RecipientInfo kari
>    choice MUST be used.
>

This would be fine.

-Ekr


>
> Russ
>
>