Branch free witness generation - #97
Merged
Merged
Conversation
This was referenced Aug 4, 2026
burdges
reviewed
Aug 10, 2026
| .iter() | ||
| .map(|&b| if b { F::one() } else { F::zero() }) | ||
| .collect(); | ||
| let bits_as_field_elements = bits.iter().map(|&bit| bit_to_field(bit)).collect(); |
Collaborator
There was a problem hiding this comment.
I'd probably have passed an iterator here, but whatever.
burdges
reviewed
Aug 10, 2026
| //! branches and memory indexing out of witness generation. They are defense | ||
| //! in depth, not a complete side-channel countermeasure: later pipeline | ||
| //! stages (in particular the polynomial commitment MSMs) still process the | ||
| //! witness in variable time. |
Collaborator
There was a problem hiding this comment.
Why not use https://github.com/dalek-cryptography/subtle here?
Arkworks doesn't have constant time below us, but nothing wrong in having our stuff be constant time, and hoping their improves. Also, one could write arkworks curve wrappers over curves that claim constant time, although whether this claims hold is another matter.
Member
Author
There was a problem hiding this comment.
Yeah subtle introduction is a nice follow-up. Perhaps I'll open a PR to introduce it.
But let's first ship these crates as downstream we need them for production asap
Collaborator
|
I'm fine to merge this. It's a bit over the time imho, but whatever. |
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.
Remove secret-dependent branches and memory indexing from witness generation
Audit issue reference: https://github.com/paritytech/srlabs_findings/issues/709