These APIs support multi-buffer MAC processing by enqueueing message buffers and later dequeuing the corresponding MAC outputs.
-
alc_error_t alcp_mac_flush(alc_mac_handle_p pMacHandle, const Uint8 **ppMsgBuf, Uint64 numBuffers, Uint64 msgLen)#
Stage multiple message buffers for multi-buffer MAC computation.
This API stages multiple message buffers for parallel HMAC computation. It must be called after alcp_mac_init and before alcp_mac_dequeue.
All input buffers must be the same size (msgLen bytes). This function records the buffer addresses for later processing by alcp_mac_dequeue.
Supported mode: ALC_MB_MAC_HMAC only.
Note
Error needs to be checked for each call, valid only if alcp_is_error (ret) is false
- Parameters:
pMacHandle – [in] Session handle for MAC operation
ppMsgBuf – [in] Array of pointers to input message buffers
numBuffers – [in] Number of input buffers
msgLen – [in] Length of each message buffer in bytes; all buffers must be exactly this size
- Pre:
alcp_mac_request must be called with ALC_MB_MAC_HMAC, followed by alcp_mac_init with the key and HMAC info.
- Returns:
ALC_ERROR_NONE on success.
-
alc_error_t alcp_mac_dequeue(alc_mac_handle_p pMacHandle, Uint8 **ppDstBuf, Uint64 numBuffers)#
Compute MACs for buffers staged via alcp_mac_flush.
Performs parallel HMAC computation for all buffers previously staged by alcp_mac_flush and writes each MAC to the corresponding entry in ppDstBuf.
Each output buffer must be pre-allocated with sufficient space for the MAC output. The MAC size is determined by the digest algorithm configured during alcp_mac_init (e.g., 32 bytes for HMAC-SHA256).
This API must be called after alcp_mac_flush and before alcp_mac_finish.
Note
Error needs to be checked for each call, valid only if alcp_is_error (ret) is false
- Parameters:
pMacHandle – [in] Session handle for MAC operation
ppDstBuf – [out] Array of pointers to pre-allocated output buffers for computed MACs
numBuffers – [in] Number of output buffers (must match the count provided to alcp_mac_flush)
- Pre:
alcp_mac_flush must be called before this API.
- Pre:
alcp_mac_init must be called with ALC_MB_MAC_HMAC before using this API, and numBuffers must be greater than 0.
- Returns:
ALC_ERROR_NONE on success.