Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix curves interfaces inconsistencies #35

Merged

Conversation

AntoineRondelet
Copy link
Collaborator

On the current master branch, the interfaces of the various curves are not consistent.
This is problematic as we cannot write code that would work for all curves and be generic.

This issue has to deal with how coordinates are managed in all curves implementations.
There are 5 curves implementations:

  • alt_bn128
  • bn128
  • mnt4 and 6
  • edwards

All these implementations follow different approaches to represent and access the points coordinates:

(Note that the comment above only links to the groups G1, but the same applies for the G2 groups).

As such, we see that there are 3 different methods used to handle the point coordinates.
This is problematic since we cannot easily switch "one curve for another" and write generic code.

An example of affected project is: https://github.com/clearmatics/zeth, especially the functions here: https://github.com/clearmatics/zeth/pull/181/files

This PR fixes the above issue by refactoring the groups interfaces consistently. The convention followed is the one of the alt_bn128 and edwards curves where the point coordinates are public attributes called X, Y, Z.

Important note1: This is a breaking change.
Important note2: I haven't ran benchmarks for this change. I suspect that the bn128 arithmetic may be a tiny bit affected by the changes as we need to pay the cost of filling the coordinate arrays before calling the functions from the namespace bn::ecop. This should be negligible compared to the actual "curve arithmetic" though.

@madars madars merged commit 6bb7a50 into scipr-lab:master Apr 28, 2020
@AntoineRondelet AntoineRondelet deleted the fix-curves-interfaces-inconsistencies branch August 26, 2021 12:46
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.

3 participants