Example for the mcuxClOsccaRandomModes component.
#include <stdbool.h>
#include <stddef.h>
#include <mcuxClExample_Session_Helper.h>
#include <mcuxClCore_Examples.h>
#include <mcuxClExample_ELS_Helper.h>
MCUXCLEXAMPLE_FUNCTION(mcuxClOsccaRandomModes_OsccaTrng_example)
{
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
uint8_t rng_buffer[41u];
uint8_t rng_buffer1[3u];
uint8_t rng_buffer2[4u];
uint8_t rng_buffer3[5u];
MCUXCLEXAMPLE_ALLOCATE_AND_INITIALIZE_SESSION(&session, MCUXCLEXAMPLE_MAX_WA(MCUXCLOSCCARANDOMMODES_OSCCARNG_SELFTEST_CPU_SIZE, MCUXCLRANDOMMODES_NCINIT_WACPU_SIZE), 0u);
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
&session,
mcuxClOsccaRandomModes_Mode_TRNG));
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
uint32_t ctx[MCUXCLOSCCARANDOMMODES_OSCCARNG_CONTEXT_SIZE_IN_WORDS];
MCUX_CSSL_ANALYSIS_START_PATTERN_REINTERPRET_MEMORY_OF_OPAQUE_TYPES()
MCUX_CSSL_ANALYSIS_STOP_PATTERN_REINTERPRET_MEMORY_OF_OPAQUE_TYPES()
&session,
MCUX_CSSL_ANALYSIS_START_SUPPRESS_POINTER_INCOMPATIBLE("pCtx has the correct type (mcuxClRandom_Context_t), the cast was valid.")
pCtx,
MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_POINTER_INCOMPATIBLE()
mcuxClOsccaRandomModes_Mode_TRNG));
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
MCUX_CSSL_ANALYSIS_START_SUPPRESS_ESCAPING_LOCAL_ADDRESS("Address of rng_buffer1 is for internal use only and does not escape")
&session,
rng_buffer1,
3u));
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_ESCAPING_LOCAL_ADDRESS()
MCUX_CSSL_ANALYSIS_START_SUPPRESS_ESCAPING_LOCAL_ADDRESS("Address of rng_buffer2 is for internal use only and does not escape")
&session,
rng_buffer2,
4u));
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_ESCAPING_LOCAL_ADDRESS()
MCUX_CSSL_ANALYSIS_START_SUPPRESS_ESCAPING_LOCAL_ADDRESS("Address of rng_buffer3 is for internal use only and does not escape")
&session,
rng_buffer3,
5u));
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_ESCAPING_LOCAL_ADDRESS()
MCUX_CSSL_ANALYSIS_START_SUPPRESS_ESCAPING_LOCAL_ADDRESS("Address of rng_buffer is for internal use only and does not escape")
&session,
rng_buffer,
41u));
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_ESCAPING_LOCAL_ADDRESS()
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
if(!mcuxClExample_Session_Clean(&session))
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
if(!mcuxClExample_Els_Disable())
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
return MCUXCLEXAMPLE_STATUS_OK;
}
Top level header of mcuxClOsccaRandomModes component.
Definition of function identifiers for the flow protection mechanism.
Top level header of mcuxClRandom component.
Top level header of mcuxClRandomModes component.
Top-level include file for the mcuxClSession component.
Provides the API for the CSSL flow protection mechanism.
#define MCUXCLELS_RESET_DO_NOT_CANCEL
Set this option at mcuxClEls_ResetOption_t to abort the requested command if another ELS operation is...
Definition mcuxClEls_Common.h:119
mcuxClRandom_Status_t mcuxClRandom_ncInit(mcuxClSession_Handle_t pSession)
Non-cryptographic PRNG initialization function.
mcuxClRandom_Status_t mcuxClRandom_selftest(mcuxClSession_Handle_t pSession, mcuxClRandom_Mode_t mode)
Random data generator self-test function.
mcuxClRandom_Status_t mcuxClRandom_generate(mcuxClSession_Handle_t pSession, mcuxCl_Buffer_t pOut, uint32_t outLength)
Random data generation function.
mcuxClRandom_Status_t mcuxClRandom_uninit(mcuxClSession_Handle_t pSession)
Random data generator uninitialization function.
mcuxClRandom_Status_t mcuxClRandom_init(mcuxClSession_Handle_t pSession, mcuxClRandom_Context_t pContext, mcuxClRandom_Mode_t mode)
Random data generator initialization function.
mcuxClRandom_ContextDescriptor_t * mcuxClRandom_Context_t
Random context type.
Definition mcuxClRandom_Types.h:71
#define MCUX_CSSL_FP_FUNCTION_CALL_BEGIN(...)
Call a flow protected function and check the protection token.
Definition mcuxCsslFlowProtection.h:581
#define MCUX_CSSL_FP_FUNCTION_CALLED(...)
Expectation of a called function.
Definition mcuxCsslFlowProtection.h:735
#define MCUX_CSSL_FP_FUNCTION_CALL_END(...)
End a function call section started by MCUX_CSSL_FP_FUNCTION_CALL_BEGIN.
Definition mcuxCsslFlowProtection.h:616
#define MCUXCLRANDOM_STATUS_OK
Random function returned successfully.
Definition mcuxClRandom_Constants.h:46
Structure for mcuxClSession Descriptor.
Definition mcuxClSession_Types.h:121