NSA says move to post-quantum now: I measured this blog in Go, it was already PQ

NSA says move to post-quantum now: I measured this blog in Go, it was already PQ

Table of Contents

An advisory that landed in the middle of a rumor cycle

On 1 Dec the NSA published an advisory with a title that is not gentle at all: Immediate Actions to Push Toward Post-Quantum. The opening line: operators of national security systems should “transition to PQC immediately”, and must “prioritize migration before legacy systems are exploited”.

Three days earlier Anthropic published four papers on lattices, with a formalization in Lean. The community read the abstracts, retold it as “AI breaks RSA-2048”, and the story ran through the Guardian and then through X. By 3 Dec Cloudflare had to write a whole post to say: no, ML-KEM and ML-DSA are still safe, calm down.

The Anthropic result is theoretical math. The algorithm they describe needs on the order of billions of logical qubits, while current quantum machines get counted in thousands. Cloudflare estimates the cost of attacking ML-DSA at around 2^x with x greater than 1000, against a designed security level of 2^128. Ben Recht called it a galactic algorithm outright and pointed out that the “RSA-2048 is broken” story was a hoax.

The NSA advisory is a different animal: a real policy document, signed, with a PDF and a timeline. And Cloudflare moving its full post-quantum target from 2029 to 2027 is a real engineering decision too, dragging a whole WebPKI overhaul behind it.

The part that made me read twice is this sentence in the NSA release:

Frontier SI companies have engaged with the U.S. government to responsibly disclose recent discoveries that impact the security of some cryptographic systems currently in use.

A frontier superintelligence company has reported to the government a discovery that affects the safety of some cryptographic systems in use. Not quantum. If it were quantum there would be news of a matching advance in quantum machines, and there is no such news. This is a classical attack, accelerated by AI-assisted research.

That is why this post does not carry a “quantum machines are about to break everything” headline. The more uncomfortable story: the algorithm you are running may be weaker than you think, and somebody already knew before you did.

Filippo reads the hard part for us

Filippo Valsorda wrote What to Make of the NSA Advisory on 2 Dec, read all three documents and pulled out three points:

  • 256-bit ECC, specifically P-256, Curve25519/X25519, Ed25519, “likely broken or significantly weaker than we thought”
  • RSA and P-384 may hold for now, but only as a stopgap
  • ML-DSA and ML-KEM are fine, and the move should happen as fast as possible

The subtle bit is how the advisory lists what needs inventory. It names “elliptic curves other than P-384 or P-521 for ECDH or ECDSA”, it names “EdDSA”. In NIST, EdDSA means only Ed25519. And it does not name RSA at all. This is how you say “drop 256-bit ECC” without writing that sentence out.

Also in the advisory: if you need hybrid key exchange, follow RFC 10024. The NSA reversed its own earlier anti-hybrid position, simply because hybrid is already deployed everywhere and pure ML-DSA is not.

Hybrid is not a half measure. It is insurance in both directions: X25519MLKEM768 holds if at least one of the two algorithms is still good. If lattices break later, X25519 still carries it. If X25519 weakens the way the advisory suspects, ML-KEM still covers long-term confidentiality. You do not know which one fails, so you carry both.

This is a backend problem, not a crypto researcher problem

Quick blast radius of 256-bit ECC in an ordinary backend: TLS key exchange uses X25519. SSH host keys and user keys use Ed25519. WireGuard uses X25519. Signal, age, many kinds of JWT use Ed25519. Internal mTLS, service mesh, code signing via ECDSA P-256. This list is not in the crypto library, it is scattered across the config of 40 services.

“Weaker” here does not mean “someone can break it tomorrow”. It means the safety margin narrowed, while medical data, financial records and authentication logs still have to stay secret for 10 to 20 years. Harvest now, decrypt later is not a movie plot, it is the reason the NSA wrote exactly this sentence: “Adversaries are already collecting encrypted information to decrypt once the capabilities become available.”

Measuring on this blog itself

I did not want to write a post based on vibes, so I used the blog you are reading as the test subject. It runs behind Cloudflare, and the client is Go 1.26 on this same VPS.

First lesson: an old client lies to you

The first check I ran was with the bundled openssl:

$ openssl version
OpenSSL 3.0.13 30 Jan 2024
$ echo | openssl s_client -connect blog.luandnh.com:443 -servername blog.luandnh.com 2>/dev/null | grep "Server Temp Key"
Server Temp Key: X25519, 253 bits

Reading that line and concluding “the server is not post-quantum” is wrong. OpenSSL 3.0.13 does not know ML-KEM, it cannot even set the group:

$ openssl s_client -groups X25519MLKEM768 -connect blog.luandnh.com:443
4007B55412730000:error:0A080106:SSL routines:gid_cb:passed invalid argument:
../ssl/t1_lib.c:750:group 'X25519MLKEM768' cannot be set

If the client does not offer it, the server does not pick it. The measurement reflects the client, not the server. This is the most dangerous kind of false negative in a security audit: you think you are measuring the system, and you are actually measuring your own tooling.

