Files
chandra/docs/fingerprint.md
T
nandiandClaude Opus 4.8 f51ce088ad
CI / test (push) Failing after 50s
Docs: OnePlus 6T fingerprint investigation
Record the read-only investigation into the 6T's in-display fingerprint
reader: our unit is a Silead GSL7000 (sl7000 TA), not Goodix — GPIO 91
reads 0 and /persist carries fresh Silead calibration. Document the
extracted stock blobs (staged outside the repo), the TEE+REE software
stack and first-pass sl_fp_* command RE, the keymaster/gatekeeper HAT
path, a feasibility read, the ordered next steps, and the hardware
safety constraints. Not a shipped feature; face unlock remains the
working path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-29 01:53:09 -08:00

9.7 KiB

Fingerprint unlock on the OnePlus 6T (fajita)

Status: research / not working yet. This is a feasibility investigation, not a shipped feature. It records what the in-display fingerprint hardware on our 6T actually is, what we extracted from the stock firmware, how the stock software stack is layered, and the ordered plan to get an enrol/match working under Chandra. For unlocking today, use face unlock — it already works; this is a longer project that may still hit a wall (see Feasibility).

Everything here was gathered read-only over USB from the connected handset (chandra-6t, 172.16.42.1) and by static analysis of extracted blobs on the desktop. Nothing was written or flashed to the phone.

1. The hardware — it's Silead, not Goodix

fajita shipped with one of two in-display optical sensors, and the stock detect driver (drivers/oneplus/drivers/input/fingerprint/fingerprint_detect/) reads TLMM GPIO 91 to tell them apart:

GPIO 91 sensor_version Sensor TrustZone app
1 0x04 Goodix GF9508 gfp9508
0 0x05 Silead GSL7000 (our unit) sl7000

On our phone GPIO 91 reads 0 → Silead GSL7000. The on-device calibration state confirms it:

  • /mnt/vendor/persist/silead/fpcal4.dat (133 KB), fpcal5.dat (33 KB) — real, dated 2026-10-16, header magic ad1e5100 0f916b58 00126062 ….
  • /mnt/vendor/persist/data/{BMatrix,caliParamsInfo,chartbase}.so (Goodix) — stale 2008-epoch timestamps, i.e. unused.
  • /mnt/vendor/persist/engineermode/fpcalibrationresult: all SPI / capture / chart factory tests PASS, SENSOR_VENDOR: O-Flim, CHIPID 0x51303147... ("GSL7000" in ASCII: 51 30 31 47 = Q01G…).

So any port should target the Silead sl7000 path. The Goodix prior art (wrobelda/goodix-fp-spi-linux, yarons/beryllium_fpc) is still useful for the QSEECOM kernel plumbing, but not for the TA protocol — ours is a different vendor.

Board wiring (from stock fajita.dtsi)

Line Pin
Reset TLMM 35
IRQ TLMM 121
Enable TLMM 80
ID (sensor select) TLMM 91
Supply pm8998_l22 (ldo22), 3.2 V / 50 mA

Mainline sdm845 has no fingerprint node; these pins are currently unclaimed (verified live: all four read as plain inputs, UNCLAIMED in pinctrl).

2. What we extracted (durable copy)

Staged to ~/.local/share/chandra-fp/blobs/ (outside the repo — these are proprietary signed blobs and must not be committed; re-extract from the phone if the copy is lost). Provenance (sha256):

sl7000.elf            daa5814d…  reassembled Silead TA  (from modem_a/image/sl7000.b0*)
gfp9508.elf           4f9765ba…  reassembled Goodix TA  (unused on our unit)
keymaster_a.mbn       222e7491…  keymaster/gatekeeper TA (partition dump)
vendor/libsl_fp_impl.so  f780dfa3…  Silead HAL

Plus the rest of vendor/ (libsl_fp_algo.so, libsl_fp_prepro.so, libsl_fp_nosec.so, libsl_fp_impl_util.so, goodix.fod.sdm845.so, silead.fod.sdm845.so, the keymaster/gatekeeper @qti impls, init.oem.rc, init.target.rc) and the split .mdt/.b0* TA images under modem/.

The modem partition carries TAs for both sensors (sl7000.*, gfp9508.*) plus fpc1228, gfp5288, etc. — OnePlus ships one image for every panel/sensor variant and selects at runtime.

3. Stock software stack (how the sensor is actually driven)

 Android HAL                     Linux kernel              TrustZone (QSEE)
 ───────────                     ────────────              ────────────────
 libsl_fp_impl.so   ── ioctls ─► /dev/silead_fp  (power/reset/IRQ, HBM)
   silfp_* (flow)   ── SPI ────► /dev/spidev0.0  (REE imaging — Silead does
   sl_fp_*  (TA cmd)                              some capture in normal world)
       │            ── QSEECom ─► /dev/qseecom ──►  sl7000  (templating + match)
       ▼                                            keymaster64 (HAT / key)
 libsl_fp_algo.so / libsl_fp_prepro.so  (image pre/post-processing, REE)

Key difference from the Goodix FOD parts: Silead is a TEE+REE hybrid. It opens /dev/spidev0.0 and does part of the imaging in the normal world (libsl_fp_algo.so, libsl_fp_prepro.so carry the capture/denoise/enroll pipeline), while the sl7000 trustlet handles secure templating and matching. That is friendlier than a pure-TEE Goodix part — more of the pipeline is reachable from Linux without the TA.

