Skip to content

Commit

Permalink
ecdh: allow for setting of handshake message contents
Browse files Browse the repository at this point in the history
  • Loading branch information
iwasaki-kenta committed Feb 19, 2019
1 parent 00ff2fc commit c6cd19e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions handshake/ecdh/mod.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (b *block) OnBegin(p *protocol.Protocol, peer *noise.Peer) error {
}

req := Handshake{publicKey: ephemeralPublicKey}
req.signature, err = ephemeralPrivateKey.Sign(nil, []byte(msgEphemeralHandshake), crypto.Hash(0))
req.signature, err = ephemeralPrivateKey.Sign(nil, []byte(b.handshakeMessage), crypto.Hash(0))
if err != nil {
return errors.Wrap(errors.Wrap(protocol.DisconnectPeer, err.Error()), "failed to sign handshake message using ECDSA")
}
Expand Down Expand Up @@ -86,7 +86,7 @@ func (b *block) OnBegin(p *protocol.Protocol, peer *noise.Peer) error {
return errors.Wrap(protocol.DisconnectPeer, "failed to unmarshal our peers ephemeral public key")
}

if !edwards25519.Verify(peersPublicKey, []byte(msgEphemeralHandshake), res.signature) {
if !edwards25519.Verify(peersPublicKey, []byte(b.handshakeMessage), res.signature) {
return errors.Wrap(protocol.DisconnectPeer, "failed to verify signature in handshake request")
}

Expand Down

0 comments on commit c6cd19e

Please sign in to comment.