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

Overview

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

Macros

#define CAU3_AES_BLOCK_SIZE   16
 AES block size in bytes.
 

Functions

status_t CAU3_AES_SetKey (CAU3_Type *base, cau3_handle_t *handle, const uint8_t *key, size_t keySize)
 Load AES key into CAU3 key slot. More...
 
status_t CAU3_AES_Encrypt (CAU3_Type *base, cau3_handle_t *handle, const uint8_t plaintext[16], uint8_t ciphertext[16])
 Encrypts AES on one 128-bit block. More...
 
status_t CAU3_AES_Decrypt (CAU3_Type *base, cau3_handle_t *handle, const uint8_t ciphertext[16], uint8_t plaintext[16])
 Decrypts AES on one 128-bit block. More...
 
status_t CAU3_AES_Cmac (CAU3_Type *base, cau3_handle_t *handle, const uint8_t *message, size_t size, uint8_t *mac)
 Perform an AES-128 cipher-based authentication code (CMAC) More...
 
status_t CAU3_AES_KeyExpansion (CAU3_Type *base, cau3_key_slot_t keySlot, cau3_task_done_t taskDone)
 Perform an AES key expansion for specified key slot. More...
 

Function Documentation

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

Load the key context into the private DMEM. This function also performs an AES key expansion. For CAU3 AES encryption/decryption/cmac, users only need to call one of CAU3_AES_SetKey and CAU3_LoadSpecialKeyContext.

CAU3_AES_SetKey

Parameters
baseCAU3 peripheral base address.
handleHandle used for the request.
key0-mod-4 aligned pointer to AES key.
keySizeAES key size in bytes. Shall equal 16 or 32.
Returns
status from set key operation
status_t CAU3_AES_Encrypt ( CAU3_Type *  base,
cau3_handle_t handle,
const uint8_t  plaintext[16],
uint8_t  ciphertext[16] 
)

Encrypts AES. The source plaintext and destination ciphertext can overlap in system memory.

Parameters
baseCAU3 peripheral base address
handleHandle used for this request.
plaintextInput plain text to encrypt
[out]ciphertextOutput cipher text
Returns
Status from encrypt operation
status_t CAU3_AES_Decrypt ( CAU3_Type *  base,
cau3_handle_t handle,
const uint8_t  ciphertext[16],
uint8_t  plaintext[16] 
)

Decrypts AES. The source ciphertext and destination plaintext can overlap in system memory.

Parameters
baseCAU3 peripheral base address
handleHandle used for this request.
ciphertextInput plain text to encrypt
[out]plaintextOutput cipher text
Returns
Status from decrypt operation
status_t CAU3_AES_Cmac ( CAU3_Type *  base,
cau3_handle_t handle,
const uint8_t *  message,
size_t  size,
uint8_t *  mac 
)

Performs an AES-128 cipher-based authentication code (CMAC) on a message. RFC 4493.

Parameters
baseCAU3 peripheral base address
handleHandle used for this request.
messageis source uint8_t array of data bytes, any alignment
sizeNumber of bytes in the message.
macis the output 16 bytes MAC, must be a 0-mod-4 aligned address
Returns
status check from task completion
status_t CAU3_AES_KeyExpansion ( CAU3_Type *  base,
cau3_key_slot_t  keySlot,
cau3_task_done_t  taskDone 
)

Performs an AES key expansion (aka schedule) on the specified key slot. It uses the keySize information in the context to determine whether the key expansion applies to a 128- or 256-bit AES key. This function is primarily intended to be called after key blob has been unwrapped by CAU3_KeyBlobUnwrap to destination key slot, so that the unwrapped key can be used for AES encryption.

Parameters
baseCAU3 base address
keySlotis the key context
taskDoneindicates completion signal
Returns
status check from task completion