From a6d107c8faabb716f49dd4196fc7171ebadf5b83 Mon Sep 17 00:00:00 2001 From: Paul Adelsbach Date: Wed, 13 May 2026 10:10:27 -0700 Subject: [PATCH 1/4] Align data in wolfboot test structs --- .github/workflows/build-and-test-refactor.yml | 13 +++++++++---- .github/workflows/build-and-test.yml | 13 +++++++++---- test/gen/wh_test_wolfboot_img_data.h | 10 +++++----- test/scripts/gen_wolfboot_test_data.sh | 3 ++- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-and-test-refactor.yml b/.github/workflows/build-and-test-refactor.yml index 27a0889ac..ede56b24c 100644 --- a/.github/workflows/build-and-test-refactor.yml +++ b/.github/workflows/build-and-test-refactor.yml @@ -12,14 +12,19 @@ permissions: jobs: build: - runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - # List host CPU info - - name: Host CPU info - run: cat /proc/cpuinfo + # List host info + - name: Host info + run: uname -a # List compiler version - name: List compiler version diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index fa8d55807..346142e0d 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -12,14 +12,19 @@ permissions: jobs: build: - runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - # List host CPU info - - name: Host CPU info - run: cat /proc/cpuinfo + # List host info + - name: Host info + run: uname -a # List compiler version - name: List compiler version diff --git a/test/gen/wh_test_wolfboot_img_data.h b/test/gen/wh_test_wolfboot_img_data.h index 153b9e5bb..12c445685 100644 --- a/test/gen/wh_test_wolfboot_img_data.h +++ b/test/gen/wh_test_wolfboot_img_data.h @@ -32,7 +32,7 @@ #include /* wolfBoot signed header (RSA4096+SHA256, 1024 bytes) */ -static const uint8_t wolfboot_test_header[] = { +static const uint8_t wolfboot_test_header[] __attribute__((aligned(4))) = { 0x57, 0x4f, 0x4c, 0x46, 0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x08, 0x00, 0xbc, 0xff, 0xa9, 0x69, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, @@ -121,7 +121,7 @@ static const uint8_t wolfboot_test_header[] = { 0xff, 0xff, 0xff, 0xff}; /* Dummy firmware payload (16384 bytes) */ -static const uint8_t wolfboot_test_firmware[] = { +static const uint8_t wolfboot_test_firmware[] __attribute__((aligned(4))) = { 0x62, 0xa3, 0x47, 0xf2, 0xbc, 0xc9, 0x67, 0x1a, 0xe6, 0xe0, 0xff, 0x77, 0xb6, 0x3a, 0x07, 0x8f, 0xfb, 0xa3, 0x13, 0xef, 0xfb, 0xef, 0x6d, 0x7e, 0x9f, 0xb7, 0x88, 0xb1, 0xeb, 0x57, 0x4d, 0x8d, 0x4f, 0x48, 0x96, 0xda, @@ -1490,7 +1490,7 @@ static const uint8_t wolfboot_test_firmware[] = { 0x1c, 0x5d, 0xb6, 0xea}; /* RSA4096 signing public key (DER format) */ -static const uint8_t wolfboot_test_pubkey_der[] = { +static const uint8_t wolfboot_test_pubkey_der[] __attribute__((aligned(4))) = { 0x30, 0x82, 0x02, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x02, 0x0f, 0x00, 0x30, 0x82, 0x02, 0x0a, 0x02, 0x82, 0x02, 0x01, 0x00, 0xa0, 0x27, 0x67, @@ -1539,7 +1539,7 @@ static const uint8_t wolfboot_test_pubkey_der[] = { 0x78, 0x4b, 0x64, 0xbf, 0x9b, 0x02, 0x03, 0x01, 0x00, 0x01}; /* wolfBoot signed header with cert chain (RSA4096+SHA256, 4096 bytes) */ -static const uint8_t wolfboot_test_cert_chain_header[] = { +static const uint8_t wolfboot_test_cert_chain_header[] __attribute__((aligned(4))) = { 0x57, 0x4f, 0x4c, 0x46, 0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x08, 0x00, 0xbc, 0xff, 0xa9, 0x69, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, @@ -1884,7 +1884,7 @@ static const uint8_t wolfboot_test_cert_chain_header[] = { 0xff, 0xff, 0xff, 0xff}; /* Root CA certificate (DER format, RSA4096) */ -static const uint8_t wolfboot_test_root_ca_cert_der[] = { +static const uint8_t wolfboot_test_root_ca_cert_der[] __attribute__((aligned(4))) = { 0x30, 0x82, 0x05, 0xe5, 0x30, 0x82, 0x03, 0xcd, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x14, 0x7d, 0xb6, 0xbe, 0xc6, 0x84, 0xed, 0xb9, 0x8c, 0xdb, 0x53, 0x8e, 0x51, 0xac, 0x89, 0x50, 0x8e, 0x33, 0x16, 0xfe, 0x4d, 0x30, diff --git a/test/scripts/gen_wolfboot_test_data.sh b/test/scripts/gen_wolfboot_test_data.sh index f19843744..4f747c4c6 100755 --- a/test/scripts/gen_wolfboot_test_data.sh +++ b/test/scripts/gen_wolfboot_test_data.sh @@ -209,7 +209,8 @@ bin_to_c_array() { local description=$3 echo "/* $description */" >> "$HEADER_FILE" - echo "static const uint8_t ${varname}[] = {" >> "$HEADER_FILE" + echo "static const uint8_t ${varname}[] __attribute__((aligned(4))) = {" \ + >> "$HEADER_FILE" xxd -i < "$infile" >> "$HEADER_FILE" echo "};" >> "$HEADER_FILE" echo "" >> "$HEADER_FILE" From 010e22d8a7e07679ed2c7bb560d86c5ac9d47030 Mon Sep 17 00:00:00 2001 From: Paul Adelsbach Date: Wed, 13 May 2026 14:05:48 -0700 Subject: [PATCH 2/4] Switch to use XALIGNED(4) from wolfssl/wolfcrypt/types.h --- test/gen/wh_test_wolfboot_img_data.h | 12 +++++++----- test/scripts/gen_wolfboot_test_data.sh | 5 +++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/test/gen/wh_test_wolfboot_img_data.h b/test/gen/wh_test_wolfboot_img_data.h index 12c445685..f6e3370c8 100644 --- a/test/gen/wh_test_wolfboot_img_data.h +++ b/test/gen/wh_test_wolfboot_img_data.h @@ -31,8 +31,10 @@ #include #include +#include "wolfssl/wolfcrypt/types.h" /* for XALIGNED */ + /* wolfBoot signed header (RSA4096+SHA256, 1024 bytes) */ -static const uint8_t wolfboot_test_header[] __attribute__((aligned(4))) = { +XALIGNED(4) static const uint8_t wolfboot_test_header[] = { 0x57, 0x4f, 0x4c, 0x46, 0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x08, 0x00, 0xbc, 0xff, 0xa9, 0x69, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, @@ -121,7 +123,7 @@ static const uint8_t wolfboot_test_header[] __attribute__((aligned(4))) = { 0xff, 0xff, 0xff, 0xff}; /* Dummy firmware payload (16384 bytes) */ -static const uint8_t wolfboot_test_firmware[] __attribute__((aligned(4))) = { +XALIGNED(4) static const uint8_t wolfboot_test_firmware[] = { 0x62, 0xa3, 0x47, 0xf2, 0xbc, 0xc9, 0x67, 0x1a, 0xe6, 0xe0, 0xff, 0x77, 0xb6, 0x3a, 0x07, 0x8f, 0xfb, 0xa3, 0x13, 0xef, 0xfb, 0xef, 0x6d, 0x7e, 0x9f, 0xb7, 0x88, 0xb1, 0xeb, 0x57, 0x4d, 0x8d, 0x4f, 0x48, 0x96, 0xda, @@ -1490,7 +1492,7 @@ static const uint8_t wolfboot_test_firmware[] __attribute__((aligned(4))) = { 0x1c, 0x5d, 0xb6, 0xea}; /* RSA4096 signing public key (DER format) */ -static const uint8_t wolfboot_test_pubkey_der[] __attribute__((aligned(4))) = { +XALIGNED(4) static const uint8_t wolfboot_test_pubkey_der[] = { 0x30, 0x82, 0x02, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x02, 0x0f, 0x00, 0x30, 0x82, 0x02, 0x0a, 0x02, 0x82, 0x02, 0x01, 0x00, 0xa0, 0x27, 0x67, @@ -1539,7 +1541,7 @@ static const uint8_t wolfboot_test_pubkey_der[] __attribute__((aligned(4))) = { 0x78, 0x4b, 0x64, 0xbf, 0x9b, 0x02, 0x03, 0x01, 0x00, 0x01}; /* wolfBoot signed header with cert chain (RSA4096+SHA256, 4096 bytes) */ -static const uint8_t wolfboot_test_cert_chain_header[] __attribute__((aligned(4))) = { +XALIGNED(4) static const uint8_t wolfboot_test_cert_chain_header[] = { 0x57, 0x4f, 0x4c, 0x46, 0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x08, 0x00, 0xbc, 0xff, 0xa9, 0x69, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, @@ -1884,7 +1886,7 @@ static const uint8_t wolfboot_test_cert_chain_header[] __attribute__((aligned(4) 0xff, 0xff, 0xff, 0xff}; /* Root CA certificate (DER format, RSA4096) */ -static const uint8_t wolfboot_test_root_ca_cert_der[] __attribute__((aligned(4))) = { +XALIGNED(4) static const uint8_t wolfboot_test_root_ca_cert_der[] = { 0x30, 0x82, 0x05, 0xe5, 0x30, 0x82, 0x03, 0xcd, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x14, 0x7d, 0xb6, 0xbe, 0xc6, 0x84, 0xed, 0xb9, 0x8c, 0xdb, 0x53, 0x8e, 0x51, 0xac, 0x89, 0x50, 0x8e, 0x33, 0x16, 0xfe, 0x4d, 0x30, diff --git a/test/scripts/gen_wolfboot_test_data.sh b/test/scripts/gen_wolfboot_test_data.sh index 4f747c4c6..55f77f9cc 100755 --- a/test/scripts/gen_wolfboot_test_data.sh +++ b/test/scripts/gen_wolfboot_test_data.sh @@ -200,6 +200,8 @@ cat > "$HEADER_FILE" << 'HEADER_TOP' #include #include +#include "wolfssl/wolfcrypt/types.h" /* for XALIGNED */ + HEADER_TOP # Helper function to convert binary to C array @@ -209,8 +211,7 @@ bin_to_c_array() { local description=$3 echo "/* $description */" >> "$HEADER_FILE" - echo "static const uint8_t ${varname}[] __attribute__((aligned(4))) = {" \ - >> "$HEADER_FILE" + echo "XALIGNED(4) static const uint8_t ${varname}[] = {" >> "$HEADER_FILE" xxd -i < "$infile" >> "$HEADER_FILE" echo "};" >> "$HEADER_FILE" echo "" >> "$HEADER_FILE" From 9a4232025784c572ff95de05cf76c4bd1bbdd6e7 Mon Sep 17 00:00:00 2001 From: Paul Adelsbach Date: Wed, 13 May 2026 14:39:16 -0700 Subject: [PATCH 3/4] Empty commit to trigger CI From fdb52af2980b7532fc1cf6e522bba55fd6b7c5be Mon Sep 17 00:00:00 2001 From: Paul Adelsbach Date: Wed, 13 May 2026 15:22:58 -0700 Subject: [PATCH 4/4] Disable threadsafe test on MacOS --- test-refactor/posix/wh_test_posix_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test-refactor/posix/wh_test_posix_main.c b/test-refactor/posix/wh_test_posix_main.c index 50f0839eb..3d8c6083e 100644 --- a/test-refactor/posix/wh_test_posix_main.c +++ b/test-refactor/posix/wh_test_posix_main.c @@ -55,7 +55,8 @@ * meaningful (or portable) on bare-metal client targets. */ #if defined(WOLFHSM_CFG_THREADSAFE) \ && defined(WOLFHSM_CFG_GLOBAL_KEYS) \ - && !defined(WOLFHSM_CFG_NO_CRYPTO) + && !defined(WOLFHSM_CFG_NO_CRYPTO) \ + && !defined(__APPLE__) /* pthread_barrier_t unavailable on macOS */ #include "wh_test_posix_threadsafe_stress.h" #endif @@ -204,7 +205,8 @@ static void* _clientThread(void* arg) #if defined(WOLFHSM_CFG_THREADSAFE) \ && defined(WOLFHSM_CFG_GLOBAL_KEYS) \ - && !defined(WOLFHSM_CFG_NO_CRYPTO) + && !defined(WOLFHSM_CFG_NO_CRYPTO) \ + && !defined(__APPLE__) /* pthread_barrier_t unavailable on macOS */ /* Run the POSIX-only stress test after the portable client * group so a failure there doesn't mask earlier results. */ if (_clientRc == 0) {