comparison Common/Drivers/STM32F4xx_HAL_DRIVER_v120/Inc/stm32f4xx_hal_cryp_ex.h @ 38:5f11787b4f42

include in ostc4 repository
author heinrichsweikamp
date Sat, 28 Apr 2018 11:52:34 +0200
parents
children
comparison
equal deleted inserted replaced
37:ccc45c0e1ea2 38:5f11787b4f42
1 /**
2 ******************************************************************************
3 * @file stm32f4xx_hal_cryp_ex.h
4 * @author MCD Application Team
5 * @version V1.2.0
6 * @date 26-December-2014
7 * @brief Header file of CRYP HAL Extension module.
8 ******************************************************************************
9 * @attention
10 *
11 * <h2><center>&copy; COPYRIGHT(c) 2014 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)
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 __PHASE__: The phase.
102 * @retval None
103 */
104 #define __HAL_CRYP_SET_PHASE(__PHASE__) do{CRYP->CR &= (uint32_t)(~CRYP_CR_GCM_CCMPH);\
105 CRYP->CR |= (uint32_t)(__PHASE__);\
106 }while(0)
107
108 /**
109 * @}
110 */
111
112 /* Exported functions --------------------------------------------------------*/
113 /** @defgroup CRYPEx_Exported_Functions CRYPEx Exported Functions
114 * @{
115 */
116
117 /** @addtogroup CRYPEx_Exported_Functions_Group1
118 * @{
119 */
120
121 /* AES encryption/decryption using polling ***********************************/
122 HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
123 HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
124 HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Finish(CRYP_HandleTypeDef *hcryp, uint32_t Size, uint8_t *AuthTag, uint32_t Timeout);
125 HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
126 HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
127 HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Finish(CRYP_HandleTypeDef *hcryp, uint8_t *AuthTag, uint32_t Timeout);
128
129 /* AES encryption/decryption using interrupt *********************************/
130 HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
131 HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
132 HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
133 HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
134
135 /* AES encryption/decryption using DMA ***************************************/
136 HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
137 HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
138 HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
139 HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
140
141 /**
142 * @}
143 */
144
145 /** @addtogroup CRYPEx_Exported_Functions_Group2
146 * @{
147 */
148
149 void HAL_CRYPEx_GCMCCM_IRQHandler(CRYP_HandleTypeDef *hcryp);
150
151 /**
152 * @}
153 */
154
155 /**
156 * @}
157 */
158
159
160 /* Private types -------------------------------------------------------------*/
161 /** @defgroup CRYPEx_Private_Types CRYPEx Private Types
162 * @{
163 */
164
165 /**
166 * @}
167 */
168
169 /* Private variables ---------------------------------------------------------*/
170 /** @defgroup CRYPEx_Private_Variables CRYPEx Private Variables
171 * @{
172 */
173
174 /**
175 * @}
176 */
177
178 /* Private constants ---------------------------------------------------------*/
179 /** @defgroup CRYPEx_Private_Constants CRYPEx Private Constants
180 * @{
181 */
182
183 /**
184 * @}
185 */
186
187 /* Private macros ------------------------------------------------------------*/
188 /** @defgroup CRYPEx_Private_Macros CRYPEx Private Macros
189 * @{
190 */
191
192 /**
193 * @}
194 */
195
196 /* Private functions ---------------------------------------------------------*/
197 /** @defgroup CRYPEx_Private_Functions CRYPEx Private Functions
198 * @{
199 */
200
201 /**
202 * @}
203 */
204
205 #endif /* STM32F437xx || STM32F439xx */
206 /**
207 * @}
208 */
209
210 /**
211 * @}
212 */
213
214 #ifdef __cplusplus
215 }
216 #endif
217
218 #endif /* __STM32F4xx_HAL_CRYP_EX_H */
219
220 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/