5.4.2.6 Crypto_Aead_AesEax_DecryptAuthDirect
crypto_Aead_Status_E Crypto_Aead_AesEax_DecryptAuthDirect(
crypto_HandlerType_E handlerType_en,
uint8_t *ptr_inputData,
uint32_t dataLen,
uint8_t *ptr_outData,
uint8_t *ptr_key,
uint32_t keyLen,
uint8_t *ptr_nonce,
uint32_t nonceLen,
uint8_t *ptr_aad,
uint32_t aadLen,
uint8_t *ptr_authTag,
uint32_t authTagLen,
uint32_t sessionID
);
Description
This API performs AES_EAX decryption and authenticates using authentication tag in a single step without initializing.
Parameters
No. | Argument Type | Argument Name | Type | Description |
---|---|---|---|---|
1 | crypto_HandlerType_E | handlerType_en | Input | Enum for crypto operation handler i.e., SW, HW. |
2 | uint8_t* | ptr_inputData | Input | Input data to decrypt. |
3 | uint32_t | dataLen | Input | Input length of plain data in bytes. |
4 | uint8_t* | ptr_outData | Output | Pointer to store plain text as output. |
5 | uint8_t* | ptr_key | Input | Key for the AES-EAX cipher operation. |
6 | uint32_t | keyLen | Input | Key length in bytes for the AES-EAX algorithm. |
7 | uint8_t* | ptr_nonce | Input | Pointer for the Nonce value. |
8 | uint32_t | nonceLen | Input | Length of Nonce in bytes. |
9 | uint8_t* | ptr_aad | Input | Pointer for additional authentication data. It is optional to use, so it can be NULL also. |
10 | uint32_t | aadLen | Input | Length of additional authentication data, as it is optional so it can be 0 also. |
11 | uint8_t* | ptr_authTag | Input | Pointer for authentication tag. |
12 | uint8_t* | authTagLen | Input | Authentication tag length in bytes, max 16 bytes. |
13 | uint32_t | sessionID | Input | It defines the session ID, must be more than zero. |
Returns
Return Type | Description |
---|---|
crypto_Aead_Status_E | Function returns the status of the API. |
Example
#define sessionID 1
crypto_Aead_Status_E status;
crypto_HandlerType_E handlerType_en = CRYPTO_HANDLER_HW_INTERNAL;
uint8_t inputData[32] = {/*data*/};
uint32_t dataLen = sizeof(inputData);
uint8_t key[32] = {/*data*/};
uint32_t keyLen = sizeof(key);
uint8_t outData[64];
uint32_t digestLen = sizeof(outData);
uint8_t nonce[32] = {/*data*/};
uint32_t nonceLen = sizeof(nonce);
uint8_t authTag[32] = {/*data*/};
uint32_t authTagLen = 16; //auth tag length can be 4-16
uint8_t aad[32] = {/*data*/};
uint32_t aadLen = sizeof(aad);
status = Crypto_Aead_AesEax_DecryptAuthDirect(
handlerType_en,
inputData,
dataLen,
outData,
key,
keyLen,
nonce,
nonceLen,
aad,
aadLen,
authTag,
authTagLen,
sessionID
);