Skip to content

Verify the last 27 hooked routines in the binary; trusted hooks 27 → 0 - #5

Merged
antonkov merged 1 commit into
mainfrom
copybara/export-bda1481be609
Nov 19, 2026
Merged

antonkov merged 1 commit into
mainfrom
copybara/export-bda1481be609

Conversation

@antonkov

@antonkov antonkov commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

The headline theorems no longer trust any hooked routine. Apart from the 18 Rust panic entry
points, every instruction the pinned libsignal-cli binary executes now runs as machine code from
the ELF. Calls to the panic entry points are modelled as an immediate SIGABRT instead of running
their bodies (DEV-E7); the binary's own panic and allocation-error handlers are abort-only and
print no message. The newly executed code covers the 23 formerly hooked cryptographic routines
(SHA-256/512 and HMAC, AES-256-CBC, X25519 and the curve25519-dalek operations, ML-KEM-768 and
Kyber-1024), Rust's core::fmt formatting, and the file and standard-output I/O. AES now uses the
ARMv8 hardware backend.

The headlines are restated directly on the ELF, and their names drop the _placed suffix:
libsignal_cli_pq_binary_correct, libsignal_cli_pq_secure_elf_binary, signal_session_secure and
comp_refines_cli. The run starts from the ELF as loaded into memory (ElfImage.loadState), with no
memory patches. The auxiliary vector is fixed to AT_HWCAP = 0x1b (FP, ASIMD, AES, PMULL; no LSE
atomics), AT_HWCAP2 = 0 and an all-zero AT_RANDOM, so the results cover CPUs that report exactly
these features (DEV-CLI10). The trusted statements no longer refer to library placements,
placement witnesses or symbol-label checks. The one remaining trust point about the ELF's symbol
table is that it correctly labels the 18 panic entry points and the 5 libcrux_ml_kem KEM entry
points that sample the public matrix. The pinned binary changes: the formerly hooked routines are
linked and executed, AES uses the hardware backend, and the panic handlers are abort-only. It is
still built from libsignal v0.105.4 and rustc 1.98.1 with stock ld.lld, SHA-256
f35c326d90895b1b52e5daf099bdc5cadff1e34ba3352b807a06a3d94c33e56a (was 50066cbd…). The trusted
part of this repository is now 19,349 code lines (26,061 with docs), on top of the arm64-semantics
machine model (6,763 code lines) and the Lean and Mathlib foundations, and it contains no
generated code; the generated object bundle (about 97k lines) is no longer trusted.

The computational main theorem, libsignal_cli_pq_secure_elf_binary, is instantiated at Kyber-1024
(kyber1024KemKeyGen) with decapsulation-failure parameter δ_kem = ε + 2^-112 (proved by
kyber1024_kem_delta_correct), under the CBD-noise idealization hypothesis KyberNoiseGap ε:
replacing the SHA3/SHAKE-derived noise by uniform noise changes the decryption-failure probability
by at most ε. Its other premises include:

  • a public-key collision bound, Pr[pk = t] ≤ 2^-255 for every fixed t (DEV-PQ21);
  • the plaintext length bound ℓ < 10^6 (DEV-CLI14);
  • fewer than about 2^31 messages per session (2·(q + 1) + 25002 < 2^32);
  • for the second form of the bound, which reduces to the PQXDH assumptions (signature
    unforgeability, KEM security, gap Diffie-Hellman), the HKDF random-oracle gap KeyIndRoGap
    (DEV-CLI16).

The security statement is now made at the concrete X25519 group. libcrux's SampleNTT rejection
loop, which samples the ML-KEM and Kyber public matrix, now executes from the ELF instead of
sitting behind a hook. Runs on which it never terminates (a matrix seed whose SHAKE-128 stream
never yields 256 coefficients below 3329) are excused: the correctness theorem does not promise
termination on them, and both forms of the security bound gain a term 2·CliPqxdhFlagProb, twice
the probability that the game reaches such a run. Lean does not bound this term further
(DEV-CLI22).

The Double Ratchet session bound now has a linear instead of a quadratic MAC-forgery term. It is
incomparable with the previous bound: the MAC term is much smaller, but the PRF-PRNG and
FS-AEAD terms are up to about 2× larger (DEV-LS31). The trusted ML-KEM-768 and
Kyber-1024 specifications are now checked against official NIST test vectors: 70 ML-KEM-768
ACVP cases (key generation, encapsulation, decapsulation, encapsulation-key check) and the first
10 Kyber-1024 Round 3 KAT cases.

On the symbolic side, three new theorems fix the primitives to the ones linked in the binary:
real_prims_admissible shows that they satisfy the laws the symbolic model assumes, and
comp_refines_cli_real and signal_session_secure_real then cover every ELF run, without
restricting to runs on which the primitives agree with the real ones. signal_session_secure and
comp_refines_cli remain; they quantify over any primitive interpretation that satisfies the laws
and keep only the runs on which it agrees with the real primitives.

The bug-injection suite has not yet been moved to the hook-free ELF statements. For the two
historical libsignal bugs, the full binary disproofs were kernel-checked against an earlier
hooked binary and an untrusted placed variant of the security statement; their execution
checkpoints predate the hook removal and have not been regenerated. Of the 17 synthetic mutants,
16 have the specification side of the disproof proved; all 17 full binary disproofs are still
open. The binary disproofs live in a separate library outside the default build, CI and the
comparator check.

comparator passes on this tree for all 22 theorems in its two lists (6 computational, 16
symbolic), using only the axioms propext, Quot.sound and Classical.choice. The checked set
changes: the four _placed headlines are replaced by the ELF-direct ones above, the three placement
theorems (libsignal_cli_elf_linked_in, libsignal_cli_elf_mallocng_linked_in,
libsignal_cli_labels_from_objects) are gone from both lists, and kyber1024_kem_delta_correct and
the three real-primitive symbolic theorems (real_prims_admissible, comp_refines_cli_real,
signal_session_secure_real) are added.

Lean v4.35.0, arm64-semantics v0.56.1.

GitOrigin-RevId: bda1481be6099ea5974654830c209851ae90c536

@google-cla

google-cla Bot commented Nov 19, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

GitOrigin-RevId: bda1481be6099ea5974654830c209851ae90c536
@antonkov
antonkov force-pushed the copybara/export-bda1481be609 branch from f648935 to dde6e05 Compare November 19, 2026 19:09
@antonkov
antonkov merged commit 8c8d371 into main Nov 19, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants