Re: [Cfrg] Elliptic Curves - curve form and coordinate systems (ends on March 12th)

Andrey Jivsov <crypto@brainhub.org> Thu, 12 March 2015 22:06 UTC

Return-Path: <crypto@brainhub.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 D34131A8741 for <cfrg@ietfa.amsl.com>; Thu, 12 Mar 2015 15:06:26 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Level:
X-Spam-Status: No, score=-1.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, 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 chtGVuwoQHhf for <cfrg@ietfa.amsl.com>; Thu, 12 Mar 2015 15:06:24 -0700 (PDT)
Received: from resqmta-po-03v.sys.comcast.net (resqmta-po-03v.sys.comcast.net [IPv6:2001:558:fe16:19:96:114:154:162]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 446091A6FFA for <cfrg@irtf.org>; Thu, 12 Mar 2015 15:06:24 -0700 (PDT)
Received: from resomta-po-18v.sys.comcast.net ([96.114.154.242]) by resqmta-po-03v.sys.comcast.net with comcast id 2m661q0045E3ZMc01m6PPq; Thu, 12 Mar 2015 22:06:23 +0000
Received: from [IPv6:::1] ([71.202.164.227]) by resomta-po-18v.sys.comcast.net with comcast id 2m6N1q00E4uhcbK01m6Ng2; Thu, 12 Mar 2015 22:06:23 +0000
Message-ID: <55020DDE.2070701@brainhub.org>
Date: Thu, 12 Mar 2015 15:06:22 -0700
From: Andrey Jivsov <crypto@brainhub.org>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0
MIME-Version: 1.0
To: Michael Hamburg <mike@shiftleft.org>
References: <54F8E735.2010202@isode.com> <5501E6A5.5040608@brainhub.org> <CAMfhd9VNM7q7PKfxDdZPOFAMBsyKfREUOotxtYycozvsS9UvxA@mail.gmail.com> <5501F149.2070008@brainhub.org> <76112F6C-8D5E-4958-888D-2076F8E3B547@shiftleft.org> <981A9A41-719B-49F1-A289-43ECEDD1BD3E@shiftleft.org>
In-Reply-To: <981A9A41-719B-49F1-A289-43ECEDD1BD3E@shiftleft.org>
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Transfer-Encoding: 8bit
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1426197983; bh=PPe5mPwXjrf9TkOZXr3wb6t315+meS/sMlCXHmz+piE=; h=Received:Received:Message-ID:Date:From:MIME-Version:To:Subject: Content-Type; b=I491wVJCjqUnc05/zEr41BiYOBH53axgJKHiBF8HsDEBr3PNnxqmjB1v460SMxAD+ eeyjBPhASZA5hl9KdyC4WJgxzORf9gni1WpJoAS9xFYyW1KyYLKOPQ2/tuzCeobfoL 4WPiJK0l/Ob0v/VvTp1r8NLD7++cWzkEHxtFNsPQWFtnyfcrg7IwQhgSJEvUOCYkFO pPzzx75rJTYk9C+/0sod+LOhBiI8hLLfNs5p88OZ3780xZUdWpKssORzM0OikAJqZX cbTiXK6cptZWcLwC0q/QBEzGx1SWEhNBRqAh6rw2KYurOioyvh566scq0Na7k2bTh+ 4N2JrBZpeBc4Q==
Archived-At: <http://mailarchive.ietf.org/arch/msg/cfrg/2qWVg3dI31NZSRKasc6y1PGDnkU>
Cc: Adam Langley <agl@imperialviolet.org>, "cfrg@irtf.org" <cfrg@irtf.org>
Subject: Re: [Cfrg] Elliptic Curves - curve form and coordinate systems (ends on March 12th)
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, 12 Mar 2015 22:06:27 -0000

On 03/12/2015 01:40 PM, Michael Hamburg wrote:
> Or maybe I’m misunderstanding.  Are you still figuring that an ECDH implementation will only use the u output from the Montgomery ladder?

Correct, the Montgomery implementation would always use u (disregard v 
on input).

The shared secret is u, as produced by the existing Montgomery ladder 
code. If the implementation is a mix of e.g. Twisted Edwards calculation 
for fixed base and Montgomery for variable base, the Montgomery ladder 
code doesn't change at all.

Ephemeral keys can be pre-calculated (or reused) and thus the <1% cost 
applies to the worst-case scenario. Public keys in certificates live for 
years.

>
> In that case, the ladder doesn’t have this added complexity, but I prefer Adam’s suggestion to use a sign bit instead of sending the full v coordinate.  In that case also, ECDH wouldn’t output the sign bit, so it wouldn’t be a completely unified point format, but that’s fine.

Adam's proposal is a step in the direction I advocate, except that I 
point that sending only 1 bit, i.e. the point compression, has 10% 
penalty during decompression. For this reason I think that the sender 
should "help" the recipient avoid it for about 10% saving for both.

The cost of decompression is 10% for each ECDHE or signature verification.

I wonder how many trees will die due to everybody decompressing the v 
for the life of each certificate :-) ?

