Skip to content

Commit b6b46e4

Browse files
committed
Fix build errors
1 parent 5b0e8ed commit b6b46e4

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

src/tpm.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include "spi_drv.h"
3333
#include "tpm.h"
3434
#include "wolftpm/tpm2_tis.h" /* for TIS header size and wait state */
35-
#include <wolfssl/wolfcrypt/misc.h>
3635

3736
WOLFTPM2_DEV wolftpm_dev;
3837
#if defined(WOLFBOOT_TPM_KEYSTORE) || defined(WOLFBOOT_TPM_SEAL)
@@ -45,6 +44,19 @@ WOLFTPM2_KEY wolftpm_srk;
4544
#endif
4645

4746
#if defined(WOLFBOOT_TPM_SEAL) || defined(WOLFBOOT_TPM_KEYSTORE)
47+
static int wolfBoot_constant_compare(const uint8_t* a, const uint8_t* b,
48+
uint32_t len)
49+
{
50+
uint32_t i;
51+
uint8_t diff = 0;
52+
53+
for (i = 0; i < len; i++) {
54+
diff |= a[i] ^ b[i];
55+
}
56+
57+
return diff;
58+
}
59+
4860
void wolfBoot_print_hexstr(const unsigned char* bin, unsigned long sz,
4961
unsigned long maxLine)
5062
{
@@ -1516,7 +1528,7 @@ int wolfBoot_check_rot(int key_slot, uint8_t* pubkey_hint)
15161528
if (rc == 0) {
15171529
/* verify the hint (hash) matches */
15181530
if (digestSz == WOLFBOOT_SHA_DIGEST_SIZE &&
1519-
ConstantCompare(digest, pubkey_hint,
1531+
wolfBoot_constant_compare(digest, pubkey_hint,
15201532
WOLFBOOT_SHA_DIGEST_SIZE) == 0) {
15211533
wolfBoot_printf("TPM Root of Trust valid (id %d)\n", key_slot);
15221534
}

stage1/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ $(LSCRIPT): $(LSCRIPT_IN) FORCE
178178
sed -e "s/@WOLFBOOT_DTS_BOOT_ADDRESS@/$(WOLFBOOT_DTS_BOOT_ADDRESS)/g" | \
179179
sed -e "s/@WOLFBOOT_DTS_UPDATE_ADDRESS@/$(WOLFBOOT_DTS_UPDATE_ADDRESS)/g" | \
180180
sed -e "s/@WOLFBOOT_LOAD_ADDRESS@/$(WOLFBOOT_LOAD_ADDRESS)/g" | \
181-
sed -e "s/@WOLFBOOT_LOAD_DTS_ADDRESS@/$(WOLFBOOT_LOAD_DTS_ADDRESS)/g" \
181+
sed -e "s/@WOLFBOOT_LOAD_DTS_ADDRESS@/$(WOLFBOOT_LOAD_DTS_ADDRESS)/g" | \
182+
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" \
182183
> $@
183184

184185
$(BUILD_DIR)/%.o: %.c

0 commit comments

Comments
 (0)