MCUXpresso SDK API Reference Manual  Rev 2.15.000
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
CAU3 CHACHA20_POLY1305 driver

Overview

This section describes the programming interface of the CAU3 CHACHA20_POLY1305 driver.

Functions

status_t CAU3_CHACHA20_POLY1305_SetKey (CAU3_Type *base, cau3_handle_t *handle, const uint8_t *key, size_t keySize)
 Load 256-bit key into CAU3 key context (in key slot). More...
 
status_t CAU3_CHACHA20_POLY1305_Encrypt (CAU3_Type *base, cau3_handle_t *handle, const uint8_t *plaintext, uint8_t *ciphertext, size_t size, const uint8_t *aad, size_t aadLen, const uint8_t *nonce, uint8_t *tag)
 Perform ChaCha-Poly encryption/authentication. More...
 
status_t CAU3_CHACHA20_POLY1305_Decrypt (CAU3_Type *base, cau3_handle_t *handle, const uint8_t *ciphertext, uint8_t *plaintext, size_t size, const uint8_t *aad, size_t aadLen, const uint8_t *nonce, const uint8_t *tag)
 Perform ChaCha-Poly decryption/authentication check. More...
 

Function Documentation

status_t CAU3_CHACHA20_POLY1305_SetKey ( CAU3_Type *  base,
cau3_handle_t handle,
const uint8_t *  key,
size_t  keySize 
)

Load the key context into the private DMEM for CHACHA20_POLY1305 AEAD.

Parameters
baseCAU3 peripheral base address.
handleHandle used for the request.
key0-mod-4 aligned pointer to CHACHA20_POLY1305 256-bit key.
keySizeSize of the key in bytes. Shall be 32.
Returns
status from set key operation
status_t CAU3_CHACHA20_POLY1305_Encrypt ( CAU3_Type *  base,
cau3_handle_t handle,
const uint8_t *  plaintext,
uint8_t *  ciphertext,
size_t  size,
const uint8_t *  aad,
size_t  aadLen,
const uint8_t *  nonce,
uint8_t *  tag 
)

Perform ChaCha encryption over a message of "n" bytes, and authentication over the encrypted data plus an additional authenticated data, returning encrypted data + a message digest.

Parameters
baseCAU3 peripheral base address
handleHandle used for this request. The keySlot member specifies key context with key and IV.
plaintextThe uint8_t source message to be encrypted, any alignment
[out]ciphertextis a pointer to the output encrypted message, any aligment
sizeThe length of the plaintext and ciphertext in bytes
aadA pointer to the additional authenticated data, any alignment
aadLenLength of additional authenticated data in bytes
nonce0-mod-4 aligned pointer to CHACHA20_POLY1305 96-bit nonce.
[out]tagA pointer to the 128-bit message digest output, any alignment
Returns
status check from task completion
status_t CAU3_CHACHA20_POLY1305_Decrypt ( CAU3_Type *  base,
cau3_handle_t handle,
const uint8_t *  ciphertext,
uint8_t *  plaintext,
size_t  size,
const uint8_t *  aad,
size_t  aadLen,
const uint8_t *  nonce,
const uint8_t *  tag 
)

Perform ChaCha decryption over a message of "n" bytes, and checks authentication over the encrypted data plus an additional authenticated data, returning decrypted data. IF the tag authentication fails, the task terminates with error and the output is forced to zero.

Parameters
baseCAU3 peripheral base address
handleHandle used for this request. The keySlot member specifies key context with key and IV.
ciphertextThe uint8_t source msg to be decrypted, any alignment
[out]plaintextA pointer to the output decrypted message, any alignment
sizeLength of the plaintext and ciphertext in bytes
aadA pointer to the additional authenticated data, any alignment
aadLenLength of additional authenticated data in bytes
nonce0-mod-4 aligned pointer to CHACHA20_POLY1305 96-bit nonce.
tagA pointer to the 128-bit msg digest input to be checked, any alignment
Returns
status check from task completion