HASH Engine LLD API.
More...
|
| file | hw_hash.h |
| | Definition of API for the HASH Engine Low Level Driver.
|
| |
HASH Engine LLD API.
◆ HW_HASH_OUTPUT_LENGTH_MAX
The maximum allowed output length of the HASH engine in bytes for all supported HASH types.
| Enumerator |
|---|
| HW_HASH_OUTPUT_LEN_MAX_SHA_256_224 | The maximum allowed output length for HASH Type SHA-256/224
|
| HW_HASH_OUTPUT_LEN_MAX_SHA_256 | The maximum allowed output length for HASH Type SHA-256
|
◆ HW_HASH_TYPE
HASH Type.
| Enumerator |
|---|
| HW_HASH_TYPE_SHA_256_224 | HASH Type SHA-256/224
|
| HW_HASH_TYPE_SHA_256 | HASH Type SHA-256
|
◆ hw_hash_check_input_data_len_restrictions()
| bool hw_hash_check_input_data_len_restrictions |
( |
void |
| ) |
|
Check if the restrictions of the input data length are fulfilled.
There are some restrictions in terms of the acceptable values of the data_len with regards to Input Data Mode, indicated by the next table:
| wait_more_input = true | wait_more_input = false |
| multiple of 8 | no restrictions |
- Returns
- true if the restrictions are fulfilled, otherwise false
◆ hw_hash_init()
HASH engine initialization function.
Configure the HASH engine provided that the crypto engine is NOT locked by the AES engine. If the function returns HW_HASH_ERROR_NONE, the operation can be started by calling the hw_aes_hash_start().
- Parameters
-
| [in] | hash_cfg | Configuration structure for HASH engine. |
- Returns
- HW_HASH_ERROR_NONE if the HASH engine has been successfully initialized, otherwise an error code.
- Warning
- When HASHing has been completed, the hw_aes_hash_deinit() should be called in order for the crypto engine to be unlocked from HASH. This is mandatory in case that both AES and HASH are used by the same application. The two blocks make use of the same hardware accelerator, thus they are mutually exclusive and cannot be used simultaneously. The functions hw_aes_init(), hw_hash_init() and hw_aes_hash_deinit() incorporate a mechanism which ensures mutual exclusion and prevents race condition, provided that the user doesn't call the functions hw_aes_hash_disable_clock(), hw_aes_hash_enable_clock(), hw_aes_set_mode() and hw_hash_set_type(). The aforementioned functions affect some AES/HASH register fields which are used by this mechanism and might violate it. Therefore, it is highly recommended to use the corresponding init/deinit functions instead.
- See also
- hw_hash_config_t
-
HW_HASH_ERROR
◆ hw_hash_set_output_data_len()
| __STATIC_INLINE void hw_hash_set_output_data_len |
( |
HW_HASH_TYPE |
hash_type, |
|
|
uint8_t |
output_data_len |
|
) |
| |
Set HASH output length.
There are restrictions with regards to the maximum length of the output data. If the selected output_data_len exceeds the maximum allowed length determined by HW_HASH_OUTPUT_LEN_MAX this function automatically equalizes the output length with the maximum allowed value.
- Parameters
-
| [in] | hash_type | HASH type |
| [in] | output_data_len | HASH output length |
- See also
- HW_HASH_TYPE
-
HW_HASH_OUTPUT_LEN_MAX
◆ hw_hash_set_type()
| __STATIC_INLINE void hw_hash_set_type |
( |
HW_HASH_TYPE |
hash_type | ) |
|