cc y / mbed

Fork of mbed by mbed official

Committer:
Kojto
Date:
Wed Mar 02 09:58:28 2016 +0100
Revision:
115:87f2f5183dfb
Child:
116:c0f6e94411f5
Release 115 of the mbed library

Changes:
- new targets - NUCLEO_F746ZG
- Bugfix - STM32F7 + STM32L4 - RTC init fix
- Bugfix - STM32L4 Set NVIC_RAM_VECTOR_ADDRESS to 0x10000000
- B96B_F446VE - CAN addition
- Changed target name from NZ32SC151 to NZ32_SC151

Who changed what in which revision?

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