AEAD (Authenticated Encryption with Associated Data) related

nRF5 SDK v15.0.0

Provides AEAD related functionality through nrf_crypto. More...

Functions

ret_code_t nrf_crypto_aead_init ( nrf_crypto_aead_context_t *const p_context, nrf_crypto_aead_info_t const *const p_info, uint8_t *p_key)
Function for initializing the AEAD calculation context. More...
ret_code_t nrf_crypto_aead_uninit (void *const p_context)
Function for uninitializing the AEAD calculation context. More...
ret_code_t nrf_crypto_aead_crypt ( nrf_crypto_aead_context_t *const p_context, nrf_crypto_operation_t operation, uint8_t *p_nonce, uint8_t nonce_size, uint8_t *p_adata, size_t adata_size, uint8_t *p_data_in, size_t data_in_size, uint8_t *p_data_out, uint8_t *p_mac, uint8_t mac_size)
Integrated encryption / decryption function. More...

Variables

const nrf_crypto_aead_info_t g_nrf_crypto_aes_ccm_128_info
External variable declaration to the info structure for AES CCM mode with a 128-bit key. More...
const nrf_crypto_aead_info_t g_nrf_crypto_aes_ccm_192_info
External variable declaration to the info structure for AES CCM mode with a 192-bit key. More...
const nrf_crypto_aead_info_t g_nrf_crypto_aes_ccm_256_info
External variable declaration to the info structure for AES CCM mode with a 256-bit key. More...
const nrf_crypto_aead_info_t g_nrf_crypto_aes_ccm_star_128_info
External variable declaration to the info structure for AES CCM* mode with a 128-bit key. More...
const nrf_crypto_aead_info_t g_nrf_crypto_aes_eax_128_info
External variable declaration to the info structure for AES EAX mode with a 128-bit key. More...
const nrf_crypto_aead_info_t g_nrf_crypto_aes_eax_192_info
External variable declaration to the info structure for AES EAX mode with a 192-bit key. More...
const nrf_crypto_aead_info_t g_nrf_crypto_aes_eax_256_info
External variable declaration to the info structure for AES EAX mode with a 256-bit key. More...
const nrf_crypto_aead_info_t g_nrf_crypto_aes_gcm_128_info
External variable declaration to the info structure for AES GCM mode with a 128-bit key. More...
const nrf_crypto_aead_info_t g_nrf_crypto_aes_gcm_192_info
External variable declaration to the info structure for AES GCM mode with a 192-bit key. More...
const nrf_crypto_aead_info_t g_nrf_crypto_aes_gcm_256_info
External variable declaration to the info structure for AES GCM mode with a 256-bit key. More...
const nrf_crypto_aead_info_t g_nrf_crypto_chacha_poly_256_info
External variable declaration to the info structure for CHACHA-POLY mode with a 256-bit key. More...

Detailed Description

Provides AEAD related functionality through nrf_crypto.

functions.

Typedef Documentation

Context type for AEAD.

Note
The size of this type is scaled for the largest AEAD backend context that is enabled in SDK configuration header file .

Function Documentation

ret_code_t nrf_crypto_aead_crypt ( nrf_crypto_aead_context_t *const p_context ,
nrf_crypto_operation_t operation ,
uint8_t * p_nonce ,
uint8_t nonce_size ,
uint8_t * p_adata ,
size_t adata_size ,
uint8_t * p_data_in ,
size_t data_in_size ,
uint8_t * p_data_out ,
uint8_t * p_mac ,
uint8_t mac_size
)

Integrated encryption / decryption function.

Parameters
[in] p_context Context object. Must be initialized before the call.
[in] operation Parameter indicating whether an encrypt (NRF_CRYPTO_ENCRYPT) or a decrypt (NRF_CRYPTO_DECRYPT) operation shall be performed.
[in] p_nonce Pointer to nonce. For nonce_size == 0 p_nonce can be NULL.
[in] nonce_size Nonce byte size. Valid values for supported modes:
  • CCM [7 ... 13]
  • CCM* [13]
  • EAX nonce size can be any length
  • GCM nonce size can be any length
  • CHACHA-POLY [12]
