]> Cypherpunks.ru repositories - govpn.git/blobdiff - src/cypherpunks.ru/govpn/handshake.go
Fix handshake peer identification
[govpn.git] / src / cypherpunks.ru / govpn / handshake.go
index a3ef2b5cf536397c176678d38c8fcd4fff70d1d8..054c73e32f3718c7293fb575d91e6ea175a1f09b 100644 (file)
@@ -1,6 +1,6 @@
 /*
 GoVPN -- simple secure free software virtual private network daemon
-Copyright (C) 2014-2016 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2014-2017 Sergey Matveev <stargrave@stargrave.org>
 
 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
@@ -141,13 +141,13 @@ func idTag(id *PeerId, timeSync int, data []byte) []byte {
                panic(err)
        }
        mac.Write(enc)
-       mac.Sum(enc[:0])
-       return enc
+       sum := mac.Sum(nil)
+       return sum[len(sum)-8:]
 }
 
 // Start handshake's procedure from the client. It is the entry point
-// for starting the handshake procedure. // First handshake packet
-// will be sent immediately.
+// for starting the handshake procedure.
+// First handshake packet will be sent immediately.
 func HandshakeStart(addr string, conn io.Writer, conf *PeerConf) *Handshake {
        state := NewHandshake(addr, conn, conf)
        var dhPubRepr *[32]byte