ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_rsip.c File Reference

Renesas Secure IP (RSIP-E50D) HAL driver implementation. More...

#include "ra8_rsip.h"
#include <stdint.h>
#include "ra8_attributes.h"
#include "ra8_check.h"
#include "ra8_err.h"
#include "ra8_hw_err.h"
#include "ra8_log.h"
#include "ra8_mstp.h"
#include "ra8_rsip_internal.h"
#include "ra8_rsip_regs.h"
Include dependency graph for ra8_rsip.c:

Go to the source code of this file.

Macros

#define RA8_RSIP_SOFTWARE_BACKEND   (1)
 RA8 RSIP SOFTWARE BACKEND.

Enumerations

enum  ra8_rsip_sw_sha256_t : uint32_t {
  k_ra8_rsip_sw_sha256_block_w = 16U ,
  k_ra8_rsip_sw_sha256_round_cnt = 64U ,
  k_ra8_rsip_sw_sha256_state_w = 8U ,
  k_ra8_rsip_sw_sha256_len_bytes = 8U ,
  k_ra8_rsip_sw_sha256_pad_byte = 0x80U ,
  k_ra8_rsip_sw_sha256_w_back_2 = 2U ,
  k_ra8_rsip_sw_sha256_w_back_7 = 7U ,
  k_ra8_rsip_sw_sha256_w_back_15 = 15U ,
  k_ra8_rsip_sw_sha256_w_back_16 = 16U ,
  k_ra8_rsip_sw_rotr_2 = 2U ,
  k_ra8_rsip_sw_rotr_3 = 3U ,
  k_ra8_rsip_sw_rotr_6 = 6U ,
  k_ra8_rsip_sw_rotr_7 = 7U ,
  k_ra8_rsip_sw_rotr_10 = 10U ,
  k_ra8_rsip_sw_rotr_11 = 11U ,
  k_ra8_rsip_sw_rotr_13 = 13U ,
  k_ra8_rsip_sw_rotr_17 = 17U ,
  k_ra8_rsip_sw_rotr_18 = 18U ,
  k_ra8_rsip_sw_rotr_19 = 19U ,
  k_ra8_rsip_sw_rotr_22 = 22U ,
  k_ra8_rsip_sw_rotr_25 = 25U ,
  k_ra8_rsip_sw_word_bits = 32U
}
 File-private constants for the software SHA-256 fall-back. More...
enum  sha256_lane_t : uint8_t {
  k_sha256_lane_a = 0U ,
  k_sha256_lane_b = 1U ,
  k_sha256_lane_c = 2U ,
  k_sha256_lane_d = 3U ,
  k_sha256_lane_e = 4U ,
  k_sha256_lane_f = 5U ,
  k_sha256_lane_g = 6U ,
  k_sha256_lane_h = 7U
}
 FIPS 180-4 6.2.2 SHA-256 working-state lane indices a..h. More...

Functions

static void internal_sw_sha256 (const uint8_t *msg, uint32_t msg_len, uint8_t *digest)
 One-shot software SHA-256 over a contiguous message buffer.
ra8_err_t priv_wait_bit (ra8_rsip_off_t offset, uint32_t mask)
 Implementation of priv_wait_bit() – bounded MMIO mask spin.
static ra8_err_t internal_run_bist (void)
 Arm the BIST and wait for STATUS.BIST_OK.
ra8_err_t priv_hash_wait_done (void)
 Wait for the HASH engine to raise DONE after the trailing block.
ra8_err_t ra8_rsip_init (const ra8_rsip_config_t *cfg)
 Power on the RSIP engine and (optionally) run BIST.
ra8_err_t ra8_rsip_deinit (void)
 Power off the RSIP engine.
ra8_err_t ra8_rsip_get_status (uint32_t *out)
 Snapshot the STATUS mailbox word.
ra8_err_t ra8_rsip_clear_status (uint32_t mask)
 Acknowledge ISR bits via write-1-to-clear.
ra8_err_t ra8_rsip_attach_handler (ra8_rsip_event_fn_t fn, void *ctx)
 Attach a single shared interrupt callback.
void ra8_rsip_dispatch (void)
 Run the attached callback with the current ISR snapshot.
ra8_err_t ra8_rsip_trng_read (uint8_t *buf, uint32_t len)
 Drain len bytes from the RSIP true RNG – fail-closed, no backend.
ra8_err_t ra8_rsip_sha256 (const uint8_t *msg, uint32_t msg_len, uint8_t *digest)
 Compute SHA-256 of an in-memory buffer.
static uint32_t internal_sw_rotr (uint32_t x, uint32_t n)
static void internal_sw_sha256_schedule (uint32_t w[k_ra8_rsip_sw_sha256_round_cnt], const uint8_t block[k_ra8_rsip_sha256_block])
static void internal_sw_sha256_rounds (uint32_t s[k_ra8_rsip_sw_sha256_state_w], const uint32_t w[k_ra8_rsip_sw_sha256_round_cnt])
 Run the 64-round SHA-256 compression loop over one message schedule.
static void internal_sw_sha256_compress (uint32_t state[k_ra8_rsip_sw_sha256_state_w], const uint8_t block[k_ra8_rsip_sha256_block])
static void internal_sw_sha256_finalize (ra8_rsip_sha256_ctx_t *ctx)
 Finalize one streaming SHA-256 chaining state.
static void internal_sw_sha256_emit (const uint32_t state[k_ra8_rsip_sw_sha256_state_w], uint8_t *digest)
static ra8_err_t internal_sha256_dispatch (const uint8_t *msg, uint32_t msg_len, uint8_t *digest)
ra8_err_t ra8_rsip_sha256_init (ra8_rsip_sha256_ctx_t *ctx)
 Initialise a streaming SHA-256 context.
ra8_err_t ra8_rsip_sha256_update (ra8_rsip_sha256_ctx_t *ctx, const uint8_t *data, uint32_t len)
 Absorb additional bytes into a streaming SHA-256 context.
ra8_err_t ra8_rsip_sha256_final (ra8_rsip_sha256_ctx_t *ctx, uint8_t *digest_out)
 Emit the digest of a streaming SHA-256 context.
static ra8_err_t internal_hmac_prep_key (const uint8_t *key, uint32_t key_len, uint8_t block[k_ra8_rsip_sha256_block])
ra8_err_t ra8_rsip_hmac_sha256_init (ra8_rsip_hmac_sha256_ctx_t *ctx, const uint8_t *key, uint32_t key_len)
 Initialise a streaming HMAC-SHA-256 context.
