X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcypherpunks.ru%2Fgovpn%2Fpeer.go;h=7bb978c8d0548b6e1e03f37f2a8d31d17e97f8e2;hb=8b30dc0a74d068b1a081e897dc0bb6d4d80281ab;hp=22c893c80fb51d3bb0bb1affbfa395e32a137257;hpb=0bf04621961589bc735dc8bd8a075d7db24c4178;p=govpn.git diff --git a/src/cypherpunks.ru/govpn/peer.go b/src/cypherpunks.ru/govpn/peer.go index 22c893c..7bb978c 100644 --- a/src/cypherpunks.ru/govpn/peer.go +++ b/src/cypherpunks.ru/govpn/peer.go @@ -1,6 +1,6 @@ /* GoVPN -- simple secure free software virtual private network daemon -Copyright (C) 2014-2016 Sergey Matveev +Copyright (C) 2014-2017 Sergey Matveev This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -56,13 +56,15 @@ 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]) + mac.Sum(sum[0:]) + copy(buf[:], sum) nonces <- buf mac.Reset() i += 2