Example for the mcuxClRandom component with seeding for Prng.
#include <mcuxClCore_Examples.h>
#include <mcuxClToolchain.h>
#include <mcuxClExample_Session_Helper.h>
#define randomDataSize (16u)
#define randomDataWordSize ((randomDataSize) / sizeof(uint32_t))
MCUXCLEXAMPLE_FUNCTION(mcuxClRandom_PRNG_Seed_example)
{
mcuxClSession_Descriptor_t sessionDesc;
MCUXCLEXAMPLE_ALLOCATE_AND_INITIALIZE_SESSION(session, MCUXCLRANDOM_NCINIT_WACPU_SIZE, 0u);
MCUX_CSSL_ANALYSIS_START_SUPPRESS_DEREFERENCE_NULL_POINTER("session->apiCall is not NULL when accessed")
MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_DEREFERENCE_NULL_POINTER()
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
uint32_t pPrngData1[randomDataWordSize];
ncg_status1,
ncg_token1,
);
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
uint8_t pPrngData2[randomDataSize];
ncg_status2,
ncg_token2,
);
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
if(!mcuxClExample_Session_Clean(session))
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
return MCUXCLEXAMPLE_STATUS_OK;
}
Top-level include file for the mcuxClBuffer component.
Definition of function identifiers for the flow protection mechanism.
Top level header of mcuxClRandom component.
Top-level include file for the mcuxClSession component.
Provides the API for the CSSL flow protection mechanism.
#define MCUXCLBUFFER_INIT(name, info, ptr, size)
Initialize an input/output buffer (mcuxCl_Buffer_t).
Definition mcuxClBuffer.h:67
mcuxClRandom_Status_t mcuxClRandom_ncReseed(mcuxClSession_Handle_t pSession)
Non-cryptographic PRNG reseed function.
mcuxClRandom_Status_t mcuxClRandom_ncInit(mcuxClSession_Handle_t pSession)
Non-cryptographic PRNG initialization function.
mcuxClRandom_Status_t mcuxClRandom_ncGenerate(mcuxClSession_Handle_t pSession, mcuxCl_Buffer_t pOut, uint32_t outLength)
Non-cryptographic PRNG data generation function.
mcuxClSession_Descriptor_t *const mcuxClSession_Handle_t
Type for mcuxClSession Handle.
Definition mcuxClSession_Types.h:98
#define MCUX_CSSL_FP_FUNCTION_CALL_BEGIN(...)
Call a flow protected function and check the protection token.
Definition mcuxCsslFlowProtection.h:623
#define MCUX_CSSL_FP_FUNCTION_CALLED(...)
Expectation of a called function.
Definition mcuxCsslFlowProtection.h:777
#define MCUX_CSSL_FP_FUNCTION_CALL_END(...)
End a function call section started by MCUX_CSSL_FP_FUNCTION_CALL_BEGIN.
Definition mcuxCsslFlowProtection.h:658
#define MCUXCLRANDOM_STATUS_OK
Random function returned successfully.
Definition mcuxClRandom_Constants.h:46