ra8_err_t ra8_rsip_hmac_sha256_update (ra8_rsip_hmac_sha256_ctx_t *ctx, const uint8_t *data, uint32_t len)
 Absorb additional bytes into a streaming HMAC-SHA-256 context.
static ra8_err_t internal_hmac_outer (const uint8_t key_block[k_ra8_rsip_sha256_block], const uint8_t inner[k_ra8_rsip_sha256_digest_bytes], uint8_t *mac_out)
 Compute SHA256(K_opad || inner_digest) for HMAC.
ra8_err_t ra8_rsip_hmac_sha256_final (ra8_rsip_hmac_sha256_ctx_t *ctx, uint8_t *mac_out)
 Emit the MAC of a streaming HMAC-SHA-256 context.
ra8_err_t ra8_rsip_enter_stop (void)
 Park the engine for software-standby entry.
ra8_err_t ra8_rsip_exit_stop (void)
 Re-enable the engine after software-standby exit.

Variables

static const char * s_tag = "RSIP"
 Logger tag used by every ra8_log_* call in this TU.
static ra8_rsip_event_fn_t s_rsip_fn
 Currently attached interrupt callback, or nullptr.
static void * s_rsip_ctx
 Caller context paired with s_rsip_fn.
static const uint32_t s_sw_sha256_k [k_ra8_rsip_sw_sha256_round_cnt]
 FIPS PUB 180-4 Section 4.1.2 SHA-256 round constants K[0..63].
static const uint32_t s_sw_sha256_h0 [k_ra8_rsip_sw_sha256_state_w]
 FIPS PUB 180-4 Section 5.3.3 initial hash value H(0).

Detailed Description

Renesas Secure IP (RSIP-E50D) HAL driver implementation.

Tag
[Ring 3 / HAL] {World: S}

Round-3 driver for the RA8D2 RSIP-E50D engine covering the full HUM Ch 51 (Security Features p 3263-3301) + Ch 52 (RSIP-E50D mailbox p 3302-3307) surface:

  • lifecycle with module-stop release + BIST gate;
  • generic status / IRQ helpers (every documented bit);
  • 32-byte TRNG draws;
  • generic hash family (SHA-2 / SHA-3 / SHAKE) + HMAC;
  • symmetric AES (ECB / CBC / CTR / GCM / CCM / XTS / CMAC / GMAC) for both encrypt and decrypt;
  • ChaCha20 + Poly1305 (stream + AEAD + standalone MAC);
  • asymmetric RSA + ECDSA sign / verify and ECDH key agreement;
  • wrapped-key install (plaintext + OEM (PE5/PE6) flows);
  • wrapped-key vault (read / write / erase / count);
  • key wrap / unwrap engine (KEK-backed);
  • key derivation (HKDF + HUK / UID bound);
  • device lifecycle + debug-authorisation level transitions;
  • tamper subsystem (per-source enable / status / ack + SPA / DPA arm);
  • DOTF key delivery routing.

The engine itself is opaque (HUM Ch 52, p 3302-3307); sequences here are derived from the FSP RSIP primitive layer but no FSP code is included verbatim.

