David Anderson
d5a7eabcd0
control/controlbase: enable asynchronous client handshaking.
...
With this change, the client can obtain the initial handshake message
separately from the rest of the handshake, for embedding into another
protocol. This enables things like RTT reduction by stuffing the
handshake initiation message into an HTTP header.
Similarly, the server API optionally accepts a pre-read Noise initiation
message, in addition to reading the message directly off a net.Conn.
Updates #3488
Signed-off-by: David Anderson <danderson@tailscale.com>
4 years ago
David Anderson
6cd180746f
control/controlbase: rename from control/noise.
...
Updates #3488
Signed-off-by: David Anderson <danderson@tailscale.com>
4 years ago
David Anderson
d3acd35a90
control/noise: make message headers match the specification.
...
Only the initiation message should carry a protocol version, all
others are just type+len.
Signed-off-by: David Anderson <danderson@tailscale.com>
5 years ago
David Anderson
a63c4ab378
control/noise: don't panic when handling ciphertext.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
5 years ago
David Anderson
4004b22fe5
control/noise: stop using poly1305 package constants.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
5 years ago
David Anderson
293431aaea
control/noise: use key.Machine{Public,Private} as appropriate.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
5 years ago
David Anderson
edb33d65c3
control/noise: don't cache mixer, just rebuild a BLAKE2s each time.
...
This should optimize out fine, and readability is preferable to performance
here.
Signed-off-by: David Anderson <danderson@tailscale.com>
5 years ago
David Anderson
7e9e72887c
control/noise: add singleUseCHP, use it to simplify nonce/key tracking in handshake.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
5 years ago
David Anderson
cf90392174
control/noise: review fixups
...
Signed-off-by: David Anderson <danderson@tailscale.com>
5 years ago
David Anderson
0b392dbaf7
control/noise: adjust implementation to match revised spec.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
5 years ago
David Anderson
89a68a4c22
control/noise: include the protocol version in the Noise prologue.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
5 years ago
David Anderson
5e005a658f
control/noise: fix typo in docstring.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
5 years ago
David Anderson
eabca699ec
control/noise: remove allocations in the encrypt and decrypt paths.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
5 years ago
David Anderson
da7544bcc5
control/noise: implement the base transport for the 2021 control protocol.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
5 years ago