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

bounds check comparing polynomials #56

Merged
merged 3 commits into from
Feb 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion share/poly.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,14 +379,19 @@ func (p *PubPoly) Add(q *PubPoly) (*PubPoly, error) {
}

// Equal checks equality of two public commitment polynomials p and q. If p and
// q are trivially unequal (e.g., due to mismatching cryptographic groups),
// q are trivially unequal (e.g., due to mismatching cryptographic groups, or threshold issues),
// this routine returns in variable time. Otherwise it runs in constant time
// regardless of whether it eventually returns true or false.
func (p *PubPoly) Equal(q *PubPoly) bool {
if p.g.String() != q.g.String() {
return false
AnomalRoil marked this conversation as resolved.
Show resolved Hide resolved
}
b := 1

if len(p.commits) < p.Threshold() || len(q.commits) < p.Threshold() || p.Threshold() != q.Threshold() {
return false
}

for i := 0; i < p.Threshold(); i++ {
pb, _ := p.commits[i].MarshalBinary()
qb, _ := q.commits[i].MarshalBinary()
Expand Down
Loading