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

shallue_van_de_woestijne returns an off-curve point when t is 0. #279

Closed
roconnor-blockstream opened this issue Nov 27, 2023 · 1 comment

Comments

@roconnor-blockstream
Copy link
Contributor

roconnor-blockstream commented Nov 27, 2023

My suggestion is to either

A) Rewrite shallue_van_de_woestijne. The natural result for t equal to 0 is the point with x-coordinate d. In particular this is what the cited paper suggests that the function do.

or

B) Have secp256k1_generator_generate_internal return 0 if it calls shallue_van_de_woestijne with 0.

My preference would be for (A). The existing elements codebase already just crashes if secp256k1_generator_generate_internal returns 0. Therefore doing a cryptographically impossible hard-fork is not materially worse.

Doing (A) totally addresses the issue while, doing (B) requires still doing point addition with off-curve points in violation of that code's preconditions. While all the functions being called in secp256k1_generator_generate_internal should be safe to run on off-curve points, some code, (such as some scalar multiplication operations) really does requires on-curve points to avoid undefined behavior.

@jonasnick
Copy link
Contributor

Fixed in merged PR #286.

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

No branches or pull requests

2 participants