MG32F157 Standard Peripherals Firmware Library
Modules | Data Structures | Macros | Enumerations | Functions

AES driver modules. More...

Modules

 AES_Exported_Constants
 
 AES_Private_Defines
 
 AES_Private_Functions
 

Data Structures

struct  AES_InitTypeDef
 AES Init structure definition. More...
 

Macros

#define IS_AES_CHMOD(MODE)
 
#define IS_AES_MODE(MODE)
 
#define IS_AES_DATATYPE(DATA)
 

Enumerations

enum  AESChMod_TypeDef { AES_CHMOD_ECB, AES_CHMOD_CBC, AES_CHMOD_CTR }
 AES chaining mode definition. More...
 
enum  AESMode_TypeDef { AES_MODE_Encryption, AES_MODE_Decryption, AES_MODE_Derivation, AES_MODE_Derivation_Decryption }
 AES working mode definition. More...
 
enum  AESData_TypeDef { AES_DATATYPE_32Bits, AES_DATATYPE_16Bits, AES_DATATYPE_8Bits, AES_DATATYPE_1Bit }
 AES datatype definition.
 

Functions

void AES_DeInit (void)
 Deinitializes the AES peripheral registers to their default reset values. More...
 
void AES_Cmd (FunctionalState NewState)
 Enables or disables the AES. More...
 
void AES_IT_Config (uint32_t AES_IT, FunctionalState NewState)
 Enables or disables the specified AES interrupts. More...
 
void AES_Init (AES_InitTypeDef *AES_InitStruct)
 Initializes the AES peripheral according to the specified parameters in the AES_InitStruct. More...
 
void AES_SetKey (uint8_t *Key)
 Writes the Key in Key registers. More...
 
void AES_SetInitVector (uint8_t *InitVector)
 Writes the InitVector/InitCounter in IV registers. More...
 
void AES_DataInput (uint32_t *inputaddr)
 Writes the origin data into AES DINR register. More...
 
void AES_DataOutput (uint32_t *outputaddr)
 Gets the output data from AES DOUTR register. More...
 
void AES_DMA_Cmd (uint16_t AES_DMA, FunctionalState NewState)
 Enables or disables the specified AES DMA request. More...
 
FlagStatus AES_GetFlagStatus (uint8_t AES_FLAG)
 Checks whether the specified AES flag is set or not. More...
 
void AES_ClearFlag (uint8_t AES_FLAG)
 Clears the AES's pending flags. More...
 
ITStatus AES_GetITStatus (uint32_t AES_IT)
 Checks whether the specified AES interrupt has occurred or not. More...
 
void AES_ClearITPendingBit (uint32_t AES_IT)
 Clears the AES's interrupt pending bits. More...
 

Detailed Description

AES driver modules.

Macro Definition Documentation

◆ IS_AES_CHMOD

#define IS_AES_CHMOD (   MODE)
Value:
(((MODE) == AES_CHMOD_ECB) || ((MODE) == AES_CHMOD_CBC) || \
((MODE) == AES_CHMOD_CTR))

◆ IS_AES_DATATYPE

#define IS_AES_DATATYPE (   DATA)
Value:
(((DATA) == AES_DATATYPE_32Bits) || ((DATA) == AES_DATATYPE_16Bits) || \
((DATA) == AES_DATATYPE_8Bits) || ((DATA) == AES_DATATYPE_1Bit))

◆ IS_AES_MODE

#define IS_AES_MODE (   MODE)
Value:
(((MODE) == AES_MODE_Encryption) || ((MODE) == AES_MODE_Decryption) || \
((MODE) == AES_MODE_Derivation) || ((MODE) == AES_MODE_Derivation_Decryption))

Enumeration Type Documentation

◆ AESChMod_TypeDef

AES chaining mode definition.

◆ AESMode_TypeDef

AES working mode definition.

Function Documentation

◆ AES_ClearFlag()

void AES_ClearFlag ( uint8_t  AES_FLAG)

Clears the AES's pending flags.

Parameters
AES_FLAGspecifies the flag to clear. This parameter can be one of the following values:
  • AES_FLAG_WRERR: Write error flag
  • AES_FLAG_RDERR: Read error flag
  • AES_FLAG_CCF: Calculation completly flag
Returns
None

◆ AES_ClearITPendingBit()

void AES_ClearITPendingBit ( uint32_t  AES_IT)

