Skip to content

Conversation

@tarcieri
Copy link
Member

@tarcieri tarcieri commented Jun 5, 2025

In the past we've deliberately avoided exposing the y-coordinate to prevent the possibility of things like invalid curve attacks, although with time we have exposed more and more to support things like alternative point compression formats. See #1237 for some history.

We're now trying to use these traits with Edwards curves like Curve25519 (in curve25519-dalek) and Ed448-Goldilocks, which use compressed Edwards y-coordinates as their compressed point format. That requires y-coordinate access.

As such, this changes the previous y_is_odd method, which was used to implement SEC1-like compressed points, to a full fn y which returns a serialized field element for the y-coordinate.

Closes #1019

tarcieri added 3 commits June 5, 2025 09:20
In the past we've deliberately avoided exposing the y-coordinate to
prevent the possibility of things like invalid curve attacks, although
with time we have exposed more and more to support things like
alternative point compression formats. See #1237 for some history.

We're now trying to use these traits with Edwards curves like Curve25519
(in `curve25519-dalek`) and Ed448-Goldilocks, which use compressed
Edwards y-coordinates as their compressed point format. That requires
y-coordinate access.

As such, this changes the previous `y_is_odd` method, which was used to
implement SEC1-like compressed points, to a full `fn y` which returns a
serialized field element for the y-coordinate.

Closes #1019
This is quite hard to express via the trait-based interface otherwise,
which is needed for ECDSA recovery, at the very least.

We can experiment with getting rid of this before the next release, but
preserving it ensures this change isn't breaking for now.
For symmetry with `y_is_odd`. This is also useful for point compression
using an Edwards y-coordinate.
tarcieri added a commit to RustCrypto/elliptic-curves that referenced this pull request Jun 5, 2025
Companion PR to RustCrypto/traits#1891 which adds access to affine
y-coordinates.

Notably we've just added an Edwards curve with `ed448-goldilocks`, and
these curves use compressed Edwards y-coordinates, so y-coordinate
access is needed to even implement point compression generically for
these curves.
tarcieri added a commit to RustCrypto/elliptic-curves that referenced this pull request Jun 5, 2025
Companion PR to RustCrypto/traits#1891 which adds access to affine
y-coordinates.

Notably we've just added an Edwards curve with `ed448-goldilocks`, and
these curves use compressed Edwards y-coordinates, so y-coordinate
access is needed to even implement point compression generically for
these curves.

Note that due to #1229 it's currently not
possible to impl the extened `AffineCoordinates API for the Decaf
implementation in the `ed448-goldilocks` crate. This PR comments out the
relevant code for now with a TODO to fix it.
@tarcieri
Copy link
Member Author

tarcieri commented Jun 5, 2025

With one minor hiccup, there's now a companion PR for this here: RustCrypto/elliptic-curves#1230

tarcieri added a commit to RustCrypto/elliptic-curves that referenced this pull request Jun 5, 2025
Companion PR to RustCrypto/traits#1891 which adds access to affine
y-coordinates.

Notably we've just added an Edwards curve with `ed448-goldilocks`, and
these curves use compressed Edwards y-coordinates, so y-coordinate
access is needed to even implement point compression generically for
these curves.

Note that due to #1229 it's currently not
possible to impl the extened `AffineCoordinates API for the Decaf
implementation in the `ed448-goldilocks` crate. This PR comments out the
relevant code for now with a TODO to fix it.
@tarcieri tarcieri merged commit c190381 into master Jun 5, 2025
12 checks passed
@tarcieri tarcieri deleted the elliptic-curve/expose-affine-y-coordinate branch June 5, 2025 17:13
tarcieri added a commit to RustCrypto/elliptic-curves that referenced this pull request Jun 5, 2025
Companion PR to RustCrypto/traits#1891 which adds access to affine
y-coordinates.

Notably we've just added an Edwards curve with `ed448-goldilocks`, and
these curves use compressed Edwards y-coordinates, so y-coordinate
access is needed to even implement point compression generically for
these curves.

Note that due to #1229 it's currently not
possible to impl the extened `AffineCoordinates API for the Decaf
implementation in the `ed448-goldilocks` crate. This PR comments out the
relevant code for now with a TODO to fix it.
tarcieri added a commit to RustCrypto/elliptic-curves that referenced this pull request Jun 5, 2025
Companion PR to RustCrypto/traits#1891 which adds access to affine
y-coordinates.

Notably we've just added an Edwards curve with `ed448-goldilocks`, and
these curves use compressed Edwards y-coordinates, so y-coordinate
access is needed to even implement point compression generically for
these curves.

Note that due to #1229 it's currently not
possible to impl the extened `AffineCoordinates API for the Decaf
implementation in the `ed448-goldilocks` crate. This PR comments out the
relevant code for now with a TODO to fix it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

elliptic-curve: affine y-coordinate access

2 participants