MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
CAAM RNG driver

Overview

This section describes the programming interface of the CAAM RNG driver.

Data Structures

struct  caam_rng_config_t
 CAAM RNG configuration. More...
 

Typedefs

typedef uint32_t caam_rng_generic256_t [256/sizeof(uint32_t)]
 256-bit value used as optional additional entropy input
 

Enumerations

enum  caam_rng_state_handle_t {
  kCAAM_RngStateHandle0 = 0u,
  kCAAM_RngStateHandle1 = 1u
}
 CAAM RNG state handle. More...
 
enum  caam_rng_random_type_t {
  kCAAM_RngDataAny = 0u,
  kCAAM_RngDataOddParity = 1u,
  kCAAM_RngDataNonZero = 2u
}
 Type of random data to generate. More...
 

Functions

status_t CAAM_RNG_GetDefaultConfig (caam_rng_config_t *config)
 Initializes user configuration structure to default. More...
 
status_t CAAM_RNG_Init (CAAM_Type *base, caam_handle_t *handle, caam_rng_state_handle_t stateHandle, const caam_rng_config_t *config)
 Instantiate the CAAM RNG state handle. More...
 
status_t CAAM_RNG_Deinit (CAAM_Type *base, caam_handle_t *handle, caam_rng_state_handle_t stateHandle)
 Uninstantiate the CAAM RNG state handle. More...
 
status_t CAAM_RNG_GenerateSecureKey (CAAM_Type *base, caam_handle_t *handle, caam_rng_generic256_t additionalEntropy)
 Generate Secure Key. More...
 
status_t CAAM_RNG_Reseed (CAAM_Type *base, caam_handle_t *handle, caam_rng_state_handle_t stateHandle, caam_rng_generic256_t additionalEntropy)
 Reseed the CAAM RNG state handle. More...
 
status_t CAAM_RNG_GetRandomData (CAAM_Type *base, caam_handle_t *handle, caam_rng_state_handle_t stateHandle, void *data, size_t dataSize, caam_rng_random_type_t dataType, caam_rng_generic256_t additionalEntropy)
 Get random data. More...
 

Data Structure Documentation

struct caam_rng_config_t

Data Fields

uint32_t autoReseedInterval
 Automatic reseed internal. More...
 
caam_rng_generic256_tpersonalString
 NULL or pointer to optional personalization string.
 

Field Documentation

uint32_t caam_rng_config_t::autoReseedInterval

If set to zero, CAAM RNG will use hardware default interval of 10.000.000 generate requests.

Enumeration Type Documentation

Enumerator
kCAAM_RngStateHandle0 

CAAM RNG state handle 0.

kCAAM_RngStateHandle1 

CAAM RNG state handle 1.

Enumerator
kCAAM_RngDataAny 

CAAM RNG any random data bytes.

kCAAM_RngDataOddParity 

CAAM RNG odd parity random data bytes.

kCAAM_RngDataNonZero 

CAAM RNG non zero random data bytes.

Function Documentation

status_t CAAM_RNG_GetDefaultConfig ( caam_rng_config_t config)

This function initializes the configure structure to default value. the default value are:

* config->autoReseedInterval = 0;
* config->personalString = NULL;
*
Parameters
configUser configuration structure.
Returns
status of the request
status_t CAAM_RNG_Init ( CAAM_Type *  base,
caam_handle_t handle,
caam_rng_state_handle_t  stateHandle,
const caam_rng_config_t config 
)

This function instantiates CAAM RNG state handle. The function is blocking and returns after CAAM has processed the request.

Parameters
baseCAAM peripheral base address
handleCAAM jobRing used for this request
stateHandleRNG state handle to instantiate
configPointer to configuration structure.
Returns
Status of the request
status_t CAAM_RNG_Deinit ( CAAM_Type *  base,
caam_handle_t handle,
caam_rng_state_handle_t  stateHandle 
)

This function uninstantiates CAAM RNG state handle. The function is blocking and returns after CAAM has processed the request.

Parameters
baseCAAM peripheral base address
handlejobRing used for this request.
stateHandleRNG state handle to uninstantiate
Returns
Status of the request
status_t CAAM_RNG_GenerateSecureKey ( CAAM_Type *  base,
caam_handle_t handle,
caam_rng_generic256_t  additionalEntropy 
)

This function generates random data writes it to Secure Key registers. The function is blocking and returns after CAAM has processed the request. RNG state handle 0 is always used.

Parameters
baseCAAM peripheral base address
handlejobRing used for this request
additionalEntropyNULL or Pointer to optional 256-bit additional entropy.
Returns
Status of the request
status_t CAAM_RNG_Reseed ( CAAM_Type *  base,
caam_handle_t handle,
caam_rng_state_handle_t  stateHandle,
caam_rng_generic256_t  additionalEntropy 
)

This function reseeds the CAAM RNG state handle. For a state handle in nondeterministic mode, the DRNG is seeded with 384 bits of entropy from the TRNG and an optional 256-bit additional input from the descriptor via the Class 1 Context Register.

The function is blocking and returns after CAAM has processed the request.

Parameters
baseCAAM peripheral base address
handlejobRing used for this request
stateHandleRNG state handle to reseed
additionalEntropyNULL or Pointer to optional 256-bit additional entropy.
Returns
Status of the request
status_t CAAM_RNG_GetRandomData ( CAAM_Type *  base,
caam_handle_t handle,
caam_rng_state_handle_t  stateHandle,
void *  data,
size_t  dataSize,
caam_rng_random_type_t  dataType,
caam_rng_generic256_t  additionalEntropy 
)

This function gets random data from CAAM RNG.

The function is blocking and returns after CAAM has generated the requested data or an error occured.

Parameters
baseCAAM peripheral base address
handlejobRing used for this request
stateHandleRNG state handle used to generate random data
[out]dataPointer address used to store random data
dataSizeSize of the buffer pointed by the data parameter
dataTypeType of random data to be generated
additionalEntropyNULL or Pointer to optional 256-bit additional entropy.
Returns
Status of the request