Re: [Cfrg] (technical flaws to be corrected in next version of the draft) Fwd: Re: Adoption of draft-agl-cfrgcurve-00 as a RG document

Rene Struik <rstruik.ext@gmail.com> Wed, 28 January 2015 02:25 UTC

Return-Path: <rstruik.ext@gmail.com>
X-Original-To: cfrg@ietfa.amsl.com
Delivered-To: cfrg@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 65E9F1A1AD8 for <cfrg@ietfa.amsl.com>; Tue, 27 Jan 2015 18:25:38 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 4.201
X-Spam-Level: ****
X-Spam-Status: No, score=4.201 tagged_above=-999 required=5 tests=[BAYES_50=0.8, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, J_CHICKENPOX_12=0.6, J_CHICKENPOX_21=0.6, MANGLED_OFF=2.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 ok7pZuZEgViR for <cfrg@ietfa.amsl.com>; Tue, 27 Jan 2015 18:25:34 -0800 (PST)
Received: from mail-ie0-x22a.google.com (mail-ie0-x22a.google.com [IPv6:2607:f8b0:4001:c03::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 89CC61ACCE0 for <cfrg@irtf.org>; Tue, 27 Jan 2015 18:25:28 -0800 (PST)
Received: by mail-ie0-f170.google.com with SMTP id y20so19163880ier.1 for <cfrg@irtf.org>; Tue, 27 Jan 2015 18:25:27 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; bh=4hSqMmyV7GT8Z05s1nRtTAN0VYMjUTzTw6Qos6sg9ms=; b=V6ZjnwgbH4ruzdy7U4lAZRR+cWFu4/L54hk+HJtvm7fEFgOXSegFHPTlAmxFqoeGzh I0++nUFkkhOSIzE0yGcxAtrTzqKRmoynH7In++XkxbmpXxGI/kifyNX7M8h8nx6xZV5g rC3SfDiCidfKt0bYWKmjQmRcGbOYWcwBrD7ywAucbApvhPGs9vzeUVQDsQWfhYsHlVd7 vv/q9896TBTDI+famBTKB72yFLzqmWV4SWFtGJutN/efBRXifye37EMb4VGzI1fuYgVo UIr+5fibw4fEFQR0GA6zNbx/OZfEjSPppFE0Qkzkcrwo51iSiK1L3sSKBb9HemT7NprQ WNdw==
X-Received: by 10.50.36.103 with SMTP id p7mr1123615igj.20.1422411927587; Tue, 27 Jan 2015 18:25:27 -0800 (PST)
Received: from [192.168.0.10] (CPE7cb21b2cb904-CM7cb21b2cb901.cpe.net.cable.rogers.com. [99.231.49.38]) by mx.google.com with ESMTPSA id b7sm2043904igx.15.2015.01.27.18.25.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Jan 2015 18:25:27 -0800 (PST)
Message-ID: <54C84883.2090608@gmail.com>
Date: Tue, 27 Jan 2015 21:25:07 -0500
From: Rene Struik <rstruik.ext@gmail.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0
MIME-Version: 1.0
To: Adam Langley <agl@imperialviolet.org>
References: <54C3DD05.6060706@isode.com> <54C7D5BA.6050606@gmail.com> <CAMfhd9XA5OkPHHnh19H8H6R7Z=XqJ1vWDG2-_U9Ej6_gO+KN4A@mail.gmail.com>
In-Reply-To: <CAMfhd9XA5OkPHHnh19H8H6R7Z=XqJ1vWDG2-_U9Ej6_gO+KN4A@mail.gmail.com>
Content-Type: multipart/alternative; boundary="------------040303010307060901050706"
Archived-At: <http://mailarchive.ietf.org/arch/msg/cfrg/oZU4EkEQCHqYhq-hsWzwt_Ni8lo>
Cc: "cfrg@irtf.org" <cfrg@irtf.org>
Subject: Re: [Cfrg] (technical flaws to be corrected in next version of the draft) Fwd: Re: Adoption of draft-agl-cfrgcurve-00 as a RG document
X-BeenThere: cfrg@irtf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
List-Unsubscribe: <http://www.irtf.org/mailman/options/cfrg>, <mailto:cfrg-request@irtf.org?subject=unsubscribe>
List-Archive: <http://www.irtf.org/mail-archive/web/cfrg/>
List-Post: <mailto:cfrg@irtf.org>
List-Help: <mailto:cfrg-request@irtf.org?subject=help>
List-Subscribe: <http://www.irtf.org/mailman/listinfo/cfrg>, <mailto:cfrg-request@irtf.org?subject=subscribe>
X-List-Received-Date: Wed, 28 Jan 2015 02:25:38 -0000

Hi Adam:

Thanks for the quick feedback and willingness to accommodate my 
suggestions to improve the draft.

I will revisit your email later. However, just another brief process note:
I would like to strongly suggest first re-publishing your individual 
internet draft draft-agl-cfrgcurve-00, but now as 
draft-irtf-cfrg-curve-00 (i.e., verbatim copy, except change of title 
and submission date) and only then make changes to the resulting 
document. As I said in my previous process note (Jan 5, 2015, 4.42pm 
EST), this allows easy to keep track of evolution over time.

Please forgive me my "rigid" approach here, but the "rigid curve 
selection criteria" we started out with seem to have to apply to the 
processes of this (somewhat dysfunctional) IRTF group as well. I hope 
you appreciate this; this is not a personal criticism. BTW - this 
republication suggestion is precisely what Alexey Melnikov suggested in 
his Sat Jan 24, 2015 adoption email.

Best regards, Rene

On 1/27/2015 7:16 PM, Adam Langley wrote:
> On Tue, Jan 27, 2015 at 10:15 AM, Rene Struik <rstruik.ext@gmail.com 
> <mailto:rstruik.ext@gmail.com>> wrote:
>
>     It seems that draft-agl-cfrgcurve-00 contains a few technical
>     flaws, including:
>
>
> Thank you very much for this. It prompted me to make some changes that 
> I've been planning.
>
>     a) Section 9, p. 10:
>     The Montgomery ladder works on projective points of the form
>     (X:Y:Z), or (X::Z) {if the Y-coordinate is deleted}, where x=X/Z,
>     y=Y/Z, and where the point at infinity is (1::0).
>     If so, one has Q-Q'=(x1::z1)=(u::1), Q'=(x2::z2)=(1::0) {the point
>     at infinity}, and Q=(x3::z3)=(u::1).
>     With the draft, one mistakenly has (x2::z2)=(0::1), i.e., the
>     representation of the affine point (0,0) of order two. In that
>     case Montgomery Adds results in (u::1) + (0::1) = (4::4u^3)~ (1::
>     u^3). So, the procedure outputs on input Q:=(u::1) and scalar k=1,
>     the incorrect output R:=(1::u^3) (with x-coordinate u^{-3}),
>     rather than simply u.
>
>
> You are quite correct. I've fixed this.
>
>     b) Section 9, p. 10:
>     The Montgomery ladder should produce, on input Q=(x1::z1) and
>     scalar k, the output R:=kQ=(x2::z2), which can be mapped to an
>     affine point with x-coordinate x2/z2.
>     With the draft, one mistakenly takes 1/z2 = z2^{p-1}, whereas this
>     should obviously be z2^{p-2} (if z2 is nonzero).
>
>
> I had fixed this on GitHub after Andrey's note and it'll be in 
> draft-irtf-cfrg-curves-00.
>
>     c) Section 9, p. 10:
>     The Montgomery ladder does not produce the output R=kQ for each
>     input Q and scalar k, since, e.g., (after correcting the flaw
>     identified in #a above), one can end up with the unidentified
>     string projective point (0::0) in some cases. So, one should
>     clarify what the input/output behavior of the Montgomery ladder is
>     more clearly. {Does this work for all Montgomery curves, e.g.,
>     also when the curve y^2 = x^3 + A x^2 + x for which A^2 <>4?, etc.}
>
>
> The curve25519 function is defined as a function from ([32]byte, 
> [32]byte) -> [32]byte. As such, it does have a defined behaviour when 
> the resulting point is (0::0) as it'll output all zero bytes. Although 
> the draft was written with the possibility in mind that we might 
> define several curves, my estimation at the moment if that the CFRG 
> won't actually do that. Things might turn out differently but, for the 
> moment, I'm changing the document to be more curve25519 specific 
> rather than specifying the Montgomery ladder more generally.
>
>     d) Section 9.1, p. 11:
>     With the draft, the output of the Diffie-Hellman protocol, as
>     presented, succumbs to the small subgroup attack (e.g.,
>     DH(f,0)=0), no matter the value of f contributed by A).
>
>
> It's certainly possible to extract the value of the scalar mod the 
> cofactor from curve25519, but the scalar construction ensures that 
> value is zero. I've made a note about the "non-contributory" behaviour 
> of curve25519 in the draft.
>
>     e) Section 9.1, p. 11:
>     With the draft one has some annoying editorial glitches, including
>     -- "Alice then transmits K_A=DH(f,9) to Bob, where 9 is the number
>     9" should most likely read "Alice then transmits K_A=DH(f,g) to
>     Bob, where g is the number 9".
>     -- "Alice computes DH(f,DH(g,9))" should read "Alice computes
>     DH(f,K_B)"; etc., and vice-versa for Bob.
>
>
> Both fixed, thanks.
>
>     f) Section 9, pp. 9-11:
>     -- With the draft, the first part of Section 9 (till Section 9.1)
>     is about scalar multiplication and probably deserves a separate
>     subsection to that effect.
>
>
> I've split the scalar-mult function into its own section and moved the 
> DH bits into a separate one.
>
>     -- With the draft, not sure why scalar multiplication ineptly uses
>     the acronym "DH" (as in DH(s,u). I would strongly suggest avoiding
>     any language that could put people on the wrong footing, due to
>     connotations ubiquitous in the crypto literature.
>
>
> That's my screwup. The scalar-mult function was called "curve25519" 
> and I changed it to DH in anticipation that more curves might be 
> defined. Since I get the feeling that won't happen now, I've switched 
> back to calling it "curve25519".
>
>     -- With the draft, one seems to introduce lots of new variables to
>     denote objects (e.g., why not use scalar k, point G, Q, DH key K=
>     a Qb, co-factor h, etc., if one wants to cross a message most
>     effectively)?
>
>
> This is still an open issue as I have it now. In order to be 
> consistent, I've called the coordinates on the Montgomery curve (u, v) 
> and those on the (twisted) Edwards (x, y). We need to figure out 
> whether the existing specification for generating curves is called for 
> if we're not going to have any others. If not, then we could have 
> (x,y)  for the Montgomery curve and at least be a little more 
> consistent. I have, at least, make the scalar be 'k'.
>
>     -- With the draft, outsiders who are not necessarily be versed in
>     cryptography would have a hard time following/verifying esoteric
>     language and certainly would not be familiar with "quadratic
>     extensions", "projection maps ... extended, so". I would suggest
>     that clarity of language is key here.
>
>
> I agree and have removed that language.
>
>     Notes: Andrey Jivsov noted error #b above. I tried to retrace
>     other errors to cut-and-paste errors from
>     draft-turner-thecurve25519function-01, but that original draft
>     also contains these errors (despite mentioned review by Tanja
>     Lange, according to acknowledgements). The turner draft does
>     contain an implicit reference to flaw #d above, although in
>     nebulous terms ("contributory behavior").
>
>     For now, I refrain from other comments, but hope that we at least
>     get the technical details right. (I was hoping that the adoption
>     call would end with someone else noticing the errors above, but
>     did not see this (except for #b above), so reluctantly go to the
>     CFRG list to mention some of this here. [I have my private
>     thoughts about how many people actually read the entire draft...].)
>
>     Best regards, Rene
>
>     -------- Forwarded Message --------
>     Subject: 	Re: [Cfrg] Adoption of draft-agl-cfrgcurve-00 as a RG
>     document
>     Date: 	Sat, 24 Jan 2015 17:57:25 +0000
>     From: 	Alexey Melnikov <alexey.melnikov@isode.com>
>     <mailto:alexey.melnikov@isode.com>
>     To: 	cfrg@irtf.org <mailto:cfrg@irtf.org> <cfrg@irtf.org>
>     <mailto:cfrg@irtf.org>
>
>
>
>     Dear CFRG participants,
>
>     On 05/01/2015 19:15, Alexey Melnikov wrote:
>     > This message starts 2 weeks adoption call (ending on January 19th
>     > 2015) on:
>     >
>     >https://www.imperialviolet.org/cfrgcurve/cfrgcurve.xml
>     >
>     > as the starting point for the CFRG document which describes an
>     > algorithm for safe curve parameter generation for a particular
>     > security level and also recommends a specific curve (2^255-19) for the
>     > 128-bit security level.
>     >
>     > Please reply to this message or directly to CFRG chairs, stating
>     > whether you support (or not) adoption of this document. If you do not
>     > support adoption of this document, please state whether you support
>     > adoption of any alternative document or whether you want a particular
>     > change be made to the document before adoption.
>     >
>     > Chairs ask not to reiterate previously expressed technical opinions or
>     > arguments. But clarifying questions on the adoption call are welcome.
>     >
>     > While making your decision, please keep in mind
>     >
>     >http://www.ietf.org/mail-archive/web/cfrg/current/msg05813.html
>     Thank you for all the constructive feedback.
>
>     Chairs have reviewed responses to this message (both public and some
>     private) and can confirm that there is rough consensus for adopting
>     draft-agl-cfrgcurve-00 as a RG document. Some people supported the
>     document with conditions that some changes would (or would not) be done
>     to it, although the majority of people supported it unconditionally.
>     Some people who objected to the document being adopted asked about
>     changes that were also asked by people who supported the document, so we
>     are hoping that a future revision of the draft might become acceptable
>     even to them.
>
>     Chairs are asking Adam to republish draft-agl-cfrgcurve-00 as
>     draft-irtf-cfrg-curves-00. Chairs are in the process of discussing who
>     would be editors of the CFRG document.
>
>     Best Regards,
>     Alexey,
>     On behalf of CFRG chairs.
>     >
>     > Alexey,
>     > On behalf of CFRG chairs.
>     >
>     > P.S. Editors of draft-black-rpgecc-01 and
>     > draft-turner-thecurve25519function-01 can become co-editors of the
>     > adopted document, if they choose to do so. Email chairs directly if
>     > you are willing or not willing to do so.
>
>     _______________________________________________
>     Cfrg mailing list
>     Cfrg@irtf.org  <mailto:Cfrg@irtf.org>
>     http://www.irtf.org/mailman/listinfo/cfrg
>
>
>
>
>     _______________________________________________
>     Cfrg mailing list
>     Cfrg@irtf.org <mailto:Cfrg@irtf.org>
>     http://www.irtf.org/mailman/listinfo/cfrg
>
>
>
>
> -- 
> Adam Langley agl@imperialviolet.org <mailto:agl@imperialviolet.org> 
> https://www.imperialviolet.org


-- 
email: rstruik.ext@gmail.com | Skype: rstruik
cell: +1 (647) 867-5658 | US: +1 (415) 690-7363