mirror of https://github.com/wolfSSL/wolfBoot.git
Fixed more comments from copilot + fenrir
parent
e6c1976754
commit
6540f17ef2
|
|
@ -632,8 +632,11 @@ static int wolfBoot_delta_update(struct wolfBoot_image *boot,
|
|||
return -1;
|
||||
}
|
||||
delta_img_size = wb_delta_im2n(*img_size);
|
||||
if (inverse)
|
||||
if (inverse) {
|
||||
delta_img_offset = wb_delta_im2n(*img_offset);
|
||||
} else {
|
||||
delta_img_offset = IMAGE_HEADER_SIZE;
|
||||
}
|
||||
cur_v = wolfBoot_current_firmware_version();
|
||||
upd_v = wolfBoot_update_firmware_version();
|
||||
delta_base_v = wolfBoot_get_diffbase_version(PART_UPDATE);
|
||||
|
|
@ -691,7 +694,7 @@ static int wolfBoot_delta_update(struct wolfBoot_image *boot,
|
|||
ret = -1;
|
||||
} else {
|
||||
ret = wb_patch_init(&ctx, boot->hdr, boot->fw_size + IMAGE_HEADER_SIZE,
|
||||
update->hdr + IMAGE_HEADER_SIZE, delta_img_size);
|
||||
update->hdr + delta_img_offset, delta_img_size);
|
||||
}
|
||||
}
|
||||
if (ret < 0)
|
||||
|
|
@ -1488,6 +1491,10 @@ void RAMFUNCTION wolfBoot_start(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
if ((boot.hdr_ok != 1U) || (boot.sha_ok != 1U) ||
|
||||
(boot.signature_ok != 1U)) {
|
||||
wolfBoot_panic();
|
||||
}
|
||||
PART_SANITY_CHECK(&boot);
|
||||
#else
|
||||
if (bootRet < 0) {
|
||||
|
|
|
|||
|
|
@ -122,6 +122,14 @@ static int wolfBoot_local_constant_compare(const uint8_t* a, const uint8_t* b,
|
|||
return diff;
|
||||
}
|
||||
|
||||
static void ahci_secret_zeroize(void *ptr, size_t len)
|
||||
{
|
||||
volatile uint8_t *p = (volatile uint8_t *)ptr;
|
||||
while (len-- > 0U) {
|
||||
*p++ = 0U;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the AHCI Base Address Register (ABAR) for the given device.
|
||||
*
|
||||
|
|
@ -278,7 +286,7 @@ static int sata_get_random_base64(uint8_t *out, int *out_size)
|
|||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
TPM2_ForceZero(rand, sizeof(rand));
|
||||
ahci_secret_zeroize(rand, sizeof(rand));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -322,7 +330,7 @@ static int sata_create_and_seal_unlock_secret(const uint8_t *pubkey_hint,
|
|||
}
|
||||
|
||||
wolfBoot_printf("Secret Check %d bytes\n", secret_check_sz);
|
||||
TPM2_ForceZero(secret_check, sizeof(secret_check));
|
||||
ahci_secret_zeroize(secret_check, sizeof(secret_check));
|
||||
}
|
||||
|
||||
if (ret == 0)
|
||||
|
|
@ -495,7 +503,7 @@ int sata_unlock_disk(int drv, int freeze)
|
|||
error:
|
||||
r = -1;
|
||||
cleanup:
|
||||
TPM2_ForceZero(secret, sizeof(secret));
|
||||
ahci_secret_zeroize(secret, sizeof(secret));
|
||||
return r;
|
||||
}
|
||||
#endif /* WOLFBOOT_ATA_DISK_LOCK */
|
||||
|
|
|
|||
Loading…
Reference in New Issue