diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-07-06 16:24:24 +0200 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-07-06 16:24:24 +0200 |
commit | 70179f8c8c2eeb39c9a3666012481a25ce39b338 (patch) | |
tree | 036dd744f18f62750d431c0dcdb5687e3041451b /src/macs_device.go | |
parent | 59f9316f51ce3cb470200b0cfe847116a0583d25 (diff) |
Fixed broken test
Diffstat (limited to 'src/macs_device.go')
-rw-r--r-- | src/macs_device.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/macs_device.go b/src/macs_device.go index 730c361..deac803 100644 --- a/src/macs_device.go +++ b/src/macs_device.go @@ -11,7 +11,7 @@ import ( "time" ) -type MacStateDevice struct { +type MACStateDevice struct { mutex sync.RWMutex refreshed time.Time secret [blake2s.Size]byte @@ -19,7 +19,7 @@ type MacStateDevice struct { xaead cipher.AEAD } -func (state *MacStateDevice) Init(pk NoisePublicKey) { +func (state *MACStateDevice) Init(pk NoisePublicKey) { state.mutex.Lock() defer state.mutex.Unlock() func() { @@ -32,7 +32,7 @@ func (state *MacStateDevice) Init(pk NoisePublicKey) { state.refreshed = time.Time{} // never } -func (state *MacStateDevice) CheckMAC1(msg []byte) bool { +func (state *MACStateDevice) CheckMAC1(msg []byte) bool { size := len(msg) startMac1 := size - (blake2s.Size128 * 2) startMac2 := size - blake2s.Size128 @@ -47,7 +47,7 @@ func (state *MacStateDevice) CheckMAC1(msg []byte) bool { return hmac.Equal(mac1[:], msg[startMac1:startMac2]) } -func (state *MacStateDevice) CheckMAC2(msg []byte, addr *net.UDPAddr) bool { +func (state *MACStateDevice) CheckMAC2(msg []byte, addr *net.UDPAddr) bool { state.mutex.RLock() defer state.mutex.RUnlock() |