Repository: betrusted-io/xous-core
Affects: services/usb-bao1x/
Feature gate: ccid-openpgp (no effect on existing builds)
Summary
The Galdralag-firmware project (https://github.com/Supermagnum/Galdralag-firmware) implements an OpenPGP card security token on the Baochip-1x (Dabao) platform. The firmware-side CCID class, OpenPGP protocol handlers, vault backend, and first-boot PIN provisioning are complete. What is missing is the usb-bao1x integration in xous-core.
Two things are needed:
- A first-boot USB provisioning personality so an operator can set User PIN and Admin PIN before CCID activates.
- CCID OpenPGP support wired into the
usb-bao1xpoll loop alongside the existing HID, FIDO, and serial classes.
What Galdralag-firmware provides
crates/usb-personality—CcidClassandProvisioningClass(CDC-ACM first-boot PIN setup)crates/baochip-openpgp— vault backend,open_or_provision_backend,write_provisioning_pins,HalError::NeedsProvisioninghost-tools—galdralag-provisionCLI for operator PIN setup over serial
What xous-core needs to add in services/usb-bao1x/
- Optional dependencies on
baochip-openpgp,usb-personality, andtrngunder accid-openpgpfeature flag - First-boot detection via
HalError::NeedsProvisioning— runProvisioningClassuntil operator commits PINs viagaldralag-provision, then switch to CCID CcidClassadded to thedevice.pollcall incomposite_handlerccid.reset()called on USB reset and unplug events
Constraints
- Provisioning personality only reachable on first boot; subsequent boots go directly to CCID
- No display dependency — provisioning is handled over CDC-ACM serial by the host tool
- No effect on existing HID, FIDO, or serial functionality
References
docs/RRAM_LAYOUT.md— PIN provision slot layoutdocs/HARDWARE_BRINGUP_TEST_PLAN.md— bring-up sequence including provisioning steplibs/bao1x-hal/src/usb/driver.rs—CorigineWrapper,QUIRK_SET_ADDRESS_BEFORE_STATUS
Activity
2Caller authentication requirement for CCID transport opcodes (640/642)
Somewhat related:
Galdralag tracks CCID IPC as CcidRxDeferred (640) and CcidTx (642) in application code (usb_bao_ipc.rs), mirroring the existing U2F wire types (U2fMsgIpc / U2fCode).
Requirement before merge: both CCID opcodes must enforce on-device caller authentication equivalent to the existing U2F first-PID-lock pattern already implemented in services/usb-bao1x/src/main.rs for U2fRxDeferred (129) and U2fTx (128):
- On first use, record
msg.sender.pid()as the CCID listener owner. - Subsequent messages from other PIDs must fail closed (U2F returns
U2fCode::Deniedin the IPC buffer; CCID should returnCcidCode::Deniedor reject without side effects). - Do not rely on host-side session-token verification alone; Galdralag threat model T7 treats host session-token checks and on-device PID lock as independent, both required.
Prior art in the same server: fido_listener_pid handling around Opcode::U2fRxDeferred and Opcode::U2fTx (approx. lines 403–535 in current main.rs).
Current vendored snapshot in Galdralag: api.rs has no 640/642 variants yet; unknown opcodes still hit the _ arm (log + continue). Please add CCID opcodes with auth at implementation time, not as a follow-up.
Reference: Galdralag docs/THREAT_MODEL.md section "IPC access control (userspace audit refresh, 2026-06)".
Caller authentication requirement for CCID transport opcodes (640/642)
Galdralag tracks CCID IPC as
CcidRxDeferred(640) andCcidTx(642) in application code (usb_bao_ipc.rs), mirroring the existing U2F wire types (U2fMsgIpc/U2fCode).Requirement before merge: both CCID opcodes must enforce on-device caller authentication equivalent to the existing U2F first-PID-lock pattern already implemented in
services/usb-bao1x/src/main.rsforU2fRxDeferred(129) andU2fTx(128):msg.sender.pid()as the CCID listener owner.U2fCode::Deniedin the IPC buffer; CCID should returnCcidCode::Deniedor reject without side effects).Prior art in the same server:
fido_listener_pidhandling aroundOpcode::U2fRxDeferredandOpcode::U2fTx(approx. lines 403–535 in currentmain.rs).Current vendored snapshot in Galdralag:
api.rshas no 640/642 variants yet; unknown opcodes still hit the_arm (log + continue). Please add CCID opcodes with auth at implementation time, not as a follow-up.Reference: Galdralag
docs/THREAT_MODEL.mdsection "IPC access control (userspace audit refresh, 2026-06)".