qseecom-supplicant/README.md
2026-12-03 13:50:41 -05:00

61 lines
2.6 KiB
Markdown

# qseecom-supplicant
What Qualcomm QSEE trusted apps call back into, for Linux's QSEECOM TEE driver
([wrobelda/linux `qcom-qseecom-tee`](https://github.com/wrobelda/linux/tree/qcom-qseecom-tee)). It's
the part of Android's `qseecomd` they need, the way `tee-supplicant` is for OP-TEE.
Trusted apps reach the normal world through listeners, and this serves three:
- **10, the file system.** Open, read, write, seek and so on, for the app's Android paths.
- **28672, the GP file system,** where apps keep their sealed objects.
- **8192, RPMB,** the UFS Replay Protected Memory Block. Gatekeeper, in keymaster64, keeps its
password handles and rollback counter there. The secure world MACs every frame, so this only
moves frames between it and the RPMB well-known LUN, with SCSI SECURITY PROTOCOL IN/OUT.
The Android paths apps ask for are served from below a root directory. It also loads the apps it's
given, and keeps them loaded while it runs. Apps the firmware loads itself, like keymaster64, are
served all the same.
```sh
qseecom-supplicant <root> <firmware dir> [app...]
```
An app is loaded as `<name>.mdt` and its `.bNN` segments, from the firmware directory: the kernel
fetches them with `request_firmware()`, so the firmware search path is pointed there while loading.
It came out of getting the OnePlus 6T's in-display fingerprint sensor working, whose app (gfp9508)
and libfprint driver need it, but nothing in it is specific to that.
## Using it
On NixOS, import the flake's module and turn it on:
```nix
imports = [ qseecom-supplicant.nixosModules.default ];
services.qseecom-supplicant = {
enable = true;
apps = [ "gfp9508" ];
};
```
- `root`, where apps keep their data, `/var/lib/qseecom` by default. Under `/var/lib`, it's the
service's state directory.
- `firmwareDirectory`, where the apps are, the system's firmware by default.
Elsewhere, `make install` installs it and a systemd unit. Set `QSEECOM_APPS` in the unit to the apps
to load, and if they aren't in `/lib/firmware`, change its firmware directory.
Only one supplicant can run at a time: the driver has one queue of requests, so two would take each
other's.
## Limitations
- RPMB is only reached on UFS, through the `/dev/bsg/*:49476` node, with 8192 sectors and one frame
per reliable write, rather than read from the device's descriptors.
- File system operations nothing has asked for yet (`stat`, directories, links, free space) are
refused.
## License
GPL-2.0-only. The listeners and the RPMB bridge come from `gfharness` in
[wrobelda/goodix-fp-spi-linux](https://github.com/wrobelda/goodix-fp-spi-linux).