Current release status (2026-07-11): production packaging is quarantined.
make release,_release, andfsbl-releasefail at make-evaluation time, including undermake -i.fwsign signemits only the legacy unsigned-slotPQFW_V1format and requires the explicit--legacy-bench-unsafeacknowledgement. Nothing in this document grants release, factory, OTP, option-byte, or RDP2 authority. Reproducible build and measurement mechanics remain valid independently of that quarantine.
Every shipped PQSigner firmware image carries an 8-BIP-39-word measurement that the device displays at boot and on every firmware-update confirmation. The whole authenticity story rests on anyone being able to re-derive those words from the source tree and check that they match what the vendor published — without that property the measurement is just a vendor attestation, not an independently verifiable fingerprint.
Reproducibility is what makes the measurement a fingerprint rather than a claim.
Two pieces are required for the trust loop to close:
- An independently-derivable baseline —
./measure.shwords for the published release commit. This is what reproducible builds provide; everything below in this document is about getting it. - An on-device ground truth the running firmware can't forge — the target
design has an approved, WRP-protected FSBL render the measurement words on
the NV3007 LCD before branching into the slot. The legacy bench FSBL
implements the measurement/display behavior, but production immutability
still awaits the geometry, WRP/factory, build/resource, and silicon gates.
See
measured-boot.mdfor the threat model and the trust chain.
The user closes the loop by comparing two values they each derived
independently: the FSBL LCD words (on-device ground truth) and
the ./measure.sh output (independent rebuild). Without the FSBL-
rooted display this loop was unclosed (the device's claim was
unverifiable in software); with it, the user has cryptographic
confidence that what they confirmed at install time is what is
actually running.
Two independent clean builds of the same git commit, when run inside
the pinned Nix flake, produce byte-for-byte identical secure.elf
and nonsecure.elf on the same host architecture, and (per the CI
matrix) byte-identical thumbv8m output across host architectures too.
This means:
./measure.sh(ornix run .#measure) prints the same 8 words on every supported host for a given commit.- A vendor-signed release bundle (
.pqfw) can be audited by anyone: rebuild the commit the vendor points to, run./measure.sh, and confirm the words matchmeasurement.txtin the bundle. - The FSBL's check
sha256(active_slot) == manifest.secure_hashbehaves identically on any hardware running any build of the same commit.
- Pinned Rust toolchain:
rust-toolchain.tomlpinsnightly-2026-04-06withthumbv8m.main-none-eabitarget and therust-src+llvm-toolscomponents. Every machine that builds releases must honour this (rustupdoes it automatically when the file is present). - Locked dependencies:
Cargo.lockis committed; all crates-io dependencies are pinned to exact versions. Any git dependency must be pinned by commit hash (make verify-pins; none remain since the TROPIC01 backend was removed 2026-07-14). - Single-codegen-unit release profile:
[profile.release] codegen-units = 1, lto = truein the workspaceCargo.toml(already present before this work). - Path-remapped debug info + stripped build-id: the Makefile's
REPRO_FLAGSvariable adds--remap-path-prefixfor$HOME/.cargo,$HOME/.rustup, and$CURDIR, plus-C link-arg=--build-id=none. Both linker flags are fed toarm-none-eabi-lddirectly (no-Wl,wrapper — the Rust linker driver invokes ld directly, not via gcc). - Deterministic build scripts:
secure/build.rsandnonsecure/build.rswere audited for non-determinism (timestamps, random IDs, directory iteration order) — none found. The QR-code generator pins a literal URL constant. SOURCE_DATE_EPOCH: exported fromgit log -1 --format=%ctby the Makefile, for any future build script that embeds a timestamp. Currently unused but the knob is wired up.
The pinned flake.nix at the repo root is the canonical way to get the
same toolchain closure on every supported host: Linux x86_64, Linux
aarch64, macOS Intel, macOS Apple Silicon, and WSL2. It pins:
nixpkgsto a specific commit (gives identicalgcc-arm-embedded/gnumake/coreutilseverywhere).rust-overlay, which readsrust-toolchain.tomldirectly so the channel + target + components stay in lockstep with the rustup-driven workflow.
flake.lock is committed and contains SHA-256 hashes for every input;
nix run .#measure against a given commit produces the same closure on
any host that can run Nix. The wrapper script (./measure.sh) installs
Nix via the Determinate Systems installer if it is missing.
packages.measure is always evaluated as an x86_64-linux
derivation, regardless of the host running nix build. Every store
path in the build closure (rustc, arm-none-eabi-ld, glibc, …) hashes
identically on every host because the system argument is fixed —
nothing is sourced from the host's nixpkgs view. The build runs offline
inside the Nix sandbox with cargo dependencies vendored via
rustPlatform.importCargoLock, so there is no network-mediated source
of variance either. The derivation's output is plain text
(words.txt), which any host can cat regardless of architecture.
This means:
- Linux x86_64 hosts build the derivation natively.
- macOS (Intel or Apple Silicon) hosts have nothing to install
manually —
./measure.shauto-bootstraps a Lima-managed Linux VM + Docker daemon on first run (see the macOS section below). The build then dispatches into alinux/amd64container socurrentSystem == x86_64-linuxand the closure matches the Linux-native build byte-for-byte. - Linux aarch64 hosts need a remote
x86_64-linuxbuilder configured separately (orbinfmt_misc+qemu-userfor transparent emulation)../measure.shprints concrete setup steps if it can't find either.
./measure.sh on macOS is self-bootstrapping — vanilla macOS users do
not need to install Homebrew, Docker Desktop, OrbStack, Xcode CLT, or
any other tooling first. On a fresh machine it:
- Installs Determinate Nix on the host (single curl,
--no-confirm) ifnixisn't on PATH. One sudo password prompt for the system-extension install of the multi-user Nix daemon. - Detects that the host can't natively build
x86_64-linuxderivations. - Auto-installs a Lima VM with Nix inside, under
$HOME/.local:- Rosetta 2, on Apple Silicon (
softwareupdate --install-rosetta --agree-to-license). One sudo password prompt only if the unprivilegedsoftwareupdateinvocation fails (rare on recent macOS); already-installed Rosetta is auto-detected viaarch -x86_64 /usr/bin/trueand skipped. limactlfrom the pinned Lima release tarball.- A Lima VM named
pqsigner-builder-nixrunning Ubuntu LTS with--vm-type=vz --rosettaon Apple Silicon (plain--vm-type=vzon Intel). On Apple Silicon the VM kernel itself stays aarch64 (Apple's VZ framework can only host the host arch); the--rosettaflag registers Rosetta 2 as thebinfmt_mischandler for x86_64 ELFs inside the VM, so x86_64 USERSPACE binaries execute under Rosetta translation at near-native speed. - Determinate Nix inside the VM, configured with
extra-platforms = x86_64-linuxin/etc/nix/nix.conf.
- Rosetta 2, on Apple Silicon (
- Dispatches the build via
limactl shell --workdir $PWD <vm> nix run .#measure. Inside the VM, Nix sees asystem = aarch64-linuxhost withx86_64-linuxlisted inextra-platforms, accepts the x86_64-linux derivation, and executes its build commands (rustc, ld, …) as x86_64 ELFs which the kernel routes through Rosetta translation.
This is the same architectural pattern that nix-darwin's
nix.linux-builder.enable = true; uses internally, just without
requiring a nix-darwin install on the host.
Why no Docker? An earlier iteration of ./measure.sh ran the
build inside a nixos/nix:latest Docker container with --platform linux/amd64. On Apple Silicon hosts this hit reproducible
Input/output error failures during overlay2 + containerd writes
under Rosetta translation — a known Docker-on-VZ-on-Rosetta corner
case. Removing the Docker layer eliminated the entire failure mode:
the in-VM Nix daemon talks to its own /nix/store on a normal ext4
partition, no overlay involved.
Total interactions on a vanilla Mac: at most two sudo password prompts (host Nix daemon install, Rosetta install). After the first run, every subsequent invocation is fully silent.
The whole stack lives under $HOME (no writes to /Applications,
/usr/local, or system paths) and cohabits cleanly with whatever
container tooling the user installs later. The pinned versions are at
the top of measure.sh (LIMA_VERSION, DOCKER_CLI_VERSION); bump
them together when refreshing.
The first ./measure.sh run on a fresh Mac takes 5–8 minutes (Lima VM
first-boot + Docker daemon install + Nix closure download); subsequent
runs are sub-minute because the VM, Nix store, and nixos/nix Docker
image are all cached.
If the Lima auto-install fails (e.g., macOS pre-Ventura, no network),
./measure.sh falls back to a clear remediation message rather than
the underlying Nix Required system: 'x86_64-linux' wall of text.
If the user has already configured one of the following, ./measure.sh
detects it and skips the Lima auto-install:
- A working
docker info(Docker Desktop, OrbStack, Colima, or any other Docker-API-compatible daemon). - nix-darwin's
nix.linux-builder.enable = true;(or Determinate's managed linux-builder). - A remote
x86_64-linuxbuilder declared in/etc/nix/machinesornix.conf'sbuilders =.
Because the derivation closure is byte-identical on every host, the
output (words.txt) is byte-identical on every host by construction —
not by empirical observation of LLVM's cross-target codegen. The CI
matrix exists to catch regressions in the closure pinning, not to
discover whether reproducibility happens to hold this week.
The flake measures the git-committed state of the repo. If you
have uncommitted modifications or untracked source files, they will
not appear in the sandbox build — nix run .#measure will either fail
with "file not found for module …" (if a tracked file references an
untracked one) or silently measure the older committed state. To get
a meaningful measurement you can compare with someone else, commit
your changes first.
make verify-repro
Runs two isolated clean builds (in target/repro-a/ and target/repro-b/)
and diffs the resulting ELFs byte-for-byte. The default feature set
(FEATURES?=mock-se,debug-log,ui-semihosting) is used; override via
make verify-repro FEATURES=stm32u585,se050,optiga-trust-m,dual-se,ui-lcd
to check the production feature matrix.
CI runs verify-repro on every PR. A PR that breaks reproducibility
must be either fixed or explicitly marked "deliberately non-reproducible"
(which would almost always indicate a leak of build-host state into the
firmware and should be rejected).
There is no active release pipeline. The historical command
FSBL_VENDOR_PUBKEY=… make release now fails closed and does not remove,
replace, or publish any artifact. Restore this section only after an exact
rollback architecture digest is implementation-approved, its backend and
separate FLASH plus RAM/stack gates close, and the production ceremony is
reviewed and owner-authorized.
UPDATE 2026-07-17. Rebuilding proves the published artifact matches the source. Proving a delivered device contains exactly that artifact is the end-user SWD ground-truth procedure (reset-halt full dump at RDP-0, before first lock) designed in
docs/security/user-device-verification.md.
A non-developer who wants to confirm the firmware on their device matches the published source needs exactly two commands:
git clone https://github.com/<vendor>/sphincs_rust.git
cd sphincs_rust && git checkout <commit-from-release>
./measure.sh
./measure.sh is unattended on a fresh machine:
- Linux x86_64: installs Nix on first run (Determinate Systems
installer), then
nix run .#measure. - macOS (Intel or Apple Silicon): installs Nix and a Lima-managed
Docker daemon (Lima + Rosetta + Docker CLI under
$HOME/.local), then dispatches the build into alinux/amd64container. No Homebrew, Docker Desktop, or other tooling required up front. See the "macOS: how./measure.shprovisions x86_64-linux capability" section above for the full breakdown. - WSL2: identical to Linux x86_64 (run from the WSL shell, not
PowerShell).
measure.batat the repo root dispatches into WSL automatically.
The 8 BIP-39 words it prints must match what the device's NV3007 LCD shows
at boot. They must also match measurement.txt inside the released
.pqfw bundle.
For deeper auditing of a historical legacy bundle, the same hermetic
environment is available via ./measure.sh --shell and read-only verification
commands. The following former production workflow is intentionally blocked:
./measure.sh --shell # drops into nix develop
# make release # REFUSED while rollback is quarantined
# fwsign verify-release ... # legacy V1 verification only
A mismatch at any step means the bundle does not correspond to the source tree the vendor claims it does. Do not load such a bundle on a device.
- Vendored dependencies (offline / air-gap builds):
Cargo.lockpins every crates.io dep by SHA-256 (no git deps remain), so the build is bit-reproducible givencrates.ioreachability. For true air-gap audit support,cargo vendor(or crane-driven Nix vendoring) committed to the repo is the follow-up. - Native Windows builds: use WSL2.
measure.batat the repo root dispatches into WSL automatically (after a one-timewsl --installfrom an elevated PowerShell). The Nix flake works inside WSL2 identically to native Linux; targeting native Windows would require a separate toolchain story with no benefit for measurement verification.
If make verify-repro fails:
- Run with
VERBOSE=1to see full cargo logs. - Use
diffoscopeon the two ELFs to locate the diverging bytes. - Common culprits and fixes:
- Random symbol ordering from multiple codegen units: LTO is on
and
codegen-units = 1is set. If somehow disabled, check the release profile inCargo.toml. - Absolute path leak: something is embedding a path that
REPRO_REMAPdoesn't cover. ExtendREPRO_REMAPin the Makefile. - Timestamp in a build script: check
build.rsfiles undersecure/,nonsecure/,shared/forSystemTime,chrono::Utc::now, etc. None exist today; a regression would be caught here. env!("OUT_DIR")embedded in a release binary: would leak a per-build hash. Searchrg 'env!\("OUT_DIR"\)'in the secure and nonsecure trees — any hit is a potential regression.- File iteration order in a build script: if a build script walks a directory, sort the results.
- Random symbol ordering from multiple codegen units: LTO is on
and
The build is reproducible today. Keeping it reproducible is an
invariant; any PR that breaks verify-repro is a bug.