fix(core): check pairing start in wireless setup
What changed, and why it matters
This commit fixes a bootloader wireless setup workflow so it checks whether Bluetooth pairing actually started before continuing. Previously, the code ignored the return value of the pairing-start function, so if pairing failed to initiate, the setup would proceed anyway. The fix makes the workflow return a pairing-failed status instead. This is a defensive hardening change in the bootloader's BLE pairing path.
Treat as a low-to-moderate hardening fix. Review whether downstream callers of `workflow_wireless_setup()` handle `WF_OK_PAIRING_FAILED` correctly and ensure no other BLE interface return values are ignored in the bootloader.
Security signals we found
Unchecked return value from security-relevant BLE pairing initialization
Bootloader workflow proceeds on assumed-success of pairing start
Return value now enforced, failing closed on pairing initiation failure
Evidence from the diff
In workflow_wireless_setup() in the Trezor bootloader, the call to ble_iface_start_pairing() was not checked. The function returns a boolean indicating success/failure of pairing initiation. The patch wraps the call in an if (!ble_iface_start_pairing()) guard and returns WF_OK_PAIRING_FAILED on failure, preventing the workflow from continuing into advertising-name retrieval and subsequent wireless setup steps when pairing could not start.
Changed components
core/embed/projects/bootloader/workflow/wf_ble_pairing_request.cBootloader wireless setup workflowBluetooth Low Energy pairing interfaceInspect captured patch +3 / −1
diff --git a/core/embed/projects/bootloader/workflow/wf_ble_pairing_request.c b/core/embed/projects/bootloader/workflow/wf_ble_pairing_request.c
index ee370a1d..98ce6c91 100644
--- a/core/embed/projects/bootloader/workflow/wf_ble_pairing_request.c
+++ b/core/embed/projects/bootloader/workflow/wf_ble_pairing_request.c
@@ -122,7 +122,9 @@ workflow_result_t workflow_ble_pairing_request(const vendor_header *const vhdr,
workflow_result_t workflow_wireless_setup(const vendor_header *const vhdr,
const image_header *const hdr,
protob_ios_t *ios) {
- ble_iface_start_pairing();
+ if (!ble_iface_start_pairing()) {
+ return WF_OK_PAIRING_FAILED;
+ }
char name[BLE_ADV_NAME_LEN + 1] = {0};
ble_get_advertising_name(name, sizeof(name));
Why this scored 49/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.