MCUX CLNS
MCUX Crypto Library Normal Secure
 
Loading...
Searching...
No Matches
mcuxClRandom_Functions

Defines all functions of mcuxClRandom. More...

Functions

mcuxClRandom_Status_t mcuxClRandom_init (mcuxClSession_Handle_t pSession, mcuxClRandom_Context_t pContext, mcuxClRandom_Mode_t mode)
 Random data generator initialization function.
 
mcuxClRandom_Status_t mcuxClRandom_reseed (mcuxClSession_Handle_t pSession)
 Random data generator reseed 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_selftest (mcuxClSession_Handle_t pSession, mcuxClRandom_Mode_t mode)
 Random data generator self-test function.
 
mcuxClRandom_Status_t mcuxClRandom_checkSecurityStrength (mcuxClSession_Handle_t pSession, uint32_t securityStrength)
 Random data generator security strength check.
 
mcuxClRandom_Status_t mcuxClRandom_ncPatch (mcuxClSession_Handle_t pSession, mcuxClRandom_CustomNcGenerateAlgorithm_t prngPatchFunction, void *pCustomPrngState)
 Function to enable the PRNG patch mode.
 
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.
 

Detailed Description

Defines all functions of mcuxClRandom.

Function Documentation

◆ mcuxClRandom_init()

mcuxClRandom_Status_t mcuxClRandom_init ( mcuxClSession_Handle_t  pSession,
mcuxClRandom_Context_t  pContext,
mcuxClRandom_Mode_t  mode 
)

Random data generator initialization function.

This function performs the initialization of a random data generator. This operation initializes the Random context referenced in the session handle.

Parameters
[in]pSessionHandle for the current CL session.
[in]pContextPointer to a Random data context buffer large enough to hold the context for the selected mode
[in]modeMode of operation for random data generator.
Returns
status
Examples
mcuxClRandomModes_CtrDrbg_AES256_DRG3_example.c, mcuxClRandomModes_CtrDrbg_AES256_DRG4_example.c, mcuxClRandomModes_CtrDrbg_AES256_ELS_example.c, mcuxClRandomModes_Different_Sessions_example.c, mcuxClRandomModes_ELS_example.c, mcuxClRandomModes_PatchMode_CtrDrbg_AES256_DRG3_example.c, and mcuxClRandomModes_TestMode_CtrDrbg_AES256_DRG4_example.c.

◆ mcuxClRandom_reseed()

mcuxClRandom_Status_t mcuxClRandom_reseed ( mcuxClSession_Handle_t  pSession)

Random data generator reseed function.

This function performs the reseeding of a random data generator. This operation fetches a fresh seed from a TRNG and updates the state in the Random context referenced in the session handle.

Parameters
[in]pSessionHandle for the current CL session.
Returns
status
Examples
mcuxClRandomModes_CtrDrbg_AES256_DRG3_example.c, mcuxClRandomModes_CtrDrbg_AES256_DRG4_example.c, mcuxClRandomModes_CtrDrbg_AES256_ELS_example.c, mcuxClRandomModes_Different_Sessions_example.c, and mcuxClRandomModes_TestMode_CtrDrbg_AES256_DRG4_example.c.

◆ mcuxClRandom_generate()

mcuxClRandom_Status_t mcuxClRandom_generate ( mcuxClSession_Handle_t  pSession,
mcuxCl_Buffer_t  pOut,
uint32_t  outLength 
)

Random data generation function.

This function generates random data based on the information contained in the Random context referenced in the session handle.

Parameters
[in]pSessionHandle for the current CL session.
[out]pOutBuffer in which the generated random data must be written.
[in]outLengthNumber of random data bytes that must be written in the pOut buffer.
Returns
status
Examples
mcuxClRandomModes_CtrDrbg_AES256_DRG3_example.c, mcuxClRandomModes_CtrDrbg_AES256_DRG4_example.c, mcuxClRandomModes_CtrDrbg_AES256_ELS_example.c, mcuxClRandomModes_Different_Sessions_example.c, mcuxClRandomModes_ELS_example.c, mcuxClRandomModes_PatchMode_CtrDrbg_AES256_DRG3_example.c, and mcuxClRandomModes_TestMode_CtrDrbg_AES256_DRG4_example.c.

◆ mcuxClRandom_uninit()

mcuxClRandom_Status_t mcuxClRandom_uninit ( mcuxClSession_Handle_t  pSession)

