mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-27 04:36:19 +08:00
sm9: need to further check 0 handling
This commit is contained in:
parent
13ddfad8e4
commit
bf17ff1a4d
@ -256,9 +256,7 @@ func (e *G1) UnmarshalCompressed(data []byte) ([]byte, error) {
|
||||
e.p.x.Unmarshal(data[1:])
|
||||
montEncode(&e.p.x, &e.p.x)
|
||||
x3 := e.p.polynomial(&e.p.x)
|
||||
if !Sqrt(&e.p.y, x3) {
|
||||
return nil, errors.New("sm9.G1: invalid compressed point encoding")
|
||||
}
|
||||
e.p.y.Sqrt(x3)
|
||||
montDecode(x3, &e.p.y)
|
||||
if byte(x3[0]&1) != data[0]&1 {
|
||||
gfpNeg(&e.p.y, &e.p.y)
|
||||
|
Loading…
x
Reference in New Issue
Block a user