From 18d0c712f6954564df50e5aa78862b1d6e128b3b Mon Sep 17 00:00:00 2001 From: Bruno Clermont Date: Tue, 24 Jan 2017 13:54:29 +0800 Subject: [PATCH] Fix an other misusage of .Sum() --- src/cypherpunks.ru/govpn/peer.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cypherpunks.ru/govpn/peer.go b/src/cypherpunks.ru/govpn/peer.go index 081ea00..792ebe7 100644 --- a/src/cypherpunks.ru/govpn/peer.go +++ b/src/cypherpunks.ru/govpn/peer.go @@ -56,13 +56,17 @@ func newNonces(key *[32]byte, i uint64) chan *[NonceSize]byte { if err != nil { panic(err) } + sum := make([]byte, mac.Size()) nonces := make(chan *[NonceSize]byte, NonceBucketSize*3) go func() { for { buf := new([NonceSize]byte) binary.BigEndian.PutUint64(buf[:], i) mac.Write(buf[:]) - mac.Sum(buf[:0]) + sum = mac.Sum(nil) + for index := 0; index < NonceSize; index++ { + buf[index] = sum[index] + } nonces <- buf mac.Reset() i += 2 -- 2.44.0