ll_aes.h File Reference

Header file containing functions prototypes of AES LL library. More...

#include "gr5x.h"

Go to the source code of this file.

Classes

struct  _ll_aes_init
 LL AES Init Structure definition. More...
 

Macros

#define LL_AES_FLAG_DATAREADY   AES_STAT_READY
 
#define LL_AES_FLAG_DMA_DONE   AES_STAT_DMA_XFE_CPLT
 
#define LL_AES_FLAG_DMA_ERR   AES_STAT_DMA_XFE_ERR
 
#define LL_AES_FLAG_KEY_VALID   AES_STAT_KEY_STAT
 
#define LL_AES_KEY_SIZE_128   0x00000000U
 
#define LL_AES_KEY_SIZE_192   (1UL << AES_CFG_KEY_MODE_POS)
 
#define LL_AES_KEY_SIZE_256   (2UL << AES_CFG_KEY_MODE_POS)
 
#define LL_AES_OPERATION_MODE_ECB   0x00000000U
 
#define LL_AES_OPERATION_MODE_CBC   (1UL << AES_CFG_OPT_MODE_POS)
 
#define LL_AES_KEYTYPE_MCU   0x00000000U
 
#define LL_AES_KEYTYPE_AHB   (1UL << AES_CFG_KEY_TYPE_POS)
 
#define LL_AES_KEYTYPE_KRAM   (2UL << AES_CFG_KEY_TYPE_POS)
 
#define LL_AES_KEYMODE_NORMAL   0x00000000U
 
#define LL_AES_KEYMODE_KEYWRAP   (1UL << AES_CFG_KEY_WRAP_POS)
 
#define LL_AES_DMA_TRANSIZE_MIN   (1)
 
#define LL_AES_DMA_TRANSIZE_MAX   (2048)
 
#define LL_AES_KEYRAM_KEYSLOT_0   ((uint32_t)0x00000000U)
 
#define LL_AES_KEYRAM_KEYSLOT_1   ((uint32_t)0x00000010U)
 
#define LL_AES_KEYRAM_KEYSLOT_2   ((uint32_t)0x00000020U)
 
#define LL_AES_KEYRAM_KEYSLOT_3   ((uint32_t)0x00000030U)
 
#define LL_AES_KEYRAM_KEYSLOT_4   ((uint32_t)0x00000040U)
 
#define LL_AES_KEYRAM_KEYSLOT_5   ((uint32_t)0x00000050U)
 
#define LL_AES_KEYRAM_KEYSLOT_6   ((uint32_t)0x00000060U)
 
#define LL_AES_KEYRAM_KEYSLOT_7   ((uint32_t)0x00000070U)
 
#define LL_AES_KEYRAM_KEYSLOT_8   ((uint32_t)0x00000080U)
 
#define LL_AES_KEYRAM_KEYSLOT_9   ((uint32_t)0x00000090U)
 
#define LL_AES_KEYRAM_KEYSLOT_10   ((uint32_t)0x000000A0U)
 
#define LL_AES_KEYRAM_KEYSLOT_11   ((uint32_t)0x000000B0U)
 
#define LL_AES_KEYRAM_KEYSLOT_12   ((uint32_t)0x000000C0U)
 
#define LL_AES_KEYRAM_KEYSLOT_13   ((uint32_t)0x000000D0U)
 
#define LL_AES_KEYRAM_KEYSLOT_14   ((uint32_t)0x000000E0U)
 
#define LL_AES_KEYRAM_KEYSLOT_15   ((uint32_t)0x000000F0U)
 
#define LL_AES_WriteReg(__INSTANCE__, __REG__, __VALUE__)   WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
 Write a value in AES register. More...
 
#define LL_AES_ReadReg(__INSTANCE__, __REG__)   READ_REG(__INSTANCE__->__REG__)
 Read a value in AES register. More...
 

Typedefs

typedef struct _ll_aes_init ll_aes_init_t
 LL AES Init Structure definition. More...
 

Functions

__STATIC_INLINE void ll_aes_enable (aes_regs_t *AESx)
 Enable AES. More...
 
__STATIC_INLINE void ll_aes_disable (aes_regs_t *AESx)
 Disable AES. More...
 
