aboutsummaryrefslogtreecommitdiffstats
path: root/src/noise_protocol.go
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2017-06-27 17:33:06 +0200
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2017-06-27 17:33:06 +0200
commit8236f3afa2eca0aae6c5da9560301c04d882c81b (patch)
tree5babaff66d6709f7f1fcdba69847ac684d1ef3de /src/noise_protocol.go
parentBegin implementation of outbound work queue (diff)
downloadwireguard-go-8236f3afa2eca0aae6c5da9560301c04d882c81b.tar.xz
wireguard-go-8236f3afa2eca0aae6c5da9560301c04d882c81b.zip
Implemented MAC1/2 calculation
Diffstat (limited to '')
-rw-r--r--src/noise_protocol.go22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/noise_protocol.go b/src/noise_protocol.go
index bf1db9b..e237dbe 100644
--- a/src/noise_protocol.go
+++ b/src/noise_protocol.go
@@ -24,15 +24,20 @@ const (
)
const (
- MessageInitiationType = 1
- MessageResponseType = 2
- MessageCookieResponseType = 3
- MessageTransportType = 4
+ MessageInitiationType = 1
+ MessageResponseType = 2
+ MessageCookieReplyType = 3
+ MessageTransportType = 4
+)
+
+const (
+ MessageInitiationSize = 148
+ MessageResponseSize = 92
)
/* Type is an 8-bit field, followed by 3 nul bytes,
* by marshalling the messages in little-endian byteorder
- * we can treat these as a 32-bit int
+ * we can treat these as a 32-bit unsigned int (for now)
*
*/
@@ -63,6 +68,13 @@ type MessageTransport struct {
Content []byte
}
+type MessageCookieReply struct {
+ Type uint32
+ Receiver uint32
+ Nonce [24]byte
+ Cookie [blake2s.Size128 + poly1305.TagSize]byte
+}
+
type Handshake struct {
state int
mutex sync.Mutex