Re: [Cfrg] Comparing ECC curves

Michael Hamburg <mike@shiftleft.org> Thu, 24 July 2014 18:46 UTC

Return-Path: <mike@shiftleft.org>
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 011A31A0194 for <cfrg@ietfa.amsl.com>; Thu, 24 Jul 2014 11:46:55 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 1.556
X-Spam-Level: *
X-Spam-Status: No, score=1.556 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FH_HOST_EQ_D_D_D_D=0.765, FH_HOST_EQ_D_D_D_DB=0.888, HELO_MISMATCH_ORG=0.611, HOST_MISMATCH_NET=0.311, HTML_MESSAGE=0.001, RDNS_DYNAMIC=0.982, SPF_HELO_PASS=-0.001, 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 1ur2zqwMnj8F for <cfrg@ietfa.amsl.com>; Thu, 24 Jul 2014 11:46:53 -0700 (PDT)
Received: from aspartame.shiftleft.org (199-116-74-168-v301.PUBLIC.monkeybrains.net [199.116.74.168]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 8CE4D1A0146 for <Cfrg@irtf.org>; Thu, 24 Jul 2014 11:46:53 -0700 (PDT)
Received: from [10.184.148.249] (unknown [209.36.6.242]) by aspartame.shiftleft.org (Postfix) with ESMTPSA id 2C9103AA13; Thu, 24 Jul 2014 11:44:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=shiftleft.org; s=sldo; t=1406227494; bh=OMIyhRmieYyKK2hU8EVgND6gUI5x2gK4pNuKTQoGpCk=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=Ipa5a4/FQQ8L1MUPlHUgk/WYbuawcVXXquzReG25HJ7rfBd9r6yGJHQOIrx65pc0u FHAacV4YkRFg/onkTW4f2NJZyfx/yHpy7qAMT6Ntv9n+bfAsD45XrnOgF34sjLGuWs 9xNhdZk4B2iumuSmfp6ftiU4mOLijsWjuS28Ghqc=
Content-Type: multipart/alternative; boundary="Apple-Mail=_6F3CDF41-D879-4598-B7D9-9DBA7380AAA9"
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\))
From: Michael Hamburg <mike@shiftleft.org>
In-Reply-To: <72F16DDC-E62B-4AB0-B500-4C0EC74E8B38@gmail.com>
Date: Thu, 24 Jul 2014 11:46:49 -0700
Message-Id: <8A5BD82E-F647-417D-A5A3-A7B13562FABC@shiftleft.org>
References: <CAMm+Lwj9EPJ9v92xrkM1ceAbkWYe22fpOOBObUbUJjkk8X0dng@mail.gmail.com> <bf68fd7300e14fb58330b094f4795f30@BY2PR03MB474.namprd03.prod.outlook.com> <53D117AD.8060506@sbcglobal.net> <CAMm+LwiJbkr3z5DxDtVMqjrzt0bz=5+4MRkwBMSScoLh_K=k0Q@mail.gmail.com> <53D139EF.1020002@shiftleft.org> <CAMm+LwhEC8Cqfv1Z+qiyNYEDU4t-mXwirCU9TY+d_XQEhXDvUw@mail.gmail.com> <72F16DDC-E62B-4AB0-B500-4C0EC74E8B38@gmail.com>
To: Yoav Nir <ynir.ietf@gmail.com>
X-Mailer: Apple Mail (2.1878.6)
Archived-At: http://mailarchive.ietf.org/arch/msg/cfrg/sKrQCVaTQaK9rSCeoV1QNAmRWUI
Cc: "Cfrg@irtf.org" <Cfrg@irtf.org>
Subject: Re: [Cfrg] Comparing ECC curves
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: Thu, 24 Jul 2014 18:46:55 -0000

On Jul 24, 2014, at 10:52 AM, Yoav Nir <ynir.ietf@gmail.com> wrote:

> 
> On Jul 24, 2014, at 1:23 PM, Phillip Hallam-Baker <phill@hallambaker.com> wrote:
> 
>> On Thu, Jul 24, 2014 at 12:53 PM, Mike Hamburg <mike@shiftleft.org> wrote:
>>> On 7/24/2014 8:11 AM, Phillip Hallam-Baker wrote:
>>> 
>>> E-521 seems to have been chosen as the fastest prime giving a work
>>> factor of at least 2^256. If someone finds a prime that gives a work
>>> factor of 2^240 and is 30% faster, I would have to think about which I
>>> preferred.
>>> 
>>> It may interest you to know that that the prime 2^480 - 2^240 - 1 is about
>>> 40% faster than 2^512 - 569 on modern 64-bit Intel processors, meaning that
>>> each field operation takes about 60% of the time.  For example, on Haswell a
>>> field multiply mod 2^480 - 2^240 - 1 costs about 121 cycles, and addition
>>> (with no reduce, because of reduced radix) takes fewer cycles than the
>>> pipeline (it's just two AVX2 add instructions).
>>> 
>>> I believe it is also about that much faster on than 2^521 - 1 on Sandy
>>> Bridge, but only by 20% or so on Haswell due to an implementation of
>>> multiplication mod 2^521-1 using 3-way Karatsuba/Chung-Hasan with AVX2.  It
>>> uses 9 limbs of 58 bits each organized as (Z[w]/(w^3-2))[t]/(t^3-w), and
>>> needs AVX2 for all the adding.
>> 
>> Hmm, that is good for performance I guess. But doesn't help making a decision.
>> 
>> Talking to folk, I see the current concerns raised:
>> 
>> 1) Nothing up my sleeves.
>> 2) Key size.
>> 3) Ability to support encryption and signature with one set of code.
>> 4) Performance.
>> 5) Work factor
> 
> You missed:
>    6) constant-time operation


I’d like to add:
  7) difficulty of implementation.

I think that 2), 3) and 6) are close to even across every option.

2) Every curve can use point compression once the patent expires, even if they don’t use the Montgomery ladder.  So the key size is the same as the field size, +- a few bits.

3) Weierstrass has this by default.  The other options proposed are all twisted or untwisted Edwards, or Montgomery.  These three forms are all isomorphic or isogenous to each other depending on the field, so you can pick your representation.  The isomorphisms and isogenies tend to be cheap and simple enough not to matter very much.

For a stronger curve (384-bit field and above), Bos-Costello-Longa-Naehrig and I did work which suggests that the Montgomery ladder is only 5% faster than twisted Edwards, and only if you’re compressing points.  So implementations can use twisted Edwards for everything if they want simplicity.  Montgomery-compatible point formats might still be desirable, but they aren’t that important.

6) To my knowledge, all the options we’ve discussed support constant-time operation.  The Weierstrass options are complex but doable.  The full-size packed options (field size 256, 384, 512) are slightly tricky but not that bad.


So that leaves:

1) NUMS.  I think we can all agree that this favors the BCLN curves and Curve25519.

4) Performance.  This trades off with work factor, but overall I think it favors non-BCLN curves (Curve25519, Ed448-Goldilocks, a 480-bit cousin of Goldilocks, possibly E-521) and within the BCLN curves it favors the twisted Edwards ones.

5) Work factor.  It’s clear what this is for every curve, but it isn’t clear what the ideal set of options is.

7) Difficulty of implementation.  This favors cofactor-4 curves, because constant-time Weierstrass is tricky (but doable and not horribly slow; see BCLN).

Cheers,
— Mike