Clears the AES's interrupt pending bits.

Parameters
AES_ITspecifies the interrupt pending bit to clear. This parameter can be any combination of the following values:
  • AES_IT_ERR: Error interrupt
  • AES_IT_CCF: Calculation completly interrupt
Returns
None

◆ AES_Cmd()

void AES_Cmd ( FunctionalState  NewState)

Enables or disables the AES.

Parameters
NewStatenew state of the AES. This parameter can be: ENABLE or DISABLE.
Returns
None

◆ AES_DataInput()

void AES_DataInput ( uint32_t *  inputaddr)

Writes the origin data into AES DINR register.

Parameters
inputaddrPointer to input data buffer.
Note
Set the 128bits input data by writing the AES Input Data Register(DINR) 4 times.
Returns
None

◆ AES_DataOutput()

void AES_DataOutput ( uint32_t *  outputaddr)

Gets the output data from AES DOUTR register.

Parameters
outputaddrPointer to output data buffer.
Note
Get the 128bits output data by reading the AES Output Data Register(DOUTR) 4 times.
Returns
None

◆ AES_DeInit()

void AES_DeInit ( void  )

Deinitializes the AES peripheral registers to their default reset values.

Parameters
None
Returns
None

◆ AES_DMA_Cmd()

void AES_DMA_Cmd ( uint16_t  AES_DMA,
FunctionalState  NewState 
)

Enables or disables the specified AES DMA request.

Parameters
AES_DMAspecifies the DMA input request or DAM output request. This parameter can be: AES_DMA_IN or AES_DMA_OUT.
NewStatenew state of the specified AES DMAC request. This parameter can be: ENABLE or DISABLE.
Returns
None

◆ AES_GetFlagStatus()

FlagStatus AES_GetFlagStatus ( uint8_t  AES_FLAG)

Checks whether the specified AES flag is set or not.

Parameters
AES_FLAGspecifies the flag to check. This parameter can be one of the following values:
  • AES_FLAG_WRERR: Write error flag
  • AES_FLAG_RDERR: Read error flag
  • AES_FLAG_CCF: Calculation completly flag
Returns
The new state of AES_FLAG (SET or RESET).

◆ AES_GetITStatus()

ITStatus AES_GetITStatus ( uint32_t  AES_IT)

Checks whether the specified AES interrupt has occurred or not.

Parameters
AES_ITspecifies the interrupt source to check. This parameter can be one of the following values:
  • AES_IT_ERR: Error interrupt
  • AES_IT_CCF: Calculation completly interrupt
Returns
The new state of AES_IT (SET or RESET).

◆ AES_Init()

void AES_Init ( AES_InitTypeDef AES_InitStruct)

Initializes the AES peripheral according to the specified parameters in the AES_InitStruct.

Parameters
AES_InitStructpointer to a AES_InitTypeDef structure that contains the configuration information for the specified AES peripheral.
Returns
None

◆ AES_IT_Config()

void AES_IT_Config ( uint32_t  AES_IT,
FunctionalState  NewState 
)

Enables or disables the specified AES interrupts.

Parameters
AES_ITspecifies the AES interrupt sources to be enabled or disabled. This parameter can be any combination of the following values:
  • AES_IT_ERR: Error interrupt mask
  • AES_IT_CCF: Calulation completly interrupt mask
NewStatenew state of the specified AES interrupts. This parameter can be: ENABLE or DISABLE.
Returns
None

◆ AES_SetInitVector()

void AES_SetInitVector ( uint8_t *  InitVector)

Writes the InitVector/InitCounter in IV registers.

Parameters
InitVector: Pointer to InitVector/InitCounter buffer
Note
Init Vector must be written as little endian. If Init Vector pointer points at address n, n[15:0] contains Vector[96:127], (n+4)[15:0] contains Vector[64:95], (n+8)[15:0] contains Vector[32:63] and (n+12)[15:0] contains Vector[0:31]
Returns
None

◆ AES_SetKey()

void AES_SetKey ( uint8_t *  Key)

Writes the Key in Key registers.

Parameters
KeyPointer to Key buffer.
Note
Key must be written as little endian. If Key pointer points at address n, n[15:0] contains key[96:127], (n+4)[15:0] contains key[64:95], (n+8)[15:0] contains key[32:63] and (n+12)[15:0] contains key[0:31]
Returns
None