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

Fail-closed PSA external-RNG hook for the verify-only bootloader. More...

#include <stddef.h>
#include <stdint.h>
#include "mbedtls/platform_util.h"
#include "psa/crypto.h"
Include dependency graph for psa_verify_rng.c:

Go to the source code of this file.

Functions

psa_status_t mbedtls_psa_external_get_random (mbedtls_psa_external_random_context_t *context, uint8_t *output, size_t output_size, size_t *output_length)

Detailed Description

Fail-closed PSA external-RNG hook for the verify-only bootloader.

Tag
[Ring 6 / APP] {World: S}

The vendored tf-psa-crypto port sets MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG, so the PSA core needs an mbedtls_psa_external_get_random symbol at link time. This immutable bootloader performs exactly ONE cryptographic operation: ECDSA-P256 signature verification over the public image body, the public provisioned root key, and the public trailer (via ra8_rot_verify_image from the RA8_ENABLE_ROOT_OF_TRUST launch gate). That operation is mathematically deterministic and draws NO randomness, and the bootloader never signs, generates a key, or derives a secret – so there is no secret here for randomness to protect.

Rather than link the deterministic placeholder RNG the KAT apps use (a latent catastrophe if this image were ever repurposed to sign or keygen), this hook FAILS CLOSED: any request for entropy returns PSA_ERROR_INSUFFICIENT_ENTROPY. On the verify-only boot path it is never called, so the bootloader authenticates and launches the genuine image normally. A call would mean an unexpected code path drew randomness – and for an immutable bootloader, failing loudly (rejecting the launch) is the correct, safe response, never emitting predictable bytes that could masquerade as entropy.

Warning
If a future bootloader feature genuinely needs entropy (a challenge-response, a signing step, a key exchange), wire a real hardware TRNG here. Do NOT relax this to a deterministic generator.
Since
0.1.0

Definition in file psa_verify_rng.c.

Function Documentation

◆ mbedtls_psa_external_get_random()

psa_status_t mbedtls_psa_external_get_random ( mbedtls_psa_external_random_context_t * context,
uint8_t * output,
size_t output_size,
size_t * output_length )

Definition at line 43 of file psa_verify_rng.c.