MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
RNG: Random Number Generator

Overview

The MCUXpresso SDK provides a peripheral driver for the Random Number Generator module of MCUXpresso SDK devices.

The Random Number Generator is a hardware module that generates 32-bit random numbers. A typical consumer is a pseudo random number generator (PRNG) which can be implemented to achieve both true randomness and cryptographic strength random numbers using the RNG output as its entropy seed. The data generated by a RNG is intended for direct use by functions that generate secret keys, per-message secrets, random challenges, and other similar quantities used in cryptographic algorithms.

Macros

#define FSL_RNG_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))
 RNG driver version 2.0.0. More...
 

Functions

static void RNG_Init (void)
 This function initializes random number generator.
 
static status_t GenerateSecureRng (uint8_t *pBuffer, uint32_t dwDataLength)
 This function generates CHI SQUARE tested random numbers in the passed buffer. More...
 
static status_t GenerateRng (uint8_t *pBuffer, uint32_t dwDataLength)
 This function generates random numbers buffer. More...
 
static status_t GeneratePrng (uint8_t *pBuf, uint32_t dwLen)
 This function generates random numbers buffer. More...
 
static status_t GenerateSecurePrng (uint8_t *pbiRngBuffer, uint32_t dRNrLength)
 This function generates CHI SQUARE tested random numbers in the passed buffer. More...
 

Macro Definition Documentation

#define FSL_RNG_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))

Function Documentation

static status_t GenerateSecureRng ( uint8_t *  pBuffer,
uint32_t  dwDataLength 
)
inlinestatic
Parameters
*pBuffer: Pointer to generated random number data message structure.
dwDataLength: Length of pBuffer in bytes.
Return values
kStatus_Successon successful RNG Generation
kStatus_InvalidArgumenterror code due to wrong parameter
Note
Value of RNG is 8-bit, but it is placed in 32-bit register.
This function will first enable RNG, calculate RNG and then disable RNG.
static status_t GenerateRng ( uint8_t *  pBuffer,
uint32_t  dwDataLength 
)
inlinestatic
Parameters
*pBuffer: Pointer to generated random number data message structure.
dwDataLength: Length of data message structure in bytes
Return values
kStatus_Successon successful RNG Generation
kStatus_InvalidArgumentParameter error
Note
Once started RNG will be enabled all the time and will continuously generate random numbers.
Value of RNG is 8-bit, but it is placed in 32-bit register.
static status_t GeneratePrng ( uint8_t *  pBuf,
uint32_t  dwLen 
)
inlinestatic
Parameters
*pBuf: Pointer to generated random number data message structure.
dwLen: Length of data message structure in bytes.
Return values
kStatus_Successon successful PRNG Generation
kStatus_InvalidArgumentParameter error
Note
This function is generic and not dependent on any RTOS
Once started RNG will be enabled all the time and will continuously generate random numbers
static status_t GenerateSecurePrng ( uint8_t *  pbiRngBuffer,
uint32_t  dRNrLength 
)
inlinestatic
Parameters
*pbiRngBuffer: Pointer to generated random number data message structure
dRNrLength: Length of data message structure in bytes
Return values
kStatus_Successon successful Secure PRNG generated.
kStatus_InvalidArgumentParameter error
Note
This function is generic and not dependent on any RTOS
This function will first enable RNG, calculate RNG and then disable RNG