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

Error handling #267

Merged
merged 14 commits into from
Jul 6, 2023
Merged

Error handling #267

merged 14 commits into from
Jul 6, 2023

Conversation

BasileiosKal
Copy link
Contributor

Implicitly handle errors form the utility sub-routines in the core operations + address point B from #246

@BasileiosKal BasileiosKal force-pushed the vasilis/suites-format branch from ba6914a to bdaf8fc Compare June 14, 2023 11:55
@BasileiosKal
Copy link
Contributor Author

BasileiosKal commented Jun 14, 2023

Updated the PR with the following

  • Introduced ABORT (like in h2c). An operation will ABORT if some of the Precoditions are not met. Any operation calling a function that ABORTed will also ABORT.
  • If expand_message ABORTs (which it may), hash_to_scalar will also ABORT, so no need for checking explicitly its result (or require expand_len to be defined in a way that will not cause expand_message to fail, which may not always be possible).
  • return INVALID is used for errors in the Deserialization/Procedure (like getting an invalid signature or deserializing a malformed proof). A subroutine's INVALID result is explicitly handled by the calling operation.
  • Updated hash_to_scalar and create_generators to NOT check for 0, duplicates etc.

IMO this gives the more readable result.

Copy link
Contributor

@christianpaquin christianpaquin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improves readability

Comment on lines 907 to 908
2. length(ph) > 2^64 - 1
3. for i in i_array, i > 2^64 - 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this would be checked by serialize?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Iv added these checks here to ABORT instead of returning INVALID (which we would have to do if we were relying on serialize for the checks).

That way we don't have to check the result of calculate_challenge and calculate_domain in the core operations.

@BasileiosKal
Copy link
Contributor Author

Breaking Changes

  1. In hash_to_scalar removed the counter
  2. In create_generators step 3, changed I2OSP(i, 4) to I2OSP(i, 8)

("1." is because I removed the checks for 0 and "2." is to align the max number of messages with the max number of generators)

@tplooker
Copy link
Member

Ready for merge, subject to resolving the conflicts.

This was referenced Jul 2, 2023
@tplooker tplooker merged commit 8e6106a into main Jul 6, 2023
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.

5 participants