[CFRG] Re: RFC 8032bis: resources on resolving some Ed25519 issues

Jack Grigg <ietf@jackgrigg.com> Fri, 08 November 2024 12:29 UTC

Return-Path: <me@jackgrigg.com>
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 AFD74C1519A9 for <cfrg@ietfa.amsl.com>; Fri, 8 Nov 2024 04:29:17 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.909
X-Spam-Level:
X-Spam-Status: No, score=-1.909 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sPnokYLyCug3 for <cfrg@ietfa.amsl.com>; Fri, 8 Nov 2024 04:29:17 -0800 (PST)
Received: from mail-oa1-f48.google.com (mail-oa1-f48.google.com [209.85.160.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 14656C1519A6 for <cfrg@irtf.org>; Fri, 8 Nov 2024 04:29:17 -0800 (PST)
Received: by mail-oa1-f48.google.com with SMTP id 586e51a60fabf-2891055c448so1073934fac.0 for <cfrg@irtf.org>; Fri, 08 Nov 2024 04:29:17 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731068956; x=1731673756; h=to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DZSPOPJElxj7skdiKIn+Y7IpvWbhCPEe9vjirD0ESws=; b=ITTbyQaDNYzsFBsatHcLJt8GbFb6S8aJXCQc55SNQ1J61aLsqSyb7PUeLoUgPF+NRo S+9ifikQXm2DtTeRCOv51xx+YZ3MrGx0tpACIo/4hKwmAAhgppsDz2gG8Dv6qD49ZMIz ZBs4LSPxdeGNIC1jAFOx01eYnPwFY99dxmWxIxtY72lR8IidFa47ce3y6EVIrmqmOaSC +xafks1dFqXCIK+r1zVImpF+S4COcu9oTb8kS7qHk58F2Du1pecO86J//KEjC9ni4vt3 T/eeJKnOyILQeeuSQQ6X56zg84VVHOvUz/EwdOgMTQ2MxFHlG72kI6T/RJgOvVI1Cqls 5mjg==
X-Gm-Message-State: AOJu0YzpaE783E24qnGRSAlhRXTbebMv0bC1pIC2/ZardFYY7Ls9CIHK Yl+pOWOmktlqGsgl951FI/DesmwRrg2DMe91NWBo8XX3TLNhSGv0arqBK+ChywbkbgmxdBJjIvw CX4F0b9V7QTczm/1cjsNlrZsBkspMxMORHB9guhWp4OoDjjNZPy8=
X-Google-Smtp-Source: AGHT+IGxCylGxl4fXoVvt0p9fcsABo1o/QgMVl4dZrCTGecv98e5gjwgy8dC9iqlXBuu1Ozc8zLrfej+8Iv54gW0kaU=
X-Received: by 2002:a05:6870:5b88:b0:288:60bc:1361 with SMTP id 586e51a60fabf-295600f1776mr2707352fac.19.1731068955956; Fri, 08 Nov 2024 04:29:15 -0800 (PST)
MIME-Version: 1.0
References: <CAFR824zuXp26A-Jt9h5tL=xi3oWebME1HjXNkeyJhL4jestX-w@mail.gmail.com> <5D23F0C8-9625-41A3-998D-C1C1CD5D0205@hotmail.com> <TXLBar-O1IkD4_H9fAXXDUSV5yi4_VyACIKqJUANFG4v9BKuqfGrg3kU-Iw39B7zcQ8guFad3w2tltolttmGoJh2-LndPAEDX0tcAc_bH2c=@proton.ch> <Zy3fhmxVPq3Y1K3A@LK-Perkele-VII2.locald>
In-Reply-To: <Zy3fhmxVPq3Y1K3A@LK-Perkele-VII2.locald>
From: Jack Grigg <ietf@jackgrigg.com>
Date: Sat, 09 Nov 2024 01:29:04 +1300
Message-ID: <CAPC=aNVu1Dj8awH-1tHB4Y5MPhzzNLON1FfGtRAAEnMwijxjWQ@mail.gmail.com>
To: CFRG <cfrg@irtf.org>
Content-Type: multipart/alternative; boundary="00000000000033b7b2062665e692"
Message-ID-Hash: EDLN2CHAOXN64PQVSSGX7R54FPJH5KES
X-Message-ID-Hash: EDLN2CHAOXN64PQVSSGX7R54FPJH5KES
X-MailFrom: me@jackgrigg.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-cfrg.irtf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
X-Mailman-Version: 3.3.9rc6
Precedence: list
Reply-To: ietf@jackgrigg.com
Subject: [CFRG] Re: RFC 8032bis: resources on resolving some Ed25519 issues
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/cfrg/T8LzatMkcSNscnmj_JE4jumwrrs>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cfrg>
List-Help: <mailto:cfrg-request@irtf.org?subject=help>
List-Owner: <mailto:cfrg-owner@irtf.org>
List-Post: <mailto:cfrg@irtf.org>
List-Subscribe: <mailto:cfrg-join@irtf.org>
List-Unsubscribe: <mailto:cfrg-leave@irtf.org>

At C2SP we maintain a set of Ed25519 test vectors:

https://github.com/C2SP/CCTV/tree/main/ed25519

These exercise a complete set of edge cases for the elliptic curve point
inputs (the public key A and the first half R of the signature) to Ed25519
signature verification. We also document the behaviours of some known
ecosystem specifications and implementations (which test vectors they
accept, reject, or are silent on). If you maintain an implementation of
Ed25519, we encourage you to run these test vectors; if you see a different
pattern of test vector results than any listed therein, or notice any bugs,
we'd welcome an update to the list!

On Fri, Nov 8, 2024 at 10:54 PM Ilari Liusvaara <ilariliusvaara@welho.com>
wrote:

> It seems that some of the divergences are baked into exact specification
> requirements so there is no satisfying everyone with one specification
> without optional steps.
>
> There are at least the following axes:
>
> - No point check vs. order check vs. subgroup check.
> - Check point canonicity or not.
> - Check scalar canonicity or not.
> - Clear cofactor or not.
>
> (With some degeneracies: If doing subgroup check on R and A, clearing
> cofactor does not matter.)
>

And this is just the set of axes that are apparent within the
specifications. Implementation behaviour varies much more broadly beyond
these axes, and rarely conforms to any specification (as described in the
aforementioned blog post, and encoded in the C2SP test vectors).


> E.g., ZIP215 has no point check, no point canonicity check, scalar
> canonicity check, and cofactor clear. And it mandates doing exactly
> this.
>

(With my Zcash developer hat on:)

The reason we took this approach is that, by being a strict broadening of
the valid set of signatures, it entirely removed the need for the signer to
be aware of ZIP 215 rules and made migrating to them possible. Our pre-ZIP
215 validator implementation enforced scalar canonicity of S (as specified
in RFC 8032) which meant we could be certain that all signature producers
were also producing canonical scalars (which are significantly easier for
implementations to handle than non-prime-order elliptic curve points, as
evidenced by the wide variety of documented incompatible behaviour in the
latter). Under ZIP 215, signers required no changes in order for their
signatures to be valid, and crucially, the set of previously-created
signatures remained valid under ZIP 215 rules. Attempting to craft tighter
validation criteria for the elliptic curve point inputs, while navigating
around the numerous validation compatibility pitfalls, would have massively
complicated the protocol.

Cheers,
Jack