hal_aes.h File Reference

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

#include "ll_aes.h"
#include "ll_misc.h"
#include "hal_def.h"

Go to the source code of this file.

Classes

struct  _aes_init
 AES Init Structure definition. More...
 
struct  _aes_handle
 AES handle Structure definition. More...
 
struct  _hal_aes_callback
 HAL AES Callback function definition. More...
 

Macros

#define HAL_AES_ERROR_NONE   ((uint32_t)0x00000000)
 
#define HAL_AES_ERROR_BUSY   ((uint32_t)0x00000001)
 
#define HAL_AES_ERROR_TIMEOUT   ((uint32_t)0x00000002)
 
#define HAL_AES_ERROR_TRANSFER   ((uint32_t)0x00000004)
 
#define HAL_AES_ERROR_INVALID_PARAM   ((uint32_t)0x00000008)
 
#define AES_OPERATION_MODE_ENCRYPT   (1U)
 
#define AES_OPERATION_MODE_DECRYPT   (0U)
 
#define AES_CHAININGMODE_ECB   LL_AES_OPERATION_MODE_ECB
 
#define AES_CHAININGMODE_CBC   LL_AES_OPERATION_MODE_CBC
 
#define AES_ENDIAN_MODE_BIG   (1U)
 
#define AES_ENDIAN_MODE_SMALL   (0U)
 
#define AES_KEY_TYPE_MCU   LL_AES_KEYTYPE_MCU
 
#define AES_KEY_TYPE_AHB   LL_AES_KEYTYPE_AHB
 
#define AES_KEY_TYPE_KEYRAM   LL_AES_KEYTYPE_KRAM
 
#define AES_KEY_MODE_NORMAL   LL_AES_KEYMODE_NORMAL
 
#define AES_KEY_MODE_KEYWRAP   LL_AES_KEYMODE_KEYWRAP
 
#define AES_KEYSIZE_128BITS   LL_AES_KEY_SIZE_128
 
#define AES_KEYSIZE_192BITS   LL_AES_KEY_SIZE_192
 
#define AES_KEYSIZE_256BITS   LL_AES_KEY_SIZE_256
 
#define AES_DPA_MODE_ENABLE   (1U)
 
#define AES_DPA_MODE_DISABLE   (0U)
 
#define AES_BLOCK_MAX   (2048U)
 
#define AES_BLOCKSIZE_BITS   (128U)
 
#define AES_BLOCKSIZE_BYTES   (AES_BLOCKSIZE_BITS >> 3)
 
#define AES_BLOCKSIZE_WORDS   (AES_BLOCKSIZE_BYTES >> 2)
 
#define AES_FLAG_DATAREADY   LL_AES_FLAG_DATAREADY
 
#define AES_FLAG_DMA_DONE   LL_AES_FLAG_DMA_DONE
 
#define AES_FLAG_DMA_ERR   LL_AES_FLAG_DMA_ERR
 
#define AES_FLAG_KEY_VALID   LL_AES_FLAG_KEY_VALID
 
#define AES_IT_DONE   ((uint32_t)0x00000001)
 
#define __HAL_AES_GET_FLAG_IT(__HANDLE__, __FLAG__)   (READ_BITS((__HANDLE__)->p_instance->INT, (__FLAG__)) == (__FLAG__))
 Check whether the specified AES interrupt flag is set or not. More...
 
#define __HAL_AES_CLEAR_FLAG_IT(__HANDLE__, __FLAG__)   SET_BITS((__HANDLE__)->p_instance->INT, (__FLAG__))
 Clear the specified AES interrupt flag. More...
 
#define __HAL_AES_GET_FLAG(__HANDLE__, __FLAG__)   ((READ_BITS((__HANDLE__)->p_instance->STAT, (__FLAG__)) != 0U) ? SET : RESET)
 Check whether the specified AES flag is set or not. More...
 

Typedefs

typedef struct _aes_init aes_init_t
 AES Init Structure definition. More...
 
typedef struct _aes_handle aes_handle_t
 AES handle Structure definition. More...
 
typedef struct _hal_aes_callback hal_aes_callback_t
 HAL AES Callback function definition. More...
 

Enumerations

enum  hal_aes_state_t {
  HAL_AES_STATE_RESET = 0x00,
  HAL_AES_STATE_READY = 0x01,
  HAL_AES_STATE_BUSY = 0x02
}
 HAL AES State Enumerations definition. More...
 

