![]() |
TrustCore SDK NanoCrypto API reference
version 7.0
|
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... | |
Header file for the Nanocrypto AES-CMAC API.
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__
hwAccelCtx | If a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. |
pCtx | Pointer to AES-CMAC context data structure to be cleared. |
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.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 | ![]() |
Suite B Algorithm | ![]() |
Flowchart | AES-CMAC |
To enable this function, the following flag must not be defined:
__DISABLE_AES_CIPHERS__
hwAccelCtx | If a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. |
cmac | Pointer to buffer in which to write the final hash value, of length CMAC_RESULT_SIZE octets. |
pCtx | Pointer to AES-CMAC context data strucutre that is already initialized by AESCMAC_init(). |
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.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 | ![]() |
Suite B Algorithm | ![]() |
Flowchart | AES-CMAC |
To enable this function, the following flag must not be defined:
__DISABLE_AES_CIPHERS__
hwAccelCtx | If 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. |
pKeyMaterial | Pointer to key material for AES-CMAC. |
keyLength | Number 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). |
pCtx | Pointer to allocated AES-CMAC context data structure to initialize. |
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.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 | ![]() |
Suite B Algorithm | ![]() |
Flowchart | AES-CMAC |
To enable this function, the following flag must not be defined:
__DISABLE_AES_CIPHERS__
hwAccelCtx | If a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. |
pData | Pointer to data to be hashed or digested. |
dataLength | Number of octets of data to hash or digest (pData ). |
pCtx | Pointer to AES-CMAC context data strucutre that is already initialized by AESCMAC_init(). |
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.