Browse Source

Fix for panic in signature verification if a peer sends a nil public key.

v0.31
Zaki Manian 5 years ago
committed by Jack Zampolin
parent
commit
9939562bbe
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      p2p/conn/secret_connection.go

+ 5
- 0
p2p/conn/secret_connection.go View File

@ -122,6 +122,11 @@ func MakeSecretConnection(conn io.ReadWriteCloser, locPrivKey crypto.PrivKey) (*
} }
remPubKey, remSignature := authSigMsg.Key, authSigMsg.Sig remPubKey, remSignature := authSigMsg.Key, authSigMsg.Sig
if remPubKey == nil {
return nil, errors.New("Peer sent a nil public key")
}
if !remPubKey.VerifyBytes(challenge[:], remSignature) { if !remPubKey.VerifyBytes(challenge[:], remSignature) {
return nil, errors.New("Challenge verification failed") return nil, errors.New("Challenge verification failed")
} }


Loading…
Cancel
Save