chore(core/bootloader): run the firmware check only for debuglink messages that need it [no changelog]
What changed, and why it matters
This is a small bootloader performance and robustness tweak. Previously, the bootloader computed a hash of the entire firmware image for every debuglink message, even when that hash wasn't used. Now it only computes the hash for the two message types that actually report it (Initialize and GetFeatures), and it recomputes it fresh for each such message. The change also avoids hashing during firmware uploads when the image is incomplete. There is no direct security fix here, but it removes a potential source of inconsistent or stale state and reduces unnecessary work.
No immediate action required. Treat as routine maintenance. If auditing, verify that `workflow_initialize` and `workflow_get_features` are the only consumers of `fw_check_info_t` in the debuglink path and that skipping the hash for other messages does not break any assumptions elsewhere.
Security signals we found
Defensive reduction of unnecessary firmware hashing in bootloader debug path
Avoids computing firmware hash while image is incomplete during upload
Fresh computation of firmware hash per message reduces stale-state risk
No change to input validation, buffer handling, or cryptographic verification logic
Evidence from the diff
In core/embed/projects/bootloader/workflow/debuglink.c, the call to fw_check(&fw)—which hashes the whole firmware image and populates a fw_check_info_t—was moved out of the top of debuglink_process() and into only the Initialize and GetFeatures case branches. Those are the only two handlers that consume fw. The hash is now computed fresh per message rather than once per debuglink poll, and it is skipped for Ping, screen-dump messages, and during firmware uploads when the image may be incomplete. This is a defensive optimization; it does not change message parsing, trust boundaries, or cryptographic checks.
Changed components
Trezor Core bootloader debuglink workflowcore/embed/projects/bootloader/workflow/debuglink.cInspect captured patch +2 / −1
### core/embed/projects/bootloader/workflow/debuglink.c
@@ -162,17 +162,18 @@ static debuglink_result_t debuglink_process_record_screen(protob_io_t *io) {
debuglink_result_t debuglink_process(void) {
fw_check_info_t fw = {0};
- fw_check(&fw);
debuglink_result_t res = DEBUGLINK_RESULT_NONE;
uint16_t msg_id = 0;
if (protob_get_msg_header(&g_debug_io, &msg_id) == sectrue) {
switch (msg_id) {
case MessageType_MessageType_Initialize:
+ fw_check(&fw);
workflow_initialize(&g_debug_io, &fw);
break;
case MessageType_MessageType_GetFeatures:
+ fw_check(&fw);
workflow_get_features(&g_debug_io, &fw);
break;
case MessageType_MessageType_Ping:Why this scored 19/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.