Go to the documentation of this file.
52 #ifndef __GR55xx_HAL_HMAC_H__
53 #define __GR55xx_HAL_HMAC_H__
194 #define HAL_HMAC_ERROR_NONE ((uint32_t)0x00000000)
195 #define HAL_HMAC_ERROR_TIMEOUT ((uint32_t)0x00000001)
196 #define HAL_HMAC_ERROR_TRANSFER ((uint32_t)0x00000002)
197 #define HAL_HMAC_ERROR_INVALID_PARAM ((uint32_t)0x00000004)
203 #define HMAC_MODE_SHA LL_HMAC_CALCULATETYPE_SHA
204 #define HMAC_MODE_HMAC LL_HMAC_CALCULATETYPE_HMAC
210 #define HMAC_BLOCK_MAX (512)
211 #define HMAC_BLOCKSIZE_BITS (512)
212 #define HMAC_BLOCKSIZE_BYTES (HMAC_BLOCKSIZE_BITS >> 3)
213 #define HMAC_BLOCKSIZE_WORDS (HMAC_BLOCKSIZE_BYTES >> 2)
214 #define HMAC_DIGESTSIZE_BITS (256)
215 #define HMAC_DIGESTSIZE_BYTES (HMAC_DIGESTSIZE_BITS >> 3)
216 #define HMAC_DIGESTSIZE_WORDS (HMAC_DIGESTSIZE_BYTES >> 2)
217 #define HMAC_DMA_BLOCK_MAX (512)
223 #define HMAC_FLAG_DATAREADY_SHA LL_HMAC_FLAG_DATAREADY_SHA
224 #define HMAC_FLAG_DATAREADY_HMAC LL_HMAC_FLAG_DATAREADY_HMAC
225 #define HMAC_FLAG_DMA_MESSAGEDONE LL_HMAC_FLAG_DMA_MESSAGEDONE
226 #define HMAC_FLAG_DMA_DONE LL_HMAC_FLAG_DMA_DONE
227 #define HMAC_FLAG_DMA_ERR LL_HMAC_FLAG_DMA_ERR
228 #define HMAC_FLAG_KEY_VALID LL_HMAC_FLAG_KEY_VALID
234 #define HAL_HMAC_KEYTYPE_MCU LL_HMAC_KEYTYPE_MCU
236 #define HAL_HMAC_KEYTYPE_AHB LL_HMAC_KEYTYPE_AHB
238 #define HAL_HMAC_KEYTYPE_KRAM LL_HMAC_KEYTYPE_KRAM
244 #define HMAC_IT_DONE ((uint32_t)0x00000001)
250 #define HAL_HMAC_TIMEOUT_DEFAULT_VALUE ((uint32_t)5000)
264 #define __HAL_HMAC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_HMAC_STATE_RESET)
271 #define __HAL_HMAC_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CTRL, HMAC_CTRL_EN)
277 #define __HAL_HMAC_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CTRL, HMAC_CTRL_EN)
283 #define __HAL_HMAC_ENABLE_IT(__HANDLE__) ll_hmac_enable_it_done((__HANDLE__)->p_instance)
289 #define __HAL_HMAC_DISABLE_IT(__HANDLE__) ll_hmac_disable_it_done((__HANDLE__)->p_instance)
299 #define __HAL_HMAC_GET_FLAG_IT(__HANDLE__, __FLAG__) (READ_BITS((__HANDLE__)->p_instance->INT, (__FLAG__)) == (__FLAG__))
309 #define __HAL_HMAC_CLEAR_FLAG_IT(__HANDLE__, __FLAG__) SET_BITS((__HANDLE__)->p_instance->INT, (__FLAG__))
323 #define __HAL_HMAC_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BITS((__HANDLE__)->p_instance->STAT, (__FLAG__)) != 0) ? SET : RESET)
uint32_t hal_hmac_get_error(hmac_handle_t *p_hmac)
Return the HMAC error code.
hal_status_t hal_hmac_resume_reg(hmac_handle_t *p_hmac)
Restore some registers related to HMAC configuration after sleep. This function must be used in conju...
void hal_hmac_irq_handler(hmac_handle_t *p_hmac)
Handle HMAC interrupt request.
HMAC init Structure definition.
hal_lock_t
HAL Lock structures definition.
void(* hmac_msp_init)(hmac_handle_t *p_hmac)
struct _hmac_handle hmac_handle_t
HMAC handle Structure definition.
hal_status_t hal_hmac_suspend_reg(hmac_handle_t *p_hmac)
Suspend some registers related to HMAC configuration before sleep.
__IO hal_hmac_state_t state
void hal_hmac_msp_init(hmac_handle_t *p_hmac)
Initialize the HMAC MSP.
@ HAL_HMAC_STATE_SUSPENDED
void hal_hmac_msp_deinit(hmac_handle_t *p_hmac)
De-initialize the HMAC MSP.
hal_status_t hal_hmac_init(hmac_handle_t *p_hmac)
Initialize the HMAC according to the specified parameters in the hmac_init_t and initialize the assoc...
void(* hmac_error_callback)(hmac_handle_t *p_hmac)
struct _hal_hmac_callback hal_hmac_callback_t
HAL_HMAC Callback function definition.
struct _hmac_init hmac_init_t
HMAC init Structure definition.
hal_status_t hal_hmac_sha256_digest_it(hmac_handle_t *p_hmac, uint32_t *p_message, uint32_t number, uint32_t *p_digest)
xxx in non-blocking mode with interrupt in HMAC/SHA mode.
void hal_hmac_set_timeout(hmac_handle_t *p_hmac, uint32_t timeout)
Set the HMAC internal process timeout value.
void hal_hmac_error_callback(hmac_handle_t *p_hmac)
HMAC error callback.
hal_hmac_state_t hal_hmac_get_state(hmac_handle_t *p_hmac)
Return the HMAC handle state.
hal_status_t hal_hmac_sha256_digest(hmac_handle_t *p_hmac, uint32_t *p_message, uint32_t number, uint32_t *p_digest, uint32_t timeout)
xxx in blocking mode in HMAC/SHA mode.
HMAC handle Structure definition.
hal_status_t
HAL Status structures definition.
void(* hmac_msp_deinit)(hmac_handle_t *p_hmac)
void(* hmac_done_callback)(hmac_handle_t *p_hmac)
void hal_hmac_done_callback(hmac_handle_t *p_hmac)
Digest Done callback.
hal_hmac_state_t
HAL HMAC State enumerations definition.
hal_status_t hal_hmac_deinit(hmac_handle_t *p_hmac)
De-initialize the HMAC peripheral.
Header file containing functions prototypes of HMAC LL library.
HAL_HMAC Callback function definition.
hal_status_t hal_hmac_sha256_digest_dma(hmac_handle_t *p_hmac, uint32_t *p_message, uint32_t number, uint32_t *p_digest)
xxx in non-blocking mode with DMA in HMAC/SHA mode.
This file contains HAL common definitions, enumeration, macros and structures definitions.