__STATIC_INLINE uint32_t ll_aes_is_enabled (aes_regs_t *AESx)
 Indicate whether the AES is enabled. More...
 
__STATIC_INLINE void ll_aes_enable_start (aes_regs_t *AESx)
 Enable AES start in MCU mode. More...
 
__STATIC_INLINE void ll_aes_disable_start (aes_regs_t *AESx)
 Disable AES start in MCU mode. More...
 
__STATIC_INLINE uint32_t ll_aes_is_enabled_start (aes_regs_t *AESx)
 Indicate whether the AES start in MCU mode is enabled. More...
 
__STATIC_INLINE void ll_aes_enable_dma_start (aes_regs_t *AESx)
 Enable AES DMA mode. More...
 
__STATIC_INLINE void ll_aes_disable_dma_start (aes_regs_t *AESx)
 Disable AES DMA mode. More...
 
__STATIC_INLINE uint32_t ll_aes_is_enabled_dma_start (aes_regs_t *AESx)
 Indicate whether the AES DMA mode is enabled. More...
 
__STATIC_INLINE void ll_aes_enable_read_key (aes_regs_t *AESx)
 Enable fetch key through AHB/key port. More...
 
__STATIC_INLINE void ll_aes_set_key_size (aes_regs_t *AESx, uint32_t size)
 Set AES key size. More...
 
__STATIC_INLINE uint32_t ll_aes_get_key_size (aes_regs_t *AESx)
 Get AES key size. More...
 
__STATIC_INLINE void ll_aes_enable_full_mask (aes_regs_t *AESx)
 Enable AES full mask. More...
 
__STATIC_INLINE void ll_aes_disable_full_mask (aes_regs_t *AESx)
 Disable AES full mask. More...
 
__STATIC_INLINE uint32_t ll_aes_is_enabled_full_mask (aes_regs_t *AESx)
 Indicate whether the AES full mask is enabled. More...
 
__STATIC_INLINE void ll_aes_enable_encryption (aes_regs_t *AESx)
 Enable AES encryption mode. More...
 
__STATIC_INLINE void ll_aes_disable_encryption (aes_regs_t *AESx)
 Disable AES encryption mode. More...
 
__STATIC_INLINE uint32_t ll_aes_is_enabled_encryption (aes_regs_t *AESx)
 Indicate whether the AES encryption mode is enabled. More...
 
__STATIC_INLINE void ll_aes_set_load_seed (aes_regs_t *AESx)
 Set AES to load seed for LFSR. More...
 
__STATIC_INLINE void ll_aes_set_first_block (aes_regs_t *AESx)
 Set AES in first block before starting the first block in normal CBC and DMA CBC mode. More...
 
__STATIC_INLINE void ll_aes_enable_little_endian (aes_regs_t *AESx)
 Enable AES in little endian. More...
 
__STATIC_INLINE void ll_aes_disable_little_endian (aes_regs_t *AESx)
 Disable AES in little endian. More...
 
__STATIC_INLINE uint32_t ll_aes_is_enabled_little_endian (aes_regs_t *AESx)
 Indicate whether the AES is in little endian. More...
 
__STATIC_INLINE void ll_aes_set_operation_mode (aes_regs_t *AESx, uint32_t mode)
 Set AES operation mode. More...
 
__STATIC_INLINE uint32_t ll_aes_get_operation_mode (aes_regs_t *AESx)
 Get AES operation mode. More...
 
__STATIC_INLINE void ll_aes_set_key_type (aes_regs_t *AESx, uint32_t Type)
 Set ways to obtain AES key. More...
 
__STATIC_INLINE uint32_t ll_aes_get_key_type (aes_regs_t *AESx)
 Get ways to obtain AES key. More...
 
__STATIC_INLINE void ll_aes_set_key_mode (aes_regs_t *AESx, uint32_t mode)
 Set AES key mode. More...
 
__STATIC_INLINE uint32_t ll_aes_get_key_mode (aes_regs_t *AESx)
 Get AES key mode. More...
 
__STATIC_INLINE void ll_aes_enable_it_done (aes_regs_t *AESx)
 Enable AES the done interrupt. More...
 
