-
Uint64 alcp_digest_context_size(void)#
Returns the digest context size.
This API should be called before alcp_digest_request to identify the memory to be allocated for context
- Returns:
Size of context in bytes
-
alc_error_t alcp_digest_request(alc_digest_mode_t mode, alc_digest_handle_p p_digest_handle)#
Request a handle for digest for a configuration as pointed by alc_digest_mode_t.
- Parameters:
mode – [in] Description of the requested digest session
p_digest_handle – [out] Library populated session handle for future digest operations.
- Returns:
Error Code for the API called.
-
alc_error_t alcp_digest_init(alc_digest_handle_p p_digest_handle)#
Initializes the digest handle.
This API can be called only after alcp_digest_request and before alcp_digest_finish
- Parameters:
p_digest_handle – [in] Library populated session handle
- Returns:
Error Code for the API called.
-
alc_error_t alcp_digest_update(const alc_digest_handle_p p_digest_handle, const Uint8 *buf, Uint64 size)#
Computes digest for the buffer pointed by buf for size as as mentioned by size in bytes.
This API can be called only after alcp_digest_init and before alcp_digest_finalize
Note
repeated calls to this is allowed and the handle will contain the latest digest.
- Parameters:
p_digest_handle – [in] Handle created by alcp_digest_request()
buf – [in] Input buffer
size – [in] Input buffer size in bytes.
- Returns:
Error Code for the API called.
-
alc_error_t alcp_digest_finalize(const alc_digest_handle_p p_digest_handle, Uint8 *buf, Uint64 size)#
Finalize the digest and copy the result into the output buffer.
This API can be called only after alcp_digest_update and before alcp_digest_finish
- Parameters:
p_digest_handle – [in] Handle created by alcp_digest_request()
buf – [out] Destination buffer to which digest will be copied
size – [in] Destination buffer size in bytes, should be big enough to hold the digest
- Returns:
Error Code for the API called.
-
void alcp_digest_finish(const alc_digest_handle_p p_digest_handle)#
Performs any cleanup actions.
This API is called to free resources so should be called to free the session
Note
Must be called to ensure memory allotted (if any) is cleaned.
- Parameters:
p_digest_handle – [in] Handle created by alcp_digest_request(). Once this function is called, the handle will not be valid for future calls
- Returns:
None
-
alc_error_t alcp_digest_context_copy(const alc_digest_handle_p pSrcHandle, const alc_digest_handle_p pDestHandle)#
Copies the context from source to destination.
This API can be called only after alcp_digest_init and before alcp_digest_finish on pSrcHandle
- Parameters:
pSrcHandle – [in] source digest handle
pDestHandle – [out] destination digest handle
- Returns:
alc_error_t Error code to validate the operation
-
alc_error_t alcp_digest_shake_squeeze(const alc_digest_handle_p pDigestHandle, Uint8 *pBuff, Uint64 size)#
Valid only for SHAKE algorithm for squeezing the digest out. It can be called multiple times. It should not be called with alcp_digest_finalize.
This API can be called only after alcp_digest_update and before alcp_digest_finish
- Parameters:
pDigestHandle – [in] Handle created by alcp_digest_request()
pBuff – [out] Destination Buffer for digest out
size – [in] size of data to be squeezed out
- Returns:
alc_error_t Error code to validate the operation