crypto: do not check if point is on curve during marshalling

This commit is contained in:
Marius van der Wijden 2024-03-15 12:20:24 +01:00
parent bbae80ae76
commit b3e47410c9

View file

@ -178,14 +178,7 @@ func (curve KoblitzCurve) Unmarshal(data []byte) (x, y *big.Int) {
if data[0] != 4 { // uncompressed form if data[0] != 4 { // uncompressed form
return nil, nil return nil, nil
} }
p := curve.Params().P
x = new(big.Int).SetBytes(data[1 : 1+byteLen]) x = new(big.Int).SetBytes(data[1 : 1+byteLen])
y = new(big.Int).SetBytes(data[1+byteLen:]) y = new(big.Int).SetBytes(data[1+byteLen:])
if x.Cmp(p) >= 0 || y.Cmp(p) >= 0 {
return nil, nil
}
if !curve.IsOnCurve(x, y) {
return nil, nil
}
return return
} }