comparison Common/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cryp_ex.h @ 128:c78bcbd5deda FlipDisplay

Added current STM32 standandard libraries in version independend folder structure
author Ideenmodellierer
date Sun, 17 Feb 2019 21:12:22 +0100
parents
children
comparison
equal deleted inserted replaced
127:1369f8660eaa 128:c78bcbd5deda
1 /**
2 ******************************************************************************
3 * @file stm32f4xx_hal_cryp_ex.h
4 * @author MCD Application Team
5 * @brief Header file of CRYP HAL Extension module.
6 ******************************************************************************
7 * @attention
8 *
9 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
10 *
11 * Redistribution and use in source and binary forms, with or without modification,
12 * are permitted provided that the following conditions are met:
13 * 1. Redistributions of source code must retain the above copyright notice,
14 * this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 * 3. Neither the name of STMicroelectronics nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *
33 ******************************************************************************
34 */
35
36 /* Define to prevent recursive inclusion -------------------------------------*/
37 #ifndef __STM32F4xx_HAL_CRYP_EX_H
38 #define __STM32F4xx_HAL_CRYP_EX_H
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 /* Includes ------------------------------------------------------------------*/
45 #include "stm32f4xx_hal_def.h"
46
47
48 #if defined(CRYP)
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 0x00080000U
69 #define CRYP_CR_ALGOMODE_AES_GCM_DECRYPT 0x00080004U
70 #define CRYP_CR_ALGOMODE_AES_CCM_ENCRYPT 0x00080008U
71 #define CRYP_CR_ALGOMODE_AES_CCM_DECRYPT 0x0008000CU
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 0x00000000U
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 ***********************************/
123 HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
124 HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
125 HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Finish(CRYP_HandleTypeDef *hcryp, uint32_t Size, uint8_t *AuthTag, uint32_t Timeout);
126 HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
127 HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
128 HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Finish(CRYP_HandleTypeDef *hcryp, uint8_t *AuthTag, uint32_t Timeout);
129
130 /* AES encryption/decryption using interrupt *********************************/
131 HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
132 HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
133 HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
134 HAL_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 ***************************************/
137 HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
138 HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
139 HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
140 HAL_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
150 void 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 /* CRYP */
207
208 #if defined (AES)
209
210 /** @addtogroup CRYPEx_Exported_Functions
211 * @{
212 */
213
214 /** @addtogroup CRYPEx_Exported_Functions_Group1
215 * @{
216 */
217
218 /* CallBack functions ********************************************************/
219 void HAL_CRYPEx_ComputationCpltCallback(CRYP_HandleTypeDef *hcryp);
220
221 /**
222 * @}
223 */
224
225 /** @addtogroup CRYPEx_Exported_Functions_Group2
226 * @{
227 */
228
229 /* AES encryption/decryption processing functions ****************************/
230 HAL_StatusTypeDef HAL_CRYPEx_AES(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint16_t Size, uint8_t *pOutputData, uint32_t Timeout);
231 HAL_StatusTypeDef HAL_CRYPEx_AES_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint16_t Size, uint8_t *pOutputData);
232 HAL_StatusTypeDef HAL_CRYPEx_AES_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint16_t Size, uint8_t *pOutputData);
233
234 /* AES encryption/decryption/authentication processing functions *************/
235 HAL_StatusTypeDef HAL_CRYPEx_AES_Auth(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint64_t Size, uint8_t *pOutputData, uint32_t Timeout);
236 HAL_StatusTypeDef HAL_CRYPEx_AES_Auth_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint64_t Size, uint8_t *pOutputData);
237 HAL_StatusTypeDef HAL_CRYPEx_AES_Auth_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint64_t Size, uint8_t *pOutputData);
238
239 /**
240 * @}
241 */
242
243 /** @addtogroup CRYPEx_Exported_Functions_Group3
244 * @{
245 */
246
247 /* AES suspension/resumption functions ***************************************/
248 void HAL_CRYPEx_Read_IVRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Output);
249 void HAL_CRYPEx_Write_IVRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Input);
250 void HAL_CRYPEx_Read_SuspendRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Output);
251 void HAL_CRYPEx_Write_SuspendRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Input);
252 void HAL_CRYPEx_Read_KeyRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Output, uint32_t KeySize);
253 void HAL_CRYPEx_Write_KeyRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Input, uint32_t KeySize);
254 void HAL_CRYPEx_Read_ControlRegister(CRYP_HandleTypeDef *hcryp, uint8_t* Output);
255 void HAL_CRYPEx_Write_ControlRegister(CRYP_HandleTypeDef *hcryp, uint8_t* Input);
256 void HAL_CRYPEx_ProcessSuspend(CRYP_HandleTypeDef *hcryp);
257
258 /**
259 * @}
260 */
261
262
263 /**
264 * @}
265 */
266
267 /* Private functions -----------------------------------------------------------*/
268 /** @addtogroup CRYPEx_Private_Functions CRYPEx Private Functions
269 * @{
270 */
271 HAL_StatusTypeDef CRYP_AES_Auth_IT(CRYP_HandleTypeDef *hcryp);
272
273 /**
274 * @}
275 */
276
277 #endif /* AES */
278
279 /**
280 * @}
281 */
282
283 /**
284 * @}
285 */
286
287 #ifdef __cplusplus
288 }
289 #endif
290
291 #endif /* __STM32F4xx_HAL_CRYP_EX_H */
292
293 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/