Functions

group group_crypto_lld_sha_functions

Functions

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Sha (CRYPTO_Type *base, uint8_t const *message, uint32_t messageSize, uint8_t *digest, cy_en_crypto_sha_mode_t mode)

Performs the SHA Hash function.

Return

cy_en_crypto_status_t

Parameters
  • base: The pointer to the CRYPTO instance.

  • mode: cy_en_crypto_sha_mode_t

  • message: The pointer to the message whose hash value is being computed.

  • messageSize: The size of the message.

  • digest: The pointer to the hash digest.

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Sha_Init (CRYPTO_Type *base, cy_stc_crypto_sha_state_t *shaHashState, cy_en_crypto_sha_mode_t mode, void *shaBuffers)

The function to initialize the SHA operation.

Return

cy_en_crypto_status_t

Parameters
  • base: The pointer to the CRYPTO instance.

  • shaHashState: The pointer to a Hash state.

  • mode: One of these: CY_CRYPTO_SHA256, CY_CRYPTO_SHA1, CY_CRYPTO_SHA256_224, CY_CRYPTO_SHA512, CY_CRYPTO_SHA384, CY_CRYPTO_SHA512_224, CY_CRYPTO_SHA512_256

  • shaBuffers: The pointer to the memory buffers storage.

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Sha_Start (CRYPTO_Type *base, cy_stc_crypto_sha_state_t *hashState)

Initializes the initial Hash vector.

Return

cy_en_crypto_status_t

Parameters
  • base: The pointer to the CRYPTO instance.

  • hashState: The pointer to the SHA context.

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Sha_Update (CRYPTO_Type *base, cy_stc_crypto_sha_state_t *hashState, uint8_t const *message, uint32_t messageSize)

Performs the SHA calculation on one message.

note

This function can be called several times only with message lengths dividable by the block size. Only the last call to the function can process a message with a not-dividable size.

Return

cy_en_crypto_status_t

Parameters
  • base: The pointer to the CRYPTO instance.

  • hashState: The pointer to the SHA context.

  • message: The pointer to the message whose Hash is being computed.

  • messageSize: The size of the message whose Hash is being computed.

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Sha_Finish (CRYPTO_Type *base, cy_stc_crypto_sha_state_t *hashState, uint8_t *digest)

Completes the SHA calculation.

Return

cy_en_crypto_status_t

Parameters
  • base: The pointer to the CRYPTO instance.

  • hashState: The pointer to the SHA context.

  • digest: The pointer to the calculated Hash digest.

__STATIC_INLINE cy_en_crypto_status_t Cy_Crypto_Core_Sha_Free (CRYPTO_Type *base, cy_stc_crypto_sha_state_t *hashState)

Clears the used memory buffers.

Return

cy_en_crypto_status_t

Parameters
  • base: The pointer to the CRYPTO instance.

  • hashState: The pointer to the SHA context.