1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-18 05:28:40 +00:00

fix(core): small secbool refactors

This commit is contained in:
Pavol Rusnak 2021-03-04 11:59:38 +01:00
parent 4a82d6c9d5
commit 2dc094bd3e
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
3 changed files with 3 additions and 4 deletions

View File

@ -176,7 +176,7 @@ int main(void) {
if (sectrue != flash_configure_option_bytes()) { if (sectrue != flash_configure_option_bytes()) {
// display is not initialized so don't call ensure // display is not initialized so don't call ensure
secbool r = const secbool r =
flash_erase_sectors(STORAGE_SECTORS, STORAGE_SECTORS_COUNT, NULL); flash_erase_sectors(STORAGE_SECTORS, STORAGE_SECTORS_COUNT, NULL);
(void)r; (void)r;
return 2; return 2;

View File

@ -262,11 +262,10 @@ main_start:
vendor_header vhdr; vendor_header vhdr;
image_header hdr; image_header hdr;
secbool firmware_present;
// detect whether the devices contains a valid firmware // detect whether the devices contains a valid firmware
firmware_present = secbool firmware_present =
load_vendor_header_keys((const uint8_t *)FIRMWARE_START, &vhdr); load_vendor_header_keys((const uint8_t *)FIRMWARE_START, &vhdr);
if (sectrue == firmware_present) { if (sectrue == firmware_present) {
firmware_present = check_vendor_keys_lock(&vhdr); firmware_present = check_vendor_keys_lock(&vhdr);

View File

@ -466,7 +466,7 @@ int process_msg_FirmwareUpload(uint8_t iface_num, uint32_t msg_size,
uint8_t *buf) { uint8_t *buf) {
MSG_RECV_INIT(FirmwareUpload); MSG_RECV_INIT(FirmwareUpload);
MSG_RECV_CALLBACK(payload, _read_payload, read_offset); MSG_RECV_CALLBACK(payload, _read_payload, read_offset);
secbool r = MSG_RECV(FirmwareUpload); const secbool r = MSG_RECV(FirmwareUpload);
if (sectrue != r || chunk_size != (chunk_requested + read_offset)) { if (sectrue != r || chunk_size != (chunk_requested + read_offset)) {
MSG_SEND_INIT(Failure); MSG_SEND_INIT(Failure);