The HAL also owns the optical display requirements directly: sl_fp_set_hbm_mode (High Brightness Mode) and read_brightness / set bright_value against the backlight sysfs node, plus the #00ff00 FOD illumination that the compositor would draw.

RE progress on the sl_fp_* command layer (first pass)

libsl_fp_impl.so holds both the HAL flow (silfp_*) and the TA/kernel senders (sl_fp_*). The senders split two ways:

  • Kernel ioctls to /dev/silead_fp — control plane. Recovered opcodes: sl_fp_set_hbm_mode → 0x32, sl_fp_set_tpirq_enable → 0x2, sl_fp_calibrate loops a sub-op 0x1 over steps 3/4/5, sl_fp_init → 0xa.
  • QSEE commands to sl7000 — sl_fp_capture_image, enroll_start/step/end, auth_start/step/end, load/verify_enroll_challenge. These funnel through a shared buffer-builder before silfp_qsee_send_modified_command_to_tz_with_ion (→ QSEECom_send_modified_cmd); the per-command TA opcodes are assembled in that helper and still need tracing. This is the main remaining RE task (see Step 1 below). A live trace of the stock HAL is the fast way to get it; the alternative is finishing the static disassembly of the helper + the TA's dispatcher in sl7000.elf.

4. The gatekeeper / keymaster path — crossable here

The usual wall on mainline Linux is that the fingerprint TA wants a Gatekeeper hardware-auth-token (HAT) to enrol, and the keymaster/gatekeeper state is never initialised outside Android. The good news from keymaster_a.mbn:

  • Its command table exposes the full HAT-minting chain proven on sister 2018-era Qualcomm hardware (Pixel 3a / SDM670, samcday/sam-sargo#11): 0x200/0x207 (init), 0x20e GET_HMAC_SHARING_PARAMS, 0x20f COMPUTE_SHARING_HMAC, then 0x1001 GK_ENROLL / 0x1002 GK_VERIFY.
  • Gatekeeper is implemented inside keymaster64 (resident app_id=1), KM3-era — the same design Sam Day drove from Linux to mint real 69-byte HATs.

QSEECOM itself is alive on our mainline kernel: boot log shows qseecom: found qseecom with version 0x1400000, SHM Bridge not supported (falls back cleanly), with CONFIG_QCOM_QSEECOM=y and CONFIG_QCOMTEE=m built in.

5. Feasibility

More promising than a first glance suggests, but still a real project with a genuine make-or-break step:

  • For us: a Silead sensor with valid on-disk calibration, a partly-REE imaging pipeline, reachable enrol/match TA commands, and a keymaster exposing the HAT path proven on sister hardware.
  • Against us: the TA may still refuse enrol without a correctly-minted HAT (the beryllium_fpc Goodix dead-end), and the sl7000 opcode map isn't fully recovered yet.

6. Next steps (cheapest / safest first — each gates the next)

  1. Recover the live sl7000 command sequence. Either trace the stock OxygenOS HAL (frida/LD_PRELOAD on libQSEEComAPI.so, logging every QSEECom_send_modified_cmd to sl7000/keymaster64 during a real enrol + unlock), or finish the static RE of the shared sender + sl7000.elf dispatcher. This is the biggest unknown and needs no kernel work.
  2. Port a QSEECOM TEE driver (Wróbel + Sam-Day qcom-qseecom-tee series + supplicant, listeners 10 / 28672) onto linux-sdm845 7.1. Success = sl7000 loads and answers a no-op over /dev/tee0.
  3. HAT bootstrap, RAM-booted (fastboot boot, nothing flashed): run keymaster 0x200→0x207→0x20e→0x20f then GK_ENROLL 0x1001. Make-or-break: it either mints a HAT (like SDM670) or returns VERIFICATION_FAILED (like the Poco).
  4. Only if 3 passes: Silead optic enrol/match using the on-disk fpcal4/5.dat → Chandra FOD illumination spot + HBM via compositor/shell/backlight.mbt, synced to the touch-down → libfprint + PAM, mirroring face/pam_chandra_face.c and the existing auth dialog.

7. Safety — do not

  • Do not probe the sensor's SPI GENI SE from Linux (the TrustZone/XPU-owned SE). On the Poco F1 any Linux MMIO access to it hung the whole SoC and needed a power-cycle. The TA owns that bus.
  • Do not enable the mainline-disabled Crypto Engine DT node (crypto@1dfa000) — it's shared with TZ and triggers a hard reset.
  • Do not write or wipe persist. The Silead fpcal4/5.dat are our only factory optical calibration; regenerating them needs physical calibration fixtures. Everything above reads persist read-only.
  • Prefer RAM-boot (fastboot boot) for every on-device kernel test so nothing is flashed; a power-cycle returns to the installed system.

Prior art

  • wrobelda/goodix-fp-spi-linux — working QSEE enrol/match stack (kernel TEE driver, supplicant, libfprint) on SM8250. Goodix TA, but the QSEECOM plumbing is reusable.
  • samcday/sam-sargo#11 — HAT minting on 2018-era QSEE (SDM670), the blueprint for Step 3.
  • yarons/beryllium_fpc — SDM845 + Goodix TA loads on mainline 7.x; documents the gatekeeper dead-end.