The host unit-test build runs every register access through ra8_fake_mmap-backed pages and routes the bounded BIST / DONE polls through the ra8_fake_mmio wait seam (issue #238): an unarmed register satisfies its wait on the first poll, and a test arms ra8_fake_mmio_fail_wait / ra8_fake_mmio_satisfy_after to drive the timeout / continuation legs of the real loop. The driver itself runs the identical register sequence on every build and never forges an engine-side status bit.

Definition in file ra8_rsip.c.

Macro Definition Documentation

◆ RA8_RSIP_SOFTWARE_BACKEND

#define RA8_RSIP_SOFTWARE_BACKEND   (1)

RA8 RSIP SOFTWARE BACKEND.

Definition at line 76 of file ra8_rsip.c.

Enumeration Type Documentation

◆ ra8_rsip_sw_sha256_t

enum ra8_rsip_sw_sha256_t : uint32_t

File-private constants for the software SHA-256 fall-back.

Used only when RA8_RSIP_SOFTWARE_BACKEND is defined. Values are straight FIPS PUB 180-4 Section 4.2.2 / 6.2.1 references.

Enumerator
k_ra8_rsip_sw_sha256_block_w 

64-byte block = 16 words.

k_ra8_rsip_sw_sha256_round_cnt 

Sched + compression rounds.

k_ra8_rsip_sw_sha256_state_w 

8 working-state words.

k_ra8_rsip_sw_sha256_len_bytes 

64-bit length encoding tail.

k_ra8_rsip_sw_sha256_pad_byte 

RFC 6234 / FIPS 180-4 marker.

k_ra8_rsip_sw_sha256_w_back_2 

W[i-2] schedule lookback.

k_ra8_rsip_sw_sha256_w_back_7 

W[i-7] schedule lookback.

k_ra8_rsip_sw_sha256_w_back_15 

W[i-15] schedule lookback.

k_ra8_rsip_sw_sha256_w_back_16 

W[i-16] schedule lookback.

k_ra8_rsip_sw_rotr_2 

RA8 rsip sw rotr 2.

k_ra8_rsip_sw_rotr_3 

RA8 rsip sw rotr 3.

k_ra8_rsip_sw_rotr_6 

RA8 rsip sw rotr 6.

k_ra8_rsip_sw_rotr_7 

RA8 rsip sw rotr 7.

k_ra8_rsip_sw_rotr_10 

RA8 rsip sw rotr 10.

k_ra8_rsip_sw_rotr_11 

RA8 rsip sw rotr 11.

k_ra8_rsip_sw_rotr_13 

RA8 rsip sw rotr 13.

k_ra8_rsip_sw_rotr_17 

RA8 rsip sw rotr 17.

k_ra8_rsip_sw_rotr_18 

RA8 rsip sw rotr 18.

k_ra8_rsip_sw_rotr_19 

RA8 rsip sw rotr 19.

k_ra8_rsip_sw_rotr_22 

RA8 rsip sw rotr 22.

k_ra8_rsip_sw_rotr_25 

RA8 rsip sw rotr 25.

k_ra8_rsip_sw_word_bits 

Word width in bits.

Definition at line 450 of file ra8_rsip.c.

◆ sha256_lane_t

enum sha256_lane_t : uint8_t

FIPS 180-4 6.2.2 SHA-256 working-state lane indices a..h.

Enumerator
k_sha256_lane_a 

Sha256 lane a.

k_sha256_lane_b 

Sha256 lane b.

k_sha256_lane_c 

Sha256 lane c.

k_sha256_lane_d 

Sha256 lane d.

k_sha256_lane_e 

Sha256 lane e.

k_sha256_lane_f 

Sha256 lane f.

k_sha256_lane_g 

Sha256 lane g.

k_sha256_lane_h 

Sha256 lane h.

Definition at line 546 of file ra8_rsip.c.

Function Documentation

◆ internal_hmac_outer()

ra8_err_t internal_hmac_outer ( const uint8_t key_block[k_ra8_rsip_sha256_block],
const uint8_t inner[k_ra8_rsip_sha256_digest_bytes],
uint8_t * mac_out )
static

Compute SHA256(K_opad || inner_digest) for HMAC.

Uses a stack-local 96-byte buffer (K_opad + inner_digest = 64 + 32) directly through internal_sha256_dispatch. The dispatcher's streaming context retains only one partial SHA-256 block, so this composition remains comfortably inside the firmware's 2200-byte stack ceiling.

Parameters
[in]key_block64-byte prepared HMAC key block.
[in]inner32-byte inner-hash digest.
[out]mac_out32-byte MAC output buffer.
Returns
ra8_err_t propagated from the outer SHA pass.
Precondition
All pointers are non-NULL.
Postcondition
On success mac_out is the HMAC.
Note
Internal helper.
Since
0.1.0
Return values
k_ra8_okOperation completed successfully.
otherNon-zero error code from the underlying operation.
Precondition
Module/state preconditions hold (see function body).
Postcondition
Documented side effects are visible on success.

Definition at line 910 of file ra8_rsip.c.

References internal_sha256_dispatch(), k_ra8_rsip_hmac_outer_pad, k_ra8_rsip_sha256_block, and k_ra8_rsip_sha256_digest_bytes.

Referenced by ra8_rsip_hmac_sha256_final().

◆ internal_hmac_prep_key()

ra8_err_t internal_hmac_prep_key ( const uint8_t * key,
uint32_t key_len,
uint8_t block[k_ra8_rsip_sha256_block] )
static

◆ internal_run_bist()

ra8_err_t internal_run_bist ( void )
static

Arm the BIST and wait for STATUS.BIST_OK.

Sets CTRL.BIST and spins on STATUS.BIST_OK, which the access-management circuit asserts once the on-board firmware finishes the self-test. The driver never forges the bit itself: on the host build the bounded wait routes through the ra8_fake_mmio seam (unarmed = pass on the first poll; a test arms ra8_fake_mmio_fail_wait to reach the failure leg).

Returns
k_ra8_ok on pass, k_ra8_err_hw_init_failed on fail.
Precondition
Engine is clocked (MSTPC31 cleared).
CTRL.ENABLE has been set.
Postcondition
On success, STATUS.BIST_OK is observed set.
On failure, the engine MUST be considered unsafe and the caller is expected to deinit.
Note
Internal helper; not exposed in the public header.
Since
0.1.0
Return values
k_ra8_okOperation completed successfully.
otherNon-zero error code from the underlying operation.

Definition at line 166 of file ra8_rsip.c.

References k_ra8_err_hw_init_failed, k_ra8_ok, k_ra8_rsip_mask_ctrl_bist, k_ra8_rsip_mask_status_bistok, k_ra8_rsip_off_ctrl, k_ra8_rsip_off_status, priv_wait_bit(), and ra8_rsip_reg32().

Referenced by ra8_rsip_exit_stop(), and ra8_rsip_init().

◆ internal_sha256_dispatch()

ra8_err_t internal_sha256_dispatch ( const uint8_t * msg,
uint32_t msg_len,
uint8_t * digest )
static

Definition at line 736 of file ra8_rsip.c.

References internal_sw_sha256(), k_ra8_ok, and ra8_rsip_sha256().

Referenced by internal_hmac_outer(), and internal_hmac_prep_key().

◆ internal_sw_rotr()

uint32_t internal_sw_rotr ( uint32_t x,
uint32_t n )
inlinestatic

Definition at line 477 of file ra8_rsip.c.

References k_ra8_rsip_sw_word_bits.

Referenced by internal_sw_sha256_rounds(), and internal_sw_sha256_schedule().

◆ internal_sw_sha256()

void internal_sw_sha256 ( const uint8_t * msg,
uint32_t msg_len,
uint8_t * digest )
static

One-shot software SHA-256 over a contiguous message buffer.

Pure-software FIPS PUB 180-4 SHA-256 and the only working RSIP HASH backend: seeds the eight-word hash state from the standard initial constants (s_sw_sha256_h0), folds in each full 64-byte block through internal_sw_sha256_compress, length-pads and compresses the trailing partial block via internal_sw_sha256_pad, then serialises the state as a big-endian 32-byte digest with internal_sw_sha256_emit. Compiled under RA8_RSIP_SOFTWARE_BACKEND; a forward declaration near the top of the file lets the earlier ra8_rsip_sha256 dispatch to it so the RoT image digest works on silicon.

Parameters
[in]msgMessage bytes to hash; read-only, msg_len bytes long.
[in]msg_lenMessage length in bytes.
[out]digestOutput buffer receiving the 32-byte big-endian digest.
Precondition
msg points to at least msg_len readable bytes.
digest points to at least 32 writable bytes.
Postcondition
digest holds the SHA-256 of msg[0 .. msg_len).
The input buffer msg is left unmodified.
Note
Re-entrant: all working state lives on the caller's stack and the only global read (s_sw_sha256_h0) is const, so concurrent calls on disjoint buffers do not interfere.
Since
0.1.0

Definition at line 724 of file ra8_rsip.c.

References ra8_rsip_sha256_final(), ra8_rsip_sha256_init(), and ra8_rsip_sha256_update().

Referenced by internal_sha256_dispatch(), and ra8_rsip_sha256().

◆ internal_sw_sha256_compress()

void internal_sw_sha256_compress ( uint32_t state[k_ra8_rsip_sw_sha256_state_w],
const uint8_t block[k_ra8_rsip_sha256_block] )
static

◆ internal_sw_sha256_emit()

void internal_sw_sha256_emit ( const uint32_t state[k_ra8_rsip_sw_sha256_state_w],
uint8_t * digest )
static

◆ internal_sw_sha256_finalize()

void internal_sw_sha256_finalize ( ra8_rsip_sha256_ctx_t * ctx)
static

Finalize one streaming SHA-256 chaining state.

Appends the FIPS 180-4 marker, zero padding, and big-endian 64-bit message length, compressing one or two final blocks as required.

Parameters
[in,out]ctxInitialized streaming context to pad and compress.
Precondition
ctx is non-NULL and initialized by ra8_rsip_sha256_init.
ctx->used is less than k_ra8_rsip_sha256_block.
Postcondition
ctx->state contains the final chaining words.
No storage outside ctx is modified.
Note
File-local helper; the caller emits and clears the resulting state.
Since
0.1.0

Definition at line 657 of file ra8_rsip.c.

References ra8_rsip_sha256_ctx_t::block, internal_sw_sha256_compress(), k_ra8_rsip_byte_bits, k_ra8_rsip_byte_mask, k_ra8_rsip_sha256_block, k_ra8_rsip_sw_sha256_len_bytes, k_ra8_rsip_sw_sha256_pad_byte, ra8_rsip_sha256_ctx_t::state, ra8_rsip_sha256_ctx_t::total_bytes, and ra8_rsip_sha256_ctx_t::used.

Referenced by ra8_rsip_sha256_final().

◆ internal_sw_sha256_rounds()

void internal_sw_sha256_rounds ( uint32_t s[k_ra8_rsip_sw_sha256_state_w],
const uint32_t w[k_ra8_rsip_sw_sha256_round_cnt] )
static

Run the 64-round SHA-256 compression loop over one message schedule.

FIPS PUB 180-4 Section 6.2.2: copies the eight working-state lanes a..h out of the hash state, iterates the round function across the expanded message schedule plus the round constants, and folds the results back into the state in place. Pure software fallback used when the RSIP hardware path is unavailable.

Parameters
[in,out]sEight-word SHA-256 hash state (lanes a..h), updated in place.
[in]wExpanded 64-word message schedule for the current block.
Precondition
Module state is consistent.
Module state is consistent.
Postcondition
Caller-visible state matches the documented contract.
Caller-visible state matches the documented contract.
Note
Not thread-safe unless documented otherwise.
Since
0.1.0

Definition at line 578 of file ra8_rsip.c.

References internal_sw_rotr(), k_ra8_rsip_sw_rotr_11, k_ra8_rsip_sw_rotr_13, k_ra8_rsip_sw_rotr_2, k_ra8_rsip_sw_rotr_22, k_ra8_rsip_sw_rotr_25, k_ra8_rsip_sw_rotr_6, k_ra8_rsip_sw_sha256_round_cnt, k_ra8_rsip_sw_sha256_state_w, k_sha256_lane_a, k_sha256_lane_b, k_sha256_lane_c, k_sha256_lane_d, k_sha256_lane_e, k_sha256_lane_f, k_sha256_lane_g, k_sha256_lane_h, and s_sw_sha256_k.

Referenced by internal_sw_sha256_compress().

◆ internal_sw_sha256_schedule()

◆ priv_hash_wait_done()

ra8_err_t priv_hash_wait_done ( void )

Wait for the HASH engine to raise DONE after the trailing block.

On hardware the engine raises HASH_STATUS.DONE once it absorbs the trailing block + length. The bounded wait routes through the host ra8_fake_mmio seam inside priv_wait_bit (never forged by the driver). Defined in ra8_rsip.c; shared with the generic hash / HMAC path in ra8_rsip_cipher.c.

Returns
k_ra8_ok on success; k_ra8_err_hw_timeout otherwise.
Precondition
Engine is clocked and a hash command has been issued.
HASH_DATA_IN has received the full message body.
Postcondition
On k_ra8_ok, HASH_STATUS.DONE was observed set.
On timeout, no caller-visible state is modified.
Note
Internal helper; not exposed in the public header.
Since
0.1.0
Return values
k_ra8_okOperation completed successfully.
otherNon-zero error code from the underlying operation.

Definition at line 204 of file ra8_rsip.c.

References k_ra8_rsip_mask_isr_done, k_ra8_rsip_off_hash_status, and priv_wait_bit().

Referenced by ra8_rsip_sha256().

◆ priv_wait_bit()

ra8_err_t priv_wait_bit ( ra8_rsip_off_t offset,
uint32_t mask )

Implementation of priv_wait_bit() – bounded MMIO mask spin.

Spin until mask is set in the register at offset.

Definition at line 120 of file ra8_rsip.c.

References k_ra8_err_hw_timeout, k_ra8_ok, k_ra8_rsip_poll_budget, and ra8_rsip_reg32().

Referenced by internal_run_bist(), priv_complete(), priv_hash_wait_done(), ra8_rsip_sha256(), and ra8_rsip_trng_read().

◆ ra8_rsip_attach_handler()

ra8_err_t ra8_rsip_attach_handler ( ra8_rsip_event_fn_t fn,
void * ctx )
nodiscard

Attach a single shared interrupt callback.

The RSIP routes a small number of edge-triggered events (DONE / RND / HASH / TAMPER) into one peripheral IRQ line. The driver fans them out by passing the live ISR snapshot to a single callback.

Parameters
[in]fnCallback fired by ra8_rsip_dispatch; may be NULL to detach.
[in]ctxOpaque context forwarded to fn.
Returns
ra8_err_t error code.
Return values
k_ra8_okCallback installed.
Precondition
IRQs masked while swapping callbacks.
Caller owns the lifetime of ctx.
Postcondition
fn / ctx are visible to ra8_rsip_dispatch.
Previous callback (if any) is no longer invoked.
Note
Thread safety: not thread-safe.
See also
ra8_rsip_dispatch
Since
0.1.0

Definition at line 307 of file ra8_rsip.c.

References k_ra8_ok, s_rsip_ctx, and s_rsip_fn.

◆ ra8_rsip_clear_status()

ra8_err_t ra8_rsip_clear_status ( uint32_t mask)
nodiscard

Acknowledge ISR bits via write-1-to-clear.

Writes mask to the ISR register; only the bits listed in k_ra8_rsip_mask_isr_* are valid. The write masks unrelated bits before issuing.

Parameters
[in]maskOR of k_ra8_rsip_mask_isr_* values.
Returns
ra8_err_t error code.
Return values
k_ra8_okBits cleared.
k_ra8_err_invalid_argmask had bits outside the ISR field.
Precondition
ra8_rsip_init has been called.
mask has at least one valid bit set.
Postcondition
Requested ISR bits read as 0.
No CTRL bits are touched.
Note
Thread safety: not thread-safe with concurrent dispatch.
See also
ra8_rsip_attach_handler
Since
0.1.0

Definition at line 293 of file ra8_rsip.c.

References k_ra8_err_invalid_arg, k_ra8_ok, k_ra8_rsip_mask_isr_all, k_ra8_rsip_off_isr, and ra8_rsip_reg32().

◆ ra8_rsip_deinit()

ra8_err_t ra8_rsip_deinit ( void )
nodiscard

Power off the RSIP engine.

Clears CTRL.ENABLE, scrubs any pending ISR bits, releases the shared callback slot, and asks ra8_mstp to gate MSTPC31.

Returns
ra8_err_t error code.
Return values
k_ra8_okEngine gated.
k_ra8_err_invalid_statera8_mstp had no matching enable.
k_ra8_err_hw_timeoutMSTP read-back loop expired.
Precondition
Engine is idle (STATUS.BUSY = 0); the HAL does not enforce this – callers must drain in-flight commands.
ra8_rsip_init has been called at least once since reset.
Postcondition
Engine is gated and the shared callback / context are cleared.
MSTPC31 ref count is decremented.
Note
Thread safety: not thread-safe.
See also
ra8_rsip_init
Since
0.1.0

Definition at line 267 of file ra8_rsip.c.

References k_ra8_mstp_rsip, k_ra8_rsip_mask_isr_all, k_ra8_rsip_off_ctrl, k_ra8_rsip_off_isr, ra8_mstp_disable(), ra8_rsip_reg32(), s_rsip_ctx, and s_rsip_fn.

◆ ra8_rsip_dispatch()

void ra8_rsip_dispatch ( void )

Run the attached callback with the current ISR snapshot.

Called from the secure-world ICU dispatch when the RSIP IRQ fires. Reads the live ISR word, fires the registered callback (if any), and acks the bits the callback observed via ra8_rsip_clear_status.

Precondition
Caller is the IRQ glue layer; runs in IRQ context.
ra8_rsip_init has been called at least once since reset.
Postcondition
Pending ISR bits that were visible to the callback are cleared.
No CTRL bits are modified.
Note
Thread safety: must run with IRQ priority above the RSIP line (default for ICU dispatch). See HUM Ch 39 "Renesas Secure IP (RSIP-E51A)" pp 1839-1859.
See also
ra8_rsip_attach_handler
Since
0.1.0

Definition at line 315 of file ra8_rsip.c.

References k_ra8_rsip_off_isr, ra8_rsip_reg32(), s_rsip_ctx, and s_rsip_fn.

◆ ra8_rsip_enter_stop()

ra8_err_t ra8_rsip_enter_stop ( void )
nodiscard

Park the engine for software-standby entry.

HUM Ch 52.3.1 p 3307 ("Software Standby Mode") requires the engine to be idle before software-standby; this helper clears CTRL.ENABLE then gates MSTPC31.

Returns
ra8_err_t error code.
Return values
k_ra8_okEngine parked.
k_ra8_err_invalid_statera8_mstp had no matching enable.
k_ra8_err_hw_timeoutMSTP read-back loop expired.
Precondition
Engine is idle (caller's responsibility; HUM 52.3.1).
ra8_rsip_init has been called.
Postcondition
CTRL.ENABLE = 0.
MSTPC31 ref count is decremented.
Note
Thread safety: not thread-safe.
See also
ra8_rsip_exit_stop
Since
0.1.0

Definition at line 947 of file ra8_rsip.c.

References k_ra8_mstp_rsip, k_ra8_rsip_off_ctrl, ra8_mstp_disable(), and ra8_rsip_reg32().

◆ ra8_rsip_exit_stop()

ra8_err_t ra8_rsip_exit_stop ( void )
nodiscard

Re-enable the engine after software-standby exit.

Calls ra8_mstp_enable to clock the block, sets CTRL.ENABLE, and re-runs BIST so a side-channel injection during standby does not silently leak.

Returns
ra8_err_t error code.
Return values
k_ra8_okEngine ready, BIST passed.
k_ra8_err_hw_init_failedBIST did not pass.
k_ra8_err_hw_timeoutMSTP read-back loop expired.
Precondition
ra8_rsip_enter_stop was the previous transition.
IRQs masked.
Postcondition
CTRL.ENABLE = 1 and STATUS.BIST_OK = 1.
MSTPC31 ref count is incremented.
Note
Thread safety: not thread-safe.
See also
ra8_rsip_enter_stop
Since
0.1.0

Definition at line 955 of file ra8_rsip.c.

References internal_run_bist(), k_ra8_mstp_rsip, k_ra8_ok, k_ra8_rsip_mask_ctrl_enable, k_ra8_rsip_off_ctrl, ra8_mstp_disable(), ra8_mstp_enable(), RA8_RETURN_ON_ERROR, ra8_rsip_reg32(), and s_tag.

◆ ra8_rsip_get_status()

ra8_err_t ra8_rsip_get_status ( uint32_t * out)
nodiscard

Snapshot the STATUS mailbox word.

Parameters
[out]outReceives the raw STATUS word; never NULL.
Returns
ra8_err_t error code.
Return values
k_ra8_okSnapshot returned.
k_ra8_err_null_ptrout was nullptr.
Precondition
out is non-NULL.
ra8_rsip_init has been called.
Postcondition
*out reflects the live STATUS word.
No engine state is modified.
Note
Thread safety: read-only, safe to call concurrently with data-path operations.
See also
ra8_rsip_clear_status
Since
0.1.0

Definition at line 284 of file ra8_rsip.c.

References k_ra8_ok, k_ra8_rsip_off_status, RA8_CHECK_NULL_PTR, ra8_rsip_reg32(), and s_tag.

◆ ra8_rsip_hmac_sha256_final()

ra8_err_t ra8_rsip_hmac_sha256_final ( ra8_rsip_hmac_sha256_ctx_t * ctx,
uint8_t * mac_out )
nodiscard

Emit the MAC of a streaming HMAC-SHA-256 context.

Parameters
[in,out]ctxContext populated by prior update() calls.
[out]mac_out32-byte MAC output buffer; never NULL.
Returns
ra8_err_t error code.
Return values
k_ra8_okMAC written.
k_ra8_err_null_ptrctx or mac_out was nullptr.
k_ra8_err_invalid_statectx was not initialized.
k_ra8_err_hw_timeoutEither SHA pass timed out.
Precondition
ctx->initialized == 1.
mac_out is non-NULL.
Postcondition
On success mac_out[0..31] is the HMAC-SHA-256.
On any return ctx->initialized == 0.
Note
Thread safety: not thread-safe.
See also
ra8_rsip_hmac_sha256_init
Since
0.1.0

Definition at line 927 of file ra8_rsip.c.

References ra8_rsip_hmac_sha256_ctx_t::initialized, ra8_rsip_hmac_sha256_ctx_t::inner, internal_hmac_outer(), k_ra8_err_invalid_state, k_ra8_ok, k_ra8_rsip_sha256_block, k_ra8_rsip_sha256_digest_bytes, ra8_rsip_hmac_sha256_ctx_t::key_block, RA8_CHECK_NULL_PTR, ra8_rsip_sha256_final(), and s_tag.

◆ ra8_rsip_hmac_sha256_init()

ra8_err_t ra8_rsip_hmac_sha256_init ( ra8_rsip_hmac_sha256_ctx_t * ctx,
const uint8_t * key,
uint32_t key_len )
nodiscard

Initialise a streaming HMAC-SHA-256 context.

Parameters
[out]ctxStreaming HMAC state; never NULL.
[in]keyHMAC key bytes; never NULL when key_len > 0.
[in]key_lenLength of key in bytes (may be 0).
Returns
ra8_err_t error code.
Return values
k_ra8_okContext ready.
k_ra8_err_null_ptrctx was nullptr or key was NULL with non-zero key_len.
k_ra8_err_hw_timeoutInternal SHA collapse of an oversized key timed out.
Precondition
ra8_rsip_init has been called.
ctx is non-NULL.
Postcondition
ctx->initialized == 1.
No engine state is modified beyond the optional key-collapse.
Note
Thread safety: not thread-safe.
See also
ra8_rsip_hmac_sha256_update
Since
0.1.0

Definition at line 846 of file ra8_rsip.c.

References ra8_rsip_hmac_sha256_ctx_t::initialized, ra8_rsip_sha256_ctx_t::initialized, ra8_rsip_hmac_sha256_ctx_t::inner, internal_hmac_prep_key(), k_ra8_err_null_ptr, k_ra8_ok, k_ra8_rsip_hmac_inner_pad, k_ra8_rsip_sha256_block, ra8_rsip_hmac_sha256_ctx_t::key_block, RA8_CHECK_NULL_PTR, ra8_rsip_sha256_init(), ra8_rsip_sha256_update(), and s_tag.

◆ ra8_rsip_hmac_sha256_update()

ra8_err_t ra8_rsip_hmac_sha256_update ( ra8_rsip_hmac_sha256_ctx_t * ctx,
const uint8_t * data,
uint32_t len )
nodiscard

Absorb additional bytes into a streaming HMAC-SHA-256 context.

Parameters
[in,out]ctxContext primed by ra8_rsip_hmac_sha256_init.
[in]dataBytes to absorb; may be NULL only if len is 0.
[in]lenNumber of bytes in data.
Returns
ra8_err_t error code.
Return values
k_ra8_okBytes accumulated.
k_ra8_err_null_ptrctx was nullptr or data NULL with non-zero len.
k_ra8_err_invalid_statectx was not initialized.
k_ra8_err_invalid_sizeCumulative input exceeds SHA-256's encoded length range.
Precondition
ctx->initialized == 1.
Either len == 0 or data is non-NULL.
Postcondition
On success ctx->inner.total_bytes grew by len.
On failure ctx is unchanged.
Note
Thread safety: not thread-safe.
See also
ra8_rsip_hmac_sha256_init
Since
0.1.0

Definition at line 874 of file ra8_rsip.c.

References ra8_rsip_hmac_sha256_ctx_t::initialized, ra8_rsip_hmac_sha256_ctx_t::inner, k_ra8_err_invalid_state, RA8_CHECK_NULL_PTR, ra8_rsip_sha256_update(), and s_tag.

◆ ra8_rsip_init()

ra8_err_t ra8_rsip_init ( const ra8_rsip_config_t * cfg)
nodiscard

Power on the RSIP engine and (optionally) run BIST.

Sequence:

  1. Release MSTPC31 via ra8_mstp_enable(k_ra8_mstp_rsip). HUM Ch 11.2.8 "MSTPCRC: Module Stop Control Register C" p 446 + HUM Ch 52.3.2 "Module-Stop Function Setting" p 3307.
  2. Soft-reset the engine via CTRL.RESET pulse.
  3. Set CTRL.ENABLE so the access-management circuit clocks the internal subsystem.
  4. If cfg->run_bist is true, set CTRL.BIST and spin on STATUS.BIST_OK. Returns k_ra8_err_hw_init_failed if the spin exhausts its budget (BIST failure is a fatal condition – the engine MUST NOT be used).
  5. Clear pending ISR bits.
Parameters
[in]cfgNon-NULL configuration descriptor.
Returns
ra8_err_t error code.
Return values
k_ra8_okEngine ready, BIST passed.
k_ra8_err_null_ptrcfg was nullptr.
k_ra8_err_hw_init_failedBIST did not pass within budget.
Precondition
IRQs masked or single-threaded init context.
ra8_mstp_init has been called.
Postcondition
On success, the engine is clocked, BIST_OK is set, and no spurious ISR bits are pending.
On success, MSTPC31 ref count is at least 1.
Warning
See file-level
– TRNG output is invalid until BIST passes. Do not call ra8_rsip_trng_read if this function returned anything other than k_ra8_ok.
Note
Thread safety: not thread-safe.
const ra8_rsip_config_t cfg = {.run_bist = true };
if (ra8_rsip_init(&cfg) != k_ra8_ok) { panic; }
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
Definition ra8_err.h:119
ra8_err_t ra8_rsip_init(const ra8_rsip_config_t *cfg)
Power on the RSIP engine and (optionally) run BIST.
Definition ra8_rsip.c:234
Initial configuration for ra8_rsip_init.
See also
ra8_rsip_deinit
ra8_rsip_trng_read
Since
0.1.0

Definition at line 234 of file ra8_rsip.c.

References internal_run_bist(), k_ra8_mstp_rsip, k_ra8_ok, k_ra8_rsip_mask_ctrl_enable, k_ra8_rsip_mask_ctrl_reset, k_ra8_rsip_mask_isr_all, k_ra8_rsip_off_ctrl, k_ra8_rsip_off_isr, RA8_CHECK_NULL_PTR, ra8_log_info, ra8_mstp_disable(), ra8_mstp_enable(), RA8_RETURN_ON_ERROR, ra8_rsip_reg32(), ra8_rsip_config_t::run_bist, and s_tag.

Referenced by demo_setup_or_halt(), internal_demo_setup_or_halt(), and internal_run().

◆ ra8_rsip_sha256()

ra8_err_t ra8_rsip_sha256 ( const uint8_t * msg,
uint32_t msg_len,
uint8_t * digest )
nodiscard

Compute SHA-256 of an in-memory buffer.

Streams msg through the HASH engine 32 bits at a time, then reads back the 8-word (32-byte) digest from HASH_DIGEST. Algorithm select is hard-wired to k_ra8_rsip_hash_sha256. Suitable for short messages; incremental update / final API is deferred to a future revision.

Parameters
[in]msgPointer to the input buffer; never NULL.
[in]msg_lenLength of msg in bytes; may be 0.
[out]digest32-byte output buffer; never NULL.
Returns
ra8_err_t error code.
Return values
k_ra8_okDigest written.
k_ra8_err_null_ptrmsg or digest was nullptr.
k_ra8_err_hw_timeoutHASH engine did not signal done.
Precondition
ra8_rsip_init has been called.
digest is at least k_ra8_rsip_sha256_digest_bytes wide.
Postcondition
On success, digest[0..31] holds the SHA-256 of msg.
HASH_STATUS.DONE has been observed and acked.
Note
Thread safety: not thread-safe.
(void)ra8_rsip_sha256(buf, len, out);
ra8_err_t ra8_rsip_sha256(const uint8_t *msg, uint32_t msg_len, uint8_t *digest)
Compute SHA-256 of an in-memory buffer.
Definition ra8_rsip.c:397
@ k_ra8_rsip_sha256_digest_bytes
SHA-256 digest length.
Since
0.1.0

Definition at line 397 of file ra8_rsip.c.

References internal_sw_sha256(), k_ra8_ok, k_ra8_rsip_hash_sha256, k_ra8_rsip_mask_status_ready, k_ra8_rsip_off_hash_ctrl, k_ra8_rsip_off_hash_status, priv_hash_wait_done(), priv_wait_bit(), RA8_CHECK_NULL_PTR, RA8_RETURN_ON_ERROR, ra8_rsip_reg32(), and s_tag.

Referenced by app_stage_images(), internal_demo_verify_cert_pin(), internal_kat_one(), and internal_sha256_dispatch().

◆ ra8_rsip_sha256_final()

ra8_err_t ra8_rsip_sha256_final ( ra8_rsip_sha256_ctx_t * ctx,
uint8_t * digest_out )
nodiscard

Emit the digest of a streaming SHA-256 context.

Parameters
[in,out]ctxContext populated by prior update() calls.
[out]digest_out32-byte digest output buffer; never NULL.
Returns
ra8_err_t error code.
Return values
k_ra8_okDigest written.
k_ra8_err_null_ptrctx or digest_out was nullptr.
k_ra8_err_invalid_statectx was not initialized.
Precondition
ctx->initialized == 1.
digest_out is non-NULL.
Postcondition
On success digest_out[0..31] holds the SHA-256.
On success ctx is cleared and no message bytes remain resident.
Note
Thread safety: not thread-safe.
See also
ra8_rsip_sha256_init
Since
0.1.0

Definition at line 794 of file ra8_rsip.c.

References ra8_rsip_sha256_ctx_t::block, ra8_rsip_sha256_ctx_t::initialized, internal_sw_sha256_emit(), internal_sw_sha256_finalize(), k_ra8_err_invalid_state, k_ra8_ok, k_ra8_rsip_sha256_block, k_ra8_rsip_sha256_state_words, RA8_CHECK_NULL_PTR, s_tag, ra8_rsip_sha256_ctx_t::state, ra8_rsip_sha256_ctx_t::total_bytes, and ra8_rsip_sha256_ctx_t::used.

Referenced by app_sha_final(), internal_sha_final(), internal_sw_sha256(), and ra8_rsip_hmac_sha256_final().

◆ ra8_rsip_sha256_init()

ra8_err_t ra8_rsip_sha256_init ( ra8_rsip_sha256_ctx_t * ctx)
nodiscard

Initialise a streaming SHA-256 context.

Parameters
[out]ctxStreaming state; never NULL.
Returns
ra8_err_t error code.
Return values
k_ra8_okContext ready for update().
k_ra8_err_null_ptrctx was nullptr.
Precondition
ra8_rsip_init has been called at least once since reset.
ctx is non-NULL.
Postcondition
ctx->used == 0, ctx->total_bytes == 0 and ctx->initialized == 1.
No engine state is modified.
Note
Thread safety: not thread-safe.
(void)ra8_rsip_sha256_update(&ctx, hello, hello_len);
uint8_t transcript[k_ra8_rsip_sha256_digest_bytes];
(void)ra8_rsip_sha256_final(&ctx, transcript);
ra8_err_t ra8_rsip_sha256_final(ra8_rsip_sha256_ctx_t *ctx, uint8_t *digest_out)
Emit the digest of a streaming SHA-256 context.
Definition ra8_rsip.c:794
ra8_err_t ra8_rsip_sha256_update(ra8_rsip_sha256_ctx_t *ctx, const uint8_t *data, uint32_t len)
Absorb additional bytes into a streaming SHA-256 context.
Definition ra8_rsip.c:759
ra8_err_t ra8_rsip_sha256_init(ra8_rsip_sha256_ctx_t *ctx)
Initialise a streaming SHA-256 context.
Definition ra8_rsip.c:747
Streaming state for incremental SHA-256.
See also
ra8_rsip_sha256_update
ra8_rsip_sha256_final
Since
0.1.0

Definition at line 747 of file ra8_rsip.c.

References ra8_rsip_sha256_ctx_t::initialized, k_ra8_ok, k_ra8_rsip_sha256_state_words, RA8_CHECK_NULL_PTR, s_sw_sha256_h0, s_tag, ra8_rsip_sha256_ctx_t::state, ra8_rsip_sha256_ctx_t::total_bytes, and ra8_rsip_sha256_ctx_t::used.

Referenced by app_sha_init(), internal_sha_init(), internal_sw_sha256(), and ra8_rsip_hmac_sha256_init().

◆ ra8_rsip_sha256_update()

ra8_err_t ra8_rsip_sha256_update ( ra8_rsip_sha256_ctx_t * ctx,
const uint8_t * data,
uint32_t len )
nodiscard

Absorb additional bytes into a streaming SHA-256 context.

Parameters
[in,out]ctxContext primed by ra8_rsip_sha256_init.
[in]dataBytes to absorb; may be NULL only if len is 0.
[in]lenNumber of bytes in data.
Returns
ra8_err_t error code.
Return values
k_ra8_okBytes compressed or retained.
k_ra8_err_null_ptrctx was nullptr or data was NULL with non-zero len.
k_ra8_err_invalid_statectx was not initialized.
k_ra8_err_invalid_sizeCumulative input cannot be represented by SHA-256's 64-bit bit-length field.
Precondition
ctx->initialized == 1.
Either len == 0 or data is non-NULL.
Postcondition
On success ctx->total_bytes grew by len and ctx->used identifies only the retained partial block.
On failure ctx is unchanged.
Note
Thread safety: not thread-safe.
See also
ra8_rsip_sha256_init
Since
0.1.0

Definition at line 759 of file ra8_rsip.c.

References ra8_rsip_sha256_ctx_t::block, ra8_rsip_sha256_ctx_t::initialized, internal_sw_sha256_compress(), k_ra8_err_invalid_size, k_ra8_err_invalid_state, k_ra8_err_null_ptr, k_ra8_ok, k_ra8_rsip_byte_bits, k_ra8_rsip_sha256_block, RA8_CHECK_NULL_PTR, s_tag, ra8_rsip_sha256_ctx_t::state, ra8_rsip_sha256_ctx_t::total_bytes, and ra8_rsip_sha256_ctx_t::used.

Referenced by app_sha_update(), internal_sha_update(), internal_sw_sha256(), ra8_rsip_hmac_sha256_init(), and ra8_rsip_hmac_sha256_update().

◆ ra8_rsip_trng_read()

ra8_err_t ra8_rsip_trng_read ( uint8_t * buf,
uint32_t len )
nodiscard

Drain len bytes from the RSIP true RNG – fail-closed, no backend.

The RSIP-E50D TRNG has no documented register interface (HUM Ch 52 is a 6-page feature overview with no register map), so the hand-written RND_* access is invented and non-functional on silicon: RND_STATUS.READY never asserts. This routine therefore fails closed with k_ra8_err_not_supported rather than spin to a timeout or hand back a deterministic / all-zero value – predictable "entropy" is far more dangerous than an honest error. A working TRNG needs an FSP-derived RSIP primitive sequence; the register path is retained behind RA8_RSIP_TRNG_HARDWARE (never defined) for a future port. A software PRNG is NOT a substitute here.

Parameters
[out]bufDestination buffer (>= len bytes); never NULL.
[in]lenBytes to fetch; must be a non-zero multiple of 4.
Returns
ra8_err_t error code.
Return values
k_ra8_err_not_supportedNo working RSIP TRNG register interface exists (the shipped, fail-closed path).
k_ra8_err_null_ptrbuf was nullptr.
k_ra8_err_invalid_arglen is zero or not a multiple of k_ra8_rsip_trng_word_bytes.
Precondition
buf is non-NULL.
len is a non-zero multiple of k_ra8_rsip_trng_word_bytes.
Postcondition
buf is left untouched; the caller must treat it as uninitialized.
No RSIP register is mutated in the fail-closed build.
Warning
Returns no entropy on this silicon. Do NOT use for key or nonce generation until a real TRNG backend exists.
Note
Thread safety: not thread-safe.
uint8_t seed[32];
ra8_err_t e = ra8_rsip_trng_read(seed, sizeof(seed)); // e == k_ra8_err_not_supported
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
ra8_err_t ra8_rsip_trng_read(uint8_t *buf, uint32_t len)
Drain len bytes from the RSIP true RNG – fail-closed, no backend.
Definition ra8_rsip.c:338
Since
0.1.0

Definition at line 338 of file ra8_rsip.c.

References k_ra8_err_invalid_arg, k_ra8_err_not_supported, k_ra8_ok, k_ra8_rsip_byte_bits, k_ra8_rsip_byte_mask, k_ra8_rsip_byte_shift_2, k_ra8_rsip_byte_shift_3, k_ra8_rsip_mask_ctrl_enable, k_ra8_rsip_mask_status_ready, k_ra8_rsip_off_rnd_ctrl, k_ra8_rsip_off_rnd_data, k_ra8_rsip_off_rnd_status, k_ra8_rsip_trng_word_bytes, k_ra8_rsip_word_shift, priv_wait_bit(), RA8_CHECK_NULL_PTR, ra8_rsip_reg32(), and s_tag.

Referenced by internal_demo_entropy_source(), and mbedtls_psa_external_get_random().

Variable Documentation

◆ s_rsip_ctx

void* s_rsip_ctx
static

Caller context paired with s_rsip_fn.

Warning
Do not modify directly; use ra8_rsip_attach_handler.
Note
Static, file-scope.
Since
0.1.0

Definition at line 117 of file ra8_rsip.c.

Referenced by ra8_rsip_attach_handler(), ra8_rsip_deinit(), and ra8_rsip_dispatch().

◆ s_rsip_fn

ra8_rsip_event_fn_t s_rsip_fn
static

Currently attached interrupt callback, or nullptr.

Updated by ra8_rsip_attach_handler and read by ra8_rsip_dispatch. There is one shared slot because the RSIP routes every event through one peripheral IRQ line.

Warning
Do not modify directly; use ra8_rsip_attach_handler.
Note
Static, file-scope.
Since
0.1.0

Definition at line 107 of file ra8_rsip.c.

Referenced by ra8_rsip_attach_handler(), ra8_rsip_deinit(), and ra8_rsip_dispatch().

◆ s_sw_sha256_h0

const uint32_t s_sw_sha256_h0[k_ra8_rsip_sw_sha256_state_w]
static
Initial value:
= {
0x6a09e667UL, 0xbb67ae85UL, 0x3c6ef372UL, 0xa54ff53aUL,
0x510e527fUL, 0x9b05688cUL, 0x1f83d9abUL, 0x5be0cd19UL,
}

FIPS PUB 180-4 Section 5.3.3 initial hash value H(0).

Note
Static, file-scope.
Since
0.1.0

Definition at line 514 of file ra8_rsip.c.

Referenced by ra8_rsip_sha256_init().

◆ s_sw_sha256_k

const uint32_t s_sw_sha256_k[k_ra8_rsip_sw_sha256_round_cnt]
static
Initial value:
= {
0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL,
0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL,
0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL,
0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL,
0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL,
0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL,
0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL,
0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL,
0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL,
0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL,
0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL,
0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL,
0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL,
0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL,
0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL,
0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL,
}

FIPS PUB 180-4 Section 4.1.2 SHA-256 round constants K[0..63].

Note
Static, file-scope.
Since
0.1.0

Definition at line 489 of file ra8_rsip.c.

Referenced by internal_sw_sha256_rounds().

◆ s_tag

const char* s_tag = "RSIP"
static

Logger tag used by every ra8_log_* call in this TU.

Kept short ("RSIP") so it fits in the fixed-width log prefix without truncation.

Note
Static, file-scope.
Since
0.1.0

Definition at line 92 of file ra8_rsip.c.