Skip to content

Commit

Permalink
Merge pull request #11 from ThomasPiellard/audit/M-04
Browse files Browse the repository at this point in the history
fix: fixed M-04
  • Loading branch information
ThomasPiellard authored Jul 2, 2024
2 parents 872a106 + 8fa4348 commit e23bfe6
Show file tree
Hide file tree
Showing 8 changed files with 216 additions and 0 deletions.
27 changes: 27 additions & 0 deletions backend/plonk/bls12-377/verify.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions backend/plonk/bls12-381/verify.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions backend/plonk/bls24-315/verify.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions backend/plonk/bls24-317/verify.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions backend/plonk/bn254/verify.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions backend/plonk/bw6-633/verify.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions backend/plonk/bw6-761/verify.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
var (
errAlgebraicRelation = errors.New("algebraic relation does not hold")
errInvalidWitness = errors.New("witness length is invalid")
errInvalidPoint = errors.New("point is not on the curve")
)

func Verify(proof *Proof, vk *VerifyingKey, publicWitness fr.Vector, opts ...backend.VerifierOption) error {
Expand All @@ -43,6 +44,32 @@ func Verify(proof *Proof, vk *VerifyingKey, publicWitness fr.Vector, opts ...bac
return errInvalidWitness
}

// check that the points in the proof are on the curve
for i := 0; i < len(proof.LRO); i++ {
if !proof.LRO[i].IsInSubGroup() {
return errInvalidPoint
}
}
if !proof.Z.IsInSubGroup() {
return errInvalidPoint
}
for i := 0; i < len(proof.H); i++ {
if !proof.H[i].IsInSubGroup() {
return errInvalidPoint
}
}
for i := 0; i < len(proof.Bsb22Commitments); i++ {
if !proof.Bsb22Commitments[i].IsInSubGroup() {
return errInvalidPoint
}
}
if !proof.BatchedProof.H.IsInSubGroup() {
return errInvalidPoint
}
if !proof.ZShiftedOpening.H.IsInSubGroup() {
return errInvalidPoint
}

// transcript to derive the challenge
fs := fiatshamir.NewTranscript(cfg.ChallengeHash, "gamma", "beta", "alpha", "zeta")

Expand Down

0 comments on commit e23bfe6

Please sign in to comment.