Skip to content

Commit bf17762

Browse files
yycenlukasz-zimnoch
authored andcommitted
Add check in mta_proof (bnb-chain#205)
* Add check in mta_proof * go fmt on range_proof.go This reverts commit 4871684. (cherry picked from commit bde1ac3)
1 parent c6ccbea commit bf17762

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

crypto/mta/proofs.go

+14
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,20 @@ func (pf *ProofBobWC) Verify(ec elliptic.Curve, pk *paillier.PublicKey, NTilde,
194194
q3 := new(big.Int).Mul(q, q)
195195
q3 = new(big.Int).Mul(q, q3)
196196

197+
gcd := big.NewInt(0)
198+
if pf.S.Cmp(zero) == 0 {
199+
return false
200+
}
201+
if gcd.GCD(nil, nil, pf.S, pk.N).Cmp(one) != 0 {
202+
return false
203+
}
204+
if pf.V.Cmp(zero) == 0 {
205+
return false
206+
}
207+
if gcd.GCD(nil, nil, pf.V, pk.N).Cmp(one) != 0 {
208+
return false
209+
}
210+
197211
// 3.
198212
if pf.S1.Cmp(q3) > 0 {
199213
return false

crypto/mta/range_proof.go

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const (
2222

2323
var (
2424
zero = big.NewInt(0)
25+
one = big.NewInt(1)
2526
)
2627

2728
type (

0 commit comments

Comments
 (0)