arXiv:2610.36808cs.CROct 2026

Manuscript Offprint

arXiv:2610.36808

HqcLethe: Streaming HQC Encapsulation for Tiny Stateless Servers

Wind Wong, Klaus v. Gleissenthall

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Wind Wong, Klaus v. Gleissenthall

{t.f.w.wong, kfl900}@vu.nl

Vrije Universiteit Amsterdam

Abstract—Stateless post-quantum authenticated key exchanges such as post-quantum WireGuard hedge against unexpected cryptanalytic advances by combining a lattice KEM with code-based Classic McEliece. However, recent attacks have led Germany’s BSI to advise against McEliece, which leaves these protocols with lattices alone. HQC, the code-based KEM that NIST selected, could restore diversity, but its keys do not fit in a single packet, so a server would have to buffer multi-packet handshakes. This would leave an attack surface for memory exhaustion, which is what WireGuard’s stateless handshake was designed to avoid in the first place. McTiny demonstrated that stateless key encapsulation for Classic McEliece is possible by streaming key blocks one-at-a-time. However, HQC’s encapsulation does not split as easily into individual packets, as cyclic polynomial multiplication, unlike matrix-vector multiplication, is inherently non-local.

We present HQCLETHE, a stateless key exchange that streams an HQC encapsulation in packet-sized pieces. It uses the Chinese remainder theorem to split the polynomial multiplication into independent remainders, one per packet, and masks them so that they reveal no more than an ordinary HQC ciphertext, which we prove in Rocq with SSProve; we also verify session secrecy, server authentication and forward secrecy in ProVerif. Client puzzles bound CPU exhaustion, and HQCLETHE removes memory exhaustion: on a Raspberry Pi 3B+, each worker runs in a fixed 1.2–1.6 MiB. At category 5 it sends 27×27 \times fewer bytes and uses 9.0×9.0 \times less server CPU than McTiny, the earlier stateless code-based design.

1. Introduction

Authenticated key exchange (AKE) lets two parties establish a shared secret while verifying each other's identities. One common design for security against quantum adversaries uses two post-quantum key-encapsulation mechanisms (KEMs) in each session: a long-term, static KEM key pair for authentication, and a fresh, ephemeral KEM key pair used only for that session. The ephemeral key pair provides forward secrecy: because its secret key is erased after the exchange, a later compromise of the long-term key does not reveal recorded past sessions.

A server that wants to remain cheap to operate—say, a VPN endpoint on a home router, or a gateway on an IoT device—has very little memory to spare, and every byte it allocates on behalf of an unauthenticated client is a lever for an attacker. If completing a handshake requires the server to buffer per-client state, an adversary can open thousands of half-finished handshakes at once, forcing the server to allocate memory for each which exhausts the device easily. This type of memory-flooding denial-of-service attack, is exactly what low-footprint network software is built to avoid. Indeed, WireGuard [1] owes much of its adoption, especially on constrained devices, to a stateless UDP design in which the server holds no per-client state until a handshake is cryptographically verified. We call a server with this property a tiny network server: it keeps no per-client state, and its memory is fixed, independent of the number of clients and of the attacker's effort.

Previous efforts to make WireGuard post-quantum secure [2], [3], [4] obtain their ephemeral security from lattices, and reserve code-based cryptography only for long-lived static keys, with Classic McEliece [5] being the code-based KEM of choice. This hybrid design stems from a general consensus that post-quantum cryptanalysis is too new to rely entirely on one mathematical family alone. Classic McEliece was considered to be uniquely suited for long term keys, because it has a long history dating to McEliece's 1978 proposal [6], and was the oldest and most conservatively studied post-quantum family [7]. While its keys are large: the Classic McEliece parameters recommended for long-term security use public keys of roughly 1 MB, even the largest parameters have ciphertexts of only 208 bytes, allowing it to fit comfortably within UDP packets, retaining statelessness. However, attacks published in 2026 have called Classic McEliece's security into doubt: building on the distinguisher of Ghoshal et al. [8], Weis claims key recovery at 2992^{99} to 21022^{102} operations for the recommended parameter sets [9], [10], [11]. On 29 September 2026, Germany's BSI advised that “Classic McEliece should currently no longer be used in new developments or when planning new cryptographic applications” [12]. A code-based replacement for Classic McEliece is needed.

