primeorder: use FieldArithmetic trait#1833
Merged
Merged
Conversation
Uses the new `hazmat` trait added to `elliptic-curve` in RustCrypto/traits#2458 to define the associated `FieldElement` type for a given curve.
935a4a4 to
9c9b728
Compare
tarcieri
added a commit
that referenced
this pull request
Jun 21, 2026
This removes the `expose-field` feature from `k256`, `p256`, `p384`, and `p521`, which previously re-exported the `FieldElement` types for these curves from the toplevel of these crates. That's the wrong level of abstraction and mixes something which is easy to misuse with the other safe abstractions provided at the crate's toplevel. Instead, the `FieldElement` types can always be accessed using the new `hazmat` trait: `FieldArithmetic` (see #1833) use elliptic_curve::hazmat::FieldArithmetic; type FieldElement = <MyCurve as FieldArithmetic>::FieldElement; There's no longer any crate features to enable and it's always accessible, but must be accessed through the `hazmat` trait, which we recommend you *do not* re-export (nor should you re-export a type alias) so the "hazmat" string is always easy to search for.
tarcieri
added a commit
that referenced
this pull request
Jun 22, 2026
This removes the `expose-field` feature from `k256`, `p256`, `p384`, and `p521`, which previously re-exported the `FieldElement` types for these curves from the toplevel of these crates. That's the wrong level of abstraction and mixes something which is easy to misuse with the other safe abstractions provided at the crate's toplevel. Instead, the `FieldElement` types can always be accessed using the new `hazmat` trait: `FieldArithmetic` (see #1833) use elliptic_curve::hazmat::FieldArithmetic; type FieldElement = <MyCurve as FieldArithmetic>::FieldElement; There's no longer any crate features to enable and it's always accessible, but must be accessed through the `hazmat` trait, which we recommend you *do not* re-export (nor should you re-export a type alias) so the "hazmat" string is always easy to search for.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uses the new
hazmattrait added toelliptic-curvein RustCrypto/traits#2458 to define the associatedFieldElementtype for a given curve.