nrfx 4.5.0
Loading...
Searching...
No Matches
CRACEN RNG HAL

Hardware access layer for managing the Crypto Accelerator Engine (CRACEN) Random Generator (RNG) peripheral. More...

Data Structures

struct  nrf_cracen_rng_control_t
 CRACEN random generator configuration. More...
 

Macros

#define NRF_CRACEN_RNG_HAS_IDLE_TIMER   1
 Symbol indicating whether the TRNG FSM has an idle timer.
 
#define NRF_CRACEN_RNG_HAS_BLENDING   1
 Symbol indicating whether the TRNG has entropy blending.
 
#define NRF_CRACEN_RNG_HAS_FIFOWRITESTARTUP   1
 Symbol indicating whether the TRNG has FIFO start-up write configuration.
 
#define NRF_CRACEN_RNG_HAS_REPEATTHRESHOLD   1
 Symbol indicating whether the TRNG has REPEATTHRESHOLD register.
 
#define NRF_CRACEN_RNG_HAS_PROPTESTCUTOFF   1
 Symbol indicating whether the TRNG has PROPTESTCUTOFF register.
 
#define NRF_CRACEN_RNG_HAS_DISABLEOSC   1
 Symbol indicating whether the TRNG has DISABLEOSC register.
 
#define NRF_CRACEN_RNG_HAS_COOLDOWNPERIOD   1
 Symbol indicating whether the TRNG has COOLDOWNPERIOD register.
 
#define NRF_CRACEN_HAS_RECOMMENDED_CONF   1
 Symbol indicating whether the TRNG has specified recommended configuration parameters.
 
#define NRF_CRACEN_RNG_FIFO_SIZE   ((CRACENCORE_RNGCONTROL_FIFOTHRESHOLD_ResetValue + 1) * 16)
 

Enumerations

enum  nrf_cracen_rng_blending_t {
  NRF_CRACEN_RNG_BLENDING_CONCATENATION = CRACENCORE_RNGCONTROL_CONTROL_BLENDINGMETHOD_CONCATENATION ,
  NRF_CRACEN_RNG_BLENDING_XOR_LEVEL_1 = CRACENCORE_RNGCONTROL_CONTROL_BLENDINGMETHOD_XORLEVEL1 ,
  NRF_CRACEN_RNG_BLENDING_XOR_LEVEL_2 = CRACENCORE_RNGCONTROL_CONTROL_BLENDINGMETHOD_XORLEVEL2 ,
  NRF_CRACEN_RNG_BLENDING_VONNEUMANN = CRACENCORE_RNGCONTROL_CONTROL_BLENDINGMETHOD_VONNEUMANN
}
 CRACEN entropy blending methods. More...
 
enum  nrf_cracen_rng_fsm_state_t {
  NRF_CRACEN_RNG_FSM_STATE_RESET = CRACENCORE_RNGCONTROL_STATUS_STATE_RESET ,
  NRF_CRACEN_RNG_FSM_STATE_STARTUP = CRACENCORE_RNGCONTROL_STATUS_STATE_STARTUP ,
  NRF_CRACEN_RNG_FSM_STATE_IDLE_READY = CRACENCORE_RNGCONTROL_STATUS_STATE_IDLERON ,
  NRF_CRACEN_RNG_FSM_STATE_IDLE_STANDBY = CRACENCORE_RNGCONTROL_STATUS_STATE_IDLEROFF ,
  NRF_CRACEN_RNG_FSM_STATE_FILL_FIFO = CRACENCORE_RNGCONTROL_STATUS_STATE_FILLFIFO ,
  NRF_CRACEN_RNG_FSM_STATE_ERROR = CRACENCORE_RNGCONTROL_STATUS_STATE_ERROR
}
 CRACEN random generator FSM state. More...
 

Functions

NRF_STATIC_INLINE void nrf_cracen_rng_control_set (NRF_CRACENCORE_Type *p_reg, nrf_cracen_rng_control_t const *p_config)
 Function for setting the control register.
 
NRF_STATIC_INLINE uint32_t nrf_cracen_rng_fifo_level_get (NRF_CRACENCORE_Type const *p_reg)
 Function for getting the FIFO level.
 
NRF_STATIC_INLINE void nrf_cracen_rng_key_set (NRF_CRACENCORE_Type *p_reg, uint8_t index, uint32_t value)
 Function for setting the AES conditioning KEY registers.
 
