4.3.2.1 Crypto_Hash_Sha_Init
crypto_Hash_Status_E Crypto_Hash_Sha_Init(
st_Crypto_Sha_Hash_Ctx *ptr_shaCtx_st,
crypto_Hash_Algo_E shaAlgorithm_en,
crypto_HandlerType_E shaHandler_en,
uint32_t shaSessionId
);
Description
This API is used to initiate context for different variants of SHA-1, SHA-2, and SHA-3 (Excluding SHAKE) algorithms.
Parameters
No. | Argument Type | Argument Name | Type | Description |
---|---|---|---|---|
1 | st_Crypto_Sha_Hash_Ctx* | ptr_hashCtx_st | Output | Hash algorithm and crypto handler selection |
2 | crypto_Hash_Algo_E | shaAlgorithm_en | Input | Hash algorithm selection |
3 | crypto_HandlerType_E | shaHandler_en | Input | Input to select crypto engine i.e., SW library or HW crypto |
4 | uint32_t | shaSessionId | Input | Length of the input data in number of bytes |
Returns
Return Type | Description |
---|---|
crypto_Hash_Status_E | Function returns the status of the API. |
Prerequisites
- To use the HW handler, the algorithm must be enabled in Crypto v4 in MPLAB® Code Configurator.
- To use the SW handler, the algorithm must be enabled in wolfCrypt, and linked to Crypto V4 in MPLAB® Code Configurator.
Example
Example provided in Crypto_Hash_Sha_Final.