Skip to content

Conversation

daxpedda
Copy link
Contributor

@daxpedda daxpedda commented Jul 11, 2025

This PR implements a set of types for Montgomery points with a full coordinate system and corresponding Curve448 type with a CurveArithmetic implementation. Our current MontgomeryPoint x-coordinate only remains in place for use with X448 and is renamed to MontgomeryXpoint.

For context: the x-only coordinate system obviously has a lot of missing information to properly implement a full set of arithmetic operations. Crucially, while the y-coordinate could be recovered, it is costly and is missing the sign. Some protocols exist that set the sign of the y-coordinate, which is why we have some methods in place for MontgomeryXpoint to do exactly that.

I made sure to add a full set of conversion methods between the new types.

@daxpedda daxpedda force-pushed the curve448-2 branch 2 times, most recently from cff6e6f to 1ecf9f9 Compare July 11, 2025 20:12
@daxpedda daxpedda changed the title Implement ExtendedMontgomeryPoint Implement Curve448 with full coordinates Jul 13, 2025
@daxpedda daxpedda force-pushed the curve448-2 branch 4 times, most recently from 0ad5214 to 0d64e73 Compare July 13, 2025 09:47
@daxpedda
Copy link
Contributor Author

I just stumbled on "Faster Complete Addition Laws for MontgomeryCurves" and will be looking into that.

@daxpedda
Copy link
Contributor Author

I just stumbled on "Faster Complete Addition Laws for MontgomeryCurves" and will be looking into that.

I'm going to leave this to a future somebody to look into.
Will open an issue to track it after the PR is merged.

@daxpedda
Copy link
Contributor Author

I found a bug in the current implementation of Montgomery scalar multiplication.
Our differential addition and double algorithm assumed that diff is normalized (Z=1), which it wasn't in our case.
It wasn't caught by tests because we only did one multiplication, which always started with a normalized point.

It is possible to switch our differential addition and double algorithm to not assume Z=1, which would save us the initial invert operation (normalization). But it adds one extra multiplication, so one inversion at the start of our scalar multiplication is probably cheaper then 448 multiplications.

@daxpedda daxpedda force-pushed the curve448-2 branch 2 times, most recently from 5562992 to a81e01d Compare July 16, 2025 10:05
@daxpedda
Copy link
Contributor Author

Closing this in favor of splitting it into multiple smaller PRs.

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.

1 participant