__STATIC_INLINE void ll_aes_disable_it_done (aes_regs_t *AESx)
 Disable AES the done interrupt. More...
 
__STATIC_INLINE uint32_t ll_aes_is_enabled_it_done (aes_regs_t *AESx)
 Indicate whether the done interrupt is enabled. More...
 
__STATIC_INLINE uint32_t ll_aes_is_action_flag_ready (aes_regs_t *AESx)
 Indicate whether the ready flag is set. More...
 
__STATIC_INLINE uint32_t ll_aes_is_action_flag_dma_done (aes_regs_t *AESx)
 Indicate whether the DMA transfer done flag is set. More...
 
__STATIC_INLINE uint32_t ll_aes_is_action_flag_dma_error (aes_regs_t *AESx)
 Indicate whether the DMA transfer error flag is set. More...
 
__STATIC_INLINE uint32_t ll_aes_is_action_flag_key_valid (aes_regs_t *AESx)
 Indicate whether the key valid flag is set. More...
 
__STATIC_INLINE uint32_t ll_aes_is_action_flag_it_done (aes_regs_t *AESx)
 Indicate whether the done interrupt flag is set. More...
 
__STATIC_INLINE void ll_aes_clear_flag_it_done (aes_regs_t *AESx)
 Clear the done interrupt flag. More...
 
__STATIC_INLINE void ll_aes_set_dma_transfer_block (aes_regs_t *AESx, uint32_t block)
 Set AES transfer blocks in DMA mode. More...
 
__STATIC_INLINE uint32_t ll_aes_get_dma_transfer_block (aes_regs_t *AESx)
 Get AES transfer blocks in DMA mode. More...
 
__STATIC_INLINE void ll_aes_set_dma_read_address (aes_regs_t *AESx, uint32_t address)
 Set AES read address of RAM in DMA mode. More...
 
__STATIC_INLINE uint32_t ll_aes_get_dma_read_address (aes_regs_t *AESx)
 Get AES read address of RAM in DMA mode. More...
 
__STATIC_INLINE void ll_aes_set_dma_write_address (aes_regs_t *AESx, uint32_t address)
 Set AES write address of RAM in DMA mode. More...
 
__STATIC_INLINE uint32_t ll_aes_get_dma_write_address (aes_regs_t *AESx)
 Get AES write address of RAM in DMA mode. More...
 
__STATIC_INLINE void ll_aes_set_key_address (aes_regs_t *AESx, uint32_t address)
 Set AES key address in memory. More...
 
__STATIC_INLINE uint32_t ll_aes_get_key_address (aes_regs_t *AESx)
 Get AES key address in memory. More...
 
__STATIC_INLINE uint32_t ll_aes_get_data_127_96 (aes_regs_t *AESx)
 Get AES output data[127:96]. More...
 
__STATIC_INLINE uint32_t ll_aes_get_data_95_64 (aes_regs_t *AESx)
 Get AES output data[95:64]. More...
 
__STATIC_INLINE uint32_t ll_aes_get_data_63_32 (aes_regs_t *AESx)
 Get AES output data[63:32]. More...
 
__STATIC_INLINE uint32_t ll_aes_get_data_31_0 (aes_regs_t *AESx)
 Get AES output data[31:0]. More...
 
__STATIC_INLINE void ll_aes_set_key_255_224 (aes_regs_t *AESx, uint32_t key)
 Set AES key[255:224]. More...
 
__STATIC_INLINE void ll_aes_set_key_223_192 (aes_regs_t *AESx, uint32_t key)
 Set AES key[223:192]. More...
 
__STATIC_INLINE void ll_aes_set_key_191_160 (aes_regs_t *AESx, uint32_t key)
 Set AES key[191:160]. More...
 
__STATIC_INLINE void ll_aes_set_key_159_128 (aes_regs_t *AESx, uint32_t key)
 Set AES key[159:128]. More...
 
__STATIC_INLINE void ll_aes_set_key_127_96 (aes_regs_t *AESx, uint32_t key)
 Set AES key[127:96]. More...
 
__STATIC_INLINE void ll_aes_set_key_95_64 (aes_regs_t *AESx, uint32_t key)
 Set AES key[95:64]. More...
 
