/**
******************************************************************************
* @file stm32f4xx_hal_cryp_ex.c
* @author MCD Application Team
* @brief Extended CRYP HAL module driver
* This file provides firmware functions to manage the following
* functionalities of CRYP extension peripheral:
* + Extended AES processing functions
*
@verbatim
==============================================================================
##### How to use this driver #####
==============================================================================
[..]
The CRYP Extension HAL driver can be used as follows:
(#)Initialize the CRYP low level resources by implementing the HAL_CRYP_MspInit():
(##) Enable the CRYP interface clock using __HAL_RCC_CRYP_CLK_ENABLE()
(##) In case of using interrupts (e.g. HAL_CRYPEx_AESGCM_Encrypt_IT())
(+++) Configure the CRYP interrupt priority using HAL_NVIC_SetPriority()
(+++) Enable the CRYP IRQ handler using HAL_NVIC_EnableIRQ()
(+++) In CRYP IRQ handler, call HAL_CRYP_IRQHandler()
(##) In case of using DMA to control data transfer (e.g. HAL_AES_ECB_Encrypt_DMA())
(+++) Enable the DMAx interface clock using __DMAx_CLK_ENABLE()
(+++) Configure and enable two DMA streams one for managing data transfer from
memory to peripheral (input stream) and another stream for managing data
transfer from peripheral to memory (output stream)
(+++) Associate the initialized DMA handle to the CRYP DMA handle
using __HAL_LINKDMA()
(+++) Configure the priority and enable the NVIC for the transfer complete
interrupt on the two DMA Streams. The output stream should have higher
priority than the input stream HAL_NVIC_SetPriority() and HAL_NVIC_EnableIRQ()
(#)Initialize the CRYP HAL using HAL_CRYP_Init(). This function configures mainly:
(##) The data type: 1-bit, 8-bit, 16-bit and 32-bit
(##) The key size: 128, 192 and 256. This parameter is relevant only for AES
(##) The encryption/decryption key. Its size depends on the algorithm
used for encryption/decryption
(##) The initialization vector (counter). It is not used ECB mode.
(#)Three processing (encryption/decryption) functions are available:
(##) Polling mode: encryption and decryption APIs are blocking functions
i.e. they process the data and wait till the processing is finished
e.g. HAL_CRYPEx_AESGCM_Encrypt()
(##) Interrupt mode: encryption and decryption APIs are not blocking functions
i.e. they process the data under interrupt
e.g. HAL_CRYPEx_AESGCM_Encrypt_IT()
(##) DMA mode: encryption and decryption APIs are not blocking functions
i.e. the data transfer is ensured by DMA
e.g. HAL_CRYPEx_AESGCM_Encrypt_DMA()
(#)When the processing function is called at first time after HAL_CRYP_Init()
the CRYP peripheral is initialized and processes the buffer in input.
At second call, the processing function performs an append of the already
processed buffer.
When a new data block is to be processed, call HAL_CRYP_Init() then the
processing function.
(#)In AES-GCM and AES-CCM modes are an authenticated encryption algorithms
which provide authentication messages.
HAL_AES_GCM_Finish() and HAL_AES_CCM_Finish() are used to provide those
authentication messages.
Call those functions after the processing ones (polling, interrupt or DMA).
e.g. in AES-CCM mode call HAL_CRYPEx_AESCCM_Encrypt() to encrypt the plain data
then call HAL_CRYPEx_AESCCM_Finish() to get the authentication message
-@- For CCM Encrypt/Decrypt API's, only DataType = 8-bit is supported by this version.
-@- The HAL_CRYPEx_AESGCM_xxxx() implementation is limited to 32bits inputs data length
(Plain/Cyphertext, Header) compared with GCM standards specifications (800-38D).
(#)Call HAL_CRYP_DeInit() to deinitialize the CRYP peripheral.
@endverbatim
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of STMicroelectronics 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 THE COPYRIGHT HOLDER OR 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.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_hal.h"
/** @addtogroup STM32F4xx_HAL_Driver
* @{
*/
/** @defgroup CRYPEx CRYPEx
* @brief CRYP Extension HAL module driver.
* @{
*/
#ifdef HAL_CRYP_MODULE_ENABLED
#if defined(CRYP)
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/** @addtogroup CRYPEx_Private_define
* @{
*/
#define CRYPEx_TIMEOUT_VALUE 1U
/**
* @}
*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/** @defgroup CRYPEx_Private_Functions_prototypes CRYP Private Functions Prototypes
* @{
*/
static void CRYPEx_GCMCCM_SetInitVector(CRYP_HandleTypeDef *hcryp, uint8_t *InitVector);
static void CRYPEx_GCMCCM_SetKey(CRYP_HandleTypeDef *hcryp, uint8_t *Key, uint32_t KeySize);
static HAL_StatusTypeDef CRYPEx_GCMCCM_ProcessData(CRYP_HandleTypeDef *hcryp, uint8_t *Input, uint16_t Ilength, uint8_t *Output, uint32_t Timeout);
static HAL_StatusTypeDef CRYPEx_GCMCCM_SetHeaderPhase(CRYP_HandleTypeDef *hcryp, uint8_t* Input, uint16_t Ilength, uint32_t Timeout);
static void CRYPEx_GCMCCM_DMAInCplt(DMA_HandleTypeDef *hdma);
static void CRYPEx_GCMCCM_DMAOutCplt(DMA_HandleTypeDef *hdma);
static void CRYPEx_GCMCCM_DMAError(DMA_HandleTypeDef *hdma);
static void CRYPEx_GCMCCM_SetDMAConfig(CRYP_HandleTypeDef *hcryp, uint32_t inputaddr, uint16_t Size, uint32_t outputaddr);
/**
* @}
*/
/* Private functions ---------------------------------------------------------*/
/** @addtogroup CRYPEx_Private_Functions
* @{
*/
/**
* @brief DMA CRYP Input Data process complete callback.
* @param h
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
毕设&课程作业_基于gcc的stm32环境搭建.zip (1552个子文件)
Hao.bin 36KB
Hao.bin 24KB
FreeRtos_Hao.bin 23KB
FreeRtos_Hao.bin 23KB
stm32f4xx_hal_cryp_ex.c 208KB
stm32f4xx_hal_cryp_ex.c 208KB
stm32f4xx_hal_tim.c 170KB
stm32f4xx_hal_tim.c 170KB
stm32f4xx_hal_fmpi2c.c 166KB
stm32f4xx_hal_fmpi2c.c 166KB
stm32f4xx_hal_i2c.c 164KB
stm32f4xx_hal_i2c.c 164KB
stm32f4xx_hal_cryp.c 164KB
stm32f4xx_hal_cryp.c 164KB
tasks.c 154KB
tasks.c 154KB
stm32f4xx_hal_rcc_ex.c 150KB
stm32f4xx_hal_rcc_ex.c 150KB
stm32f4xx_hal_dfsdm.c 129KB
stm32f4xx_hal_dfsdm.c 129KB
stm32f10x_tim.c 107KB
stm32f10x_tim.c 107KB
stm32f10x_tim.c 104KB
stm32f4xx_hal_spi.c 98KB
stm32f4xx_hal_spi.c 98KB
stm32f4xx_hal_sd.c 92KB
stm32f4xx_hal_sd.c 92KB
stm32f4xx_hal_uart.c 83KB
stm32f4xx_hal_uart.c 83KB
stm32f4xx_hal_mmc.c 82KB
stm32f4xx_hal_mmc.c 82KB
queue.c 82KB
queue.c 82KB
stm32f4xx_hal_qspi.c 79KB
stm32f4xx_hal_qspi.c 79KB
stm32f4xx_hal_usart.c 76KB
stm32f4xx_hal_usart.c 76KB
stm32f4xx_hal_eth.c 72KB
stm32f4xx_hal_eth.c 72KB
stm32f4xx_hal_dsi.c 72KB
stm32f4xx_hal_dsi.c 72KB
stm32f4xx_hal_irda.c 70KB
stm32f4xx_hal_irda.c 70KB
stm32f4xx_hal_sai.c 67KB
stm32f4xx_hal_sai.c 67KB
stm32f4xx_hal_smartcard.c 66KB
stm32f4xx_hal_smartcard.c 66KB
ipc.c 66KB
stm32f4xx_hal_tim_ex.c 65KB
stm32f4xx_hal_tim_ex.c 65KB
stm32f4xx_hal_adc.c 62KB
stm32f4xx_hal_adc.c 62KB
stm32f4xx_hal_ltdc.c 61KB
stm32f4xx_hal_ltdc.c 61KB
stm32f10x_flash.c 61KB
stm32f10x_flash.c 61KB
stm32f4xx_hal_nand.c 61KB
stm32f4xx_hal_nand.c 61KB
stm32f10x_flash.c 59KB
stm32f4xx_ll_fmc.c 59KB
stm32f4xx_ll_fmc.c 59KB
stm32f4xx_hal_hash.c 58KB
stm32f4xx_hal_hash.c 58KB
stm32f4xx_hal_dma2d.c 58KB
stm32f4xx_hal_dma2d.c 58KB
stm32f4xx_hal_rtc_ex.c 56KB
stm32f4xx_hal_rtc_ex.c 56KB
stm32f4xx_hal_rtc.c 53KB
stm32f4xx_hal_rtc.c 53KB
stm32f4xx_ll_usb.c 52KB
stm32f4xx_ll_usb.c 52KB
stm32f4xx_hal_lptim.c 51KB
stm32f4xx_hal_lptim.c 51KB
stm32f4xx_ll_rcc.c 51KB
stm32f4xx_ll_rcc.c 51KB
stm32f4xx_hal_hash_ex.c 51KB
stm32f4xx_hal_hash_ex.c 51KB
stm32f4xx_hal_flash_ex.c 51KB
stm32f4xx_hal_flash_ex.c 51KB
stm32f4xx_hal_i2s.c 50KB
stm32f4xx_hal_i2s.c 50KB
stm32f10x_rcc.c 50KB
stm32f10x_rcc.c 50KB
stm32f4xx_ll_sdmmc.c 49KB
stm32f4xx_ll_sdmmc.c 49KB
stm32f10x_rcc.c 49KB
stm32f10x_adc.c 46KB
stm32f10x_adc.c 46KB
stm32f4xx_ll_tim.c 45KB
stm32f4xx_ll_tim.c 45KB
stm32f10x_adc.c 45KB
stm32f10x_i2c.c 45KB
stm32f10x_i2c.c 45KB
stm32f10x_can.c 44KB
stm32f10x_can.c 44KB
stm32f10x_i2c.c 43KB
stm32f4xx_ll_adc.c 43KB
stm32f4xx_ll_adc.c 43KB
stm32f10x_can.c 43KB
stm32f4xx_hal_spdifrx.c 42KB
共 1552 条
- 1
- 2
- 3
- 4
- 5
- 6
- 16
资源评论
学术菜鸟小晨
- 粉丝: 1w+
- 资源: 4953
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- MyBatis 动态 SQL:灵活而强大的查询构建器.pdf
- com.accordion.prettyo.apk
- 毕业设计:基于SSM的mysql-ssm软件bug管理系统(源码 + 数据库 + 说明文档)
- MTSQL8.0.35windows(64bit)-mysql-installer-community-8.0.35.0
- 人工智能引领音乐创作新时代之Suno AI
- Public-bicycle-usage-forecast-master.zip
- 通道处理过程模拟:从理论到实践.pdf
- 数据库第七次作业E-R图第一题
- 大厂面试真题Java语法基础面试专题及答案
- IMG20240428211124.jpg
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功