Measuring again in Go, adding a byte counter

I wrote a small client that wraps net.Conn in a struct counting bytes read and written, to see what the handshake actually costs:

type countingConn struct {
	net.Conn
	r, w int64
}

func (c *countingConn) Read(p []byte) (int, error) {
	n, err := c.Conn.Read(p)
	c.r += int64(n)
	return n, err
}

func (c *countingConn) Write(p []byte) (int, error) {
	n, err := c.Conn.Write(p)
	c.w += int64(n)
	return n, err
}

Three runs: default, forced pure X25519, forced hybrid. The result:

curves=[]               group=X25519MLKEM768  client_bytes=1544  server_bytes=3864
curves=[X25519]         group=X25519          client_bytes=312   server_bytes=2775
curves=[X25519MLKEM768] group=X25519MLKEM768  client_bytes=1496  server_bytes=3863

The first line is the default. Since Go 1.24, crypto/tls has hybrid in the default curve preferences, and the comment in the source says exactly that. So I did not change a line of code, and the client was already negotiating post-quantum. This blog has been protected on the visitor-to-edge leg since some point I was not paying attention to.

What those 1232 bytes are

ClientHello goes from 312 to 1544 bytes, a difference of exactly 1232 bytes. I printed the sizes from the standard package to cross-check:

dk, _ := mlkem.GenerateKey768()
ek := dk.EncapsulationKey()
sharedKey, ct := ek.Encapsulate()
fmt.Println(len(ek.Bytes()), len(ct), mlkem.SharedKeySize)
// 1184 1088 32

The ML-KEM-768 encapsulation key is exactly 1184 bytes, plus a 32-byte X25519 share makes 1216, plus framing gives 1232. It matches to the byte. The 1088-byte ciphertext is what the server sends back in ServerHello, so the return direction grows by 1089 bytes too.

flowchart LR
    C1["Go client - X25519 only"] -->|"ClientHello 312 B"| E["Cloudflare edge"]
    C2["Go client - hybrid default"] -->|"ClientHello 1544 B"| E
    E -->|"ServerHello 2775 B"| C1
    E -->|"ServerHello 3864 B"| C2

Latency: jitter swallows the difference

12 handshakes per mode against that same host, first one discarded:

Modemedianmeanminmax
X25519165ms186ms95ms439ms
X25519MLKEM768190ms184ms108ms290ms

A 25ms median gap sounds like a lot, but the means are nearly equal (186 against 184), and min to max swings by a factor of four. With 12 samples over WAN this table says nothing about CPU. If you want to know about CPU, measure CPU.

Measuring CPU properly

Micro-benchmark on QEMU, 4 vCPU. The virtual CPU reports both avx2 and avx512f, but this is still a VM, so the absolute numbers are much slower than bare metal. Only the ratios between operations are worth trusting:

OperationTime
X25519 keygen88 us
X25519 ECDH84 us
ML-KEM-768 keygen113 us
ML-KEM-768 encapsulate88 us
ML-KEM-768 decapsulate120 us

PQ costs about 1 to 1.4 times more, not 10 times. Go has an AVX2 implementation for ML-KEM, so on real hardware this ratio is usually better than what I measured here. The handshake runs once per connection and then keep-alive takes over, so 100 microseconds is not a 2026 problem.

The problem is in the bytes.

1.2 TB a day just from ClientHello

Do the multiplication: 1 billion handshakes a day times 1232 bytes comes to about 1.2 TB of ingress per day. For an internal service with a few tens of thousands of requests it is nothing. For an edge like Cloudflare it is real money, real bandwidth, and an MTU problem.

ClientHello now weighs about 1.5KB. Add the IP and TCP headers and it stays under 1500, but only just. Add ALPN, a long SNI, a session ticket, padding, and you hit the fragmentation threshold. Old middleboxes, deep inspection firewalls and junk VPNs choke at exactly this point. That is why you test on a real network, take a phone out of the office and try it, instead of testing on localhost and calling it done.

Code: audit first, enforce later

What to do today is not turn on enforcement, it is logging. VerifyConnection runs after the handshake finishes and has enough information to know the real group:

cfg := &tls.Config{
	MinVersion: tls.VersionTLS13,
	VerifyConnection: func(cs tls.ConnectionState) error {
		pq := cs.CurveID == tls.X25519MLKEM768 ||
			cs.CurveID == tls.SecP256r1MLKEM768 ||
			cs.CurveID == tls.SecP384r1MLKEM1024
		if !pq {
			slog.Warn("non-pq key exchange", "group", cs.CurveID, "sni", cs.ServerName)
		}
		return nil
	},
}

Run it for 2 to 4 weeks, count the non-PQ ratio per client, per partner. That number decides whether you can enforce.

And here is enforcement, forcing the server to accept only hybrid:

srv := &tls.Config{
	Certificates:     []tls.Certificate{cert},
	MinVersion:       tls.VersionTLS13,
	CurvePreferences: []tls.CurveID{tls.X25519MLKEM768},
}

