CARME-M4 BSP  V1.5
stm32f4xx_cryp.h File Reference

This file contains all the functions prototypes for the Cryptographic processor(CRYP) firmware library. More...

#include "stm32f4xx.h"
+ Include dependency graph for stm32f4xx_cryp.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  CRYP_InitTypeDef
 CRYP Init structure definition. More...
 
struct  CRYP_KeyInitTypeDef
 CRYP Key(s) structure definition. More...
 
struct  CRYP_IVInitTypeDef
 CRYP Initialization Vectors (IV) structure definition. More...
 
struct  CRYP_Context
 CRYP context swapping structure definition. More...
 

Macros

#define CRYP_AlgoDir_Encrypt   ((uint16_t)0x0000)
 
#define CRYP_AlgoDir_Decrypt   ((uint16_t)0x0004)
 
#define IS_CRYP_ALGODIR(ALGODIR)
 
#define CRYP_AlgoMode_TDES_ECB   ((uint32_t)0x00000000)
 
#define CRYP_AlgoMode_TDES_CBC   ((uint32_t)0x00000008)
 
#define CRYP_AlgoMode_DES_ECB   ((uint32_t)0x00000010)
 
#define CRYP_AlgoMode_DES_CBC   ((uint32_t)0x00000018)
 
#define CRYP_AlgoMode_AES_ECB   ((uint32_t)0x00000020)
 
#define CRYP_AlgoMode_AES_CBC   ((uint32_t)0x00000028)
 
#define CRYP_AlgoMode_AES_CTR   ((uint32_t)0x00000030)
 
#define CRYP_AlgoMode_AES_Key   ((uint32_t)0x00000038)
 
#define CRYP_AlgoMode_AES_GCM   ((uint32_t)0x00080000)
 
#define CRYP_AlgoMode_AES_CCM   ((uint32_t)0x00080008)
 
#define IS_CRYP_ALGOMODE(ALGOMODE)
 
#define CRYP_Phase_Init   ((uint32_t)0x00000000)
 
#define CRYP_Phase_Header   CRYP_CR_GCM_CCMPH_0
 
#define CRYP_Phase_Payload   CRYP_CR_GCM_CCMPH_1
 
#define CRYP_Phase_Final   CRYP_CR_GCM_CCMPH
 
#define IS_CRYP_PHASE(PHASE)
 
#define CRYP_DataType_32b   ((uint16_t)0x0000)
 
#define CRYP_DataType_16b   ((uint16_t)0x0040)
 
#define CRYP_DataType_8b   ((uint16_t)0x0080)
 
#define CRYP_DataType_1b   ((uint16_t)0x00C0)
 
#define IS_CRYP_DATATYPE(DATATYPE)
 
#define CRYP_KeySize_128b   ((uint16_t)0x0000)
 
#define CRYP_KeySize_192b   ((uint16_t)0x0100)
 
#define CRYP_KeySize_256b   ((uint16_t)0x0200)
 
#define IS_CRYP_KEYSIZE(KEYSIZE)
 
#define CRYP_FLAG_BUSY   ((uint8_t)0x10)
 
#define CRYP_FLAG_IFEM   ((uint8_t)0x01)
 
#define CRYP_FLAG_IFNF   ((uint8_t)0x02)
 
#define CRYP_FLAG_INRIS   ((uint8_t)0x22)
 
#define CRYP_FLAG_OFNE   ((uint8_t)0x04)
 
#define CRYP_FLAG_OFFU   ((uint8_t)0x08)
 
#define CRYP_FLAG_OUTRIS   ((uint8_t)0x21)
 
#define IS_CRYP_GET_FLAG(FLAG)
 
#define CRYP_IT_INI   ((uint8_t)0x01)
 
#define CRYP_IT_OUTI   ((uint8_t)0x02)
 
#define IS_CRYP_CONFIG_IT(IT)   ((((IT) & (uint8_t)0xFC) == 0x00) && ((IT) != 0x00))
 
#define IS_CRYP_GET_IT(IT)   (((IT) == CRYP_IT_INI) || ((IT) == CRYP_IT_OUTI))
 
#define MODE_ENCRYPT   ((uint8_t)0x01)
 
#define MODE_DECRYPT   ((uint8_t)0x00)
 
#define CRYP_DMAReq_DataIN   ((uint8_t)0x01)
 
#define CRYP_DMAReq_DataOUT   ((uint8_t)0x02)
 
#define IS_CRYP_DMAREQ(DMAREQ)   ((((DMAREQ) & (uint8_t)0xFC) == 0x00) && ((DMAREQ) != 0x00))
 

Functions

void CRYP_DeInit (void)
 Deinitializes the CRYP peripheral registers to their default reset values. More...
 
void CRYP_Init (CRYP_InitTypeDef *CRYP_InitStruct)
 Initializes the CRYP peripheral according to the specified parameters in the CRYP_InitStruct. More...
 
void CRYP_StructInit (CRYP_InitTypeDef *CRYP_InitStruct)
 Fills each CRYP_InitStruct member with its default value. More...
 
void CRYP_KeyInit (CRYP_KeyInitTypeDef *CRYP_KeyInitStruct)
 Initializes the CRYP Keys according to the specified parameters in the CRYP_KeyInitStruct. More...
 
