diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-07-02 15:28:38 +0200 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-07-02 15:28:38 +0200 |
commit | 2aa0daf4d58ffc930fde611e7efe6ae3c9515130 (patch) | |
tree | d99a2a65be02ab3b6d4a965ab4f1d6165a981549 /src/noise_protocol.go | |
parent | 1e620427bd01b1e897c57752359f7dbb28e34bff (diff) |
Fixed transport header problem
Diffstat (limited to 'src/noise_protocol.go')
-rw-r--r-- | src/noise_protocol.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/noise_protocol.go b/src/noise_protocol.go index adb00ec..5a62901 100644 --- a/src/noise_protocol.go +++ b/src/noise_protocol.go @@ -32,10 +32,11 @@ const ( ) const ( - MessageInitiationSize = 148 - MessageResponseSize = 92 - MessageCookieReplySize = 64 - MessageTransportSize = 16 + poly1305.TagSize // size of empty transport + MessageInitiationSize = 148 + MessageResponseSize = 92 + MessageCookieReplySize = 64 + MessageTransportHeaderSize = 16 + MessageTransportSize = MessageTransportHeaderSize + poly1305.TagSize // size of empty transport ) const ( @@ -449,6 +450,8 @@ func (peer *Peer) NewKeyPair() *KeyPair { keyPair.sendNonce = 0 keyPair.recvNonce = 0 keyPair.created = time.Now() + keyPair.localIndex = peer.handshake.localIndex + keyPair.remoteIndex = peer.handshake.remoteIndex // remap index @@ -471,7 +474,7 @@ func (peer *Peer) NewKeyPair() *KeyPair { if kp.previous != nil { kp.previous.send = nil kp.previous.recv = nil - peer.device.indices.Delete(kp.previous.id) + peer.device.indices.Delete(kp.previous.localIndex) } kp.previous = kp.current kp.current = keyPair |