-
Uint64 alcp_mac_context_size(void)#
Gets the size of the context for a session described by pMacInfo.
This API should be called before alcp_mac_request to identify the memory to be allocated for the context.
- Returns:
Size of context in bytes
-
alc_error_t alcp_mac_request(alc_mac_handle_p pMacHandle, alc_mac_type_t macType)#
Request a MAC handle for the specified MAC type.
This API must be called before making any other API call
Note
Error needs to be checked after each call, valid only if alcp_is_error (ret) is false
- Parameters:
macType – [in] MAC type to use
pMacHandle – [out] Library populated session handle for future mac operations.
- Returns:
Error Code for the API called. If alc_error_t is not ALC_ERROR_NONE then, an error has occurred and handle will be invalid for future operations
-
alc_error_t alcp_mac_init(alc_mac_handle_p pMacHandle, const Uint8 *key, Uint64 size, alc_mac_info_t *info)#
Set key and initialize MAC session.
This API must be called only after alcp_mac_request
Note
Error needs to be checked after each call, valid only if alcp_is_error (ret) is false
- Parameters:
pMacHandle – [in] Session handle for MAC operations
key – [in] Pointer to key for MAC operations
size – [in] Size of key in bytes
info – [in] MAC info populated based on the selected MAC type
- Returns:
Error Code for the API called. If alc_error_t is not ALC_ERROR_NONE then, an error has occurred and handle will be invalid for future operations
-
alc_error_t alcp_mac_update(alc_mac_handle_p pMacHandle, const Uint8 *buff, Uint64 size)#
Update MAC with a chunk of data to be authenticated.
This API is called to update data to be authenticated. So should be called after alcp_mac_request and before the end of session call, 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
buff – [in] The chunk of the message to be updated
size – [in] Length of input buffer in bytes
- Returns:
Error Code for the API called. If alc_error_t is not ALC_ERROR_NONE then an error has occurred and handle will be invalid for future operations
-
alc_error_t alcp_mac_finalize(alc_mac_handle_p pMacHandle, Uint8 *buff, Uint64 size)#
Finalize the MAC and copy the result.
This API is called to finalize mac so should be called after alcp_mac_init 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
buff – [in] Output buffer for the MAC
size – [in] MAC size in bytes
- Returns:
Error Code for the API called. If alc_error_t is not ALC_ERROR_NONE then an error has occurred and handle will be invalid for future operations
-
alc_error_t alcp_mac_finish(alc_mac_handle_p pMacHandle)#
Free resources that were allocated by alcp_mac_request.
This API is called to free resources so should be called to free the session
Note
alcp_mac_request() must be called before to allocate the handle.
- Parameters:
pMacHandle – [in] Session handle used for the MAC operations
- Returns:
Error Code for the API called. If alc_error_t is not ALC_ERROR_NONE then, an error has occurred and handle will be invalid for future operations
-
alc_error_t alcp_mac_reset(alc_mac_handle_p pMacHandle)#
Reset the data given during alcp_mac_update or alcp_mac_finalize.
This API is called to reset data so should be called after alcp_mac_request and before alcp_mac_finish
- Parameters:
pMacHandle – [in] Session handle for MAC operation
- Returns:
Error Code for the API called. If alc_error_t is not ALC_ERROR_NONE, an error has occurred and handle will be invalid for future operations
-
alc_error_t alcp_mac_context_copy(const alc_mac_handle_p pSrcHandle, const alc_mac_handle_p pDestHandle)#
Copy the context from source to destination.
This API can be called only after alcp_mac_init and before alcp_mac_finish on pSrcHandle
- Parameters:
pSrcHandle – [in] source mac handle
pDestHandle – [out] destination mac handle
- Returns:
alc_error_t Error code to validate the operation