SHA-3 - 2020.2 English

OS and Libraries Document Collection (UG643)

Document ID
UG643
Release Date
2020-11-24
Version
2020.2 English

This block uses the NIST-approved SHA-3 algorithm to generate a 384-bit hash on the input data. Because the SHA-3 hardware only accepts 104 byte blocks as the minimum input size, the input data will be padded with user selectable Keccak or NIST SHA-3 padding and is handled internally in the SHA-3 library.

The SHA-3 driver instance can be initialized using the XSecure_Sha3Initialize() function.

A pointer to CsuDma instance has to be passed during initialization as the CSU DMA will be used for data transfers to the SHA module.

When all the data is available on which the SHA3 hash must be calculated, the XSecure_Sha3Digest() can be used with the appropriate parameters as described. When all the data is not available, use the SHA3 functions in the following order:

  1. XSecure_Sha3Start()
  2. XSecure_Sha3Update() - This function can be called multiple times until all input data has been passed to the SHA-3 cryptographic core.
  3. XSecure_Sha3Finish() - Provides the final hash of the data. To get intermediate hash values after each XSecure_Sha3Update() , you can call XSecure_Sha3_ReadHash() after the XSecure_Sha3Update() call.
Table 1. Quick Function Reference
Type Name Arguments
s32 XSecure_Sha3Initialize
  • XSecure_Sha3 * InstancePtr
  • XCsuDma * CsuDmaPtr
void XSecure_Sha3Start
  • XSecure_Sha3 * InstancePtr
u32 XSecure_Sha3Update
  • XSecure_Sha3 * InstancePtr
  • const u8 * Data
  • const u32 Size
u32 XSecure_Sha3Finish
  • XSecure_Sha3 * InstancePtr
  • u8 * Hash
u32 XSecure_Sha3Digest
  • XSecure_Sha3 * InstancePtr
  • const u8 * In
  • const u32 Size
  • u8 * Out
void XSecure_Sha3_ReadHash
  • XSecure_Sha3 * InstancePtr
  • u8 * Hash
s32 XSecure_Sha3PadSelection
  • XSecure_Sha3 * InstancePtr
  • XSecure_Sha3PadType Sha3Type
s32 XSecure_Sha3LastUpdate
  • XSecure_Sha3 * InstancePtr
u32 XSecure_Sha3WaitForDone
  • XSecure_Sha3 * InstancePtr