ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
mbedtls_psa_rng.c
Go to the documentation of this file.
1
17
18#include <stddef.h>
19#include <stdint.h>
20
21#include "ra8_check.h"
22#include "ra8_err.h"
23#include "ra8_rsip.h"
24
25#ifndef RA8_OFF_TARGET
26#include "psa/crypto.h"
27
54psa_status_t mbedtls_psa_external_get_random(mbedtls_psa_external_random_context_t* context,
55 uint8_t* output,
56 size_t output_size,
57 size_t* output_length)
58{
59 (void)context;
61 PSA_ERROR_INVALID_ARGUMENT,
62 "PSA_RNG",
63 "output must not be nullptr");
64 RA8_CHECK_NULL_PTR_RETURN(output_length,
65 PSA_ERROR_INVALID_ARGUMENT,
66 "PSA_RNG",
67 "output_length must not be nullptr");
68 ra8_err_t err = ra8_rsip_trng_read((uint8_t*)output, (uint32_t)output_size);
69 if (err != k_ra8_ok) {
70 return PSA_ERROR_HARDWARE_FAILURE;
71 }
72 *output_length = output_size;
73 return PSA_SUCCESS;
74}
75#endif
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)
PSA external RNG hook – feeds RSIP TRNG straight into PSA.
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_CHECK_NULL_PTR_RETURN(ptr, return_value, tag, message)
Reject nullptr while preserving an externally specified return ABI.
Definition ra8_check.h:276
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
Definition ra8_err.h:119
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Renesas Secure IP (RSIP-E50D) HAL driver – public API.
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