NRF_STATIC_INLINE nrf_cracen_rng_fsm_state_t nrf_cracen_rng_fsm_state_get (NRF_CRACENCORE_Type const *p_reg)
 Function for getting the RNG FSM state.
 
NRF_STATIC_INLINE void nrf_cracen_rng_init_wait_val_set (NRF_CRACENCORE_Type *p_reg, uint16_t value)
 Function for setting the initialization wait counter value.
 
NRF_STATIC_INLINE void nrf_cracen_rng_off_timer_set (NRF_CRACENCORE_Type *p_reg, uint16_t value)
 Function for setting the switch off timer value.
 
NRF_STATIC_INLINE void nrf_cracen_rng_clk_div_set (NRF_CRACENCORE_Type *p_reg, uint16_t value)
 Function for setting the entropy subsampling rate register.
 
NRF_STATIC_INLINE uint32_t nrf_cracen_rng_fifo_get (NRF_CRACENCORE_Type const *p_reg)
 Function for getting a word from the entropy FIFO.
 
NRF_STATIC_INLINE void nrf_cracen_rng_repeatthreshold_set (NRF_CRACENCORE_Type *p_reg, uint32_t value)
 Function for setting repetition test cut-off value.
 
NRF_STATIC_INLINE void nrf_cracen_rng_proptestcutoff_set (NRF_CRACENCORE_Type *p_reg, uint32_t value)
 Function for setting proportion test cut-off value.
 
NRF_STATIC_INLINE void nrf_cracen_rng_disableosc_set (NRF_CRACENCORE_Type *p_reg, uint8_t index, uint32_t osc_mask)
 Function for disabling oscillator rings.
 
NRF_STATIC_INLINE void nrf_cracen_rng_cooldown_period_set (NRF_CRACENCORE_Type *p_reg, uint32_t period)
 Function for setting the period of cool-down sequence.
 

Detailed Description

Hardware access layer for managing the Crypto Accelerator Engine (CRACEN) Random Generator (RNG) peripheral.

Macro Definition Documentation

◆ NRF_CRACEN_RNG_FIFO_SIZE

#define NRF_CRACEN_RNG_FIFO_SIZE   ((CRACENCORE_RNGCONTROL_FIFOTHRESHOLD_ResetValue + 1) * 16)

Size of the RNG FIFO in bytes

Enumeration Type Documentation

◆ nrf_cracen_rng_blending_t

CRACEN entropy blending methods.

Enumerator
NRF_CRACEN_RNG_BLENDING_CONCATENATION 

Collate all rings oscillators outputs.

NRF_CRACEN_RNG_BLENDING_XOR_LEVEL_1 

XOR bits inside each ring oscillator set.

NRF_CRACEN_RNG_BLENDING_XOR_LEVEL_2 

Also XOR bits in-between ring oscillator sets.

NRF_CRACEN_RNG_BLENDING_VONNEUMANN 

On top of XOR_LEVEL_2 apply VON-NEUMANN debiasing.

◆ nrf_cracen_rng_fsm_state_t

CRACEN random generator FSM state.

Enumerator
NRF_CRACEN_RNG_FSM_STATE_RESET 

RNG is not started.

NRF_CRACEN_RNG_FSM_STATE_STARTUP 

RNG is starting.

NRF_CRACEN_RNG_FSM_STATE_IDLE_READY 

RNG is idle, and ready to produce more data.

NRF_CRACEN_RNG_FSM_STATE_IDLE_STANDBY 

RNG is idle, with the ring oscillators off.

NRF_CRACEN_RNG_FSM_STATE_FILL_FIFO 

RNG is filling the FIFO with entropy.

NRF_CRACEN_RNG_FSM_STATE_ERROR 

RNG has halted on an error. Reset is needed.

Function Documentation

◆ nrf_cracen_rng_clk_div_set()

NRF_STATIC_INLINE void nrf_cracen_rng_clk_div_set ( NRF_CRACENCORE_Type * p_reg,
uint16_t value )

Function for setting the entropy subsampling rate register.

Note
The ring oscillators output is sampled at Fs=Fpclk/(ClkDiv+1).
Parameters
[in]p_regPointer to the structure of registers of the RNG peripheral.
[in]valueValue to be written in the register.

◆ nrf_cracen_rng_control_set()

NRF_STATIC_INLINE void nrf_cracen_rng_control_set ( NRF_CRACENCORE_Type * p_reg,
nrf_cracen_rng_control_t const * p_config )

