ica_shake_128
Purpose
Performs a secure hash operation on the input data using the SHAKE-128 algorithm. Unlike other hash functions, the SHAKE algorithm has no fixed output length. This means that you can choose any output length which is a multiple of 8 bits (1 byte).
Format
unsigned int ica_shake_128(unsigned int message_part,
uint64_t input_length,
const unsigned char *input_data,
shake_128_context_t *shake_128_context,
unsigned char *output_data, unsigned int output_length);
Required hardware support
KIMD-SHAKE-128 and KLMD-SHAKE-128
Parameters
- unsigned int message_part
- The message chaining state. This parameter must be one of the following values:
- SHA_MSG_PART_ONLY
- a single hash operation.
- SHA_MSG_PART_FIRST
- the first part.
- SHA_MSG_PART_MIDDLE
- the middle part.
- SHA_MSG_PART_FINAL
- the last part.
- uint64_t input_length
- Length in bytes of the input data to be hashed using the SHAKE-128 algorithm. For SHA_MSG_PART_FIRST and SHA_MSG_PART_MIDDLE calls, the byte length must be a multiple of 168, that is, the SHAKE-128 block size.
- const unsigned char *input_data
- Pointer to the input data to be hashed. This pointer must not be zero. So even in case of zero size message data, it must be set to a valid value.
- shake_128_context_t *shake_128_context
- Pointer to the SHAKE-128 context structure used to store intermediate values needed when chaining is used. The contents are ignored for message part SHA_MSG_PART_ONLY and SHA_MSG_PART_FIRST. This structure must contain the returned value of the preceding call to ica_shake_128 for message part SHA_MSG_PART_MIDDLE and SHA_MSG_PART_FINAL. For message part SHA_MSG_PART_FIRST and SHA_MSG_PART_MIDDLE, the returned value can be used for a chained call of ica_shake_128. Therefore, the application must not modify the contents of this structure in between chained calls.
- unsigned char *output_data
- Pointer to the buffer to contain the resulting hash data. Done. This pointer must be available and must not be NULL. The resulting output data has a length as specified in parameter output_length. Make sure that the buffer is at least this size.
- unsigned int output_length
- The resulting length of the hashed data. The output length must not be zero and must be 1 byte or more for all message parts.
Return codes
- 0
- Success
For return codes indicating exceptions, see Return codes.