Re: [CFRG] Closure (was Re: Small subgroup question for draft-irtf-cfrg-hash-to-curve)

Mike Hamburg <mike@shiftleft.org> Tue, 13 April 2021 13:06 UTC

Return-Path: <mike@shiftleft.org>
X-Original-To: cfrg@ietfa.amsl.com
Delivered-To: cfrg@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 053DB3A15BB for <cfrg@ietfa.amsl.com>; Tue, 13 Apr 2021 06:06:05 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.205
X-Spam-Level:
X-Spam-Status: No, score=-1.205 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, TRACKER_ID=0.1, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=shiftleft.org
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 sXgM4bp9QTdx for <cfrg@ietfa.amsl.com>; Tue, 13 Apr 2021 06:06:00 -0700 (PDT)
Received: from doomsayer.shiftleft.org (unknown [54.219.126.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 5DF9F3A15AC for <cfrg@irtf.org>; Tue, 13 Apr 2021 06:06:00 -0700 (PDT)
Received: from [192.168.7.53] (unknown [198.207.18.242]) (Authenticated sender: mike) by doomsayer.shiftleft.org (Postfix) with ESMTPSA id E84F1BB80B; Tue, 13 Apr 2021 13:05:57 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shiftleft.org; s=sldo; t=1618319158; bh=0z0PcLkzJh+v3anG25L20KBBeeAsMQ65nOMbdjjhr9A=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=J4yiCI7e5c6OHytlk8c6BfWC8trPQq+htFrc444F6e4J0PFYWXSUdHbbK14hnql1t N/W4xxefC+4GE3Q9Tb8Z27tpwnmiaGE3SV4NHHk/TfRKomOsPwRcP4UfugNtpl8cc+ vrCeIQakC40uS2sO0wpro1ncRcEvYKvIrMswenGM=
From: Mike Hamburg <mike@shiftleft.org>
Message-Id: <479FA69E-D1FF-4511-B4B0-402C31FF2AB1@shiftleft.org>
Content-Type: multipart/alternative; boundary="Apple-Mail=_F60C6815-E55A-4782-A328-9FE98E9095BC"
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\))
Date: Tue, 13 Apr 2021 10:05:55 -0300
In-Reply-To: <AM6PR01MB42789718B0838E9C305562A5D64F9@AM6PR01MB4278.eurprd01.prod.exchangelabs.com>
Cc: Armando Faz <armfazh@cloudflare.com>, IRTF CFRG <cfrg@irtf.org>
To: "Hao, Feng" <Feng.Hao=40warwick.ac.uk@dmarc.ietf.org>
References: <CABZxKYnTxM_es9tkDHd+cN4X0dT3WeOuaR2zki7LqFWzp17dgA@mail.gmail.com> <AM6PR01MB42789718B0838E9C305562A5D64F9@AM6PR01MB4278.eurprd01.prod.exchangelabs.com>
X-Mailer: Apple Mail (2.3654.60.0.2.21)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cfrg/-iOD4Taas4wTs3tArSSE0YNHhuI>
Subject: Re: [CFRG] Closure (was Re: Small subgroup question for draft-irtf-cfrg-hash-to-curve)
X-BeenThere: cfrg@irtf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
List-Unsubscribe: <https://www.irtf.org/mailman/options/cfrg>, <mailto:cfrg-request@irtf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cfrg/>
List-Post: <mailto:cfrg@irtf.org>
List-Help: <mailto:cfrg-request@irtf.org?subject=help>
List-Subscribe: <https://www.irtf.org/mailman/listinfo/cfrg>, <mailto:cfrg-request@irtf.org?subject=subscribe>
X-List-Received-Date: Tue, 13 Apr 2021 13:06:05 -0000


> On Apr 13, 2021, at 5:50 AM, Hao, Feng <Feng.Hao=40warwick.ac.uk@dmarc.ietf.org> wrote:
> 
> Therefore, precluding low-order points from map-to-curve by design is still a relevant research question. Can it be possibly done? If so, can it be done efficiently? I am curious to learn.

I suggested a way to do this earlier in the thread, which works for typical Edwards curves like Ed25519 and Ed448: just precompute the least (lexicographically or whatever) point Q such that map_to_curve(anything) + Q doesn’t hit any low-order points, and call that function map_to_large_order_point_on_curve or whatever.  Then clear the cofactor if you want, to get to the large-prime-order subgroup.  The point Q is easy to compute if the small subgroup is small enough (e.g. at most 24 elements), because SWU and Elligator are easy to invert.  For Ristretto and Decaf, I believe the byte serializations of these points are

000000000000000000000000000000000000000000000000000000000000097e

and

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002

respectively.  You could alternatively make Q the least possible multiple of G, which would be (if I’m calculating correctly) 16*G or 47*G, respectively.  The least positive and least negative values are the same, because Q is in image of Elligator iff -Q is; this also means that you can’t take Q to be map_to_curve(the least possible input).

If you want a uniform map to the large-prime-order subgroup, you can scalarmul by (1 + (second input % (p-1))).  That’s expensive, but in many cases you’re going to scalarmul the output of map-to-curve anyway, so you can just combine the two scalars.

Obviously this calculation is slightly more annoying than a single map_to_curve, but it’s entirely feasible.

Cheers,
— Mike