Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
110:165afa46840b
.

Who changed what in which revision?

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