1
0
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:
Pavol Rusnak 2019-11-09 18:37:55 +00:00
parent 86b7813629
commit 054bb3a67a
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 5 additions and 8 deletions

View File

@ -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();

View File

@ -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));