Repository navigation
fix: Remove branching on carry propagation for Montgomery reduction - #166
Merged
hubot merged 1 commit intoOct 6, 2026
Merged
Conversation
…endent branch - replace the `while carry != 0` tail in the five hand-written scalar REDCs and the shared montgomery::redc with a `for` over the limbs above the addition window, so the trip count depends only on the public round index, never on the (secret-derived) operands - behaviour is unchanged: once the carry has propagated out, the remaining iterations add 0; CAVP SigGen, wycheproof (all curves) and RFC 6979 suites pin identical signature bytes (760 tests pass) - release asm for all eleven redc/finish_redc functions now contains zero data-dependent conditional jumps (previously 22), making the branch-free contracts in ec/src/lib.rs and ecdsa/src/lib.rs accurate - diff-scoped cargo mutants (ec plus ecdsa test packages): 34/34 caught - rewrite the stale "genuinely reachable branch" and "accepted equivalent mutant" comments that described the old while loops Assisted-by: Claude:claude-fable-5
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.
Make REDC carry propagation a counted loop, removing a secret-dependent branching
while carry != 0tail in the five hand-written scalar REDCs and the shared montgomery::redc with aforover the limbs above the addition window, so the trip count depends only on the public round index, never on the (secret-derived) operandsAssisted-by: Claude:claude-fable-5