nrfx 4.5.0
Loading...
Searching...
No Matches
CRACEN driver

Cryptographic accelerator engine (CRACEN) peripheral driver. More...

Functions

int nrfx_cracen_init (void)
 Function for initializing the CRACEN driver and peripheral.
 
void nrfx_cracen_uninit (void)
 Function for uninitializing the CRACEN driver.
 
NRFX_STATIC_INLINE int nrfx_cracen_ctr_drbg_init (void)
 Function for initializing the CRACEN CTR_DRBG random generator.
 
NRFX_STATIC_INLINE void nrfx_cracen_ctr_drbg_uninit (void)
 Function for uninitializing the CRACEN CTR_DRBG random generator.
 
int nrfx_cracen_ctr_drbg_random_get (uint8_t *p_buf, size_t size)
 Function for filling the specified p_buf buffer with size bytes of random data generated by CTR DRBG algorithm.
 
int nrfx_cracen_entropy_get (uint8_t *p_buf, size_t size)
 Function for filling a buffer with entropy from the CRACEN TRNG.
 

Detailed Description

Cryptographic accelerator engine (CRACEN) peripheral driver.

Function Documentation

◆ nrfx_cracen_ctr_drbg_init()

NRFX_STATIC_INLINE int nrfx_cracen_ctr_drbg_init ( void )

Function for initializing the CRACEN CTR_DRBG random generator.

Deprecated
Use nrfx_cracen_init instead.
Note
This initialization is relatively slow and power consuming.
This function assumes exclusive access to the CRACEN TRNG and CryptoMaster, and may not be used while any other component is using those peripherals.
Return values
0Initialization was successful.
-ECANCELEDUnexpected error.
-EALREADYDriver was already initialized.

◆ nrfx_cracen_ctr_drbg_random_get()

int nrfx_cracen_ctr_drbg_random_get ( uint8_t * p_buf,
size_t size )

Function for filling the specified p_buf buffer with size bytes of random data generated by CTR DRBG algorithm.

Note
This function assumes exclusive access to the CRACEN TRNG and CryptoMaster, and may not be used while any other component is using those peripherals.
Parameters
[out]p_bufBuffer into which to copy size generated bytes.
[in]sizeNumber of bytes to copy.
Return values
0Success.
-EINVALInvalid inputs.
-ECANCELEDUnexpected error.

◆ nrfx_cracen_ctr_drbg_uninit()

NRFX_STATIC_INLINE void nrfx_cracen_ctr_drbg_uninit ( void )

Function for uninitializing the CRACEN CTR_DRBG random generator.

Deprecated
Use nrfx_cracen_uninit instead.

◆ nrfx_cracen_entropy_get()

int nrfx_cracen_entropy_get ( uint8_t * p_buf,
size_t size )

Function for filling a buffer with entropy from the CRACEN TRNG.

When this function returns successfully, size random bytes have been written to p_buf.

Up to NRF_CRACEN_RNG_FIFO_SIZE bytes can be requested at once. If more is requested the function will return -E2BIG without copying any data.

The entropy generated by this function is NIST800-90B and AIS31 compliant, and can be used to seed FIPS 140-2 compliant pseudo random number generators.

Note
This function is blocking. It will take around a couple of tenths of microseconds to complete depending on the amount of bytes requested. (~40 microseconds for an nRF54L15 for the maximum 64 bytes)
This is a relatively power consuming operation.
Warning
This function assumes exclusive ownership of the CRACEN peripheral during execution.
Parameters
[out]p_bufBuffer into which to copy size bytes of entropy.
[in]sizeNumber of bytes to copy.
Return values
0Success.
-EINVALBuffer or size is invalid.
-E2BIGThe requested size is too big.

◆ nrfx_cracen_init()

int nrfx_cracen_init ( void )

Function for initializing the CRACEN driver and peripheral.

Note
This initialization is relatively slow and power consuming.
This function assumes exclusive access to the CRACEN TRNG and CryptoMaster, and may not be used while any other component is using those peripherals.
Return values
0Initialization was successful.
-ECANCELEDUnexpected error.
-EALREADYDriver was already initialized.