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: make NonZeroScalar::invert infallible #894

Merged

Conversation

tarcieri
Copy link
Member

Because NonZeroScalar means we'll never divide by 0, it's possible to make the implementation infallible.

To accomplish this, CtOption is removed from the Invert trait's signature, and used as the result type for scalars that are potentially zero as part of the blanket impl of Invert.

Fixes RustCrypto/elliptic-curves#499

Because `NonZeroScalar` means we'll never divide by 0, it's possible to
make the implementation infallible.

To accomplish this, `CtOption` is removed from the `Invert` trait's
signature, and used as the result type for scalars that are potentially
zero as part of the blanket impl of `Invert`.

Fixes RustCrypto/elliptic-curves#499
@tarcieri tarcieri force-pushed the elliptic-curve/infallible-nonzero-scalar-inversions branch from 44c72a1 to 712434d Compare January 17, 2022 21:45
@tarcieri tarcieri merged commit bb3d0de into master Jan 17, 2022
@tarcieri tarcieri deleted the elliptic-curve/infallible-nonzero-scalar-inversions branch January 17, 2022 21:48
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.

Why is NonZeroScalar::invert() fallible?
1 participant