Functions

hal_status_t hal_aes_init (aes_handle_t *p_aes)
 Initialize the AES according to the specified parameters in the aes_init_t and initialize the associated handle. More...
 
hal_status_t hal_aes_deinit (aes_handle_t *p_aes)
 De-initialize the AES peripheral. More...
 
void hal_aes_msp_init (aes_handle_t *p_aes)
 Initialize the AES MSP. More...
 
void hal_aes_msp_deinit (aes_handle_t *p_aes)
 De-initialize the AES MSP. More...
 
hal_status_t hal_aes_ecb_encrypt (aes_handle_t *p_aes, uint32_t *p_plain_data, uint32_t number, uint32_t *p_cypher_data, uint32_t timeout)
 Encrypted an amount of data in blocking mode in ECB mode. More...
 
hal_status_t hal_aes_ecb_decrypt (aes_handle_t *p_aes, uint32_t *p_cypher_data, uint32_t number, uint32_t *p_plain_data, uint32_t timeout)
 Decrypted an amount of data in blocking mode in ECB mode. More...
 
hal_status_t hal_aes_cbc_encrypt (aes_handle_t *p_aes, uint32_t *p_plain_data, uint32_t number, uint32_t *p_cypher_data, uint32_t timeout)
 Encrypted an amount of data in blocking mode in CBC mode. More...
 
hal_status_t hal_aes_cbc_decrypt (aes_handle_t *p_aes, uint32_t *p_cypher_data, uint32_t number, uint32_t *p_plain_data, uint32_t timeout)
 Decrypted an amount of data in blocking mode in CBC mode. More...
 
hal_status_t hal_aes_ecb_encrypt_it (aes_handle_t *p_aes, uint32_t *p_plain_data, uint32_t number, uint32_t *p_cypher_data)
 Encrypted an amount of data in non-blocking mode with Interrupt in ECB mode. More...
 
hal_status_t hal_aes_ecb_decrypt_it (aes_handle_t *p_aes, uint32_t *p_cypher_data, uint32_t number, uint32_t *p_plain_data)
 Decrypted an amount of data in non-blocking mode with Interrupt in ECB mode. More...
 
hal_status_t hal_aes_cbc_encrypt_it (aes_handle_t *p_aes, uint32_t *p_plain_data, uint32_t number, uint32_t *p_cypher_data)
 Encrypted an amount of data in non-blocking mode with Interrupt in CBC mode. More...
 
hal_status_t hal_aes_cbc_decrypt_it (aes_handle_t *p_aes, uint32_t *p_cypher_data, uint32_t number, uint32_t *p_plain_data)
 Decrypted an amount of data in non-blocking mode with Interrupt in CBC mode. More...
 
hal_status_t hal_aes_ecb_encrypt_dma (aes_handle_t *p_aes, uint32_t *p_plain_data, uint32_t number, uint32_t *p_cypher_data)
 Encrypted an amount of data in non-blocking mode with DMA in ECB mode. More...
 
hal_status_t hal_aes_ecb_decrypt_dma (aes_handle_t *p_aes, uint32_t *p_cypher_data, uint32_t number, uint32_t *p_plain_data)
 Decrypted an amount of data in non-blocking mode with DMA in ECB mode. More...
 
hal_status_t hal_aes_cbc_encrypt_dma (aes_handle_t *p_aes, uint32_t *p_plain_data, uint32_t number, uint32_t *p_cypher_data)
 Encrypted an amount of data in non-blocking mode with DMA in CBC mode. More...
 
hal_status_t hal_aes_cbc_decrypt_dma (aes_handle_t *p_aes, uint32_t *p_cypher_data, uint32_t number, uint32_t *p_plain_data)
 Decrypted an amount of data in non-blocking mode with DMA in CBC mode. More...
 
void hal_aes_irq_handler (aes_handle_t *p_aes)
 Handle AES interrupt request. More...
 
void hal_aes_done_callback (aes_handle_t *p_aes)
 Encrypt or decrypt Done callback. More...
 
void hal_aes_error_callback (aes_handle_t *p_aes)
 AES error callback. More...
 
hal_aes_state_t hal_aes_get_state (aes_handle_t *p_aes)
 Return the AES handle state. More...
 
uint32_t hal_aes_get_error (aes_handle_t *p_aes)
 Return the AES error code. More...
 

Detailed Description

Header file containing functions prototypes of AES HAL 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 hal_aes.h.