The NSA told everyone this week to move to post-quantum cryptography "immediately". The next thing I saw on the same morning was OpenSSH's own page on the subject, near the top of Hacker News, saying it has shipped a post-quantum key exchange by default since 2022. So which is it: have I already got this, or is there something to migrate? I stopped guessing and went and looked at what my own machines actually do, because "by default since 9.0" turns out to mean several different things depending on which box you're sitting on.
SSH key exchange is the part of a connection that two sides use to agree on a shared secret before anything else is encrypted. If that exchange is broken, every byte that followed it can be decrypted later, even years later, by someone who only recorded the traffic at the time. That's the "store now, decrypt later" risk the NSA advisory and OpenSSH's page are both about. OpenSSH's fix is a hybrid key exchange: classical elliptic-curve Diffie-Hellman combined with a lattice-based algorithm that isn't known to be breakable by a quantum computer. There are two of these in circulation: sntrup761x25519-sha512, added in OpenSSH 9.0 (April 2022), and mlkem768x25519-sha256, added in 9.9 and made the new default in 10.0 (April 2025). The second one is built on ML-KEM, the algorithm NIST actually standardised; the first predates that standard.
I built six OpenSSH versions as Docker containers, from Ubuntu 18.04's 7.6p1 up to Debian testing's 10.6p2, wired them together on one Docker network, and connected every client to every server with no KexAlgorithms override, to see what actually gets picked.
What gets negotiated, and what doesn't
Two Ubuntu 22.04 boxes talking to each other — about as common a pairing as exists — negotiate plain classical curve25519-sha256. Not because the package can't do better: ssh -Q kex on that same build lists sntrup761x25519-sha512@openssh.com as supported, and an Ubuntu 24.04 client talking to that same 22.04 server does get it. The difference is pure ordering. ssh -G prints the client's actual negotiation list:
# Ubuntu 22.04 (OpenSSH 8.9p1) kexalgorithms curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256, ecdh-sha2-nistp384,ecdh-sha2-nistp521,sntrup761x25519-sha512@openssh.com,... # Ubuntu 24.04 (OpenSSH 9.6p1) kexalgorithms sntrup761x25519-sha512@openssh.com,curve25519-sha256, curve25519-sha256@libssh.org,ecdh-sha2-nistp256,... 22.04 ships the post-quantum algorithm sixth on its list, behind five classical ones. 24.04 puts it first. Since SSH picks the first algorithm on the client's list that the server also offers, two 22.04 boxes will never reach it on their own, and nothing on either end tells you that.
Debian's unstable build goes one step further. With both ends on OpenSSH 10.6p2, it picks mlkem768x25519-sha256, the newer NIST-based one, ahead of sntrup761. Against a Debian 12 server, which doesn't have mlkem768x25519-sha256 yet, the same client falls back to sntrup761x25519-sha512 rather than going all the way to classical. The fallback chain is exactly what I'd have assumed, right up until Ubuntu 22.04's actual order surprised me.
There's an older casualty too. Ubuntu 20.04's OpenSSH 8.2p1 supports sntrup4591761x25519-sha512@tinyssh.org, an earlier post-quantum algorithm with a different name and different parameters. None of my other five versions offer it, and it isn't even in 20.04's own default list — you have to ask for it explicitly. A 20.04 client against any of my other servers falls back to plain curve25519-sha256, no warning, no post-quantum anything. OpenSSH has already done this migration once before, just quietly.
What it refuses
The NSA advisory is explicit about moving "immediately", so I tried doing that literally: I started an sshd with only mlkem768x25519-sha256 allowed, nothing else. Connecting from my Debian testing client, which supports it, worked fine. Connecting from Ubuntu 24.04 — current, fully supported, OpenSSH 9.6 — got this:
Unable to negotiate with X.X.X.X port 22: no matching key exchange method found. Their offer: mlkem768x25519-sha256,ext-info-s,kex-strict-s-v00@openssh.com Exit code 255. Ubuntu 18.04, unsurprisingly, got the identical refusal. Enforcing the standard the advisory asks for, right now, locks out a currently-supported LTS release, not just the obviously ancient ones. There's no partial credit here: sntrup761 alone doesn't satisfy a mlkem768x25519-sha256-only server, because they're different algorithms, not versions of each other.
What it costs
My first attempt at timing this gave me a number I didn't trust, which is its own story (below). After fixing it, I ran two separate batches of 60 rounds each, every round connecting once with every one of seven key-exchange algorithms in random order, to the same Debian testing server over loopback on the same Docker network. Combined (n=120 connections per algorithm):
| algorithm | min | median |
|---|---|---|
| curve25519-sha256 (classical) | 4.78ms | 6.53ms |
| ecdh-sha2-nistp256 (classical) | 4.74ms | 6.34ms |
| diffie-hellman-group14-sha256 (classical) | 4.72ms | 6.07ms |
| sntrup761x25519-sha512 (post-quantum) | 4.65ms | 6.21ms |
| mlkem768x25519-sha256 (post-quantum) | 4.79ms | 6.14ms |
At one connection at a time, there's nothing to see: the post-quantum algorithms cost the same, within noise, as classical ones. That's not surprising once you know the handshake itself takes well under a millisecond of actual cryptographic work; everything else is TCP and process overhead that swamps it.
Concurrency told a different, noisier story. I fired 100 simultaneous connections at the server, forcing one algorithm at a time, and timed how long all 100 took to finish, repeating that 24 times with the three algorithms' order reshuffled before every repeat, so no algorithm was ever systematically first or last in the queue:
| algorithm | mean (100 connections, n=24) | slowest of its group of 3 |
|---|---|---|
| mlkem768x25519-sha256 | 0.776s | 4 of 24 times |
| curve25519-sha256 | 0.769s | 2 of 24 times |
| sntrup761x25519-sha512 | 0.846s | 18 of 24 times |
Individual runs overlapped — mlkem768x25519-sha256 and curve25519-sha256 were each the slowest of the three in a handful of runs — but sntrup761x25519-sha512 came out slowest three times out of four, in a test with no reason to systematically favour either outcome. On average it took 9-10% longer than the other two, which were indistinguishable from each other. The NIST-standard algorithm costs nothing extra under load; the older default one does, by a modest but consistent margin, once enough connections are competing for the same CPU. That's broadly consistent with sntrup761's decapsulation step having a reputation for being the heavier of the two, though "9-10% slower, most of the time" is a smaller and messier effect than I expected to find, not a clean multiple.
How you'd actually notice
None of this shows up to the connecting user by default unless the server genuinely has nothing post-quantum to offer. I confirmed that split directly: forcing my own client to use classical curve25519-sha256 against a server that does offer post-quantum key exchange produced no warning at all on my side. Connecting normally (no override) to a server configured with only classical algorithms produced this, unprompted, on OpenSSH 10.6p2:
** WARNING: connection is not using a post-quantum key exchange algorithm. ** This session may be vulnerable to "store now, decrypt later" attacks. ** The server may need to be upgraded. See https://openssh.com/pq.html So the warning is about what the server can offer, not what you personally chose. If you deliberately ask for classical key exchange, OpenSSH doesn't second-guess you.
The more useful discovery was on the server side. At the default log level, sshd itself writes a line every time a connecting client doesn't end up on a post-quantum algorithm:
WARNING: connection from X.X.X.X port 52300 is not using a post-quantum key exchange algorithm: "curve25519-sha256" [preauth] That line showed up 625 times in my own test server's log by the time I was done, one for every non-post-quantum connection I'd made to it over the course of this. If you run sshd and want to know today how many of your own connections are still classical, that line is already sitting in your logs — you don't need to touch any client.
What I got wrong on the way
My first attempt at the timing comparison ran each algorithm as its own block: 40 connections with curve25519-sha256, then 40 with ecdh-sha2-nistp256, and so on through all seven. The result looked dramatic: the two classical elliptic-curve algorithms averaged around 140ms per connection, and everything else, including both post-quantum ones, averaged around 5ms. That would have been a genuinely alarming finding, if it had been true.
It wasn't. Breaking the result down by round number showed the slow times weren't tied to the algorithm at all — they were tied to being among the first handful of uses of any elliptic-curve-based key exchange specifically. I ran the interleaved version twice to be sure: the first clean run showed exactly 7 slow connections for each of curve25519-sha256, ecdh-sha2-nistp256, sntrup761x25519-sha512 and mlkem768x25519-sha256 (all of which involve an elliptic curve), landing in rounds 1 through 7 and nowhere else; the second run showed 6 slow connections for three of those four and 7 for the fourth, again only in the earliest rounds. The exact count isn't a fixed constant, but "a handful of early connections, only for EC-based methods, never for the three plain finite-field Diffie-Hellman groups" held up both times. Running each algorithm as a sequential block of 40 connections, as I did the first time, put that entire warm-up window inside the very first block and nowhere else, which is exactly the kind of result section 2b of my own working notes warns about: a harness that hides, or in this case invents, the effect. Interleaving the algorithm order per round, so every algorithm hit its own early-connection window independently rather than all piling into the start of one block, made the fake 30x gap disappear. I still don't know exactly what in OpenSSH or OpenSSL causes that one-time warm-up, and it has nothing to do with post-quantum cryptography specifically, but I'm glad I didn't publish the first number.
Run it yourself
This needs Docker and nothing else. Building two sshd images and timing them against each other:
# server image, PKG_INSTALL set per distro's package manager docker build -f Dockerfile.server --build-arg BASE=debian:testing -t sshd-pq . docker run -d --name srv --network pqtest sshd-pq # time N rounds of every algorithm, order shuffled each round, against srv ROUNDS=60 ALGOS=(curve25519-sha256 sntrup761x25519-sha512 mlkem768x25519-sha256) for r in $(seq 1 $ROUNDS); do order=$(for a in "${ALGOS[@]}"; do echo "$RANDOM $a"; done | sort -n | awk '{print $2}') while read -r algo; do start=$(date +%s.%N) ssh -o BatchMode=yes -o KexAlgorithms=$algo -i id_ed25519 root@srv true < /dev/null end=$(date +%s.%N) echo "$algo $r $(awk -v s="$start" -v e="$end" 'BEGIN{printf "%.6f", e-s}')" done <<< "$order" done Dropping < /dev/null after the ssh call is the one line that cost me an afternoon's worth of confused output the first time, because ssh happily eats stdin from the surrounding while read loop if you let it.
What I'd actually do
I'm not going to force mlkem768x25519-sha256 anywhere yet; that refusal test showed me exactly how much of my own fleet that would break right now, and the warning text is doing a perfectly good job of telling me where I stand without needing to break anything. What I will do:
- Grep my own servers' logs today for "is not using a post-quantum key exchange algorithm" and actually look at which hosts show up, rather than assuming.
- Stop treating "the package supports it" as the same question as "it's actually negotiated here", because on Ubuntu 22.04 those are two different answers.
- Hold off worrying about CPU cost. At the connection rates I run, there isn't one worth planning around, and even under heavy concurrency the NIST-standard algorithm matched classical ECDH rather than adding to it; the cost I found sits entirely on the older default algorithm.
If you administer a mixed fleet, the useful first step isn't upgrading anything. It's reading your own sshd log for one WARNING line that's probably already there.