This section describes the programming interface of the CAU3 AES driver.
|
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...
|
|
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
-
base | CAU3 peripheral base address. |
handle | Handle used for the request. |
key | 0-mod-4 aligned pointer to AES key. |
keySize | AES 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
-
| base | CAU3 peripheral base address |
| handle | Handle used for this request. |
| plaintext | Input plain text to encrypt |
[out] | ciphertext | Output 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
-
| base | CAU3 peripheral base address |
| handle | Handle used for this request. |
| ciphertext | Input plain text to encrypt |
[out] | plaintext | Output 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
-
base | CAU3 peripheral base address |
handle | Handle used for this request. |
message | is source uint8_t array of data bytes, any alignment |
size | Number of bytes in the message. |
mac | is the output 16 bytes MAC, must be a 0-mod-4 aligned address |
- Returns
- status check from task completion
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
-
base | CAU3 base address |
keySlot | is the key context |
taskDone | indicates completion signal |
- Returns
- status check from task completion