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