mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 04:06:18 +08:00
sm9: fix npe issue
This commit is contained in:
parent
a1b44f1a64
commit
c4e0e39475
@ -264,7 +264,7 @@ func (priv *SignPrivateKey) MasterPublic() *SignMasterPublicKey {
|
|||||||
|
|
||||||
// SetMasterPublicKey bind the sign master public key to it.
|
// SetMasterPublicKey bind the sign master public key to it.
|
||||||
func (priv *SignPrivateKey) SetMasterPublicKey(pub *SignMasterPublicKey) {
|
func (priv *SignPrivateKey) SetMasterPublicKey(pub *SignMasterPublicKey) {
|
||||||
if priv.SignMasterPublicKey.MasterPublicKey == nil {
|
if priv.SignMasterPublicKey == nil || priv.SignMasterPublicKey.MasterPublicKey == nil {
|
||||||
priv.SignMasterPublicKey = pub
|
priv.SignMasterPublicKey = pub
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -538,7 +538,7 @@ func (priv *EncryptPrivateKey) MasterPublic() *EncryptMasterPublicKey {
|
|||||||
|
|
||||||
// SetMasterPublicKey bind the encrypt master public key to it.
|
// SetMasterPublicKey bind the encrypt master public key to it.
|
||||||
func (priv *EncryptPrivateKey) SetMasterPublicKey(pub *EncryptMasterPublicKey) {
|
func (priv *EncryptPrivateKey) SetMasterPublicKey(pub *EncryptMasterPublicKey) {
|
||||||
if priv.EncryptMasterPublicKey.MasterPublicKey == nil {
|
if priv.EncryptMasterPublicKey == nil || priv.EncryptMasterPublicKey.MasterPublicKey == nil {
|
||||||
priv.EncryptMasterPublicKey = pub
|
priv.EncryptMasterPublicKey = pub
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user