summaryrefslogtreecommitdiffhomepage
path: root/device/cookie.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-12-09 17:55:50 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2021-12-09 23:15:55 +0100
commit9c9e7e2724340280d0ca4ff29c067f2d144562c0 (patch)
tree239826ccafe70e5cee73936d9bcea8989dd33899 /device/cookie.go
parent2dd424e2d808703339688ff78e32ed30cd0dfe87 (diff)
global: apply gofumpt
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'device/cookie.go')
-rw-r--r--device/cookie.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/device/cookie.go b/device/cookie.go
index b02b769..840f709 100644
--- a/device/cookie.go
+++ b/device/cookie.go
@@ -83,7 +83,7 @@ func (st *CookieChecker) CheckMAC1(msg []byte) bool {
return hmac.Equal(mac1[:], msg[smac1:smac2])
}
-func (st *CookieChecker) CheckMAC2(msg []byte, src []byte) bool {
+func (st *CookieChecker) CheckMAC2(msg, src []byte) bool {
st.RLock()
defer st.RUnlock()
@@ -119,7 +119,6 @@ func (st *CookieChecker) CreateReply(
recv uint32,
src []byte,
) (*MessageCookieReply, error) {
-
st.RLock()
// refresh cookie secret
@@ -204,7 +203,6 @@ func (st *CookieGenerator) ConsumeReply(msg *MessageCookieReply) bool {
xchapoly, _ := chacha20poly1305.NewX(st.mac2.encryptionKey[:])
_, err := xchapoly.Open(cookie[:0], msg.Nonce[:], msg.Cookie[:], st.mac2.lastMAC1[:])
-
if err != nil {
return false
}
@@ -215,7 +213,6 @@ func (st *CookieGenerator) ConsumeReply(msg *MessageCookieReply) bool {
}
func (st *CookieGenerator) AddMacs(msg []byte) {
-
size := len(msg)
smac2 := size - blake2s.Size128