[PATCH 11/12] noise_protocol: mixHash(): remove unnecessary Reset()

Simon Ruderich simon at ruderich.org
Mon Jan 1 11:53:01 CET 2018


Resetting the hash is only necessary when reusing it which is not the
case as the function immediately returns.

Also prevents confusion by the reader who might expect a reason why the
hash is reset here.
---
 src/noise_protocol.go | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/noise_protocol.go b/src/noise_protocol.go
index 2bf38fe..c19f836 100644
--- a/src/noise_protocol.go
+++ b/src/noise_protocol.go
@@ -118,7 +118,6 @@ func mixHash(dst *[blake2s.Size]byte, h *[blake2s.Size]byte, data []byte) {
 	hsh.Write(h[:])
 	hsh.Write(data)
 	hsh.Sum(dst[:0])
-	hsh.Reset()
 }
 
 func (h *Handshake) mixHash(data []byte) {
-- 
2.15.1



More information about the WireGuard mailing list