r/crypto • u/Humble-Replacement-2 • Oct 24 '26
Machine-checked HQC polynomial multiplication: SAW + Isabelle/HOL, all three parameter sets
HQC is NIST's code-based backup to ML-KEM. Its reference implementation relies heavily on binary polynomial multiplication mod xn − 1, with n up to 57,637.
I've proved the unmodified HQC v5.0.0 C implementation correct for hqc-1, hqc-3 and hqc-5.
- SAW proves
vect_mulequivalent to a Cryptol model, using compositional Karatsuba proofs without expanding the full product. Scratch-buffer bounds are also verified. - Isabelle/HOL proves the model implements the intended polynomial arithmetic. No
sorry,smtoreval; oracle dependencies are checked. - Also verified GF(2⁸) operations and the Reed–Solomon encoder's algebraic properties.
- All 63 SAW mutation tests fail as expected.
An interesting solver finding: the schoolbook leaf and Karatsuba model produce very different XOR/AND circuits. ABC, Z3, Yices and cvc5 couldn't finish in 10 minutes. SAW's Reed–Muller (rme) backend completed the proof in 6 seconds.
For GF(2) arithmetic, solver representation can make the difference between a practical proof and an intractable one.
Scope: This proves specific reference arithmetic, not HQC security. Decoders, sampling, hashing, KEM and constant-time behaviour are not covered. The GF(2⁸) results apply to v5.0.0, before the October specification change.
Reproducible with make hqc (~20 min) and make hqc-isabelle (~20 sec).
https://github.com/amarshat/pqc-assay
Criticism welcome, particularly on the property specifications.
Next: the AVX2 multiplier (PCLMULQDQ + Toom-3), which is closer to what actually runs in production.
5
u/voracious-ladder Oct 24 '26
I'd be interested to see if you can verify this: https://eprint.iacr.org/2026/014