Fix build errors

pull/721/head
Daniele Lacamera 2026-03-12 00:25:32 +01:00
parent 5b0e8ed00c
commit b6b46e4d05
2 changed files with 16 additions and 3 deletions

View File

@ -32,7 +32,6 @@
#include "spi_drv.h"
#include "tpm.h"
#include "wolftpm/tpm2_tis.h" /* for TIS header size and wait state */
#include <wolfssl/wolfcrypt/misc.h>
WOLFTPM2_DEV wolftpm_dev;
#if defined(WOLFBOOT_TPM_KEYSTORE) || defined(WOLFBOOT_TPM_SEAL)
@ -45,6 +44,19 @@ WOLFTPM2_KEY wolftpm_srk;
#endif
#if defined(WOLFBOOT_TPM_SEAL) || defined(WOLFBOOT_TPM_KEYSTORE)
static int wolfBoot_constant_compare(const uint8_t* a, const uint8_t* b,
uint32_t len)
{
uint32_t i;
uint8_t diff = 0;
for (i = 0; i < len; i++) {
diff |= a[i] ^ b[i];
}
return diff;
}
void wolfBoot_print_hexstr(const unsigned char* bin, unsigned long sz,
unsigned long maxLine)
{
@ -1516,7 +1528,7 @@ int wolfBoot_check_rot(int key_slot, uint8_t* pubkey_hint)
if (rc == 0) {
/* verify the hint (hash) matches */
if (digestSz == WOLFBOOT_SHA_DIGEST_SIZE &&
ConstantCompare(digest, pubkey_hint,
wolfBoot_constant_compare(digest, pubkey_hint,
WOLFBOOT_SHA_DIGEST_SIZE) == 0) {
wolfBoot_printf("TPM Root of Trust valid (id %d)\n", key_slot);
}

View File

@ -178,7 +178,8 @@ $(LSCRIPT): $(LSCRIPT_IN) FORCE
sed -e "s/@WOLFBOOT_DTS_BOOT_ADDRESS@/$(WOLFBOOT_DTS_BOOT_ADDRESS)/g" | \
sed -e "s/@WOLFBOOT_DTS_UPDATE_ADDRESS@/$(WOLFBOOT_DTS_UPDATE_ADDRESS)/g" | \
sed -e "s/@WOLFBOOT_LOAD_ADDRESS@/$(WOLFBOOT_LOAD_ADDRESS)/g" | \
sed -e "s/@WOLFBOOT_LOAD_DTS_ADDRESS@/$(WOLFBOOT_LOAD_DTS_ADDRESS)/g" \
sed -e "s/@WOLFBOOT_LOAD_DTS_ADDRESS@/$(WOLFBOOT_LOAD_DTS_ADDRESS)/g" | \
sed -e "s|@WOLFBOOT_RAMBOOT_MAX_SIZE_DEFINE@|$(if $(strip $(WOLFBOOT_RAMBOOT_MAX_SIZE)),#define WOLFBOOT_RAMBOOT_MAX_SIZE $(WOLFBOOT_RAMBOOT_MAX_SIZE),/* WOLFBOOT_RAMBOOT_MAX_SIZE undefined */)|g" \
> $@
$(BUILD_DIR)/%.o: %.c