TrustCore SDK NanoCrypto API reference  version 7.0
aes_cmac.h File Reference

Header file for the Nanocrypto AES-CMAC API. More...

Go to the source code of this file.

Functions

MOC_EXTERN MSTATUS AESCMAC_clear (MOC_SYM(hwAccelDescr hwAccelCtx) AESCMAC_Ctx *pCtx)
 Clear an existing AES-CMAC context so it is ready for re-use. More...
 
MOC_EXTERN MSTATUS AESCMAC_final (MOC_SYM(hwAccelDescr hwAccelCtx) ubyte cmac[CMAC_RESULT_SIZE], AESCMAC_Ctx *pCtx)
 Calculate final CMAC digest value. More...
 
MOC_EXTERN MSTATUS AESCMAC_init (MOC_SYM(hwAccelDescr hwAccelCtx) const ubyte *pKeyMaterial, sbyte4 keyLength, AESCMAC_Ctx *pCtx)
 Initialize a context data structure for AES-CMAC hash and prepare the key schedule. More...
 
MOC_EXTERN MSTATUS AESCMAC_update (MOC_SYM(hwAccelDescr hwAccelCtx) const ubyte *pData, sbyte4 dataLength, AESCMAC_Ctx *pCtx)
 Calcluate intermediate AES-CMAC digest value. More...
 

Detailed Description

Header file for the Nanocrypto AES-CMAC API.

Function Documentation

◆ AESCMAC_clear()

MOC_EXTERN MSTATUS AESCMAC_clear ( MOC_SYM(hwAccelDescr hwAccelCtx) AESCMAC_Ctx *  pCtx)

To enable this function, the following flag must not be defined:

  • __DISABLE_AES_CIPHERS__

aes_cmac.h

Parameters
hwAccelCtxIf a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing.
pCtxPointer to AES-CMAC context data structure to be cleared.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

aes_cmac.h

◆ AESCMAC_final()

MOC_EXTERN MSTATUS AESCMAC_final ( MOC_SYM(hwAccelDescr hwAccelCtx) ubyte  cmac[CMAC_RESULT_SIZE],
AESCMAC_Ctx *  pCtx 
)

This function calculates the final CMAC digest value. Applications must call this function after completing their calls to AESCMAC_update().

FIPS Approved
check-green.gif
Suite B Algorithm
x-red.gif
Flowchart AES-CMAC

To enable this function, the following flag must not be defined:

  • __DISABLE_AES_CIPHERS__

aes_cmac.h

Parameters
hwAccelCtxIf a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing.
cmacPointer to buffer in which to write the final hash value, of length CMAC_RESULT_SIZE octets.
pCtxPointer to AES-CMAC context data strucutre that is already initialized by AESCMAC_init().
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

aes_cmac.h

◆ AESCMAC_init()

MOC_EXTERN MSTATUS AESCMAC_init ( MOC_SYM(hwAccelDescr hwAccelCtx) const ubyte *  pKeyMaterial,
sbyte4  keyLength,
AESCMAC_Ctx *  pCtx 
)

This function initializes a context data structure for AES-CMAC hash operation, and prepares the key schedule (intermediate key material). This is the first function your application calls when performing AES-CMAC hashing operations. Your application uses the initialized structure in subsequent AES-CMAC function calls.

The AES-CMAC context data structure holds information such as key length, key schedule, and mode of operation.

FIPS Approved
check-green.gif
Suite B Algorithm
x-red.gif
Flowchart AES-CMAC

To enable this function, the following flag must not be defined:

  • __DISABLE_AES_CIPHERS__

aes_cmac.h

Parameters
hwAccelCtxIf a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. But... what does the user specify? In the 5.3.1 docs, we just said that this was "Reserved for future use." Ditto this for all aes_cmac.{c,h} functions.
pKeyMaterialPointer to key material for AES-CMAC.
keyLengthNumber of bytes in AES key; valid key lengths are: 16 (for 128-bit key), 24 (for 192-bit key), and 32 (for 256-bit key).
pCtxPointer to allocated AES-CMAC context data structure to initialize.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

aes_cmac.h

◆ AESCMAC_update()

MOC_EXTERN MSTATUS AESCMAC_update ( MOC_SYM(hwAccelDescr hwAccelCtx) const ubyte *  pData,
sbyte4  dataLength,
AESCMAC_Ctx *  pCtx 
)

This function calculates an intermediate AES-CMAC digest value.

Applications can repeatedly call this function to calculate digests for different data items. Every time this function is called, the intermediate digest value is stored within the AES-CMAC context data structure.

The AES-CMAC context data structure holds information such as key length, key schedule, and mode of operation.

FIPS Approved
check-green.gif
Suite B Algorithm
x-red.gif
Flowchart AES-CMAC

To enable this function, the following flag must not be defined:

  • __DISABLE_AES_CIPHERS__

aes_cmac.h

Parameters
hwAccelCtxIf a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing.
pDataPointer to data to be hashed or digested.
dataLengthNumber of octets of data to hash or digest (pData).
pCtxPointer to AES-CMAC context data strucutre that is already initialized by AESCMAC_init().
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

aes_cmac.h