1.2.11.4.6 CIPHER_Wrapper_AesEaxDecrypt Function

C

int32_t CIPHER_Wrapper_AesEaxDecrypt(uint8_t *data, uint32_t dataLen,
                                     uint8_t *iv, uint32_t ivLen,
                                     uint8_t *aad, uint32_t aadLen,
                                     uint8_t *tag, uint32_t tagLen
                                     uint8_t *key)

Summary

Performs AES-EAX authenticated decryption of a buffer.

Description

This function performs AES-EAX encryption of a buffer and authenticates using authentication tag. The size of the key is 16 bytes.

Precondition

None.

Parameters

ParamDescription
dataPointer to buffer holding the input ciphered data. The output plain data is stored in the same buffer
dataLenLength of the input/output data in bytes
ivPointer to initialization vector (nonce)
ivLenLength of the nonce in bytes
aadPointer to additional authentication data field
aadLenLength of additional authentication data in bytes
tagPointer to buffer holding the authentication tag
tagLenLength of the authentication tag in bytes
keyPointer to buffer holding the 16-byte key itself

Returns

  • CIPHER_WRAPPER_RETURN_GOOD: Successful decryption.

  • Any other value: Error in the decryption.

Example

int32_t ret;
uint8_t nonce[] = { some initialization nonce };
uint8_t data[] = { some ciphered message };
uint8_t aad[] = { some additional authentication data };
uint8_t tag[] = { authentication tag received for verification };
uint8_t key[16] = { some key };

ret = CIPHER_Wrapper_AesEaxDecrypt(data, sizeof(data),
                                    nonce, sizeof(nonce),
                                    aad, sizeof(aad),
                                    tag, sizeof(tag),
                                    key);

Remarks

None.