mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-15 01:40:57 +00:00
legacy/bootloader: refactor show_halt usage
This commit is contained in:
parent
86b7813629
commit
054bb3a67a
@ -141,10 +141,7 @@ int main(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (SIG_OK != check_firmware_hashes(hdr)) {
|
if (SIG_OK != check_firmware_hashes(hdr)) {
|
||||||
layoutDialog(&bmp_icon_error, NULL, NULL, NULL, "Broken firmware",
|
show_halt("Broken firmware", "detected.");
|
||||||
"detected.", NULL, "Unplug your Trezor,",
|
|
||||||
"reinstall firmware.", NULL);
|
|
||||||
shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mpu_config_off();
|
mpu_config_off();
|
||||||
|
@ -261,27 +261,27 @@ static void rx_callback(usbd_device *dev, uint8_t ep) {
|
|||||||
if (readprotobufint(&p, &flash_len) != sectrue) { // integer too large
|
if (readprotobufint(&p, &flash_len) != sectrue) { // integer too large
|
||||||
send_msg_failure(dev);
|
send_msg_failure(dev);
|
||||||
flash_state = STATE_END;
|
flash_state = STATE_END;
|
||||||
show_halt("Firmware is too big.", NULL);
|
show_halt("Firmware is", "too big.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (flash_len <= FLASH_FWHEADER_LEN) { // firmware is too small
|
if (flash_len <= FLASH_FWHEADER_LEN) { // firmware is too small
|
||||||
send_msg_failure(dev);
|
send_msg_failure(dev);
|
||||||
flash_state = STATE_END;
|
flash_state = STATE_END;
|
||||||
show_halt("Firmware is too small.", NULL);
|
show_halt("Firmware is", "too small.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (flash_len >
|
if (flash_len >
|
||||||
FLASH_FWHEADER_LEN + FLASH_APP_LEN) { // firmware is too big
|
FLASH_FWHEADER_LEN + FLASH_APP_LEN) { // firmware is too big
|
||||||
send_msg_failure(dev);
|
send_msg_failure(dev);
|
||||||
flash_state = STATE_END;
|
flash_state = STATE_END;
|
||||||
show_halt("Firmware is too big.", NULL);
|
show_halt("Firmware is", "too big.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// check firmware magic
|
// check firmware magic
|
||||||
if (memcmp(p, &FIRMWARE_MAGIC_NEW, 4) != 0) {
|
if (memcmp(p, &FIRMWARE_MAGIC_NEW, 4) != 0) {
|
||||||
send_msg_failure(dev);
|
send_msg_failure(dev);
|
||||||
flash_state = STATE_END;
|
flash_state = STATE_END;
|
||||||
show_halt("Wrong firmware header.", NULL);
|
show_halt("Wrong firmware", "header.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memzero(FW_HEADER, sizeof(FW_HEADER));
|
memzero(FW_HEADER, sizeof(FW_HEADER));
|
||||||
|
Loading…
Reference in New Issue
Block a user