]> Cypherpunks.ru repositories - govpn.git/blobdiff - src/govpn/peer.go
Move nonce expectation calculation to common function
[govpn.git] / src / govpn / peer.go
index 7366ffd642da84cec01a7ec76dc361667286855a..1076e74bea38300f1e0531e3e9ebf52f94e58340 100644 (file)
@@ -118,6 +118,11 @@ func (p *Peer) Zero() {
        p.BusyR.Unlock()
 }
 
+func (p *Peer) NonceExpectation(buf []byte) {
+       binary.BigEndian.PutUint64(buf, p.NonceExpect)
+       p.NonceCipher.Encrypt(buf, buf)
+}
+
 func newPeer(isClient bool, addr string, conn io.Writer, conf *PeerConf, key *[SSize]byte) *Peer {
        now := time.Now()
        timeout := conf.Timeout