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 TypeArgument NameTypeDescription
1crypto_HandlerType_EhandlerType_enInputEnum for crypto operation handler i.e., SW, HW.
2uint8_t*ptr_inputDataInputInput data to decrypt.
3uint32_tdataLenInputInput length of plain data in bytes.
4uint8_t*ptr_outDataOutputPointer to store plain text as output.
5uint8_t*ptr_keyInputKey for the AES-EAX cipher operation.
6uint32_tkeyLenInputKey length in bytes for the AES-EAX algorithm.
7uint8_t*ptr_nonceInputPointer for the Nonce value.
8uint32_tnonceLenInputLength of Nonce in bytes.
9uint8_t*ptr_aadInputPointer for additional authentication data. It is optional to use, so it can be NULL also.
10uint32_taadLenInputLength of additional authentication data, as it is optional so it can be 0 also.
11uint8_t*ptr_authTagInputPointer for authentication tag.
12uint8_t*authTagLenInputAuthentication tag length in bytes, max 16 bytes.
13uint32_tsessionIDInputIt defines the session ID, must be more than zero.

Returns

Return TypeDescription
crypto_Aead_Status_EFunction 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
    );