29#include "mbedtls/memory_buffer_alloc.h"
41typedef enum : uint32_t {
48typedef enum : uint8_t {
68static void rot_write(
const uint8_t* msg,
size_t len)
78 if (trailer ==
nullptr) {
90 if (trailer ==
nullptr) {
99 __asm__
volatile(
"wfi");
105 uint32_t cpuclk0_hz = 0U;
void main(void)
Secure fallback main entry point.
static const uint8_t k_rot_diag_boot[]
static const uint8_t k_rot_diag_tamper[]
static const uint8_t k_rot_diag_psa_ok[]
static bool rot_genuine_ok(void)
The genuine signed fixture must verify (k_ra8_ok).
static const uint8_t k_rot_diag_psa_fail[]
rot_const_t
Demo tunables.
@ k_rot_heap_bytes
64 KiB static heap for tf-psa mbedtls_calloc.
@ k_rot_period_ms
Rot period ms.
static bool rot_tamper_rejected(void)
A one-bit body corruption must be rejected (not k_ra8_ok).
static void rot_panic_halt(void)
rot_bit_t
Byte flipped in the tamper copy (first body octet).
@ k_rot_tamper_bit
Rot tamper bit.
static const uint8_t k_rot_diag_no_tamp[]
static const uint8_t k_rot_msg_fail[]
static uint8_t s_rot_tamper[sizeof(k_rot_fixture_image)]
Mutable copy of the fixture used for the tamper case.
static const uint8_t k_rot_diag_genuine[]
static void rot_write(const uint8_t *msg, size_t len)
static const uint8_t k_rot_msg_pass[]
static void rot_setup_or_halt(void)
static uint8_t s_rot_heap[k_rot_heap_bytes]
Static heap tf-psa's mbedtls_calloc draws from (no libc heap on target).
static const uint8_t k_rot_diag_no_gen[]
Board-support layer for the Renesas EK-RA8D2 v1 evaluation kit.
ra8_err_t ra8_board_led_toggle(ra8_board_led_id_t led)
Toggle led's output state.
ra8_err_t ra8_board_led_init(ra8_board_led_id_t led)
Configure led as a digital output, initial level low (off).
@ k_ra8_board_led2
LED2, GREEN, P303 (jumper E26).
@ k_ra8_board_led1
LED1, BLUE, P600 (jumper E27).
ra8_err_t ra8_board_uart_console_write(const uint8_t *data, size_t len)
Polled blocking write to the J-Link OB VCOM console.
ra8_err_t ra8_board_uart_console_init(uint32_t baud)
Configure SCI8 + PD02/PD03 as the debug-console UART.
Boot entry points shared between a vector table and its startup code.
High-level Clock Generation Circuit driver.
ra8_err_t ra8_cgc_get_clock_hz(ra8_clock_id_t id, uint32_t *out_hz)
Query the current frequency of a clock-tree domain.
@ k_ra8_clock_id_cpuclk0
Cortex-M85 CPUCLK0.
ra8_err_t ra8_cgc_init(void)
Configure the clock tree to a safe default.
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
void * memcpy(void *dst, const void *src, size_t n)
Copy memory area between non-overlapping regions.
NVIC + ICU IELSR allocator.
void ra8_isr_globals_enable(void)
Globally enable maskable interrupts (PRIMASK = 0).
Application-level PSA Crypto facade over tf-psa-crypto.
ra8_err_t ra8_psa_crypto_init(void)
One-shot facade initialisation.
Root-of-trust signed-image verifier (SHA-256 + ECDSA-P256, default-deny).
ra8_err_t ra8_rot_verify_image(const uint8_t *body, uint32_t body_len, const ra8_rot_trailer_t *trailer)
Authenticate a signed image: SHA-256 + ECDSA-P256, default-deny.
const ra8_rot_trailer_t * ra8_rot_trailer_after(const void *image_base, uint32_t body_len)
Locate the trailer that immediately follows a signed image body.
SysTick-based tick counter, delay and timestamp helpers.
ra8_err_t ra8_time_init(uint32_t cpu_hz)
Initialise SysTick for a 1 kHz tick interrupt.
void ra8_delay_ms(uint32_t ms)
Busy-wait for at least ms milliseconds.
Baked RoT-signed image fixture (body + ra8_rot_trailer_t).
static const uint8_t k_rot_fixture_image[182]
Signed image: 66-byte body followed by the 116-byte trailer.
@ k_rot_fixture_body_len
Rot fixture body length.
Authenticity trailer appended after a signed image body.