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

k256: add impl of ReduceNonZero<U256> for Scalar #501

Merged
merged 4 commits into from
Jan 4, 2022

Conversation

fjarri
Copy link
Contributor

@fjarri fjarri commented Dec 30, 2021

  • add impl of ReduceNonZero<U256> for Scalar
  • fix a bug in WideScalar::reduce_nonzero() (a zero value returned when reducing MODULUS-1)

Very embarrassing for me, but at least chances of someone hitting it were astronomically small, and if they did, it most probably resulted in a panic during inversion or something of the sort.

@tarcieri
Copy link
Member

tarcieri commented Jan 3, 2022

there may be a small performance penalty for calculating order_minus_one in the method itself

It's const fn so I'd hope not, although binding it to a function-scoped constant would be a way to make sure.

should I add tests?

That'd be nice 😉

@fjarri
Copy link
Contributor Author

fjarri commented Jan 4, 2022

It's const fn so I'd hope not, although binding it to a function-scoped constant would be a way to make sure.

Fixed.

Also it's a good thing you asked me to add tests...

@tarcieri tarcieri merged commit b4ebe62 into RustCrypto:master Jan 4, 2022
@tarcieri
Copy link
Member

tarcieri commented Jan 4, 2022

Thank you!

@fjarri
Copy link
Contributor Author

fjarri commented Jan 4, 2022

Btw, are you planning on making a release of k256 any time soon? My other project would benefit from having this available.

@fjarri fjarri deleted the reduce-nonzero-256 branch January 4, 2022 23:25
@tarcieri
Copy link
Member

tarcieri commented Jan 5, 2022

Sure, I can cut a release

@tarcieri tarcieri mentioned this pull request Jan 5, 2022
@tarcieri
Copy link
Member

tarcieri commented Jan 5, 2022

In case you didn't see, I cut k256 v0.10.1 yesterday.

Another elliptic-curve crate release might take a bit longer as I'd like it to include hash-to-curve work, which is currently half-finished.

@fjarri
Copy link
Contributor Author

fjarri commented Jan 5, 2022

Thanks, appreciate it!

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.

2 participants