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 TypeArgument NameTypeDescription
1st_Crypto_Sha_Hash_Ctx*ptr_hashCtx_stOutputHash algorithm and crypto handler selection
2crypto_Hash_Algo_EshaAlgorithm_enInputHash algorithm selection
3crypto_HandlerType_EshaHandler_enInputInput to select crypto engine i.e., SW library or HW crypto
4uint32_tshaSessionIdInputLength of the input data in number of bytes

Returns

Return TypeDescription
crypto_Hash_Status_EFunction 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.