void CRYP_KeyStructInit (CRYP_KeyInitTypeDef *CRYP_KeyInitStruct)
 Fills each CRYP_KeyInitStruct member with its default value. More...
 
void CRYP_IVInit (CRYP_IVInitTypeDef *CRYP_IVInitStruct)
 Initializes the CRYP Initialization Vectors(IV) according to the specified parameters in the CRYP_IVInitStruct. More...
 
void CRYP_IVStructInit (CRYP_IVInitTypeDef *CRYP_IVInitStruct)
 Fills each CRYP_IVInitStruct member with its default value. More...
 
void CRYP_Cmd (FunctionalState NewState)
 Enables or disables the CRYP peripheral. More...
 
void CRYP_PhaseConfig (uint32_t CRYP_Phase)
 Configures the AES-CCM and AES-GCM phases. More...
 
void CRYP_FIFOFlush (void)
 Flushes the IN and OUT FIFOs (that is read and write pointers of the FIFOs are reset) More...
 
void CRYP_DataIn (uint32_t Data)
 Writes data in the Data Input register (DIN). More...
 
uint32_t CRYP_DataOut (void)
 Returns the last data entered into the output FIFO. More...
 
ErrorStatus CRYP_SaveContext (CRYP_Context *CRYP_ContextSave, CRYP_KeyInitTypeDef *CRYP_KeyInitStruct)
 Saves the CRYP peripheral Context. More...
 
void CRYP_RestoreContext (CRYP_Context *CRYP_ContextRestore)
 Restores the CRYP peripheral Context. More...
 
void CRYP_DMACmd (uint8_t CRYP_DMAReq, FunctionalState NewState)
 Enables or disables the CRYP DMA interface. More...
 
void CRYP_ITConfig (uint8_t CRYP_IT, FunctionalState NewState)
 Enables or disables the specified CRYP interrupts. More...
 
ITStatus CRYP_GetITStatus (uint8_t CRYP_IT)
 Checks whether the specified CRYP interrupt has occurred or not. More...
 
FunctionalState CRYP_GetCmdStatus (void)
 Returns whether CRYP peripheral is enabled or disabled. More...
 
FlagStatus CRYP_GetFlagStatus (uint8_t CRYP_FLAG)
 Checks whether the specified CRYP flag is set or not. More...
 
ErrorStatus CRYP_AES_ECB (uint8_t Mode, uint8_t *Key, uint16_t Keysize, uint8_t *Input, uint32_t Ilength, uint8_t *Output)
 Encrypt and decrypt using AES in ECB Mode. More...
 
ErrorStatus CRYP_AES_CBC (uint8_t Mode, uint8_t InitVectors[16], uint8_t *Key, uint16_t Keysize, uint8_t *Input, uint32_t Ilength, uint8_t *Output)
 Encrypt and decrypt using AES in CBC Mode. More...
 
ErrorStatus CRYP_AES_CTR (uint8_t Mode, uint8_t InitVectors[16], uint8_t *Key, uint16_t Keysize, uint8_t *Input, uint32_t Ilength, uint8_t *Output)
 Encrypt and decrypt using AES in CTR Mode. More...
 
ErrorStatus CRYP_AES_GCM (uint8_t Mode, uint8_t InitVectors[16], uint8_t *Key, uint16_t Keysize, uint8_t *Input, uint32_t ILength, uint8_t *Header, uint32_t HLength, uint8_t *Output, uint8_t *AuthTAG)
 Encrypt and decrypt using AES in GCM Mode. The GCM and CCM modes are available only on STM32F437x Devices. More...
 
ErrorStatus CRYP_AES_CCM (uint8_t Mode, uint8_t *Nonce, uint32_t NonceSize, uint8_t *Key, uint16_t Keysize, uint8_t *Input, uint32_t ILength, uint8_t *Header, uint32_t HLength, uint8_t *HBuffer, uint8_t *Output, uint8_t *AuthTAG, uint32_t TAGSize)
 Encrypt and decrypt using AES in CCM Mode. The GCM and CCM modes are available only on STM32F437x Devices. More...
 
ErrorStatus CRYP_TDES_ECB (uint8_t Mode, uint8_t Key[24], uint8_t *Input, uint32_t Ilength, uint8_t *Output)
 Encrypt and decrypt using TDES in ECB Mode. More...
 
ErrorStatus CRYP_TDES_CBC (uint8_t Mode, uint8_t Key[24], uint8_t InitVectors[8], uint8_t *Input, uint32_t Ilength, uint8_t *Output)
 Encrypt and decrypt using TDES in CBC Mode. More...
 
ErrorStatus CRYP_DES_ECB (uint8_t Mode, uint8_t Key[8], uint8_t *Input, uint32_t Ilength, uint8_t *Output)
 Encrypt and decrypt using DES in ECB Mode. More...
 
ErrorStatus CRYP_DES_CBC (uint8_t Mode, uint8_t Key[8], uint8_t InitVectors[8], uint8_t *Input, uint32_t Ilength, uint8_t *Output)
 Encrypt and decrypt using DES in CBC Mode. More...
 

Detailed Description

This file contains all the functions prototypes for the Cryptographic processor(CRYP) firmware library.

Author
MCD Application Team
Version
V1.3.0
Date
08-November-2013
Attention

© COPYRIGHT 2013 STMicroelectronics

Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at:

   http://www.st.com/software_license_agreement_liberty_v2

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file stm32f4xx_cryp.h.