From edd13a4b6876e0b58680acdc40cfcf4edf37b27b Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Tue, 18 Aug 2026 19:58:56 +0200 Subject: [PATCH] raspi3: fix the DEBUG_UART build and the documented key size DEBUG_UART=1 did not compile: uart_init() declared an unused local and -Werror rejected it, so the target's console output could never be enabled. Drop the local. The documented key file is 44 bytes, but AES256-CTR wants a 32-byte key plus a 16-byte IV; sign fails with "Error reading IV" as written. Use 48 bytes, matching the key the HAL used to carry. --- docs/Targets.md | 5 ++++- hal/raspi3.c | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/Targets.md b/docs/Targets.md index c798f5cd..fff33b29 100644 --- a/docs/Targets.md +++ b/docs/Targets.md @@ -3755,9 +3755,12 @@ make wolfboot.bin CROSS_COMPILE=aarch64-linux-gnu- * Create the decrypt key + nonce ``` -printf "0123456789abcdef0123456789abcdef0123456789ab" > /tmp/enc_key.der +printf "0123456789abcdef0123456789abcdef0123456789abcdef" > /tmp/enc_key.der ``` + AES256-CTR takes a 32-byte key followed by a 16-byte IV, so the file is + 48 bytes. A shorter one fails with `Error reading IV`. + * Provision the same key into the bootloader The raspi3 HAL no longer ships a hardcoded key, so the bootloader has diff --git a/hal/raspi3.c b/hal/raspi3.c index ef0c19e2..e78d75d7 100644 --- a/hal/raspi3.c +++ b/hal/raspi3.c @@ -168,8 +168,6 @@ void uart_write(const char* buf, uint32_t sz) { void uart_init() { - register unsigned int c; - /* initialize UART. turn off UART 0*/ *UART0_CR = 0;