AES_CMAC

Implementation of the AES CMAC hashing function.

int cmac_init(cmac_context_t * ctx, const uint8_t * key, uint8_t key_size)

Initialize CMAC message digest context.

Parameters

ctx:Pointer to the CMAC context to initialize
key:Key to be set
key_size:Size of the key

Return values

  • CIPHER_INIT_SUCCESS if the initialization was successful. CIPHER_ERR_INVALID_KEY_SIZE if the key size is not valid.
void cmac_update(cmac_context_t * ctx, const void * data, msp430_types.h::size_t len)

Update the CMAC context with a portion of the message being hashed.

Parameters

ctx:Pointer to the CMAC context to update
data:Input data
len:Length of data

void cmac_final(cmac_context_t * ctx, void * digest)

Finalizes the CMAC message digest.

Parameters

ctx:Pointer to the CMAC context
digest:Result location

CMAC_BLOCK_SIZE

Length of AES_CMAC block in bytes.

1
16
struct cmac_context_t

AES_CMAC calculation context.

cipher_t aes_ctx

AES128 context.

uint8_t X()

auxiliar array for CMAC calculations

uint8_t M_last()

current last block

uint32_t M_n

last byte in last block