Harden arithmetic and crypto boundary checks across u64::shr, ilog2, u32clz, and Falcon mod_12289#2808
Open
huitseeker wants to merge 6 commits intoaudit-fixes-2026from
Open
Conversation
5f15d3e to
f29b4f0
Compare
plafer
reviewed
Mar 10, 2026
| #[test] | ||
| fn verify_clz_accepts_zero_with_clz_32() { | ||
| run_verify_clz_gadget(0, 32).expect("gadget should accept valid zero boundary witness"); | ||
| } |
Contributor
There was a problem hiding this comment.
I think these should be MASM-based tests, since the ultimate goal is to test the regression with the assembler-generated code for u32clz. Instead, we're testing here the hardcoded run_verify_clz_gadget(), which might get out of date with what the assembler is doing.
Contributor
Author
There was a problem hiding this comment.
I've added MASM tests, but MASM tests validate observed output under normal system behavior, not
explicit rejection of malicious/wrong CLZ witnesses, so I've kept those.
04c3303 to
a3ab057
Compare
9b51eaf to
b20c19d
Compare
b20c19d to
0c28914
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tightens boundary/overflow verification logic in four sensitive paths:
Adds focused regression/security-style tests for each fix:
Updates cycle-count documentation/comments where instruction costs changed (u64::shr, u32clz, ilog2).
Per-commit review recommended