From bffe99aeadae09abd02f2bd3184925af6b680535 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 12 Feb 2018 20:10:44 +0100 Subject: Don't use modules Feel free to revert this if you have a strong feeling about it. But so far as I can see, it adds a lot of complexity for basically no upsides. --- noise-protocol.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'noise-protocol.go') diff --git a/noise-protocol.go b/noise-protocol.go index df08a0a..31ae55b 100644 --- a/noise-protocol.go +++ b/noise-protocol.go @@ -2,7 +2,6 @@ package main import ( "errors" - "git.zx2c4.com/wireguard-go/internal/tai64n" "golang.org/x/crypto/blake2s" "golang.org/x/crypto/chacha20poly1305" "golang.org/x/crypto/poly1305" @@ -59,7 +58,7 @@ type MessageInitiation struct { Sender uint32 Ephemeral NoisePublicKey Static [NoisePublicKeySize + poly1305.TagSize]byte - Timestamp [tai64n.TimestampSize + poly1305.TagSize]byte + Timestamp [TimestampSize + poly1305.TagSize]byte MAC1 [blake2s.Size128]byte MAC2 [blake2s.Size128]byte } @@ -100,7 +99,7 @@ type Handshake struct { remoteStatic NoisePublicKey // long term key remoteEphemeral NoisePublicKey // ephemeral public key precomputedStaticStatic [NoisePublicKeySize]byte // precomputed shared secret - lastTimestamp tai64n.Timestamp + lastTimestamp Timestamp lastInitiationConsumption time.Time } @@ -207,7 +206,7 @@ func (device *Device) CreateMessageInitiation(peer *Peer) (*MessageInitiation, e // encrypt timestamp - timestamp := tai64n.Now() + timestamp := TimestampNow() func() { var key [chacha20poly1305.KeySize]byte KDF2( @@ -272,7 +271,7 @@ func (device *Device) ConsumeMessageInitiation(msg *MessageInitiation) *Peer { // verify identity - var timestamp tai64n.Timestamp + var timestamp Timestamp var key [chacha20poly1305.KeySize]byte handshake.mutex.RLock() -- cgit v1.2.3