Jump to main content

# 1.2.11.4.1 CIPHER_Wrapper_AesCmacDirect Function

## C

    int32_t CIPHER_Wrapper_AesCmacDirect(uint8_t *input, uint32_t inputLen,
                                         uint8_t *outputMac, uint8_t *key)

## Summary

Performs AES-CMAC to generate the MAC in single step without initialization.

## Description

This function performs AES-CMAC to generate the MAC in single step without initialization. To verify, the user can compare the generated MAC with the MAC received from sender with message. The size of the key is 16 bytes. The size of the MAC is equal to the AES block size (16 bytes).

## Precondition

None.

## Parameters

Param | Description
--- | ---
input | Pointer to buffer holding the input data.
inputLen | Length of the input data in bytes.
outputMac | Pointer to store the output data (MAC). The size of the buffer must be equal or larger than the AES block size (16 bytes).
key | Pointer to buffer holding the 16-byte key itself.

## Returns

- CIPHER_WRAPPER_RETURN_GOOD: Successful process
- Any other value: Error in the process

## Example

    int32_t ret;
    uint8_t in1[] = { some input data };
    uint8_t out1[16];
    uint8_t key[16] = { some key };

    ret = CIPHER_Wrapper_AesCmacDirect(in1, sizeof(in1), out1, key);

## Remarks

None.

Rev: G