mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-13 17:00:59 +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)) {
|
||||
layoutDialog(&bmp_icon_error, NULL, NULL, NULL, "Broken firmware",
|
||||
"detected.", NULL, "Unplug your Trezor,",
|
||||
"reinstall firmware.", NULL);
|
||||
shutdown();
|
||||
show_halt("Broken firmware", "detected.");
|
||||
}
|
||||
|
||||
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
|
||||
send_msg_failure(dev);
|
||||
flash_state = STATE_END;
|
||||
show_halt("Firmware is too big.", NULL);
|
||||
show_halt("Firmware is", "too big.");
|
||||
return;
|
||||
}
|
||||
if (flash_len <= FLASH_FWHEADER_LEN) { // firmware is too small
|
||||
send_msg_failure(dev);
|
||||
flash_state = STATE_END;
|
||||
show_halt("Firmware is too small.", NULL);
|
||||
show_halt("Firmware is", "too small.");
|
||||
return;
|
||||
}
|
||||
if (flash_len >
|
||||
FLASH_FWHEADER_LEN + FLASH_APP_LEN) { // firmware is too big
|
||||
send_msg_failure(dev);
|
||||
flash_state = STATE_END;
|
||||
show_halt("Firmware is too big.", NULL);
|
||||
show_halt("Firmware is", "too big.");
|
||||
return;
|
||||
}
|
||||
// check firmware magic
|
||||
if (memcmp(p, &FIRMWARE_MAGIC_NEW, 4) != 0) {
|
||||
send_msg_failure(dev);
|
||||
flash_state = STATE_END;
|
||||
show_halt("Wrong firmware header.", NULL);
|
||||
show_halt("Wrong firmware", "header.");
|
||||
return;
|
||||
}
|
||||
memzero(FW_HEADER, sizeof(FW_HEADER));
|
||||
|
Loading…
Reference in New Issue
Block a user