Skip to content

soc: apple: sep: Touch ID retry limits, lock states and enrolment operation as on macOS - #1134

Merged
RyanTheTide merged 6 commits into
integration/aurorafrom
fix/sep-touchid-macos-policy
Nov 8, 2026
Merged

RyanTheTide merged 6 commits into
integration/aurorafrom
fix/sep-touchid-macos-policy

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Stacked on #1087 (base branch fix/sep-touchid-lift-rearm). Retarget to integration/aurora once #1087 merges.

Five commits that bring the Touch ID protocol closer to macOS 26.6.2. They come from our own macOS traces (unified log + dtrace of the J700, 11-04 and 11-07) and four clean-room research reports. No Apple binaries or bytes are in this tree.

Commits

  1. Retry limits per prompt and per lockout
    • LocalAuthentication ends a prompt after 3 failed matches and leaves Touch ID available. The enclave locks the user's biometry after 5 completed no-matches (lock state 0x04 + 0x40), and only a password clears that.
    • The driver locked Touch ID after 3 misses across prompts. It now ends the prompt's match operation at 3 and locks at 5.
    • A retry straight from the capture keeps the prompt's operation, evaluation and registered sensor, as macOS does. This covers no finger in time, partial contact and a damaged frame. Before, the driver cancelled the operation and power-cycled the sensor.
  2. OPERATION_DEVICE_LIST (0x7d) after BEGIN_ENROL
    • macOS opens every enrolment's device operation before the first capture; this commit does the same.
    • At least one device is now required in the list for enrolment and match.
  3. Every lock-state bit
    • 0x02 password lockout, 0x04 biometry lockout, 0x10 before first unlock and 0x40 identification lockout all require the password. 0x80 (catacomb corrupted) is refused as an enclave failure, not a bad finger. Every state is logged with its bit names.
    • Tag 0x02 (enrolled count) and tag 0x04 (device list changed) are named instead of "unhandled".
    • The failed-attempt count survives a restart in the host lockout record, as the enclave's own count does on macOS.
  4. Lockout record saved again after the catacombs
    • LOAD_LOCKOUT answered 0x8002 at every boot. The enclave refused a record that was older than the catacomb generation saved after a template update.
    • The record is now saved again whenever a catacomb transaction ends (the master is always saved last). 0x8002 is logged as the refusal it is.
  5. Why an image was rejected

Tests

  • Static checks: checkpatch --strict on each commit: 0 errors, 0 warnings. W=1 drivers/soc/apple: 0 (see comment).
  • KUnit apple_sep*: new tests prompt_limit_ends_the_operation_not_touch_id, unusable_touch_keeps_the_prompt, record round trip with the failure count, lock_state_bits and assessment_reasons. The 4 known apple_sep_host_store base failures are unchanged (results in a comment).
  • Neo no-finger gate (7.3.0-aurora-fleet22-tid26 = fleet22 + soc: apple: sep: arm the next Touch ID capture when the finger lifts #1087 + this): PASS.
    • Re-arm status 0.
    • Two prompts with two empty touches each stayed one match operation per prompt (0x7d 2, MATCH_CANCEL 2).
    • fprintd retried inside the prompt.
    • Failures stayed 0 and catacombs were unchanged.
    • Lock states were named, and the 0x02/0x04 notices were named.
    • 0 apple_sep errors, 0 AVC.
  • Finger test: pending with Ryan (TEST-touchid26).

🤖 Generated with Claude Code

… macOS does

macOS has two Touch ID retry limits. LocalAuthentication ends a Touch ID
prompt after three failed matches and offers the password, but the enclave
stays unlocked and the next prompt offers Touch ID again. The enclave
itself locks the user's biometry after five completed no-matches (lock
state bit 0x40), and only a password clears that. Captured on macOS
26.6.2: an LA prompt with three misses kept lock state 0x228 throughout,
while a lock screen with five misses moved it to 0x45.

The driver had one limit, three failed matches in a row across prompts,
and it locked Touch ID until a password. A person who missed three times
in sudo could not use Touch ID at the next prompt, unlike on macOS.

Apply both limits. The third miss in a prompt ends that prompt's match
operation (MATCH_CANCEL), as LocalAuthentication does, without locking
Touch ID. The fifth miss since the last match or password re-arm locks
it on the host and records the lock, as before.

macOS also keeps the match operation open across a touch that gave no
usable frame (it cleans the image up and takes the next frame). The
driver ended the prompt instead, cancelled the operation, closed the
unlock evaluation and power-cycled the sensor, so the next touch paid for
a full bring-up and a new evaluation. A retry straight from the capture
(no finger in time, partial contact, a damaged frame) now keeps the
prompt, its operation and the registered sensor.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
macOS starts every Touch ID enrolment with BEGIN_ENROL (0x03) and then,
before the first capture, OPERATION_DEVICE_LIST (0x7d): the same request
that opens a match operation, here for the enrolment. The driver sent
only BEGIN_ENROL, so its enrolments ran without the device list macOS
sets up for them. Captured on macOS 26.6.2 during a System Settings
enrolment.

Send it after BEGIN_ENROL and require a well-formed list with at least
one device; otherwise cancel the enrolment before any capture. Require at
least one device when a match operation opens too.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
…ttempts across a restart

