SmartSnippets DA1459x SDK
Files | Typedefs | Enumerations | Functions

AES/Hash Engine. More...

Files

file  hw_aes_hash.h
 Definition of API for the AES/HASH Engine Low Level Driver.
 

Typedefs

typedef void(* hw_aes_hash_cb) (uint32_t status)
 AES/Hash callback. More...
 

Enumerations

enum  HW_AES_HASH_STATUS
 AES/HASH engine status.
 
enum  HW_AES_HASH_IRQ_MASK
 Masks of AES/HASH Engine Interrupt sources. More...
 

Functions

__STATIC_INLINE void hw_aes_hash_set_input_data_mode (bool wait_more_input)
 Set AES/HASH engine input data mode. More...
 
__STATIC_INLINE bool hw_aes_hash_get_input_data_mode (void)
 Get AES/HASH engine input data mode. More...
 
__STATIC_INLINE void hw_aes_hash_set_input_data_len (uint32_t len)
 Set the input data length. More...
 
__STATIC_INLINE uint32_t hw_aes_hash_get_input_data_len (void)
 Get the input data length. More...
 
__STATIC_INLINE bool hw_aes_hash_waiting_for_input_data (void)
 Check whether the AES/Hash Engine is waiting for more input data or not. More...
 
void hw_aes_hash_set_input_data_addr (uint32_t inp_data_addr)
 Set the address of the Input Data. More...
 
void hw_aes_hash_set_output_data_addr (uint32_t out_data_addr)
 Set the address of the Output Data. More...
 
HW_AES_HASH_STATUS hw_aes_hash_get_status (void)
 Get the status of the AES/HASH engine. More...
 
__STATIC_INLINE void hw_aes_hash_enable_clock (void)
 Enable AES/HASH engine clock. More...
 
__STATIC_INLINE void hw_aes_hash_disable_clock (void)
 Disable AES/HASH engine clock. More...
 
__STATIC_INLINE bool hw_aes_hash_clock_is_enabled (void)
 Check whether the AES/HASH engine clock is enabled or not. More...
 
__ALWAYS_RETAINED_CODE bool hw_aes_hash_is_active (void)
 AES/Hash is active. More...
 
__STATIC_INLINE void hw_aes_hash_start (void)
 Start AES/HASH engine operation. More...
 
void hw_aes_hash_deinit (void)
 De-initialize AES/HASH crypto engine. More...
 
void hw_aes_hash_interrupt_enable (hw_aes_hash_cb cb)
 Enable interrupt for AES/HASH crypto engine. More...
 
void hw_aes_hash_interrupt_disable (void)
 Disable interrupt for AES/HASH crypto engine. More...
 

Detailed Description

AES/Hash Engine.

Typedef Documentation

◆ hw_aes_hash_cb

typedef void(* hw_aes_hash_cb) (uint32_t status)

AES/Hash callback.

This function is called by the AES/Hash driver when the interrupt is fired.

Enumeration Type Documentation

◆ HW_AES_HASH_IRQ_MASK

Masks of AES/HASH Engine Interrupt sources.

Use these enumerator values to detect which interrupt source triggered the Crypto_Handler by masking the status variable of the IRQ callback with them, as indicated by the next example:

void aes_hash_callback(uint32_t status)
{
bool active;
bool waiting_for_input;
active = !(status & HW_AES_HASH_IRQ_MASK_INACTIVE);
waiting_for_input = !(status & HW_AES_HASH_IRQ_MASK_WAITING_FOR_INPUT);
...

Function Documentation

◆ hw_aes_hash_clock_is_enabled()

__STATIC_INLINE bool hw_aes_hash_clock_is_enabled ( void  )

Check whether the AES/HASH engine clock is enabled or not.

Returns
true if enabled, otherwise false.

◆ hw_aes_hash_deinit()

void hw_aes_hash_deinit ( void  )

De-initialize AES/HASH crypto engine.

This function disables the AES/HASH engine interrupt, clears any pending interrupt request and disables the AES/HASH engine clock.

◆ hw_aes_hash_disable_clock()

__STATIC_INLINE void hw_aes_hash_disable_clock ( void  )

Disable AES/HASH engine clock.

◆ hw_aes_hash_enable_clock()

__STATIC_INLINE void hw_aes_hash_enable_clock ( void  )

Enable AES/HASH engine clock.

◆ hw_aes_hash_get_input_data_len()

__STATIC_INLINE uint32_t hw_aes_hash_get_input_data_len ( void  )

Get the input data length.

Returns
Input data length

◆ hw_aes_hash_get_input_data_mode()

__STATIC_INLINE bool hw_aes_hash_get_input_data_mode ( void  )

Get AES/HASH engine input data mode.

Returns
true if the AES/HASH engine expects more input data to be received, otherwise false.

◆ hw_aes_hash_get_status()

HW_AES_HASH_STATUS hw_aes_hash_get_status ( void  )

Get the status of the AES/HASH engine.

Returns
The status of the AES/HASH engine
See also
HW_AES_HASH_STATUS

◆ hw_aes_hash_interrupt_disable()

void hw_aes_hash_interrupt_disable ( void  )

Disable interrupt for AES/HASH crypto engine.

This function disables the crypto engine interrupt in the NVIC controller, disables the AES/HASH engine interrupt source and clears any registered callback function.

◆ hw_aes_hash_interrupt_enable()

void hw_aes_hash_interrupt_enable ( hw_aes_hash_cb  cb)

Enable interrupt for AES/HASH crypto engine.

This function enables the crypto engine interrupt in the NVIC controller, enables the AES/HASH engine interrupt source, and registers a callback function to serve the pending interrupt requests.

Parameters
[in]cbCallback to serve the crypto engine's interrupt requests.

◆ hw_aes_hash_is_active()

__ALWAYS_RETAINED_CODE bool hw_aes_hash_is_active ( void  )

AES/Hash is active.

Check whether the AES/Hash engine is active or not.

Warning
The AES crypto engine employs its own dedicated DMA (distinct from the system DMA) to fetch data from the memory, which utilizes the AHB-DMA bus to accomplish the data transaction. At the same time the Cortex-M33 processor utilizes the AHB-CPUC bus to fetch data in order to execute code in place, which has higher priority from the AHB-DMA.

Usually this function is called inside a loop in order to poll whether an AES operation has been completed or not. Consequently, if it resides in the XiP flash memory and the data to be processed by the AES crypto engine reside there as well, the continuous call of the function through the AHB-CPUC bus might block the engine from fetching the required data via AHB-DMA bus, actually if the instruction cache is disabled, leading the AES operation to get blocked forever. To prevent this situation, this function is always retained in SysRAM.

Returns
true if the AES/Hash engine is active, otherwise false.

◆ hw_aes_hash_set_input_data_addr()

void hw_aes_hash_set_input_data_addr ( uint32_t  inp_data_addr)

Set the address of the Input Data.

Parameters
[in]inp_data_addrAddress of the Input Data

◆ hw_aes_hash_set_input_data_len()

__STATIC_INLINE void hw_aes_hash_set_input_data_len ( uint32_t  len)

Set the input data length.

Parameters
[in]lenInput data length

◆ hw_aes_hash_set_input_data_mode()

__STATIC_INLINE void hw_aes_hash_set_input_data_mode ( bool  wait_more_input)

Set AES/HASH engine input data mode.

Parameters
[in]wait_more_inputIf true, the AES/HASH engine expects more input data to be received, thus when the current input data has been processed, it waits for incoming data by setting the corresponding flag (CRYPTO_WAIT_FOR_IN). If false, the current input data is considered as the last one and the output data is written to the memory.

◆ hw_aes_hash_set_output_data_addr()

void hw_aes_hash_set_output_data_addr ( uint32_t  out_data_addr)

Set the address of the Output Data.

Parameters
[in]out_data_addrThe output data address.

◆ hw_aes_hash_start()

__STATIC_INLINE void hw_aes_hash_start ( void  )

Start AES/HASH engine operation.

Start an AES/HASH operation depending on the configuration of the AES/HASH Engine.

◆ hw_aes_hash_waiting_for_input_data()

__STATIC_INLINE bool hw_aes_hash_waiting_for_input_data ( void  )

Check whether the AES/Hash Engine is waiting for more input data or not.

Returns
true if the AES/Hash engine is waiting more data, otherwise false.