From 667513b5f43d25ace057022ad55c3b3c914f90f9 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 40ba5e0e78..bedd9e15bb 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 1395465f3440886899ff01c097d5b1b9d41e77c5 Mon Sep 17 00:00:00 2001 From: Dirk Van Haerenborgh Date: Thu, 5 Nov 2026 14:27:21 +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 bedd9e15bb..db414f23bf 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