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

p521: fix panics when decoding FieldElements #967

Merged
merged 1 commit into from
Nov 11, 2023

Conversation

tarcieri
Copy link
Member

@tarcieri tarcieri commented Nov 11, 2023

Some debug_assert!s were getting triggered on inputs that need to be handled without panicking.

Fixes #965

cc @MasterAwesome

Some `debug_assert!`s were getting triggered on inputs that need to be
handled without panicking.

Fixes #965
@tarcieri tarcieri merged commit 0b28c07 into master Nov 11, 2023
11 checks passed
@tarcieri tarcieri deleted the p521/fix-field-element-decode-panic branch November 11, 2023 14:53
@tarcieri tarcieri mentioned this pull request Nov 11, 2023
@MasterAwesome
Copy link
Contributor

MasterAwesome commented Nov 11, 2023

Hmm, so invalid points can still be created through other functions when the name doesn't contain the suffix _unchecked like from_hex. And those functions don't return an Option or a Result. Should the u576_to_le_bytes return an Option?

@tarcieri
Copy link
Member Author

from_hex is documented as not performing the check. Are you seeing anything else which isn't documented as such?

u576_to_le_bytes needs to operate in constant time for from_bytes to be constant-time.

@MasterAwesome
Copy link
Contributor

Oh sorry, I just saw that it's a pub(crate) and that it's documented. Looks good to me!

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.

P521 FieldElement conversions can panic
2 participants