MCUX CLNS
MCUX Crypto Library Normal Secure
Multi part MAC interfaces

Interfaces to perform MAC operations in multi part. More...

Functions

mcuxClMac_Status_t mcuxClMac_init (mcuxClSession_Handle_t session, mcuxClMac_Context_t *const pContext, mcuxClKey_Handle_t key, mcuxClMac_Mode_t mode)
 Initialization for a multipart MAC computation. More...
 
mcuxClMac_Status_t mcuxClMac_process (mcuxClSession_Handle_t session, mcuxClMac_Context_t *const pContext, mcuxCl_InputBuffer_t pIn, uint32_t inLength)
 Data processing for a multipart MAC computation. More...
 
mcuxClMac_Status_t mcuxClMac_finish (mcuxClSession_Handle_t session, mcuxClMac_Context_t *const pContext, mcuxCl_Buffer_t pMac, uint32_t *const pMacLength)
 Finalize a MAC generation for a multipart MAC computation. More...
 

Detailed Description

Interfaces to perform MAC operations in multi part.

Function Documentation

◆ mcuxClMac_init()

mcuxClMac_Status_t mcuxClMac_init ( mcuxClSession_Handle_t  session,
mcuxClMac_Context_t *const  pContext,
mcuxClKey_Handle_t  key,
mcuxClMac_Mode_t  mode 
)

Initialization for a multipart MAC computation.

This function performs the initialization of a context for a multipart MAC computation. The algorithm to be used will be determined based on the key that is provided.

This function should only be called once, as the first step for a multipart computation.

For example, to perform a multipart AES MAC computation with a 128-bit key in CMAC mode on padded data, the following needs to be provided in this step:

  • AES128 key
  • CMAC mode

The size of the context depends on the mode used (see mcuxClMac_MemoryConsumption).

Parameters
[in]sessionHandle for the current CL session.
[in]pContextMAC context which is used to maintain the state and store other relevant information about the operation.
[in]keyKey to be used to MAC the data.
[in]modeMode that should be used during the MAC operation.
Returns
A code-flow protected error code (see Flow Protection API)
Return values
MCUXCLMAC_STATUS_OKMac operation successful
MCUXCLMAC_STATUS_ERRORError occurred during Mac operation
MCUXCLMAC_STATUS_INVALID_PARAMAn invalid parameter was given to the function
MCUXCLMAC_STATUS_FAULT_ATTACKFault attack detected

◆ mcuxClMac_process()

mcuxClMac_Status_t mcuxClMac_process ( mcuxClSession_Handle_t  session,
mcuxClMac_Context_t *const  pContext,
mcuxCl_InputBuffer_t  pIn,
uint32_t  inLength 
)

Data processing for a multipart MAC computation.

This function performs the data processing for a multipart MAC computation. The algorithm and key to be used will be determined based on the context that is provided.

This function can be called multiple times, after the multipart context initialization.

For example, to perform a multipart AES MAC computation with a 128-bit key in CMAC mode on padded data, the following needs to be provided in this step:

  • Input data

The size of the context depends on the mode used (see mcuxClMac_MemoryConsumption).

See also
mcuxClMac_init
Parameters
sessionHandle for the current CL session.
[in]pContextMAC context which is used to maintain the state and store other relevant information about the operation.
[in]pInPointer to the input buffer that contains the data that need to be processed.
[in]inLengthNumber of bytes of data in the in buffer.
Returns
A code-flow protected error code (see Flow Protection API)
Return values
MCUXCLMAC_STATUS_OKMac operation successful
MCUXCLMAC_STATUS_ERRORError occurred during Mac operation
MCUXCLMAC_STATUS_INVALID_PARAMAn invalid parameter was given to the function
MCUXCLMAC_STATUS_FAULT_ATTACKFault attack detected

◆ mcuxClMac_finish()

mcuxClMac_Status_t mcuxClMac_finish ( mcuxClSession_Handle_t  session,
mcuxClMac_Context_t *const  pContext,
mcuxCl_Buffer_t  pMac,
uint32_t *const  pMacLength 
)

Finalize a MAC generation for a multipart MAC computation.

This function performs the final MAC generation step for a multipart MAC computation. The algorithm and key to be used will be determined based on the context that is provided.

This function should only be called once, as the last step for a multipart computation.

For example, to perform a multipart AES MAC computation with a 128-bit key in CMAC mode on padded data, the following needs to be provided in this step:

  • Output data buffer, at least the size of a single AES block

The size of the context depends on the mode used (see mcuxClMac_MemoryConsumption).

See also
mcuxClMac_init
mcuxClMac_process
Parameters
[in]sessionHandle for the current CL session.
[in]pContextMAC context which is used to maintain the state and store other relevant information about the operation.
[out]pMacPointer to the output buffer where the MAC needs to be written.
[out]pMacLengthWill be incremented by the number of bytes of data that have been written to the pMac buffer.
Returns
A code-flow protected error code (see Flow Protection API)
Return values
MCUXCLMAC_STATUS_OKMac operation successful
MCUXCLMAC_STATUS_ERRORError occurred during Mac operation
MCUXCLMAC_STATUS_INVALID_PARAMAn invalid parameter was given to the function
MCUXCLMAC_STATUS_FAULT_ATTACKFault attack detected