The enclave announces a user's biometric lock state as a 16-bit word.
macOS 26.6.2 names its bits: 0x02 password lockout, 0x04 biometry
lockout, 0x08 unlock token, 0x10 before first unlock, 0x20 password
validated, 0x40 identification lockout, 0x80 catacomb corrupted. The
driver read only 0x40, so a password lockout, a biometry lockout without
0x40 or a state before the first password unlock still asked for a
finger the enclave would refuse, and a damaged catacomb looked like a
failed match.

Treat 0x02, 0x04, 0x10 and 0x40 as a lockout that needs the password,
in the verify gate and in the re-arm check; refuse a verify on 0x80 as
an enclave failure, not a non-matching finger; and log every state with
its bit names.

Name the enclave's other notices: tag 0x02 is a user's new enrolled
identity count, tag 0x04 says the device list changed. Neither needs an
answer; they were logged as unhandled.

On macOS a restart does not clear failed attempts: the enclave saves
its count after every result and reloads it. The driver forgot its
count at every restart (its LOAD_LOCKOUT is not accepted yet), so a
restart reset the attempts. Keep the count in the host lockout record,
next to the lock, and restore it at start-up. Records from older
kernels read as zero failed attempts.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
…acombs

At every start the driver hands the enclave its saved lockout record
(LOAD_LOCKOUT, 0x71) after the catacombs, and every start the enclave
refused it with 0x8002, so the enclave forgot its failed attempts. The
enclave checks the record against the restored catacombs, and the record
on disk was always older than them: the driver saves it right after a
match result, then a template update saves the user and master
catacombs, a newer generation.

macOS treats 0x8002 from LOAD_LOCKOUT as a refused record, not as an
empty one, and loads the record only after all catacombs, as here. Save
the lockout record again whenever a catacomb transaction ends (the
master is always saved last), so the record on disk matches the
catacombs on disk. Say in the log that a 0x8002 is a refusal; the host
record keeps the failed-attempt count in that case.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
When the enclave's image assessment (0x07) rejects an image, the driver
reported every case as partial contact. The 238-byte assessment says
more: macOS 26.6.2 reads a feedback word (bad image, damaged blocks,
sensor noise, finger moved), a finger-problem class (wet finger) and a
dirt-on-sensor byte, and turns them into its own messages (finger moved,
clean the sensor).

Decode those fields. A rejected verify or enrol image now reports the
matching retry cause (SEP_BIO_GUIDANCE_TOO_FAST for a moved finger,
SEP_BIO_GUIDANCE_CLEAN for dirt or a wet finger, LIFT_AND_MOVE for a bad
image, CENTER otherwise) and logs the reason. The outcome is unchanged:
another touch is asked for.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Gates at head 25ee9de:

  • checkpatch --strict: 0 errors, 0 warnings on each of the 5 commits.
  • W=1 drivers/soc/apple: 0 warnings.
  • KUnit apple_sep*: 178 run, 174 passed. The 4 failures are the known apple_sep_host_store ones on the base. The new prompt_limit_ends_the_operation_not_touch_id, unusable_touch_keeps_the_prompt, record_round_trips, lock_state_bits and assessment_reasons pass.
  • Neo no-finger gate, 7.3.0-aurora-fleet22-tid26 (fleet22 e5a1f1d + soc: apple: sep: arm the next Touch ID capture when the finger lifts #1087 + this; SEP files identical to this branch): PASS, 11-08 00:23.
    • The boot started in the recorded lockout. The re-arm (password verify) answered status 0 and cleared it.
    • There were 2 fprintd-verify runs with 2 empty touches each. Each empty capture kept the prompt's match operation open, and fprintd retried inside the same prompt: 0x7d 2, MATCH_CANCEL 2, all match mode 0x88, failures stayed 0, catacombs were unchanged.
    • PAUSE_CAPTURE was accepted. Lock states were logged with bit names, and the tag 0x02/0x04 notices were named.
    • LOAD_LOCKOUT 0x8002 is now logged as a refusal. 0 apple_sep error lines, 0 AVC.

The finger test is pending: TEST-touchid26 (3 misses end the prompt, the next prompt offers Touch ID again, 5 lock, password, match; partial touch keeps the prompt; enrolment with 0x7d).

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Hardware finger test PASSED on the MacBook Neo, 2026-11-08 ~14:20, by Ryan on kernel 7.3.0-aurora-fleet22-tid27 (#1087 + #1134 + #1143), libfprint aurora10, aurora-touchid-rearm 1-2.

  • Kernel log confirms password re-arm/clear (7 events), the lockout at 5 failed attempts (3), and an enrolment completed.
  • Evidence: traces/touchid/20261108-touchid27-finger.

@RyanTheTide
RyanTheTide changed the base branch from fix/sep-touchid-lift-rearm to integration/aurora November 8, 2026 04:36
@RyanTheTide
RyanTheTide merged commit 89f5615 into integration/aurora Nov 8, 2026
2 checks passed
@RyanTheTide
RyanTheTide deleted the fix/sep-touchid-macos-policy branch November 8, 2026 04:36
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merged after the cross-Mac gate. The Touch ID path here has no SoC gating, and it now runs the same on every Touch ID Mac:

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.

1 participant