From 995c6ebbf82c07eaa6b209ad78473e7a558a8632 Mon Sep 17 00:00:00 2001 From: Dirk Van Haerenborgh Date: Thu, 5 Nov 2026 14:16:17 +0100 Subject: [PATCH 1/2] fix: Do not redefine XMEMCPY in case of encrypted ext flash When using encrypted ext flash, wolfssl/types.h is included. That already defines XMEMCPY, XMEMCMP and XMEMSET, so there's no need for this fallback mechanism --- src/libwolfboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libwolfboot.c b/src/libwolfboot.c index 5dc56fea3c..0b3e20892f 100644 --- a/src/libwolfboot.c +++ b/src/libwolfboot.c @@ -156,7 +156,7 @@ int wolfBoot_initialize_encryption(void) /* MAGIC (4B) + PART_FLAG (1B) */ #endif /* EXT_FLASH && EXT_ENCRYPTED */ -#if !defined(__WOLFBOOT) && !defined(UNIT_TEST) +#if !defined(__WOLFBOOT) && !defined(UNIT_TEST) && !defined(EXT_ENCRYPTED) /* Avoid redefining if already defined by wolfSSL headers */ #if !defined(XMEMSET) #define XMEMSET memset From ae59c5dc550379fe5268d8fcc4f59f395719d4b1 Mon Sep 17 00:00:00 2001 From: Dirk Van Haerenborgh Date: Mon, 16 Nov 2026 11:33:58 +0100 Subject: [PATCH 2/2] Refactor conditional compilation for EXT_ENCRYPTED Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/libwolfboot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libwolfboot.c b/src/libwolfboot.c index 0b3e20892f..e2e678894c 100644 --- a/src/libwolfboot.c +++ b/src/libwolfboot.c @@ -156,7 +156,8 @@ int wolfBoot_initialize_encryption(void) /* MAGIC (4B) + PART_FLAG (1B) */ #endif /* EXT_FLASH && EXT_ENCRYPTED */ -#if !defined(__WOLFBOOT) && !defined(UNIT_TEST) && !defined(EXT_ENCRYPTED) +#if !defined(__WOLFBOOT) && !defined(UNIT_TEST) && \ + (!defined(EXT_ENCRYPTED) || defined(BUILD_TOOL)) /* Avoid redefining if already defined by wolfSSL headers */ #if !defined(XMEMSET) #define XMEMSET memset