42static const char*
const s_tag =
"ra8_ota";
78 for (uint32_t i = 0U; i < max_chunks; ++i) {
111typedef enum : uint8_t {
150 const uint8_t* image_digest,
165 const uint8_t*
const segments[] = {
166 (
const uint8_t*)manifest->
version,
171 const uint32_t lengths[] = {
174 (uint32_t)
sizeof size_le,
177 static_assert(
sizeof segments /
sizeof segments[0] ==
sizeof lengths /
sizeof lengths[0],
178 "segments[] and lengths[] must describe the same number of chunks");
184 for (uint8_t i = 0U; i < (uint8_t)(
sizeof segments /
sizeof segments[0]); ++i) {
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_crc_mismatch
CRC mismatch detected on received data.
@ k_ra8_err_invalid_state
Module in wrong state for requested operation.
@ k_ra8_err_not_initialized
Module not initialized – _init() not yet called successfully.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_hw_error
Generic hardware fault detected (error flag set, fault interrupt).
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
bool g_ra8_ota_initialized
True once ra8_ota_init succeeded (shared; contract in ra8_ota_internal.h).
ra8_ota_state_t g_ra8_ota_state
Current state-machine value (shared; contract in ra8_ota_internal.h).
uint8_t g_ra8_ota_buf[k_ra8_ota_chunk_bytes]
Streaming buffer (shared; contract in ra8_ota_internal.h).
void priv_ota_set_state(ra8_ota_state_t new_state, ra8_err_t err)
Implementation of priv_ota_set_state() – latch state + progress fan-out.
ra8_ota_cfg_t g_ra8_ota_cfg
Configuration captured at init time (shared; contract in ra8_ota_internal.h).
Phase-5 OTA firmware-update orchestration for the RA8D2.
@ k_ra8_ota_state_error
Last operation failed; see last err.
@ k_ra8_ota_state_verifying
SHA-256 + ECDSA verification.
@ k_ra8_ota_state_committing
About to swap banks + reset.
@ k_ra8_ota_url_max_bytes
NUL-terminated URL upper bound.
@ k_ra8_ota_sha256_bytes
SHA-256 digest length.
@ k_ra8_ota_version_str_bytes
NUL-terminated version string.
@ k_ra8_ota_chunk_bytes
Download streaming chunk size in bytes.
@ k_ra8_ota_max_image_bytes
512 KiB upper bound per bank.
Test-access surface for ra8_ota internal helpers (MC/DC).
ra8_ota_bind_field_t
Fixed byte-widths bound into the OTA signature material (T5-05).
@ k_ra8_ota_size_field_bytes
Little-endian width of image_size_bytes.
@ k_ra8_ota_octet_bits
Bits per octet for the LE size spread.
static ra8_err_t internal_rehash_bank(const ra8_ota_manifest_t *m, uint8_t out_digest[32])
Re-hash the inactive bank to re-derive the digest after program.
static ra8_err_t internal_bind_manifest_material(const ra8_ota_manifest_t *manifest, const uint8_t *image_digest, uint8_t out_bound[k_ra8_ota_sha256_bytes])
Bind manifest metadata (version/url/size) into the signed digest.
ra8_err_t ra8_ota_verify_signature(const ra8_ota_manifest_t *manifest)
Verify the freshly-programmed bank against the manifest signature.
Secure-comparison primitives for the crypto / secure-boot paths.
bool ra8_ct_equal(const void *a, const void *b, size_t len)
Constant-time equality of two byte buffers.
Decoded representation of the server manifest.
uint8_t image_sha256[k_ra8_ota_sha256_bytes]
Expected digest.
uint16_t signature_len
Bytes used in signature.
char image_url[k_ra8_ota_url_max_bytes]
HTTPS URL of the image blob.
uint8_t signature[k_ra8_ota_signature_max_bytes]
ECDSA signature over digest.
uint32_t image_size_bytes
Image size on the wire.
char version[k_ra8_ota_version_str_bytes]
Firmware version string.