I stood up a server like that and tried two clients, real results:

server=PQ-only  client=classic X25519 only  -> REJECTED: remote error: tls: handshake failure
server=PQ-only  client=PQ hybrid            -> OK group=X25519MLKEM768

The old client is not slow, it does not warn, it does not fall back. It dies right at the handshake. That is why two phases are mandatory, not process theater.

flowchart TD
    A["Log group via VerifyConnection"] --> B["2-4 weeks of real data"]
    B --> C{"Share of non-PQ?"}
    C -->|"below 1%"| D["Enforce CurvePreferences"]
    C -->|"still high"| E["Fix clients first"]
    E --> B
    D --> F["Rotate certs to ML-DSA"]

The sore spot is not TLS, it is authentication

Cloudflare put it more compactly than any blog post on the subject: encryption protects what you send, authentication proves who is talking to you. They upgraded encryption first because harvest now decrypt later only hits confidentiality. Breaking authentication in the future does not reopen sessions that are already past.

But authentication is much harder, because the cert chain has to change all at once: root CA, intermediates, client pinning, OCSP, and embedded devices sit out of reach. And ML-DSA is fat. ML-DSA-44 has a 1312-byte public key and a 2420-byte signature under FIPS 204, against a 64-byte ECDSA P-256 signature. Shove that straight into WebPKI and every handshake gains a few KB. That is why Cloudflare went the Merkle Tree Certificates route instead of just swapping the algorithm.

The NSA also split firmware signatures and hardware root of trust into their own section, because those two cannot be updated after a device ships. This is the most expensive part of the whole migration, and it does not get solved by a single deploy.

What to do this week, ordered by rising cost

  1. Inventory. No list, no plan. openssl x509 -text | grep "Public Key Algorithm" for certs, ssh-keygen -l -f for keys, grep for CurveID, ed25519, P-256 in code and config.
  2. TLS 1.3. If the service is written in Go 1.24 or later, you are already PQ on the client side without doing anything. If you still have an old nginx with OpenSSL 3.0, upgrade to a build with ML-KEM support and turn on hybrid.
  3. Internal mTLS. This is the least looked-at place and also where the most sensitive traffic lives. Drop pure X25519, hybrid first, ML-DSA after.
  4. SSH. Filippo mentions OpenSSH 10.6 with ssh-mldsa44-ed25519. Host key rotation is quarterly work, not weekly work, so start early instead of waiting until the water is at your ankles.
  5. JWT, code signing, firmware. A long backlog. What is needed right now is a design where the algorithm lives in one place and can be swapped without touching business logic. Without crypto-agility, every advisory is a six-month project.

Crypto-agility is not a decorative adjective

What I like about this case: Go changed the default curves in the stdlib from 1.24, my code changed zero lines, and the connection is post-quantum. The algorithm sits in one place, the policy sits in one place, business logic knows nothing about any of it. That is crypto-agility in the real sense.

The reverse, when X25519 is scattered across 40 services, in configs, in HSMs, in the firmware of devices already sold, every advisory is a crisis. Not because the algorithm is hard to swap, but because nobody knows where it sits.

Today’s job is one log line: group, sni, non-pq. But if 2 to 4 weeks from now you turn on enforcement without ever having logged, you will not know who dies first.

Share :

Related Posts

API Filtering: retrieving data like a coffee connoisseur

API Filtering: retrieving data like a coffee connoisseur

In my first year of working, I once wrote an endpoint GET /api/menus that returned… the entire menu. 200 items every time it was called. The JSON was 1.2MB heavy. The frontend only needed the name and price of 10 active dishes. I remember the first thing my lead said: “You’re sending the entire warehouse to someone who just needs to view the menu, aren’t you?”

Read More
CVE-2026-123007: an unsigned subtraction in Nginx, 11 years dormant, 11.8M hosts exposed

CVE-2026-123007: an unsigned subtraction in Nginx, 11 years dormant, 11.8M hosts exposed

The VPS serving this page I ran nginx -v on the exact box serving the page you are reading: nginx/1.24.0 (Ubuntu), package 1.24.0-2ubuntu7.20, built with --with-http_v2_module. CVE-2026-123007 covers 1.9.5 through 1.31.8. This box sits right in the middle of that range. The second condition is HTTP/2 being on, and the module is already compiled in.

Read More
MCP and 40 Years of Distributed Systems: When AI Agents Repeat the RPC Mistakes

MCP and 40 Years of Distributed Systems: When AI Agents Repeat the RPC Mistakes

In late July 2025, Julien Simon published an argument nobody in the AI tooling bubble wanted to hear: the Model Context Protocol ignores forty years of hard-won distributed systems lessons. The Hacker News thread pulled 409 points and 227 comments. Most people agreed, a few pushed back, and nearly everyone missed the detail that actually matters: MCP is not a new protocol. It is JSON-RPC 2.0, which makes it a grandchild of Sun RPC from 1984.

Read More