Repository navigation
aurora-sep: set up the Touch ID calibration on demand with aurora-touchid-setup - #52
Merged
Merged
Conversation
The enclave loads a standalone FSC2 calibration (J700, J713) only
resealed with the Mac's own factory records:
comb { fdrd: IMG4 { IM4P, [0] seal-<CHIP>-<ECID> }, secb: trust bundle }
prepare-sep-calibration cached the carved image by partition identity
and wrote it over that record at every start.
Every start now reads the factory cache read-only from the Hardware
volume of the iBoot System Container, and rebuilds the record from it.
The APFS reader is bounded: the newest checksummed checkpoint, the
object maps, the file-system tree and uncompressed regular files only.
The rebuild takes:
- the FSC2 calibration's IM4P;
- the one seal, which must name the running Mac's CHIP and ECID from
the boot's local policy manifest, carry its serial number, and list
the IM4P's SHA-384 as its FSC2 digest;
- the trust bundle whose named copy matches trustobject-current.
IM4M properties are walked as strict DER, with limits on size, depth
and element count.
The installed record is replaced only when it differs. The replacement
is written atomically with mode 0600 and read back, and the old bytes
are kept as private rollback evidence. When the records cannot be
admitted, the bare image is never installed, a wrong-device or
malformed record moves to private quarantine, and Touch ID stays
unready. An FSCl comb record is still installed as carved, checked as
the extractor checks it.
Readiness is a per-boot marker in /run/aurora-sep that names the
admitted digests. aurora-sep-ready.service and fprintd now also require
calibration-ready, which checks the installed bytes against the marker.
SEP trusted keys start either way. These are provenance and structure
checks; the enclave verifies the signatures.
(cherry picked from commit 0986e4c, #27)
[Ryan Murray: applied to the current main with only the helper, calibration-ready
and the tests, as written; the packaging and module changes are left out
because the next commit runs the rebuild on demand instead of at every start]
prepare-sep-calibration ran before aurora-sep.service on every boot and carved the calibration again, although it is constant for a Mac. On the MacBook Neo and the M4 Air it found a bare FSC2 image the enclave refuses. aurora-touchid-setup replaces it. It builds the files the sensor's driver loads from this Mac's own data, read-only, with Erik Bourget's reader from the previous commit: - the calibration and, where the factory cache has an MSRk record, the sensor's signed root key, both resealed from the factory records on the Hardware volume (J700, J713, J616s); - elsewhere (M1, M2), the comb record carved from the container, as is. The names come from the fingerprint node's firmware-name list, read as the driver reads it: the calibration first, the root key second, with the driver's defaults. It runs only when something is wrong or when asked: 1. A file is missing. aurora-touchid-setup.service runs before Touch ID starts. Its ExecCondition only tests that the files it recorded exist, so a boot with Touch ID in place skips it. The first boot after installation runs it once to record what is there. 2. The enclave refused a file. When the sensor did not attach, aurora-sep-ready looks for a refused LOAD_CALIBRATION or SENSOR_ROOT_KEY in this boot's kernel log and starts the service once. The driver loads the file again at its retry about 10 s later. A second refusal in the same boot is only logged. 3. The owner runs it, with --check (writes nothing) or --force-rebuild, and --json for a machine-readable result. A file it did not install is kept unless the enclave refused it or --force-rebuild asks. Replaced bytes go to /var/lib/aurora-sep/rollback. New files are written atomically, mode 0600, and read back. The result is kept in /var/lib/aurora-sep/touchid-setup.json with a JSON line per run in touchid-setup.log. NixOS keeps the kernel's firmware path on /run, so the files are kept in /var/lib/aurora-sep/firmware. The tool links each file into that path, and aurora-sep.service relinks them at each boot (touchid-publish creates links only and builds nothing). The firmware-name list parsing from nixos-aurora#50 is part of this. The per-boot readiness marker of the previous commit is left out, because nothing runs at every boot to write it; the driver's diag attributes already tell aurora-sep-ready whether the sensor attached. Tested with --check on the Neo, the J616s, the M1 Pro and the M2: each rebuild is byte-identical to the file installed and working there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two fixes found while checking what a fresh image does on each Mac. The tool took any node with the apple,mesa-fingerprint compatible as a reader. The SoC device trees carry that node disabled on Macs without one (Mac mini, Mac Studio), and aura disables the SPI controller on a J700 sold without the sensor. Those Macs found no calibration, failed, and ran the unit again on every boot. A node now counts only when it and every node above it are enabled, as the kernel decides before probing. On Arch the boot points firmware_class.path at the vendor firmware it unpacks on /run, and the tool kept its files there. They were gone after a reboot, so the setup ran at every boot on Macs whose package has no Touch ID files, and a rebuild after a refusal never lasted. The files are now always kept in /usr/lib/firmware, or AURORA_TOUCHID_FIRMWARE_DIR (NixOS), and only linked into a custom search path. The kernel falls back to /lib/firmware, so nothing else changes. Fedora has no custom path and is unaffected. Tested with the unit tests (new cases fail on the previous tool) and with --check on the Neo, J616s, M1 Pro and M2: each still finds its enabled sensor and reports the installed files identical to the rebuild. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main changed prepare-sep-calibration to read the fingerprint firmware-name as a string list (#50). This branch removes that helper; aurora-touchid-setup reads the same list the way the driver does, so the J616s, which also names its MSRk record, still gets its calibration. Keep the removal and raise the package version to 1.9, above main's 1.8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 31, 2026
RyanTheTide
added a commit
that referenced
this pull request
Nov 5, 2026
The v2 tip: speakerguardd#51, #52, #53, #54. The packaged files are unchanged. Fleet gate (gate.json, upstream's, unchanged here): units at parity: spp3, lsm2; spp3: J316s, J413, J616s; lsm2: J700. Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com> Assisted-by: LLM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This replaces the every-boot
prepare-sep-calibrationwithaurora-touchid-setup, a tool in the aurora-sep package that sets up this Mac's Touch ID files from its own factory data. It runs by itself only when something is wrong, and the owner can run it any time, much like widevine-installer.What it builds
The sensor's driver loads two per-device files named by the fingerprint node's
firmware-namelist: the calibration (first entry) and, on sensors with a nonce session, the signed root key (second entry,apple/msrk-j700.binby default). The tool reads the list the same way, which also fixes the J616s two-name list (#50).comb { fdrd: IMG4 { IM4P, [0] seal-<CHIP>-<ECID> }, secb: trust bundle }. The seal must name the running Mac's chip, ECID and serial number and cover the record. The root key is rebuilt the same way from the MSRk record. No macOS is needed.When it runs
aurora-touchid-setup.serviceruns once at boot, before Touch ID starts. ItsExecConditiononly tests that the files it recorded still exist, so a boot with Touch ID in place skips it. The name comes from the device tree and differs per model, so a staticConditionPathExists=!cannot name it; the condition script is a few file tests. The first boot after this update runs the tool once to record what is there.aurora-sep-readylooks in this boot's kernel log for a refusedLOAD_CALIBRATIONorSENSOR_ROOT_KEY(for example status 0x1c or 0x12e), or a missing file. It then runssystemctl start --no-block aurora-touchid-setup.service. The tool replaces the file and the driver loads it again at its own retry about 10 s later, or at the next enrolment or verify. One automatic rebuild per boot: a marker in/run/aurora-sepstops a loop, and a second refusal is only logged. A boot whose sensor attached never reads the log.sudo aurora-touchid-setup --checkreports and writes nothing.sudo aurora-touchid-setupsets up what is missing.--force-rebuildrebuilds and replaces what differs.--jsonprints a machine-readable result.Safety
--force-rebuildasks for it (the rule from fedora-aurora#47). The old helper's record and cache count as installed by this tool./var/lib/aurora-sep/rollback. New files are written atomically, mode 0600, and read back./var/lib/aurora-sep/touchid-setup.json, with one JSON line per run intouchid-setup.log, and every step is in the journal.The keystore wait from #42 is already on main and unchanged.
NixOS
The kernel's firmware path is on
/runhere, so the tool keeps the files in/var/lib/aurora-sep/firmwareand links each into the firmware path.aurora-sep.servicerelinks them at each boot throughtouchid-publish, which only creates links and builds nothing. The unit issystemd.services.aurora-touchid-setupinmodules/sep.nix. Bumps the package to 1.8.A note for Erik
Erik Bourget (erikwb) wrote the part that makes this possible: the narrow checksummed APFS reader, the strict DER walk and the admission against the running Mac's identity, in #27. His commit is the first commit here, with his authorship, applied as he wrote it. The second commit runs his rebuild on demand instead of at every start, extends it to the root key, and leaves out the per-boot readiness marker, since nothing now runs at every boot to write it. The tool's header credits him. Thank you, Erik: this is what lets a Mac get Touch ID without macOS.
Supersedes #27 and #50. Those are left open for review.
Testing
tests/test_touchid_setup.py: 45 tests on synthetic APFS images, manifests, records and device trees. Erik's container, manifest, admission and identity tests are kept. New tests cover the firmware-name list, install,--checkwriting nothing, keeping identical and foreign files,--force-rebuildand refusal replacements with rollback copies, the old helper's records, the bare image, FSCl records, sensorless Macs, unknown identity, links, a failed write, the boot condition script, the once-per-boot trigger, andaurora-sep-readystarting the rebuild only after a refusal.--checkon four Macs, read-only, nothing written:Not tested yet: an install on hardware, the boot-time unit and the refusal path on a real refusal. These Macs were read-only for this work. A good first hardware test is the Neo: move
mesacal-j700.binaside, reboot, and check that the unit rebuilds it and Touch ID restores.No Nix is available on the build host, so
nix flake checkand the package build were not run locally; CI runs both.Parity
/usr/sbin/aurora-touchid-setup/usr/bin/aurora-touchid-setupaurora-touchid-setupin the system profile/usr/lib/firmware/apple/usr/lib/firmware/apple/var/lib/aurora-sep/firmware, linked into the firmware path on/run🤖 Generated with Claude Code