__STATIC_INLINE void ll_aes_set_key_63_32 (aes_regs_t *AESx, uint32_t key)
 Set AES key[63:32]. More...
 
__STATIC_INLINE void ll_aes_set_key_31_0 (aes_regs_t *AESx, uint32_t key)
 Set AES key[31:0]. More...
 
__STATIC_INLINE void ll_aes_set_seed_in (aes_regs_t *AESx, uint32_t seed)
 Set AES input seed. More...
 
__STATIC_INLINE uint32_t ll_aes_get_seed_in (aes_regs_t *AESx)
 Get AES input seed. More...
 
__STATIC_INLINE void ll_aes_set_seed_out (aes_regs_t *AESx, uint32_t seed)
 Set AES output seed. More...
 
__STATIC_INLINE uint32_t ll_aes_get_seed_out (aes_regs_t *AESx)
 Get AES output seed. More...
 
__STATIC_INLINE void ll_aes_set_seed_Imask (aes_regs_t *AESx, uint32_t mask)
 Set sbox input data's mask. More...
 
__STATIC_INLINE uint32_t ll_aes_get_seed_Imask (aes_regs_t *AESx)
 Get sbox input data's mask. More...
 
__STATIC_INLINE void ll_aes_set_seed_Osbox (aes_regs_t *AESx, uint32_t mask)
 Set sbox output data's mask. More...
 
__STATIC_INLINE uint32_t ll_aes_get_seed_Osbox (aes_regs_t *AESx)
 Get sbox output data's mask. More...
 
__STATIC_INLINE void ll_aes_set_vector_127_96 (aes_regs_t *AESx, uint32_t vector)
 Set AES initialization vector[127:96]. More...
 
__STATIC_INLINE void ll_aes_set_vector_95_64 (aes_regs_t *AESx, uint32_t vector)
 Set AES initialization vector[95:64]. More...
 
__STATIC_INLINE void ll_aes_set_vector_63_32 (aes_regs_t *AESx, uint32_t vector)
 Set AES initialization vector[63:32]. More...
 
__STATIC_INLINE void ll_aes_set_vector_31_0 (aes_regs_t *AESx, uint32_t vector)
 Set AES initialization vector[31:0]. More...
 
__STATIC_INLINE void ll_aes_set_data_127_96 (aes_regs_t *AESx, uint32_t data)
 Set AES input data[127:96]. More...
 
__STATIC_INLINE void ll_aes_set_data_95_64 (aes_regs_t *AESx, uint32_t data)
 Set AES input data[95:64]. More...
 
__STATIC_INLINE void ll_aes_set_data_63_32 (aes_regs_t *AESx, uint32_t data)
 Set AES input data[63:32]. More...
 
__STATIC_INLINE void ll_aes_set_data_31_0 (aes_regs_t *AESx, uint32_t data)
 Set AES input data[31:0]. More...
 
__STATIC_INLINE void ll_aes_set_key_port_mask (aes_regs_t *AESx, uint32_t mask)
 Set AES fetch key port mask. More...
 
__STATIC_INLINE void ll_aes_set_keyram_offset (aes_regs_t *AESx, uint32_t offset)
 Set AES keyram offset. More...
 
__STATIC_INLINE uint32_t ll_aes_get_keyram_offset (aes_regs_t *AESx)
 Get AES keyram offset. More...
 
__STATIC_INLINE void ll_aes_clr_first_block (aes_regs_t *AESx)
 Clear AES CBC first block. More...
 
error_status_t ll_aes_deinit (aes_regs_t *AESx)
 De-initialize AES registers (Registers restored to their default values). More...
 
error_status_t ll_aes_init (aes_regs_t *AESx, ll_aes_init_t *p_aes_init)
 Initialize AES registers according to the specified parameters in p_aes_init. More...
 
void ll_aes_struct_init (ll_aes_init_t *p_aes_init)
 Set each field of a ll_aes_init_t type structure to default value. More...
 

Detailed Description

Header file containing functions prototypes of AES LL library.

Author
BLE Driver Team
Attention
#####Copyright (c) 2019 GOODIX All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file ll_aes.h.