diff options
-rw-r--r-- | src/device.go | 2 | ||||
-rw-r--r-- | src/macs_device.go | 8 | ||||
-rw-r--r-- | src/macs_peer.go | 6 | ||||
-rw-r--r-- | src/noise_protocol.go | 8 | ||||
-rw-r--r-- | src/noise_test.go | 4 | ||||
-rw-r--r-- | src/peer.go | 2 |
6 files changed, 15 insertions, 15 deletions
diff --git a/src/device.go b/src/device.go index a317122..c577623 100644 --- a/src/device.go +++ b/src/device.go @@ -32,7 +32,7 @@ type Device struct { stop chan struct{} } peers map[NoisePublicKey]*Peer - mac MacStateDevice + mac MACStateDevice } func (device *Device) SetPrivateKey(sk NoisePrivateKey) { 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() diff --git a/src/macs_peer.go b/src/macs_peer.go index d70c8f3..5e9ebae 100644 --- a/src/macs_peer.go +++ b/src/macs_peer.go @@ -9,7 +9,7 @@ import ( "time" ) -type MacStatePeer struct { +type MACStatePeer struct { mutex sync.RWMutex cookieSet time.Time cookie [blake2s.Size128]byte @@ -18,7 +18,7 @@ type MacStatePeer struct { xaead cipher.AEAD } -func (state *MacStatePeer) Init(pk NoisePublicKey) { +func (state *MACStatePeer) Init(pk NoisePublicKey) { state.mutex.Lock() defer state.mutex.Unlock() func() { @@ -31,7 +31,7 @@ func (state *MacStatePeer) Init(pk NoisePublicKey) { state.cookieSet = time.Time{} // never } -func (state *MacStatePeer) AddMacs(msg []byte) { +func (state *MACStatePeer) AddMacs(msg []byte) { size := len(msg) if size < blake2s.Size128*2 { diff --git a/src/noise_protocol.go b/src/noise_protocol.go index 0258288..9a9d918 100644 --- a/src/noise_protocol.go +++ b/src/noise_protocol.go @@ -57,8 +57,8 @@ type MessageInitiation struct { Ephemeral NoisePublicKey Static [NoisePublicKeySize + poly1305.TagSize]byte Timestamp [TAI64NSize + poly1305.TagSize]byte - Mac1 [blake2s.Size128]byte - Mac2 [blake2s.Size128]byte + MAC1 [blake2s.Size128]byte + MAC2 [blake2s.Size128]byte } type MessageResponse struct { @@ -67,8 +67,8 @@ type MessageResponse struct { Receiver uint32 Ephemeral NoisePublicKey Empty [poly1305.TagSize]byte - Mac1 [blake2s.Size128]byte - Mac2 [blake2s.Size128]byte + MAC1 [blake2s.Size128]byte + MAC2 [blake2s.Size128]byte } type MessageTransport struct { diff --git a/src/noise_test.go b/src/noise_test.go index 9b50ff3..86ddce9 100644 --- a/src/noise_test.go +++ b/src/noise_test.go @@ -118,7 +118,7 @@ func TestNoiseHandshake(t *testing.T) { var out []byte var nonce [12]byte out = key1.send.Seal(out, nonce[:], testMsg, nil) - out, err = key2.recv.Open(out[:0], nonce[:], out, nil) + out, err = key2.receive.Open(out[:0], nonce[:], out, nil) assertNil(t, err) assertEqual(t, out, testMsg) }() @@ -129,7 +129,7 @@ func TestNoiseHandshake(t *testing.T) { var out []byte var nonce [12]byte out = key2.send.Seal(out, nonce[:], testMsg, nil) - out, err = key1.recv.Open(out[:0], nonce[:], out, nil) + out, err = key1.receive.Open(out[:0], nonce[:], out, nil) assertNil(t, err) assertEqual(t, out, testMsg) }() diff --git a/src/peer.go b/src/peer.go index 77bd4df..e3c8060 100644 --- a/src/peer.go +++ b/src/peer.go @@ -39,7 +39,7 @@ type Peer struct { outbound chan *QueueOutboundElement // sequential ordering of work inbound chan *QueueInboundElement // sequential ordering of work } - mac MacStatePeer + mac MACStatePeer } func (device *Device) NewPeer(pk NoisePublicKey) *Peer { |