sm2 ke: make sure the peer pub key using same curve

This commit is contained in:
Sun Yimin 2022-08-19 11:39:02 +08:00 committed by GitHub
parent 45d6a74b6a
commit 474168700e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,7 +93,7 @@ func (ke *KeyExchange) SetPeerParameters(peerPub *ecdsa.PublicKey, peerUID []byt
return errors.New("sm2: 'peerPub' already exists, please do not set it") return errors.New("sm2: 'peerPub' already exists, please do not set it")
} }
if !IsSM2PublicKey(peerPub) { if peerPub.Curve != ke.privateKey.Curve {
return errors.New("sm2: peer public key is not expected/supported") return errors.New("sm2: peer public key is not expected/supported")
} }