Fixed test regressions

pull/748/head
Daniele Lacamera 2026-04-14 16:24:03 +02:00
parent e48c1eb237
commit faebb62115
4 changed files with 22 additions and 6 deletions

5
.gitignore vendored
View File

@ -114,6 +114,7 @@ include/target.h
.wolfboot-offset
.wolfboot-partition-size
.bootloader-partition-size
NVChip
MPLabX/wolfBoot-SAME51.X/.generated_files/
test-dummy-ca/**
@ -183,6 +184,9 @@ tools/unit-tests/unit-update-flash-delta
tools/unit-tests/unit-update-flash-self-update
tools/unit-tests/unit-loader-tpm-init
tools/unit-tests/unit-update-ram-nofixed
tools/unit-tests/unit-max-space
tools/unit-tests/unit-sdhci-disk-unaligned
@ -376,4 +380,3 @@ system-default.dtb
test_output/
sdcard.img

View File

@ -355,13 +355,14 @@ int wolfBoot_tpm2_extend(uint8_t pcrIndex, uint8_t* hash, int line)
TPM2_GetHashDigestSize(WOLFBOOT_TPM_PCR_ALG));
#ifdef WOLFBOOT_DEBUG_TPM
if (rc == 0) {
int read_rc;
wolfBoot_printf("Measured boot: Index %d, Line %d\n", pcrIndex, line);
rc = wolfTPM2_ReadPCR(&wolftpm_dev, pcrIndex, WOLFBOOT_TPM_PCR_ALG,
read_rc = wolfTPM2_ReadPCR(&wolftpm_dev, pcrIndex, WOLFBOOT_TPM_PCR_ALG,
digest, &digestSz);
wolfBoot_printf("PCR %d: Res %d, Digest Sz %d\n",
pcrIndex, rc, digestSz);
pcrIndex, read_rc, digestSz);
wolfBoot_print_bin(digest, digestSz);
}
else {

View File

@ -567,6 +567,18 @@ static int RAMFUNCTION wolfBoot_swap_and_final_erase(int resume)
# define DELTA_BLOCK_SIZE 1024
#endif
static inline uint32_t wb_im2n32(uint32_t val)
{
#ifdef BIG_ENDIAN_ORDER
return val;
#else
return (((val & 0x000000FFU) << 24) |
((val & 0x0000FF00U) << 8) |
((val & 0x00FF0000U) >> 8) |
((val & 0xFF000000U) >> 24));
#endif
}
static int wolfBoot_delta_update(struct wolfBoot_image *boot,
struct wolfBoot_image *update, struct wolfBoot_image *swap, int inverse,
int resume)
@ -619,9 +631,9 @@ static int wolfBoot_delta_update(struct wolfBoot_image *boot,
&delta_base_hash, &delta_base_hash_sz) < 0) {
return -1;
}
delta_img_size = im2n(*img_size);
delta_img_size = wb_im2n32(*img_size);
if (inverse)
delta_img_offset = im2n(*img_offset);
delta_img_offset = wb_im2n32(*img_offset);
cur_v = wolfBoot_current_firmware_version();
upd_v = wolfBoot_update_firmware_version();
delta_base_v = wolfBoot_get_diffbase_version(PART_UPDATE);

View File

@ -240,7 +240,7 @@ unit-boot-x86-fsp: ../../include/target.h unit-boot-x86_fsp.c
-Wl,--gc-sections
unit-loader-tpm-init: ../../include/target.h unit-loader-tpm-init.c
gcc -o $@ $^ $(CFLAGS) -DWOLFBOOT_LOADER_MAIN -DWOLFBOOT_TPM \
gcc -o $@ $^ $(CFLAGS) -I$(WOLFBOOT_LIB_WOLFTPM) -DWOLFBOOT_LOADER_MAIN -DWOLFBOOT_TPM \
-DWOLFBOOT_HOOK_PANIC -DWOLFBOOT_SIGN_ECC256 \
-DWOLFBOOT_HASH_SHA256 -ffunction-sections -fdata-sections \
$(LDFLAGS) -Wl,--gc-sections