HQC is the natural candidate. In March 2025, NIST announced that “the only key-establishment algorithm that will be standardized is HQC” [13], [14], selected from candidates meant to “reduce the risk that a single cryptanalytic breakthrough will leave no viable standard for key establishment”. The BSI note finds HQC unaffected by the new attacks and calls it “an important alternative to the lattice-based post-quantum schemes” [12]. Its public keys are far smaller than Classic McEliece’s—about 2.2 KB, 4.5 KB, and 7.2 KB at its three security levels—small enough to make a code-based ephemeral KEM practical, yet still several packets wide, and the ciphertexts are twice as big. A 2–7 KB key and 4–14 KB ciphertext do not fit in the 1280-byte payload that IPv6 guarantees will not fragment [15], and it is precisely the size at which an implementor is tempted by the simplest and seemingly obvious fix: split the content across a few datagrams, store them in a bounded buffer until they all arrive, and proceed. However, such bounds are deceptively hard to get right: in HTTP/2, attackers exhausted servers with gigabytes of memory through unbounded header fragments [16]. Similarly, streams were counted as closed while their work continued [17]. A better solution is to remove this attack surface altogether.

McTiny [18] showed the obstacle is not insurmountable. McTiny runs a Classic McEliece key exchange on a tiny network server, by having the client split its key into row/column blocks small enough for a packet and having the server compute and forget one partial matrix–vector product per block, never assembling the whole key. Unfortunately, HQC's encapsulation is cyclic polynomial arithmetic, which, unlike matrix–vector multiplication, is inherently non-local.

In this paper, we introduce HQCLETHE, the first tiny-network-server realization of HQC key encapsulation. Our key idea is to use the Chinese remainder theorem (CRT) to break polynomial multiplication into independent computations on residues: the client sends the public key polynomial modulo packet-sized, pairwise coprime polynomials, and the server computes and returns the corresponding ciphertext residue without retaining per-client state. The client then reconstructs the ciphertext from the returned residues. Since this method produces unreduced polynomial products whereas plain HQC ciphertexts are reduced against HQC's ring modulus, HQCLETHE masks the residues to prevent them from leaking information about the server's secret randomness. We build an AKE protocol around it in which HQC provides the ephemeral key and ML-KEM-768 the authentication, keeping the code and lattice diversity of prior work without Classic McEliece.

The result is a post-quantum AKE with forward secrecy by NIST chosen KEMs, two-round-trip completion, and no per-client server state: self-encrypted cookies carry session state across queries ( §5§5). Of the three attack surfaces for denial of service, HQCLETHE removes memory exhaustion entirely. CPU exhaustion, which any server that authenticates its first message suffers, is bounded by standard proof-of-work client puzzles that tie an attacker's request rate to its CPU ( §7.4§7.4, Appendix G), and saturating the network link is left to filtering upstream, as for any protocol. Beyond the protocol, we contribute masked CRT-based residue streaming, with a Rocq/SSProve proof that the stream achieves zero-leakage simulation against an ordinary HQC ciphertext, and a ProVerif proof of session secrecy, server authentication, and the protocol's forward-secrecy boundary under active key compromise ( §4.3§4.3, §4.4§4.4, §6.4§6.4). Our Rust implementation, with AVX2 and NEON Client

Server

Figure

Figure 1. A strawman of a key exchange protocol.

acceleration, sends 27×27\times fewer bytes and 44×44\times fewer packets than McTiny at category 5, while using 9.5×9.5\times less server CPU on one AVX2 core ( 9.0×9.0\times less on a Raspberry Pi 3B+); most of the savings come from HQC's smaller keys ( §7§7). Compared with a stateful buffering baseline, HQCLETHE uses 2.0×2.0\times the bytes and 4.1×4.1\times the CPU, but each worker's memory remains fixed at 1.2–1.6 MiB on a Raspberry Pi, independent of attacker activity. A stateful server's memory instead grows with the attacker: even with the same client puzzle, each attacker core can hold up to 8.5 MB of its table at category 5 ( §7.4§7.4). HQCLETHE trades moderate CPU overhead for memory that no attacker can exhaust.

References (64)