Re: [Cfrg] Curve manipulation, revisited

Watson Ladd <watsonbladd@gmail.com> Mon, 29 December 2014 13:36 UTC

Return-Path: <watsonbladd@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 0E7621A1AEC for <cfrg@ietfa.amsl.com>; Mon, 29 Dec 2014 05:36:32 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2
X-Spam-Level:
X-Spam-Status: No, score=-2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, SPF_PASS=-0.001] autolearn=ham
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 gJMk8I7fhsCy for <cfrg@ietfa.amsl.com>; Mon, 29 Dec 2014 05:36:28 -0800 (PST)
Received: from mail-yh0-x22f.google.com (mail-yh0-x22f.google.com [IPv6:2607:f8b0:4002:c01::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 4A6DE1A1AE8 for <cfrg@irtf.org>; Mon, 29 Dec 2014 05:36:28 -0800 (PST)
Received: by mail-yh0-f47.google.com with SMTP id f73so6543904yha.6 for <cfrg@irtf.org>; Mon, 29 Dec 2014 05:36:27 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=3Qlptq642qwbmwg2OTXT4XireXkH1jyCVamnAttGaPM=; b=B0hJxiC5sLWhzU7PrX90VYS2IBtmwWZVuAz2h3k28gavLsoo82n9sEsq8QqMbPQ8bf kw+Loq9fQcGgTw3i7C8WW0oeeT5GO7nbOhR78sQGRrdyIH7/11BUtQlXRS4F4sB1YHOK 6B7gujFNGYVJxu0rUI8z8o4AXrrsOMSxXtsUALoTQCVHSpPITJoxSYVD3G3+Myq62MK1 fvSl9lH3GYrmq/tG3JragQdzfCgMdT8ymsq2RW+Pq7e5xKPSmGIHcMlaRazCUQ/a+4J4 LPrTr4d0HCRprI256QyO0oHeKbTSel5X1gzKTkQOb8io+8LRjVxNqgoz5NYKXYkOjDW/ z9/w==
MIME-Version: 1.0
X-Received: by 10.170.89.130 with SMTP id g124mr43001562yka.24.1419860187447; Mon, 29 Dec 2014 05:36:27 -0800 (PST)
Received: by 10.170.207.6 with HTTP; Mon, 29 Dec 2014 05:36:27 -0800 (PST)
In-Reply-To: <CA+Vbu7zqFcu8d1053mZ_eEm0q=np6T3snSQ4rfY0k1-4hBVDsA@mail.gmail.com>
References: <CAMfhd9W684XMmXn3ueDmwrsQ_ZdiFG+VqYLxkvs7qDwiJdpk6w@mail.gmail.com> <1725646678.805875.1419539885135.JavaMail.yahoo@jws100115.mail.ne1.yahoo.com> <CAMfhd9Ua5fFZk46Xx1AN2VgyJ=Yng6fnO8aN-_ZfzXQn0Xbxhg@mail.gmail.com> <CA+Vbu7zqFcu8d1053mZ_eEm0q=np6T3snSQ4rfY0k1-4hBVDsA@mail.gmail.com>
Date: Mon, 29 Dec 2014 08:36:27 -0500
Message-ID: <CACsn0ck1tJ5USLza_kFwBr94RqS6KfczHA2yR-v4opFC3o4dDQ@mail.gmail.com>
From: Watson Ladd <watsonbladd@gmail.com>
To: Benjamin Black <b@b3k.us>
Content-Type: text/plain; charset="UTF-8"
Archived-At: http://mailarchive.ietf.org/arch/msg/cfrg/zNpvLDh87fjLoJiX9G23mqFgppI
Cc: "cfrg@irtf.org" <cfrg@irtf.org>
Subject: Re: [Cfrg] Curve manipulation, revisited
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: Mon, 29 Dec 2014 13:36:32 -0000

On Mon, Dec 29, 2014 at 2:57 AM, Benjamin Black <b@b3k.us> wrote:
> Adam has accurately described our position, and thanks to him for taking up
> the slack while many of us were on holiday.
>
> The request might've come from the TLS-WG, but it is almost inconceivable
> that something CFRG recommended to TLS-WG would not be quickly adopted by
> many other WGs. It is disingenuous to argue that since the request came from
> TLS-WG nothing outside TLS-WG should be a consideration while also arguing
> that things like cofactors for 1 (mod 4)  curves must be exactly (8,4)
> without giving an example of how it matters to TLS-WG. The latter is an
> implicit acknowledgement that the scope extends beyond TLS-WG. Similarly,
> suggesting that TLS-WG could be given only X25519 without Ed25519 being
> pulled in is either naive or an attempt to sneak them both in the back door.

What do you think we should do about signatures? The Microsoft
proposal of ECDSA with Edwards points has all the disadvantages of
ECDSA and none of the "advantages" of being already standardized. It's
remarkable that when presenting a draft after the deadline, you
haven't discussed fundamental details of what you want the result to
look like. What goes on the wire?

>
> My use of the term "compromise" when presenting the current draft seems to
> have opened the door to some misunderstanding. I used the term in the sense
> of finding common ground rather than in the sense of introducing flaws. I
> would not expect anyone in this process to find it acceptable to introduce
> what they believe to be a security flaw, conspiracy theorists aside. As Adam
> said, it would be a failure if the consensus that emerged from CFRG did not
> include Microsoft, as it would be if it didn't include Google or Akamai or
> anyone else with direct responsibility for protecting a billion people
> online. We have chosen to move some on what is acceptable to us because it
> is more important that there is a result that includes enough of the things
> we believe are essential for delivering that protection than that we get to
> be "right".

You've said repeatedly you're committed to supporting the result:
seems to me that we can pick whatever we like. Horse trading and
logrolling is not the way to do things.

>
> I've included more specific responses below.
>
>
> Thanks,
> b
>
> --
>
> The view voiced by several people that the 128-bit security level curve in
> the draft is Curve25519 is a bit off base. First, the draft describes
> generation of (twisted) Edwards curves and the 128-bit curve has minimal d
> (given the addition of the newly manufactured cofactor constraint), while
> Ed25519 does not. This is an advantage for both performance and rigidity
> with a tiny reduction in simplicity of implementation, achieving a better
> balance between security, performance, and simplicity. Second, the specified
> base point is not the same and can't be the same without forcing the
> (arbitrary) choice. The result is that it is straightforward to modify
> existing Curve25519 implementations to use the new curve, but modification
> is likely required.

I don't think this is right: I seem to remember the difference being
explained by isogeny vs. isomorphism.

Base points do not affect ECDH security. Why wouldn't you change it
for backwards compatibility?

You've changed the 128 bit prime to increase performance. Why not
apply the same logic to the choice of 384 bit prime?

The question is not about changing the logic of the proposals: rather
it's about applying that logic inconsistently, and gratuitously
breaking deployed implementations.

>
> On Wed, Dec 24, 2014 at 2:47 PM, D. J. Bernstein <djb@cr.yp.to> wrote:
>>
>> Once upon a time, Microsoft said that it was a "requirement" to have
>> "rigid parameter generation for primes and curve constants" given the
>> "security level".
>
>
> Once upon a time, Dan said that is was a "requirement" to use single
> coordinate ladders to eliminate invalid curve attacks against DH
> implementations:
>
> On Tue, Dec 2, 2014 at 1:28 AM, D. J. Bernstein <djb@cr.yp.to> wrote:
>>
>> Invalid-curve attacks completely break the simplest DH implementations
>> in Montgomery coordinates _and_ in Edwards coordinates. Rather than
>> blaming the implementor, we eliminate these security failures by
>>
>>    * adding twist security, for both Montgomery and Edwards, and
>>    * switching to single-coordinate ladders.
>
>
> Yet for Curve41417, ladders suddenly become optional, just as we've said all
> along they should be:
>
> "We use a windowing method with fixed window width for constant-time
> single-scalar multiplication on Curve41417 in Edwards form. Our analysis
> also
> allows good estimates of, e.g., the cost of signature verification using
> Curve41417.
> Another option for single-scalar multiplication is the Montgomery ladder for
> the
> Montgomery form of Curve41417; this is not quite as fast as the Edwards form
> but has the advantage of fitting the computation into less SRAM."
>
> It seems performance is the real priority here and you will happily discard
> things you insist are necessary for security when they conflict with
> performance. At the 128-bit security level the ladder can be faster. At the
> 200-bit+ security levels the ladder is slower. Should we blame the
> implementor who elects not to use a single-coordinate ladder? Should we
> wonder why you would choose not to eliminate these security failures?

DJB sent a lengthy email to the list titled "Curves, Coordinates, and
Computations". In this email he explained that what an implementation
written by highly skilled and careful implementors for the ultimate in
performance does is not the same as one written for a maximum of
simplicity. The sentence you quoted had the word simple in it: that
word has a meaning you happily ignored.

Tweetnacl.c is probably the most widely used Curve25519
implementation. It's been translated into just about every language I
can think of. It can be very simple because it uses the Montgomery
ladder.

Should I take this email as saying you won't make the changes needed
to get Curve25519?

>
> This section of your paper raises another interesting point. It seems a
> slight performance drop in exchange for consuming less SRAM can be a
> desirable property to you. In Adam's Faster Curve25519 post
> (https://www.imperialviolet.org/2013/05/10/fastercurve25519.html), he
> achieves significant performance improvements at a cost of 24KB of cache for
> tables. Our NUMS 256 curve performs slightly slower than this, but only
> requires 9KB for tables. The 15KB difference represents almost 25% of the
> 64KB L1 cache in a typical Xeon and almost 50% of the 32KB L1 data cache in
> a typical ARM. It's not quite as fast but has the advantage of fitting the
> computation into less SRAM.

This is not a property of the curves, but of your implementation: the
same comb table optimization could be used by a Curve25519 optimized
implementation. That is, if it wasn't patented by Microsoft.

AGL's described implementation uses a table with 512 entries,
representing x^{16^(2*i+1)j} for i zero, j potentially zero. But one
can also use 512 entries to store a comb of 8 bits: the LSB of each
exponent byte, the 2nd to LSB of each exponent byte, etc, as the
Microsoft implementation of NUMS whatever does, and use 8 additions
and 8 doublings to compute the result. This has nothing to do with the
choice of curve or prime.

(There is a cost to what I outlined: the table has to be read in its
entirety each time through. There are several better choices here

>
> On Mon, Dec 22, 2014 at 5:54 PM, Tanja Lange <tanja@hyperelliptic.org>
> wrote:
>>
>> I think a competition has more to offer than a 'collaboration' where
>> parties get more influence by having more people send emails to the list.
>
>
> I'm not sure what point you are trying to make here. The people who haven't
> submitted curves should remain silent? That is antithetical to the IETF
> process. If you are suggesting it shouldn't be a process whereby a minority
> attempts to "stuff the ballot box" by getting a few people to yell loud and
> often to drown out differing opinions, then I agree. However, I don't think
> we would agree on who might be doing that.
>
>>
>> What should count are the merits of papers, implementations, and internet
>> drafts so that proposals get more influence by being objectively better.
>
>
> "Objectively better" is unrealistic as it depends on which implementation,
> which architectures, which benchmarks and which priorities people have for
> various properties of the curves. The example above for different L1 cache
> footprint shows how slippery "objectively better" can be. Another example
> would be the large d in Ed25519 compared to the minimal d in the rpgecc
> draft. The smaller d is "objectively better" both in terms of performance
> and rigidity, but isn't quite as simple to move between twisted Edwards and
> Montgomery.
>
> On Thu, Dec 25, 2014 at 12:55 PM, Salz, Rich <rsalz@akamai.com> wrote:
>>> desirable. But, to make progress, people need to try and understand
>>> Microsoft's position.)
>>
>>Then perhaps, as you stated earlier in the note, it would be good if we
>> didn't have to guess.
>>
>>It's kinda funny that NUMS curve has us now wanting a NUMS rationale.  But
>> perhaps funny isn't the right word, maybe sad or >pathetic is.
>
> You've been in this from the start, so I find it odd you don't recall any of
> the numerous times this has been covered, Rich. We don't see the small
> potential performance gains as worth the additional flexibility introduced
> by manipulating prime selection like this. You are of course free to
> disagree, but there is no "objectively better" answer as it is a trade-off.
> You might also consider not calling things you don't understand or with
> which you disagree "sad" or "pathetic".

What about the additional flexibility introduced by your new draft? A
user who listened to your old draft's claims of rigidity, shouldn't
accept the new drafts. Or is it that the "rigidity" claims have far
more to do with marketing than reality?

>
> On Mon, Nov 3, 2014 at 8:37 AM, Watson Ladd <watsonbladd@gmail.com> wrote:
>>
>> On Mon, Nov 3, 2014 at 8:18 AM, Paterson, Kenny
>> <Kenny.Paterson@rhul.ac.uk> wrote:
>> > Alyssa,
>> >
>> <snip>
>> >
>> > However, if there's a reasonably simple way to ensure the highest
>> > possible
>> > levels of trustworthiness in our recommendations with unduly
>> > compromising
>> > efficiency and security, then I am prepared to sacrifice some extra time
>> > to achieve it.
>>
>> That assumes that picking a generation method would "ensure the
>> highest possible levels of trustworthiness". It's not clear to me that
>> it would. Opponents of the performance approach can demonstrate the
>> flexibility they insist exists by putting BADA55 in the hexadecimal
>> form of the coefficients obtained by taking the minimal equation
>> satisfying reasonable constraints on a performance-oriented prime.
>
>
> There are at least two, possibly three, fallacies present in this challenge.
> The first is that the enormous flexibility required to insert such a string
> in the coefficients is at all a relevant metric. The second is that the
> BADA55 work used what anyone who wasn't pushing a very particular agenda
> would call "reasonable constraints". The third is that the "performance
> approach" represents much additional performance, that the performance gains
> are certain regardless of architecture or protocol, or that any additional
> performance is free.

I think the entire idea that one can backdoor curves involves "alien
technology". But even granting that, if 1/2 of all curves are weak,
even a completely rigid process (assuming one exists) isn't much
better. It's only interesting when rare properties are being targeted.

If you actually read the BADA55 paper you would see they targeted
Brainpool, which had used the hash of a fundamental constant to
generate parameters.

By contrast there are only 100 primes or so meeting the kinds of
performance constraints we have. Shake up the requirements, maybe we
get 4 curves on each prime, so about 400 curves. This is a wild
overestimate.

With the NUMS approach, despite rhetoric of "a single curve for each
security level", users will actually accept a great deal more curves.

The additional performance of 2^255-19 vs 2^256-big costs nothing. It
exists on hardware ranging from 64 bit desktop machines to 32 bit
embedded processors and 18 bit FPGA and GPU multipliers. (GPUs got
better recently). In exchange for this hit you give us exactly
nothing.

>
> It's worth noting that we have at least two rather different interpretations
> of BADA55 present in these discussions. Your interpretation seems to be that
> if you can't insert BADA55 in the coefficients then the process is rigid.
> Adam's interpretation (which might match Dan's) is that any claim of
> rigidity in generation is necessarily limited.
>
>
> _______________________________________________
> Cfrg mailing list
> Cfrg@irtf.org
> http://www.irtf.org/mailman/listinfo/cfrg
>



-- 
"Those who would give up Essential Liberty to purchase a little
Temporary Safety deserve neither  Liberty nor Safety."
-- Benjamin Franklin