[in] p_adata Pointer to additional authenticated data (adata).
[in] adata_size Length of additional authenticated data in bytes. For CHACHA-POLY mode must be > 0.
[in] p_data_in Pointer to the input data buffer for encryption or decryption.
[in] data_in_size Length of the data in p_data_in buffer in bytes. Size of the p_data_out buffer must not be smaller than this value. When selecting CC310 backend data_in_size value shall be limited to 65535 bytes. Data out buffer must be at least the same length.
[out] p_data_out Pointer to the output buffer where encrypted or decrypted data will be stored. Must be at least 'data_in_size' bytes wide.
  • GCM: On encryption, the p_data_out buffer can be the same as the p_data_in buffer. On decryption, the p_data_out buffer cannot be the same as p_data_in buffer. If buffers overlap, the p_data_out buffer must trail at least 8 bytes behind the p_data_in buffer.
[out] p_mac Pointer to the MAC result buffer. Fo mac_size == 0 p_mac can be NULL.
[in] mac_size MAC byte size. Valid values for supported modes: -CCM [4, 6, 8, 10, 12, 14, 16] -CCM* [0, 4, 8, 16] -EAX [1 ... 16] -GCM [4 ... 16] -CHACHA-POLY [16]
Return values
NRF_SUCCESS Message was successfully encrypted.
ret_code_t nrf_crypto_aead_init ( nrf_crypto_aead_context_t *const p_context ,
nrf_crypto_aead_info_t const *const p_info ,
uint8_t * p_key
)

Function for initializing the AEAD calculation context.

Parameters
[in] p_context Pointer to the context object. It must be a context type associated with the object provided in the p_info parameter or other memory that can hold that context type.
[in] p_info Pointer to structure holding information about: selected AES AEAD mode, and key size.
[in] p_key Pointer to AEAD mode key.
Return values
NRF_SUCCESS Context was successfully initialized.
ret_code_t nrf_crypto_aead_uninit ( void *const p_context )

Function for uninitializing the AEAD calculation context.

Parameters
[in] p_context Pointer to the context object. It must be initialized before function call.
Return values
NRF_SUCCESS Context was successfully uninitialized.

Variable Documentation

const nrf_crypto_aead_info_t g_nrf_crypto_aes_ccm_128_info

External variable declaration to the info structure for AES CCM mode with a 128-bit key.

Note
The variable is defined in the nrf_crypto backend that is enabled in the sdk_config file.
const nrf_crypto_aead_info_t g_nrf_crypto_aes_ccm_192_info

External variable declaration to the info structure for AES CCM mode with a 192-bit key.

Note
The variable is defined in the nrf_crypto backend that is enabled in the sdk_config file.
const nrf_crypto_aead_info_t g_nrf_crypto_aes_ccm_256_info

External variable declaration to the info structure for AES CCM mode with a 256-bit key.

Note
The variable is defined in the nrf_crypto backend that is enabled in the sdk_config file.
const nrf_crypto_aead_info_t g_nrf_crypto_aes_ccm_star_128_info

External variable declaration to the info structure for AES CCM* mode with a 128-bit key.

Note
The variable is defined in the nrf_crypto backend that is enabled in the sdk_config file.
const nrf_crypto_aead_info_t g_nrf_crypto_aes_eax_128_info

External variable declaration to the info structure for AES EAX mode with a 128-bit key.

Note
The variable is defined in the nrf_crypto backend that is enabled in the sdk_config file.
const nrf_crypto_aead_info_t g_nrf_crypto_aes_eax_192_info

External variable declaration to the info structure for AES EAX mode with a 192-bit key.

Note
The variable is defined in the nrf_crypto backend that is enabled in the sdk_config file.
const nrf_crypto_aead_info_t g_nrf_crypto_aes_eax_256_info

External variable declaration to the info structure for AES EAX mode with a 256-bit key.

Note
The variable is defined in the nrf_crypto backend that is enabled in the sdk_config file.
const nrf_crypto_aead_info_t g_nrf_crypto_aes_gcm_128_info

External variable declaration to the info structure for AES GCM mode with a 128-bit key.

Note
The variable is defined in the nrf_crypto backend that is enabled in the SDK configuration header file .
const nrf_crypto_aead_info_t g_nrf_crypto_aes_gcm_192_info

External variable declaration to the info structure for AES GCM mode with a 192-bit key.

Note
The variable is defined in the nrf_crypto backend that is enabled in the SDK configuration header file .
const nrf_crypto_aead_info_t g_nrf_crypto_aes_gcm_256_info

External variable declaration to the info structure for AES GCM mode with a 256-bit key.

Note
The variable is defined in the nrf_crypto backend that is enabled in the SDK configuration header file .
const nrf_crypto_aead_info_t g_nrf_crypto_chacha_poly_256_info

External variable declaration to the info structure for CHACHA-POLY mode with a 256-bit key.

Note
The variable is defined in the nrf_crypto backend that is enabled in the SDK configuration header file .