source: asp3_wo_tecs/trunk/arch/arm_m_gcc/stm32f4xx_stm32cube/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cryp_ex.h@ 303

Last change on this file since 303 was 303, checked in by ertl-honda, 7 years ago

nucleo_f401re依存部の追加

File size: 7.7 KB
Line 
1/**
2 ******************************************************************************
3 * @file stm32f4xx_hal_cryp_ex.h
4 * @author MCD Application Team
5 * @version V1.4.1
6 * @date 09-October-2015
7 * @brief Header file of CRYP HAL Extension module.
8 ******************************************************************************
9 * @attention
10 *
11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
12 *
13 * Redistribution and use in source and binary forms, with or without modification,
14 * are permitted provided that the following conditions are met:
15 * 1. Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 *
35 ******************************************************************************
36 */
37
38/* Define to prevent recursive inclusion -------------------------------------*/
39#ifndef __STM32F4xx_HAL_CRYP_EX_H
40#define __STM32F4xx_HAL_CRYP_EX_H
41
42#ifdef __cplusplus
43 extern "C" {
44#endif
45
46#if defined(STM32F437xx) || defined(STM32F439xx) || defined(STM32F479xx)
47/* Includes ------------------------------------------------------------------*/
48#include "stm32f4xx_hal_def.h"
49
50/** @addtogroup STM32F4xx_HAL_Driver
51 * @{
52 */
53
54/** @addtogroup CRYPEx
55 * @{
56 */
57
58/* Exported types ------------------------------------------------------------*/
59/* Exported constants --------------------------------------------------------*/
60
61/** @defgroup CRYPEx_Exported_Constants CRYPEx Exported Constants
62 * @{
63 */
64
65/** @defgroup CRYPEx_Exported_Constants_Group1 CRYP AlgoModeDirection
66 * @{
67 */
68#define CRYP_CR_ALGOMODE_AES_GCM_ENCRYPT ((uint32_t)0x00080000)
69#define CRYP_CR_ALGOMODE_AES_GCM_DECRYPT ((uint32_t)0x00080004)
70#define CRYP_CR_ALGOMODE_AES_CCM_ENCRYPT ((uint32_t)0x00080008)
71#define CRYP_CR_ALGOMODE_AES_CCM_DECRYPT ((uint32_t)0x0008000C)
72
73/**
74 * @}
75 */
76
77/** @defgroup CRYPEx_Exported_Constants_Group3 CRYP PhaseConfig
78 * @brief The phases are relevant only to AES-GCM and AES-CCM
79 * @{
80 */
81#define CRYP_PHASE_INIT ((uint32_t)0x00000000)
82#define CRYP_PHASE_HEADER CRYP_CR_GCM_CCMPH_0
83#define CRYP_PHASE_PAYLOAD CRYP_CR_GCM_CCMPH_1
84#define CRYP_PHASE_FINAL CRYP_CR_GCM_CCMPH
85/**
86 * @}
87 */
88
89/**
90 * @}
91 */
92
93/* Exported macro ------------------------------------------------------------*/
94/** @defgroup CRYPEx_Exported_Macros CRYP Exported Macros
95 * @{
96 */
97
98/**
99 * @brief Set the phase: Init, header, payload, final.
100 * This is relevant only for GCM and CCM modes.
101 * @param __HANDLE__: specifies the CRYP handle.
102 * @param __PHASE__: The phase.
103 * @retval None
104 */
105#define __HAL_CRYP_SET_PHASE(__HANDLE__, __PHASE__) do{(__HANDLE__)->Instance->CR &= (uint32_t)(~CRYP_CR_GCM_CCMPH);\
106 (__HANDLE__)->Instance->CR |= (uint32_t)(__PHASE__);\
107 }while(0)
108
109/**
110 * @}
111 */
112
113/* Exported functions --------------------------------------------------------*/
114/** @defgroup CRYPEx_Exported_Functions CRYPEx Exported Functions
115 * @{
116 */
117
118/** @addtogroup CRYPEx_Exported_Functions_Group1
119 * @{
120 */
121
122/* AES encryption/decryption using polling ***********************************/
123HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
124HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
125HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Finish(CRYP_HandleTypeDef *hcryp, uint32_t Size, uint8_t *AuthTag, uint32_t Timeout);
126HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
127HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
128HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Finish(CRYP_HandleTypeDef *hcryp, uint8_t *AuthTag, uint32_t Timeout);
129
130/* AES encryption/decryption using interrupt *********************************/
131HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
132HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
133HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
134HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
135
136/* AES encryption/decryption using DMA ***************************************/
137HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
138HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
139HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
140HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
141
142/**
143 * @}
144 */
145
146/** @addtogroup CRYPEx_Exported_Functions_Group2
147 * @{
148 */
149
150void HAL_CRYPEx_GCMCCM_IRQHandler(CRYP_HandleTypeDef *hcryp);
151
152/**
153 * @}
154 */
155
156 /**
157 * @}
158 */
159
160
161 /* Private types -------------------------------------------------------------*/
162/** @defgroup CRYPEx_Private_Types CRYPEx Private Types
163 * @{
164 */
165
166/**
167 * @}
168 */
169
170/* Private variables ---------------------------------------------------------*/
171/** @defgroup CRYPEx_Private_Variables CRYPEx Private Variables
172 * @{
173 */
174
175/**
176 * @}
177 */
178
179/* Private constants ---------------------------------------------------------*/
180/** @defgroup CRYPEx_Private_Constants CRYPEx Private Constants
181 * @{
182 */
183
184/**
185 * @}
186 */
187
188/* Private macros ------------------------------------------------------------*/
189/** @defgroup CRYPEx_Private_Macros CRYPEx Private Macros
190 * @{
191 */
192
193 /**
194 * @}
195 */
196
197/* Private functions ---------------------------------------------------------*/
198/** @defgroup CRYPEx_Private_Functions CRYPEx Private Functions
199 * @{
200 */
201
202/**
203 * @}
204 */
205
206#endif /* STM32F437xx || STM32F439xx || STM32F479xx */
207/**
208 * @}
209 */
210
211/**
212 * @}
213 */
214
215#ifdef __cplusplus
216}
217#endif
218
219#endif /* __STM32F4xx_HAL_CRYP_EX_H */
220
221/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Note: See TracBrowser for help on using the repository browser.