ndn-lite
Functions | Variables
tc_cmac_mode.c File Reference
#include "tc_aes.h"
#include "tc_cmac_mode.h"
#include "tc_constants.h"
#include "tc_utils.h"

Functions

void gf_double (uint8_t *out, uint8_t *in)
 
int tc_cmac_setup (TCCmacState_t s, const uint8_t *key, TCAesKeySched_t sched)
 Configures the CMAC state to use the given AES key. More...
 
int tc_cmac_erase (TCCmacState_t s)
 Erases the CMAC state. More...
 
int tc_cmac_init (TCCmacState_t s)
 Initializes a new CMAC computation. More...
 
int tc_cmac_update (TCCmacState_t s, const uint8_t *data, size_t data_length)
 Incrementally computes CMAC over the next data segment. More...
 
int tc_cmac_final (uint8_t *tag, TCCmacState_t s)
 Generates the tag from the CMAC state. More...
 

Variables

static const uint64_t MAX_CALLS = ((uint64_t)1 << 48)
 
const unsigned char gf_wrap = 0x87
 

Function Documentation

◆ gf_double()

void gf_double ( uint8_t *  out,
uint8_t *  in 
)

◆ tc_cmac_erase()

int tc_cmac_erase ( TCCmacState_t  s)

Erases the CMAC state.

Returns
returns TC_CRYPTO_SUCCESS (1) after having configured the CMAC state returns TC_CRYPTO_FAIL (0) if: s == NULL
Parameters
sIN/OUT – the state to erase

◆ tc_cmac_final()

int tc_cmac_final ( uint8_t *  tag,
TCCmacState_t  s 
)

Generates the tag from the CMAC state.

Returns
returns TC_CRYPTO_SUCCESS (1) after successfully generating the tag returns TC_CRYPTO_FAIL (0) if: tag == NULL or s == NULL
Parameters
tagOUT – the CMAC tag
sIN – CMAC state

◆ tc_cmac_init()

int tc_cmac_init ( TCCmacState_t  s)

Initializes a new CMAC computation.

Returns
returns TC_CRYPTO_SUCCESS (1) after having initialized the CMAC state returns TC_CRYPTO_FAIL (0) if: s == NULL
Parameters
sIN/OUT – the state to initialize

◆ tc_cmac_setup()

int tc_cmac_setup ( TCCmacState_t  s,
const uint8_t *  key,
TCAesKeySched_t  sched 
)

Configures the CMAC state to use the given AES key.

Returns
returns TC_CRYPTO_SUCCESS (1) after having configured the CMAC state returns TC_CRYPTO_FAIL (0) if: s == NULL or key == NULL
Parameters
sIN/OUT – the state to set up
keyIN – the key to use
schedIN – AES key schedule

◆ tc_cmac_update()

int tc_cmac_update ( TCCmacState_t  s,
const uint8_t *  data,
size_t  dlen 
)

Incrementally computes CMAC over the next data segment.

Returns
returns TC_CRYPTO_SUCCESS (1) after successfully updating the CMAC state returns TC_CRYPTO_FAIL (0) if: s == NULL or if data == NULL when dlen > 0
Parameters
sIN/OUT – the CMAC state
dataIN – the next data segment to MAC
dlenIN – the length of data in bytes

Variable Documentation

◆ gf_wrap

const unsigned char gf_wrap = 0x87

◆ MAX_CALLS

const uint64_t MAX_CALLS = ((uint64_t)1 << 48)
static