Skip to content

POC global: add PQC ML-KEM to handshake as PSK #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: tailscale
Choose a base branch
from

Conversation

aparcar
Copy link

@aparcar aparcar commented May 26, 2025

I recently learned about Tailscale and found this article regarding PQC. If the approach suggested here would really be taken, two new message types should be added for backwards compatibility and a new option added to peer.go like pqcBasedPsk to enable this feature for chosen peers.


This commit extends the handshake to generate a PQC-based PSK. The NIST-approved ML-KEM (formerly Kyber) is included in the initiator and responder messages to transport the encapsulation key and ciphertext, respectively. The generated shared secrets are directly injected as a pre-shared key (PSK), since PQC resilience is the intended purpose.

The ML-KEM encapsulation key and ciphertext are piggybacked onto WireGuard message types 1 and 2, without altering the handshake itself.

As a result, the initiation and response messages grow by about 1 kB (~10x) and the handshake takes ~5x longer (0.21s vs 0.93s1), however, likely negligible, since the transported data stream is unaffected.

This commit does not address PQC authentication. However, it offers a practical solution to mitigate retrospective decryption using quantum computers—namely, "store now, decrypt later" attacks. While more comprehensive approaches like "Post-quantum WireGuard"2 include PQC authentication and a full PQC handshake, the changes proposed here aim to be as minimal as possible, usable as soon as possible.

Footnotes

  1. Naively running go test -bench=TestNoiseHandshake -count=100

  2. https://eprint.iacr.org/2020/379.pdf

@aparcar
Copy link
Author

aparcar commented May 27, 2025

If Tailscale switches to Go 1.24 one could use mlkem directly from crypto.

@aparcar aparcar changed the title global: add PQC ML-KEM to handshake as PSK POC global: add PQC ML-KEM to handshake as PSK May 27, 2025
This commit extends the handshake to generate a PQC-based PSK. The
NIST-approved ML-KEM (formerly Kyber) is included in the initiator and
responder messages to transport the encapsulation key and ciphertext,
respectively. The generated shared secrets are directly injected as a
pre-shared key (PSK), since PQC resilience is the intended purpose.

The ML-KEM encapsulation key and ciphertext are piggybacked onto
WireGuard message types 1 and 2, without altering the handshake itself.

As a result, the initiation and response messages grow by about 1 kB
(~10x) and the handshake takes ~5x longer (0.21s vs 0.93s[^1]), however,
likely negligible, since the transported data stream is unaffected.

This commit does not address PQC authentication. However, it offers a
practical solution to mitigate retrospective decryption using quantum
computers-namely, "store now, decrypt later" attacks. While more
comprehensive approaches like "Post-quantum WireGuard"[^2] include PQC
authentication and a full PQC handshake, the changes proposed here aim
to be as minimal as possible, usable as soon as possible.

[^1]: Naively running `go test -bench=TestNoiseHandshake -count=100`
[^2]: https://eprint.iacr.org/2020/379.pdf

Signed-off-by: Paul Spooren <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant