mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-27 20:16:28 -08:00
Teach controlbase to switch to a hybrid X25519 plus ML-KEM-768 handshake for ts2021 protocol versions 146 and newer. The new handshake implements the Noise IKhfs pattern (Noise_IKhfs_25519+MLKEM768_ChaChaPoly_BLAKE2s) from the Noise "KEM-based Hybrid Forward Secrecy" extension spec: https://github.com/noiseprotocol/noise_hfs_spec The legacy Noise IK wire format remains available for older protocol versions, while newer clients must send the expanded PQ initiation and response frames. The ML-KEM encapsulation key and ciphertext are encrypted and transcript-bound per the hfs spec, and both sides mix the resulting ML-KEM shared secret into the Noise chaining key before deriving transport keys, so the session is secure as long as either X25519 or ML-KEM-768 holds. For a formal analysis of KEM-augmented Noise, including hybrids of this shape, see the PQNoise paper (https://eprint.iacr.org/2022/539). Add tests for legacy and PQ handshakes, wire-format selection, mismatch rejection, and tampering of PQ fields. Updates #14370 Change-Id: I6877d9fa71d01782a2034777ae720020fe52b168