diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2018-02-11 19:25:33 +0100 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2018-02-11 19:25:33 +0100 |
commit | 1cf23c000540bac53324cffd864506c92077bf94 (patch) | |
tree | 94c07d42e22f6da692a7df3a0fab90105b012ba6 /noise-protocol.go | |
parent | 743364f647e8486d81a96ce8749d818b05668951 (diff) |
Moved tai64n into sub-package
Diffstat (limited to 'noise-protocol.go')
-rw-r--r-- | noise-protocol.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/noise-protocol.go b/noise-protocol.go index c9713c0..df08a0a 100644 --- a/noise-protocol.go +++ b/noise-protocol.go @@ -2,6 +2,7 @@ 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" @@ -58,7 +59,7 @@ type MessageInitiation struct { Sender uint32 Ephemeral NoisePublicKey Static [NoisePublicKeySize + poly1305.TagSize]byte - Timestamp [TAI64NSize + poly1305.TagSize]byte + Timestamp [tai64n.TimestampSize + poly1305.TagSize]byte MAC1 [blake2s.Size128]byte MAC2 [blake2s.Size128]byte } @@ -99,7 +100,7 @@ type Handshake struct { remoteStatic NoisePublicKey // long term key remoteEphemeral NoisePublicKey // ephemeral public key precomputedStaticStatic [NoisePublicKeySize]byte // precomputed shared secret - lastTimestamp TAI64N + lastTimestamp tai64n.Timestamp lastInitiationConsumption time.Time } @@ -206,7 +207,7 @@ func (device *Device) CreateMessageInitiation(peer *Peer) (*MessageInitiation, e // encrypt timestamp - timestamp := Timestamp() + timestamp := tai64n.Now() func() { var key [chacha20poly1305.KeySize]byte KDF2( @@ -271,7 +272,7 @@ func (device *Device) ConsumeMessageInitiation(msg *MessageInitiation) *Peer { // verify identity - var timestamp TAI64N + var timestamp tai64n.Timestamp var key [chacha20poly1305.KeySize]byte handshake.mutex.RLock() |