mirror of
https://github.com/SwingbyProtocol/tss-lib.git
synced 2026-01-10 22:38:17 -05:00
crypto/ecpoint: remove legacy SubPoint func
This commit is contained in:
@@ -73,29 +73,6 @@ func (p *ECPoint) Sub(b *ECPoint) (*ECPoint, error) {
|
||||
return p.Add(b.Neg())
|
||||
}
|
||||
|
||||
func (p *ECPoint) SubPoint(other *ECPoint) (*ECPoint, error) {
|
||||
order := p.curve.Params().P
|
||||
modP := common.ModInt(order)
|
||||
x, y := other.X(), other.Y()
|
||||
minusY := modP.Sub(order, y)
|
||||
xVec := x.Bytes()
|
||||
yVec := minusY.Bytes()
|
||||
tmpX := make([]byte, 32-len(xVec), 32)
|
||||
tmpX = append(tmpX, xVec...)
|
||||
if len(tmpX) != 32 {
|
||||
return nil, errors.New("SubPoint(): len(tmpX) != 32")
|
||||
}
|
||||
xVec = tmpX
|
||||
tmpY := make([]byte, 32-len(yVec), 32)
|
||||
tmpY = append(tmpY, yVec...)
|
||||
if len(tmpY) != 32 {
|
||||
return nil, errors.New("SubPoint(): len(tmpY) != 32")
|
||||
}
|
||||
yVec = tmpY
|
||||
minusPoint := NewECPointNoCurveCheck(p.curve, new(big.Int).SetBytes(xVec), new(big.Int).SetBytes(yVec))
|
||||
return p.Add(minusPoint)
|
||||
}
|
||||
|
||||
func (p *ECPoint) Neg() *ECPoint {
|
||||
order := p.curve.Params().P
|
||||
negY := new(big.Int).Neg(p.Y())
|
||||
|
||||
@@ -261,7 +261,7 @@ func (round *finalization) Start() *tss.Error {
|
||||
continue
|
||||
}
|
||||
gWJKI := round.temp.bigWs[j].ScalarMultBytes(kIs[i])
|
||||
gNus[i][j], _ = gWJKI.SubPoint(gMus[i][j])
|
||||
gNus[i][j], _ = gWJKI.Sub(gMus[i][j])
|
||||
}
|
||||
}
|
||||
// compute g^sigma_i's
|
||||
|
||||
Reference in New Issue
Block a user