Skip to content

Commit

Permalink
bindings/go/blst.go: fix logical error in SigValidate.
Browse files Browse the repository at this point in the history
Thanks to Yunjong Jeong (@blukat29) for report.
  • Loading branch information
dot-asm committed Aug 9, 2023
1 parent c6a3cc0 commit fb91221
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 8 additions & 4 deletions bindings/go/blst.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,10 @@ func (pk *P1Affine) KeyValidate() bool {
// always cryptographically safe, but application might want
// to guard against obviously bogus individual[!] signatures.
func (sig *P2Affine) SigValidate(sigInfcheck bool) bool {
return (sigInfcheck && !bool(C.blst_p2_affine_is_inf(sig))) ||
bool(C.blst_p2_affine_in_g2(sig))
if sigInfcheck && bool(C.blst_p2_affine_is_inf(sig)) {
return false
}
return bool(C.blst_p2_affine_in_g2(sig))
}

//
Expand Down Expand Up @@ -1090,8 +1092,10 @@ func (pk *P2Affine) KeyValidate() bool {
// always cryptographically safe, but application might want
// to guard against obviously bogus individual[!] signatures.
func (sig *P1Affine) SigValidate(sigInfcheck bool) bool {
return (sigInfcheck && !bool(C.blst_p1_affine_is_inf(sig))) ||
bool(C.blst_p1_affine_in_g1(sig))
if sigInfcheck && bool(C.blst_p1_affine_is_inf(sig)) {
return false
}
return bool(C.blst_p1_affine_in_g1(sig))
}

//
Expand Down
6 changes: 4 additions & 2 deletions bindings/go/blst_minpk.tgo
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ func (pk *P1Affine) KeyValidate() bool {
// always cryptographically safe, but application might want
// to guard against obviously bogus individual[!] signatures.
func (sig *P2Affine) SigValidate(sigInfcheck bool) bool {
return (sigInfcheck && !bool(C.blst_p2_affine_is_inf(sig))) ||
bool(C.blst_p2_affine_in_g2(sig))
if sigInfcheck && bool(C.blst_p2_affine_is_inf(sig)) {
return false
}
return bool(C.blst_p2_affine_in_g2(sig))
}

//
Expand Down

0 comments on commit fb91221

Please sign in to comment.