X-Git-Url: http://www.git.cypherpunks.ru/?p=govpn.git;a=blobdiff_plain;f=src%2Fcypherpunks.ru%2Fgovpn%2Fidentity.go;h=d738c5563e091179bd1e1fa287fb1bbcbd6ef1d9;hp=ece2dfcf0bb2131fd4c4a48c8467d39230728837;hb=8deaf99f98548064f51a3fe5a163456257c089bb;hpb=035ce75027dd6b55905c8719c0af3e09f80debc3 diff --git a/src/cypherpunks.ru/govpn/identity.go b/src/cypherpunks.ru/govpn/identity.go index ece2dfc..d738c55 100644 --- a/src/cypherpunks.ru/govpn/identity.go +++ b/src/cypherpunks.ru/govpn/identity.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 @@ -113,9 +113,9 @@ func (mc *MACCache) Find(data []byte) *PeerId { mt.l.Lock() mt.mac.Reset() mt.mac.Write(buf) - mt.mac.Sum(buf[:0]) + sum := mt.mac.Sum(nil) mt.l.Unlock() - if subtle.ConstantTimeCompare(buf, data[len(data)-8:]) == 1 { + if subtle.ConstantTimeCompare(sum[len(sum)-8:], data[len(data)-8:]) == 1 { ppid := PeerId(pid) mc.l.RUnlock() return &ppid