This section describes the programming interface of the CAU3 CHACHA20_POLY1305 driver.
|
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...
|
|
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
-
base | CAU3 peripheral base address. |
handle | Handle used for the request. |
key | 0-mod-4 aligned pointer to CHACHA20_POLY1305 256-bit key. |
keySize | Size 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
-
| base | CAU3 peripheral base address |
| handle | Handle used for this request. The keySlot member specifies key context with key and IV. |
| plaintext | The uint8_t source message to be encrypted, any alignment |
[out] | ciphertext | is a pointer to the output encrypted message, any aligment |
| size | The length of the plaintext and ciphertext in bytes |
| aad | A pointer to the additional authenticated data, any alignment |
| aadLen | Length of additional authenticated data in bytes |
| nonce | 0-mod-4 aligned pointer to CHACHA20_POLY1305 96-bit nonce. |
[out] | tag | A 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
-
| base | CAU3 peripheral base address |
| handle | Handle used for this request. The keySlot member specifies key context with key and IV. |
| ciphertext | The uint8_t source msg to be decrypted, any alignment |
[out] | plaintext | A pointer to the output decrypted message, any alignment |
| size | Length of the plaintext and ciphertext in bytes |
| aad | A pointer to the additional authenticated data, any alignment |
| aadLen | Length of additional authenticated data in bytes |
| nonce | 0-mod-4 aligned pointer to CHACHA20_POLY1305 96-bit nonce. |
| tag | A pointer to the 128-bit msg digest input to be checked, any alignment |
- Returns
- status check from task completion