@@ -60,7 +60,9 @@ func (p *ECPoint) Add(p1 *ECPoint) (*ECPoint, error) {
6060}
6161
6262func (p * ECPoint ) ScalarMult (k * big.Int ) * ECPoint {
63- x , y := p .curve .ScalarMult (p .X (), p .Y (), k .Bytes ())
63+ // fix by https://github.com/bnb-chain/tss-lib/pull/295/files
64+ kModN := new (big.Int ).Mod (k , p .curve .Params ().N )
65+ x , y := p .curve .ScalarMult (p .X (), p .Y (), kModN .Bytes ())
6466 newP , err := NewECPoint (p .curve , x , y ) // it must be on the curve, no need to check.
6567 if err != nil {
6668 panic (fmt .Errorf ("scalar mult to an ecpoint %s" , err .Error ()))
@@ -105,7 +107,9 @@ func (p *ECPoint) EightInvEight() *ECPoint {
105107}
106108
107109func ScalarBaseMult (curve elliptic.Curve , k * big.Int ) * ECPoint {
108- x , y := curve .ScalarBaseMult (k .Bytes ())
110+ // fix by https://github.com/bnb-chain/tss-lib/pull/295/files
111+ kModN := new (big.Int ).Mod (k , curve .Params ().N )
112+ x , y := curve .ScalarBaseMult (kModN .Bytes ())
109113 p , err := NewECPoint (curve , x , y ) // it must be on the curve, no need to check.
110114 if err != nil {
111115 panic (fmt .Errorf ("scalar mult to an ecpoint %s" , err .Error ()))
0 commit comments