>
> Cheers,
> — Mike
>
>> On Mar 12, 2015, at 1:26 PM, Michael Hamburg <mike@shiftleft.org> wrote:
>>
>> Hi Andrey,
>>
>> Have you considered the extra complexity to compute which is the correct v at the end of the Montgomery ladder?  If you want a unified point format that every operation uses, you need a way to compute the sign of v.
>>
>> I get 4 u0 v1 v2 = (1 - u1 u2 - u0 u2 + u0 u1) (1 - u1 u2 + u0 u2 - u0 u1) and symmetrically.  This doesn’t require a square root if you know the input’s v coordinate, but it does increase complexity.  At some point you might as well go full decaf, particularly if there’s no trivial patch to existing curve25519() functions.
>>
>> Cheers,
>> — Mike
>>
>>> On Mar 12, 2015, at 1:04 PM, Andrey Jivsov <crypto@brainhub.org> wrote:
>>>
>>> I apologize (need more coffee). I meant to write v = SQRT(u^3 + 486662*u^2 + u). The SQRT can be calculated (for almost free) during X/Z calculation by the sender at the end of scalarmult, because the sender must do 1/Z, but there is no apparent way to avoid SQRT for the receiver (unless the received doesn't need v and only works on u). The sign is embedded in v (and v can be adjusted  p-v as needed for signatures; ECDH doesn't care).
>>>
>>> On 03/12/2015 12:53 PM, Adam Langley wrote:
>>>> On Thu, Mar 12, 2015 at 12:19 PM, Andrey Jivsov <crypto@brainhub.org> wrote:
>>>>> I propose the Montgomery curve representation (u, v), which can be used for
>>>>> signatures on the same curve.
>>>>>
>>>>> "u" is identical to the sec 9 of
>>>>> https://tools.ietf.org/html/draft-agl-cfrgcurve-00.
>>>>> "v" is calculated (at virtually no additional computational cost) as v = u^3
>>>>> + 486662*u^2 + u
>>>> I'm going to display my ignorance here, but if "v" can be calculated
>>>> from just u with very little cost, why send it at all? The receiver
>>>> could equally calculate it if useful, no?
>>>>
>>>>> * The format is friendly for crypto algorithms that need to add points (as
>>>>> opposed to ECDH only)
>>>> Wouldn't they need to know an extra bit? Given a point on the
>>>> Montgomery curve, (u,v), the "v" value is v^2, right? Doesn't that
>>>> discard the sign of v?
>>>>
>>>>
>>>> Cheers
>>>>
>>>> AGL
>>>>
>>>
>>> _______________________________________________
>>> Cfrg mailing list
>>> Cfrg@irtf.org
>>> http://www.irtf.org/mailman/listinfo/cfrg
>>
>> _______________________________________________
>> Cfrg mailing list
>> Cfrg@irtf.org
>> http://www.irtf.org/mailman/listinfo/cfrg