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

elliptic-curve: add Order trait #603

Merged
merged 1 commit into from
Apr 21, 2021
Merged

Conversation

tarcieri
Copy link
Member

Adds a trait which notably does not depend on the arithmetic feature which allows associating a constant for the curve's order with a particular curve type.

Since it stores the curve type as a constant, it's not possible to use GenericArray, so instead it has each curve specify a Limbs type which is used as the type for an ORDER constant.

The longer-term goal will be to merge this with the Curve trait, ensuring that every curve implementation has a known order regardless of whether it provides an arithmetic backend or not.

This can be used as the foundation for making certain functionality generic across curve implementations at a baseline, such as checking if scalars are in-range, and as such can simplify things which are presently conditionally defined based on the presence or absence of an arithmetic backend.

Adds a trait which notably does *not* depend on the `arithmetic` feature
which allows associating a constant for the curve's order with a
particular curve type.

Since it stores the curve type as a constant, it's not possible to use
`GenericArray`, so instead it has each curve specify a `Limbs` type
which is used as the type for an `ORDER` constant.

The longer-term goal will be to merge this with the `Curve` trait,
ensuring that every curve implementation has a known order regardless of
whether it provides an arithmetic backend or not.

This can be used as the foundation for making certain functionality
generic across curve implementations at a baseline, such as checking if
scalars are in-range, and as such can simplify things which are
presently conditionally defined based on the presence or absence of an
arithmetic backend.
@tarcieri tarcieri merged commit b35bf9f into master Apr 21, 2021
@tarcieri tarcieri deleted the elliptic-curve/order-trait branch April 21, 2021 14:23
@tarcieri tarcieri mentioned this pull request Apr 21, 2021
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