mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 04:06:18 +08:00
MAGIC - consider performance, just base zero check
This commit is contained in:
parent
586ab84f33
commit
798dbe465e
@ -193,7 +193,7 @@ func Encrypt(random io.Reader, pub *ecdsa.PublicKey, msg []byte, opts *Encrypter
|
|||||||
opts = &defaultEncrypterOpts
|
opts = &defaultEncrypterOpts
|
||||||
}
|
}
|
||||||
//A3, requirement is to check if h*P is infinite point, h is 1
|
//A3, requirement is to check if h*P is infinite point, h is 1
|
||||||
if (pub.X.Sign() == 0 && pub.Y.Sign() == 0) || !curve.IsOnCurve(pub.X, pub.Y) {
|
if pub.X.Sign() == 0 && pub.Y.Sign() == 0 {
|
||||||
return nil, errors.New("SM2: invalid public key")
|
return nil, errors.New("SM2: invalid public key")
|
||||||
}
|
}
|
||||||
for {
|
for {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user