mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-10 15:30:55 +00:00
embed/bootloader: better detection of broken firmware at start
This commit is contained in:
parent
77568496da
commit
34c6fb987a
@ -227,14 +227,20 @@ main_start:
|
||||
image_header hdr;
|
||||
secbool firmware_present;
|
||||
|
||||
// detect whether the devices contains a firmware
|
||||
// detect whether the devices contains a valid firmware
|
||||
|
||||
firmware_present = load_vendor_header_keys((const uint8_t *)FIRMWARE_START, &vhdr);
|
||||
if (sectrue == firmware_present) {
|
||||
firmware_present = check_vendor_keys_lock(&vhdr);
|
||||
}
|
||||
if (sectrue == firmware_present) {
|
||||
firmware_present = load_image_header((const uint8_t *)(FIRMWARE_START + vhdr.hdrlen), FIRMWARE_IMAGE_MAGIC, FIRMWARE_IMAGE_MAXSIZE, vhdr.vsig_m, vhdr.vsig_n, vhdr.vpub, &hdr);
|
||||
}
|
||||
if (sectrue == firmware_present) {
|
||||
firmware_present = check_image_contents(&hdr, IMAGE_HEADER_SIZE + vhdr.hdrlen, firmware_sectors, FIRMWARE_SECTORS_COUNT);
|
||||
}
|
||||
|
||||
// start the bootloader if no firmware found ...
|
||||
// start the bootloader if no or broken firmware found ...
|
||||
if (firmware_present != sectrue) {
|
||||
// show intro animation
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user