Commit 8c076d4
committed
global: add PQC ML-KEM to handshake as PSK
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]>1 parent 91a0587 commit 8c076d4
3 files changed
+80
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
63 | | - | |
64 | | - | |
| 64 | + | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
102 | 105 | | |
103 | 106 | | |
104 | 107 | | |
| |||
118 | 121 | | |
119 | 122 | | |
120 | 123 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
129 | 134 | | |
130 | 135 | | |
131 | 136 | | |
| |||
193 | 198 | | |
194 | 199 | | |
195 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
196 | 207 | | |
197 | | - | |
198 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
199 | 211 | | |
200 | 212 | | |
201 | 213 | | |
| |||
331 | 343 | | |
332 | 344 | | |
333 | 345 | | |
| 346 | + | |
| 347 | + | |
334 | 348 | | |
335 | 349 | | |
336 | 350 | | |
| |||
392 | 406 | | |
393 | 407 | | |
394 | 408 | | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
395 | 419 | | |
396 | 420 | | |
397 | 421 | | |
| |||
468 | 492 | | |
469 | 493 | | |
470 | 494 | | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
471 | 510 | | |
472 | 511 | | |
473 | 512 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | | - | |
7 | | - | |
8 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
| 7 | + | |
| 8 | + | |
5 | 9 | | |
6 | 10 | | |
| 11 | + | |
| 12 | + | |
7 | 13 | | |
8 | 14 | | |
| 15 | + | |
| 16 | + | |
9 | 17 | | |
10 | 18 | | |
11 | 19 | | |
| |||
0 commit comments