Defines all functions of mcuxClMac. More...
Functions | |
mcuxClMac_Status_Protected_t | mcuxClMac_compute (mcuxClSession_Handle_t session, const mcuxClKey_Handle_t key, const mcuxClMac_Mode_t mode, const uint8_t *const in, uint32_t inSize, uint8_t *const mac) |
One-shot message authentication code (MAC) computation. More... | |
mcuxClMac_Status_Protected_t | mcuxClMac_init (mcuxClSession_Handle_t session, mcuxClMac_Context_t *const context, const mcuxClKey_Handle_t key, const mcuxClMac_Mode_t mode) |
Initialization for a multipart MAC computation. More... | |
mcuxClMac_Status_Protected_t | mcuxClMac_process (mcuxClSession_Handle_t session, mcuxClMac_Context_t *const context, const uint8_t *const in, uint32_t inSize) |
Data processing for a multipart MAC computation. More... | |
mcuxClMac_Status_Protected_t | mcuxClMac_finish (mcuxClSession_Handle_t session, mcuxClMac_Context_t *const context, uint8_t *const mac) |
MAC generation for a multipart MAC computation. More... | |
Defines all functions of mcuxClMac.
mcuxClMac_Status_Protected_t mcuxClMac_compute | ( | mcuxClSession_Handle_t | session, |
const mcuxClKey_Handle_t | key, | ||
const mcuxClMac_Mode_t | mode, | ||
const uint8_t *const | in, | ||
uint32_t | inSize, | ||
uint8_t *const | mac | ||
) |
One-shot message authentication code (MAC) computation.
This function performs a MAC computation in one shot. The algorithm to be used will be determined based on the key that is provided.
For example, to perform an AES MAC computation with a 128-bit key in CMAC mode on padded data, the following needs to be provided:
If the selected mode mode
is HMAC, i.e. mcuxClMac_Mode_HMAC_SHA2_256, the input buffer in
will be modified by applying padding to it. The caller must ensure that the input buffer is large enough by determining its size using MCUXCLMAC_GET_HMAC_INPUTBUFFER_LENGTH on the data size inSize
.
Also note that HMAC only works with keys loaded into coprocessor (see mcuxClKey for details).
[in] | session | |
[in] | key | Key to be used to authenticate the data. |
[in] | mode | Mode that should be used during the MAC operation. |
[in] | in | Pointer to the input buffer that contains the data that needs to be authenticated. |
[in] | inSize | Number of bytes of data in the in buffer. |
[out] | mac | Pointer to the output buffer where the MAC needs to be written. |
MCUXCLMAC_ERRORCODE_OK | Mac operation successful |
MCUXCLMAC_ERRORCODE_ERROR | Error occurred during Mac operation |
mcuxClMac_Status_Protected_t mcuxClMac_init | ( | mcuxClSession_Handle_t | session, |
mcuxClMac_Context_t *const | context, | ||
const mcuxClKey_Handle_t | key, | ||
const 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:
The size of the context depends on the mode used (see mcuxClMac_MemoryConsumption).
[in] | session | |
[in] | context | |
[in] | key | Key to be used to MAC the data. |
[in] | mode | Mode that should be used during the MAC operation. |
mcuxClMac_Status_Protected_t mcuxClMac_process | ( | mcuxClSession_Handle_t | session, |
mcuxClMac_Context_t *const | context, | ||
const uint8_t *const | in, | ||
uint32_t | inSize | ||
) |
Data processing for a multipart MAC computation.
This function performs the data processing for a multipart MAC computation.
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:
The size of the context depends on the mode used (see mcuxClMac_MemoryConsumption).
[in] | session | |
[in] | context | |
[in] | in | Pointer to the input buffer that contains the data that need to be processed. |
[in] | inSize | Number of bytes of data in the in buffer. |
MCUXCLMAC_ERRORCODE_OK | Mac operation successful |
MCUXCLMAC_ERRORCODE_ERROR | Error occurred during Mac operation |
mcuxClMac_Status_Protected_t mcuxClMac_finish | ( | mcuxClSession_Handle_t | session, |
mcuxClMac_Context_t *const | context, | ||
uint8_t *const | mac | ||
) |
MAC generation for a multipart MAC computation.
This function performs the final MAC generation step for a multipart MAC computation.
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:
The size of the context depends on the mode used (see mcuxClMac_MemoryConsumption).
[in] | session | |
[in] | context | |
[out] | mac | Pointer to the output buffer where the MAC needs to be written. |
MCUXCLMAC_ERRORCODE_OK | Mac operation successful |
MCUXCLMAC_ERRORCODE_ERROR | Error occurred during Mac operation |