Random data generator uninitialization function.

This function performs the cleanup of a random data generator. This operation cleans up the Random context referenced in the session handle.

Parameters
[in]pSessionHandle for the current CL session.
Returns
status
Examples
mcuxClRandomModes_CtrDrbg_AES256_DRG3_example.c, mcuxClRandomModes_CtrDrbg_AES256_DRG4_example.c, mcuxClRandomModes_CtrDrbg_AES256_ELS_example.c, mcuxClRandomModes_Different_Sessions_example.c, mcuxClRandomModes_ELS_example.c, mcuxClRandomModes_PatchMode_CtrDrbg_AES256_DRG3_example.c, and mcuxClRandomModes_TestMode_CtrDrbg_AES256_DRG4_example.c.

◆ mcuxClRandom_selftest()

mcuxClRandom_Status_t mcuxClRandom_selftest ( mcuxClSession_Handle_t  pSession,
mcuxClRandom_Mode_t  mode 
)

Random data generator self-test function.

This function performs a series of selft-tests on the random data generator. These tests are performed on the random data generator defined by Random context referenced in the session handle.

Parameters
[in]pSessionHandle for the current CL session.
Returns
status
Examples
mcuxClRandomModes_CtrDrbg_AES256_DRG3_example.c, mcuxClRandomModes_CtrDrbg_AES256_DRG4_example.c, mcuxClRandomModes_CtrDrbg_AES256_ELS_example.c, and mcuxClRandomModes_Different_Sessions_example.c.

◆ mcuxClRandom_checkSecurityStrength()

mcuxClRandom_Status_t mcuxClRandom_checkSecurityStrength ( mcuxClSession_Handle_t  pSession,
uint32_t  securityStrength 
)

Random data generator security strength check.

This function reports whether the the random data generator can provide the requested security strength.

Parameters
[in]pSessionHandle for the current CL session.
[in]securityStrengthRequested security strength in bits.
Returns
status

◆ mcuxClRandom_ncPatch()

mcuxClRandom_Status_t mcuxClRandom_ncPatch ( mcuxClSession_Handle_t  pSession,
mcuxClRandom_CustomNcGenerateAlgorithm_t  prngPatchFunction,
void *  pCustomPrngState 
)

Function to enable the PRNG patch mode.

In PRNG patch mode all calls to mcuxClRandom_ncGenerate are mapped to prngPatchFunction. pCustomPrngState can be used to allow a stateful prngPatchFunction. mcuxClRandom_ncInit does not need to be called before this. A subsequent call to mcuxClRandom_ncInit will deactivate patch mode.

Parameters
[in]pSessionSession of the PRNG to be patched.
[in]prngPatchFunctionFunction pointer of the custom PRNG patch function.
[in]pCustomPrngStatePointer to a custom prng state to be maintained by prngPatchFunction
Returns
status
Examples
mcuxClRandom_PRNG_Patch_example.c.

◆ mcuxClRandom_ncInit()

mcuxClRandom_Status_t mcuxClRandom_ncInit ( mcuxClSession_Handle_t  pSession)

Non-cryptographic PRNG initialization function.

This function performs the initialization of the non-cryptographic random number generator. If PRNG patching is active, this will also deactivate PRNG patch mode and reset to normal PRNG operation mode. A potential custom prng state is removed from pSession, but not cleared.

Parameters
[in]pSessionHandle for the current CL session.
Returns
status
Examples
mcuxClRandomModes_ELS_example.c, mcuxClRandom_PRNG_Patch_example.c, mcuxClRsa_sign_NoEncode_example.c, mcuxClRsa_sign_pss_sha2_256_example.c, mcuxClRsa_verify_NoVerify_example.c, and mcuxClRsa_verify_pssverify_sha2_256_example.c.

◆ mcuxClRandom_ncGenerate()

mcuxClRandom_Status_t mcuxClRandom_ncGenerate ( mcuxClSession_Handle_t  pSession,
mcuxCl_Buffer_t  pOut,
uint32_t  outLength 
)

Non-cryptographic PRNG data generation function.

This function generates non-cryptographic random data

Parameters
[in]pSessionHandle for the current CL session.
[out]pOutBuffer in which the generated random data must be written.
[in]outLengthNumber of random data bytes that must be written in the pOut buffer.
Returns
status
Examples
mcuxClRandomModes_ELS_example.c, and mcuxClRandom_PRNG_Patch_example.c.