Skip to content

Branch free witness generation - #97

Merged
burdges merged 1 commit into
masterfrom
branch-free-witness
Aug 10, 2026
Merged

Branch free witness generation#97
burdges merged 1 commit into
masterfrom
branch-free-witness

Conversation

@davxy

@davxy davxy commented Aug 4, 2026

Copy link
Copy Markdown
Member

Remove secret-dependent branches and memory indexing from witness generation

Audit issue reference: https://github.com/paritytech/srlabs_findings/issues/709

.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();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd probably have passed an iterator here, but whatever.

//! 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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

@davxy davxy Aug 10, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@burdges

burdges commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

I'm fine to merge this. It's a bit over the time imho, but whatever.

@burdges
burdges merged commit 8bb36d5 into master Aug 10, 2026
7 checks passed
@davxy
davxy deleted the branch-free-witness branch August 10, 2026 14:30
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.

2 participants