Jump to main content

# 1.2.11.4.3 CIPHER_Wrapper_AesCcmAuthDecrypt Function

## C

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

## Summary

Performs AES-CCM authenticated decryption of a buffer.

## Description

This function performs AES-CCM authenticated decryption of a buffer.

## Precondition

Key must be set earlier with a call to CIPHER_Wrapper_AesCcmSetkey.

## Parameters

Param | Description
--- | ---
data | Pointer to buffer holding the input ciphered data. The output plain data is stored in the same buffer.
dataLen | Length of the input/output data in bytes.
iv | Pointer to initialization vector (nonce).
ivLen | Length of the nonce in bytes.
aad | Pointer to additional authentication data field.
aadLen | Length of additional authentication data in bytes.
tag | Pointer to buffer holding the authentication tag.
tagLen | Length of the authentication tag in bytes.

## Returns

- CIPHER_WRAPPER_RETURN_GOOD: Successful decryption and authentication
- Any other value: Error in the decryption or authentication

## 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_AesCcmSetkey(key, sizeof(key));
    ret = CIPHER_Wrapper_AesCcmAuthDecrypt(data, sizeof(data),
                                            nonce, sizeof(nonce),
                                            aad, sizeof(aad),
                                            tag, sizeof(tag));

## Remarks

None.

Rev: G