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 ReduceNonZero trait #827

Merged
merged 1 commit into from Dec 3, 2021

Conversation

tarcieri
Copy link
Member

@tarcieri tarcieri commented Dec 3, 2021

Adds a trait similar to Reduce, but where the output of the reduction is ensured to be non-zero.

Also impls Reduce and ReduceNonZero for NonZeroScalar. This means that end users need only concern themselves with Reduce as they can use NonZeroScalar::<C>::from_uint_reduced instead of the more cumbersome Scalar::<C>::from_uint_reduced_non_zero.

Related: RustCrypto/elliptic-curves#432

cc @fjarri

Adds a trait similar to `Reduce`, but where the output of the reduction
is ensured to be non-zero.

Also impls `Reduce` and `ReduceNonZero` for `NonZeroScalar`. This means
that end users need only concern themselves with `Reduce` as they can
use `NonZeroScalar::<C>::from_uint_reduced` instead of the more
cumbersome `Scalar::<C>::from_uint_reduced_non_zero`.

Related: RustCrypto/elliptic-curves#432
@tarcieri tarcieri force-pushed the elliptic-curve/reduce-non-zero branch from fbb167c to 83874f3 Compare December 3, 2021 18:56
@tarcieri tarcieri merged commit f6ac4b0 into master Dec 3, 2021
@tarcieri tarcieri deleted the elliptic-curve/reduce-non-zero branch December 3, 2021 19:53
tarcieri added a commit that referenced this pull request Dec 3, 2021
In #827, a `ReduceNonZero` trait was added whose method name uses an
underscored `*_non_zero`.

However, there's already one bit of precedent in the public API:

- `SecretKey::to_nonzero_scalar`

Since this is already a stable API and providing precedent, for
consistency this commit changes all of the unstable/unreleased APIs and
internal module naming to use `nonzero` instead of `non_zero`, as this
is a non-breaking change.
tarcieri added a commit that referenced this pull request Dec 3, 2021
In #827, a `ReduceNonZero` trait was added whose method name uses an
underscored `*_non_zero`.

However, there's already one bit of precedent in the public API:

- `SecretKey::to_nonzero_scalar`

Since this is already a stable API and providing precedent, for
consistency this commit changes all of the unstable/unreleased APIs and
internal module naming to use `nonzero` instead of `non_zero`, as this
is a non-breaking change.
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.

None yet

1 participant