Function for setting the control register.

Parameters
[in]p_regPointer to the structure of registers of the RNG peripheral.
[in]p_configConfiguration to be written in the register.

◆ nrf_cracen_rng_cooldown_period_set()

NRF_STATIC_INLINE void nrf_cracen_rng_cooldown_period_set ( NRF_CRACENCORE_Type * p_reg,
uint32_t period )

Function for setting the period of cool-down sequence.

Parameters
[in]p_regPointer to the structure of registers of the RNG peripheral.
[in]periodNumber of clock cycles in cool-down sequence.

◆ nrf_cracen_rng_disableosc_set()

NRF_STATIC_INLINE void nrf_cracen_rng_disableosc_set ( NRF_CRACENCORE_Type * p_reg,
uint8_t index,
uint32_t osc_mask )

Function for disabling oscillator rings.

Note
For grouping of oscillators in the bitmask, see the Product Specification.
Parameters
[in]p_regPointer to the structure of registers of the RNG peripheral.
[in]indexOscillator group index.
[in]osc_maskMask of oscillator rings to be disabled.

◆ nrf_cracen_rng_fifo_get()

NRF_STATIC_INLINE uint32_t nrf_cracen_rng_fifo_get ( NRF_CRACENCORE_Type const * p_reg)

Function for getting a word from the entropy FIFO.

Note
The caller must ensure there is enough data by calling nrf_cracen_rng_fifo_level_get.
Parameters
[in]p_regPointer to the structure of registers of the RNG peripheral.
Returns
Entropy word read from the FIFO.

◆ nrf_cracen_rng_fifo_level_get()

NRF_STATIC_INLINE uint32_t nrf_cracen_rng_fifo_level_get ( NRF_CRACENCORE_Type const * p_reg)

Function for getting the FIFO level.

Parameters
[in]p_regPointer to the structure of registers of the RNG peripheral.
Returns
Number of random data words ready in the FIFO.

◆ nrf_cracen_rng_fsm_state_get()

NRF_STATIC_INLINE nrf_cracen_rng_fsm_state_t nrf_cracen_rng_fsm_state_get ( NRF_CRACENCORE_Type const * p_reg)

Function for getting the RNG FSM state.

Parameters
[in]p_regPointer to the structure of registers of the RNG peripheral.
Returns
State of the FSM, one of nrf_cracen_rng_fsm_state_t values.

◆ nrf_cracen_rng_init_wait_val_set()

NRF_STATIC_INLINE void nrf_cracen_rng_init_wait_val_set ( NRF_CRACENCORE_Type * p_reg,
uint16_t value )

Function for setting the initialization wait counter value.

Parameters
[in]p_regPointer to the structure of registers of the RNG peripheral.
[in]valueValue to be written in the register.

◆ nrf_cracen_rng_key_set()

NRF_STATIC_INLINE void nrf_cracen_rng_key_set ( NRF_CRACENCORE_Type * p_reg,
uint8_t index,
uint32_t value )

Function for setting the AES conditioning KEY registers.

Parameters
[in]p_regPointer to the structure of registers of the RNG peripheral.
[in]indexIndex of the key register to be written (0..3).
[in]valueValue to be written in the register.

◆ nrf_cracen_rng_off_timer_set()

NRF_STATIC_INLINE void nrf_cracen_rng_off_timer_set ( NRF_CRACENCORE_Type * p_reg,
uint16_t value )

Function for setting the switch off timer value.

Parameters
[in]p_regPointer to the structure of registers of the RNG peripheral.
[in]valueValue to be written in the register.

◆ nrf_cracen_rng_proptestcutoff_set()

NRF_STATIC_INLINE void nrf_cracen_rng_proptestcutoff_set ( NRF_CRACENCORE_Type * p_reg,
uint32_t value )

Function for setting proportion test cut-off value.

Parameters
[in]p_regPointer to the structure of registers of the RNG peripheral.
[in]valueProportion test cut-off value.

◆ nrf_cracen_rng_repeatthreshold_set()

NRF_STATIC_INLINE void nrf_cracen_rng_repeatthreshold_set ( NRF_CRACENCORE_Type * p_reg,
uint32_t value )

Function for setting repetition test cut-off value.

Parameters
[in]p_regPointer to the structure of registers of the RNG peripheral.
[in]valueRepetition test cut-off value.