Home/Documentation/FO Validity Checker

FO validity checker — partial: both limbs landed and wired

The Fujisaki–Okamoto re-encryption check that makes the decapsulation-oracle budget operable on real KEMs. Both limbs have landed and are wired at the production call sites (fix wave, Dec 6, 2026) — the checker is complete for both slots; no gate is claimed passed.

STATUS PARTIAL — BOTH LIMBS LANDED, WIRED IN PRODUCTION DECISION D-20 · PARTIAL COST ESTIMATE ≈ +97 MS PER VAULT OPEN

Why the budget needs a validity check

FO validity checker — Fujisaki–Okamoto re-encryption validity

Input

Submitted ciphertext

The KEM ciphertext ct presented at open, with its encapsulation key ek.

Step 1

Decapsulate

Recover the shared secret from ct. The decapsulation key dk is resolved from the EpochStore by the closure — never supplied by the envelope caller.

Step 2

Re-encrypt

Re-encrypt the recovered secret under ek, producing ct′.

Step 3

Compare

Compare ct′ against the submitted ct. The verdict is internal to the key service.

Match

Valid ciphertext VALID

The ciphertext is genuine. Opening proceeds; nothing is charged to the decapsulation budget.

Mismatch

Invalid submission INVALID

The submission counts against the 1,000-decap budget (D-06). The 1,001st garbage decapsulation quarantines the epoch.

ML-KEM-768 leg — landed, KAT-gated

Independent pure-Python FIPS 203 PKE re-encryption check. 23 tests (tests/test_deepdive25_fo_validity.py). Also serves T-COMB-12.

HQC-192 leg — landed, KAT-gated

NIRVQ liboqs fork validity API, exposing the recovered message m. 10 tests (tests/test_hqc_fo_fork.py). Fork ACCEPTED. HQC is the 20250822 spec, not v5.1.0.

Why it matters

Without a wired checker the 1,000-decap budget is unenforceable on real KEMs. Both limbs are landed and wired at the production call sites (make_production_key_service); the factory default is the full checker. Cost estimate: ~+97 ms per VAULT open — estimate, not measured.

Figure — the FO validity check (both limbs landed and wired). Re-encrypt the decapsulated secret and compare against the submitted ciphertext: a match is a valid ciphertext, a mismatch is an invalid submission that counts against the decapsulation budget. This is what makes the budget operable on real KEMs — for both slots.

The decapsulation-oracle budget (target: 1,000 invalid decapsulations per epoch key, then quarantine the epoch) was Specified, not operable on real KEMs (decision D-20): liboqs exposes no validity signal for a well-formed invalid ciphertext — implicit rejection happens inside the KEM — so on the real backend the counter stayed at 0 and KeyService.budget_operable was False. The budget is implemented and tested on the TEST-KEM fixture. Both limbs of the FO re-encryption check have now landed and are wired at the production call sites (fix wave, Dec 6, 2026), so both slots are metered on real KEMs. The whole-service budget_operable flag does not distinguish per-slot. The auto-wired test-backend checker carries kind "test-backend" (decision-review ruling D-06 — the fix-review wave's D-06, not the build's D-06; see Design Decisions & Open Items).

The specified interface

FoValidityChecker.check(ek, ct, dk, spec)

The checker takes the encapsulation key, the submitted ciphertext, the decapsulation key, and the KEM spec, and answers one question: is this ciphertext a genuine encapsulation under this key? A genuine ciphertext re-encrypts to itself; a crafted one does not. The check runs inside the key-service boundary and never surfaces a per-slot error to the envelope layer — every opening failure still returns exactly ERR-OPEN-FAILED.

The two legs

  • ML-KEM leg — LANDED — via an independent PKE reimplementation: re-encrypt the decapsulated secret with an independently written ML-KEM PKE and compare ciphertexts.
  • HQC leg — LANDED — via the accepted liboqs fork: the re-encryption path HQC needs is not exposed by stock liboqs, so the fork exposes the recovered message m and is wired at the production call sites (Dec 6, 2026).

The HQC leg requires a liboqs fork — ruled a follow-up workstream (liboqs 0.16.0 stable only; never built against a release candidate). The fork is built, accepted, and wired (see below); both limbs are landed, and the full two-limb checker is the landed state.

Fork outcome (Dec 6, 2026): the fork is built from the verified liboqs 0.16.0 tarball (diff 4 files / 141 lines) and formally ACCEPTED — the build-log FATAL was a script bug (grep -q + pipefail → SIGPIPE 141); the symbol OQS_KEM_hqc_3_decaps_check IS exported (verified by nm/objdump/readelf) and the KAT gates were re-run from the build tree and match (HQC-3 single and --all, ML-KEM-768 single). Production wiring is now done (fix wave, Dec 6, 2026): the full checker (CC-R1 default) is wired at the three production construction sites via make_production_key_service, so the HQC limb is no longer Absent; G-7/M-2B still open; no re-base to HQC v5.1.

Cost

Cost estimate: ≈ +97 ms per VAULT open — the re-encryption work is dominated by the HQC leg on the reference-only implementation. This is an estimate, not a measurement; both limbs have landed and the full two-limb checker is wired at the production call sites.

Status

Partial — both limbs landed and wired. D-20. The decapsulation budget is now operable for both slots on real KEMs. See the T-04 attack analysis in Threat Model & Security, the decapsulation-oracle budget in Key Service & Lifecycle, and the consolidated limitations in Codebase, Build & Tests.