Modules | Classes | Macros | Functions

CRYP driver modules. More...

Collaboration diagram for CRYP:

Modules

 CRYP_Exported_Constants
 
 CRYP_Private_Functions
 

Classes

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

Macros

#define AESBUSY_TIMEOUT   ((uint32_t) 0x00010000)
 
#define DESBUSY_TIMEOUT   ((uint32_t) 0x00010000)
 
#define FLAG_MASK   ((uint8_t)0x20)
 
#define MAX_TIMEOUT   ((uint16_t)0xFFFF)
 
#define TDESBUSY_TIMEOUT   ((uint32_t) 0x00010000)
 

Functions

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_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_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_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_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...
 
void CRYP_Cmd (FunctionalState NewState)
 Enables or disables the CRYP peripheral. 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...
 
void CRYP_DeInit (void)
 Deinitializes the CRYP peripheral registers to their default reset values. 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...
 
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...
 
void CRYP_DMACmd (uint8_t CRYP_DMAReq, FunctionalState NewState)
 Enables or disables the CRYP DMA interface. More...
 
void CRYP_FIFOFlush (void)
 Flushes the IN and OUT FIFOs (that is read and write pointers of the FIFOs are reset) 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...
 
ITStatus CRYP_GetITStatus (uint8_t CRYP_IT)
 Checks whether the specified CRYP interrupt has occurred or not. More...
 
void CRYP_Init (CRYP_InitTypeDef *CRYP_InitStruct)
 Initializes the CRYP peripheral according to the specified parameters in the CRYP_InitStruct. More...
 
void CRYP_ITConfig (uint8_t CRYP_IT, FunctionalState NewState)
 Enables or disables the specified CRYP interrupts. 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_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_PhaseConfig (uint32_t CRYP_Phase)
 Configures the AES-CCM and AES-GCM phases. More...
 
void CRYP_RestoreContext (CRYP_Context *CRYP_ContextRestore)
 Restores the CRYP peripheral Context. More...
 
ErrorStatus CRYP_SaveContext (CRYP_Context *CRYP_ContextSave, CRYP_KeyInitTypeDef *CRYP_KeyInitStruct)
 Saves the CRYP peripheral Context. More...
 
void CRYP_StructInit (CRYP_InitTypeDef *CRYP_InitStruct)
 Fills each CRYP_InitStruct member with its default value. 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_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...
 

Detailed Description

CRYP driver modules.

Macro Definition Documentation

#define AESBUSY_TIMEOUT   ((uint32_t) 0x00010000)

Definition at line 68 of file stm32f4xx_cryp_aes.c.

#define DESBUSY_TIMEOUT   ((uint32_t) 0x00010000)

Definition at line 62 of file stm32f4xx_cryp_des.c.

#define FLAG_MASK   ((uint8_t)0x20)

Definition at line 178 of file stm32f4xx_cryp.c.

#define MAX_TIMEOUT   ((uint16_t)0xFFFF)

Definition at line 179 of file stm32f4xx_cryp.c.

#define TDESBUSY_TIMEOUT   ((uint32_t) 0x00010000)

Definition at line 62 of file stm32f4xx_cryp_tdes.c.

Function Documentation

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.

Parameters
Modeencryption or decryption Mode. This parameter can be one of the following values:
  • MODE_ENCRYPT: Encryption
  • MODE_DECRYPT: Decryption
InitVectorsInitialisation Vectors used for AES algorithm.
KeyKey used for AES algorithm.
Keysizelength of the Key, must be a 128, 192 or 256.
Inputpointer to the Input buffer.
Ilengthlength of the Input buffer, must be a multiple of 16.
Outputpointer to the returned buffer.
Return values
AnErrorStatus enumeration value:
  • SUCCESS: Operation done
  • ERROR: Operation failed

Definition at line 294 of file stm32f4xx_cryp_aes.c.

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.

Parameters
Modeencryption or decryption Mode. This parameter can be one of the following values:
  • MODE_ENCRYPT: Encryption
  • MODE_DECRYPT: Decryption
Noncethe nounce used for AES algorithm. It shall be unique for each processing.
KeyKey used for AES algorithm.
Keysizelength of the Key, must be a 128, 192 or 256.
Inputpointer to the Input buffer.
Ilengthlength of the Input buffer in bytes, must be a multiple of 16.
Headerpointer to the header buffer.
Hlengthlength of the header buffer in bytes.
HBufferpointer to temporary buffer used to append the header HBuffer size must be equal to Hlength + 21
Outputpointer to the returned buffer.
AuthTAGpointer to the authentication TAG buffer.
TAGSizethe size of the TAG (called also MAC).
Return values
AnErrorStatus enumeration value:
  • SUCCESS: Operation done
  • ERROR: Operation failed

Definition at line 1125 of file stm32f4xx_cryp_aes.c.

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.

Parameters
Modeencryption or decryption Mode. This parameter can be one of the following values:
  • MODE_ENCRYPT: Encryption
  • MODE_DECRYPT: Decryption
InitVectorsInitialisation Vectors used for AES algorithm.
KeyKey used for AES algorithm.
Keysizelength of the Key, must be a 128, 192 or 256.
Inputpointer to the Input buffer.
Ilengthlength of the Input buffer, must be a multiple of 16.
Outputpointer to the returned buffer.
Return values
AnErrorStatus enumeration value:
  • SUCCESS: Operation done
  • ERROR: Operation failed

Definition at line 496 of file stm32f4xx_cryp_aes.c.

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.

Parameters
Modeencryption or decryption Mode. This parameter can be one of the following values:
  • MODE_ENCRYPT: Encryption
  • MODE_DECRYPT: Decryption
KeyKey used for AES algorithm.
Keysizelength of the Key, must be a 128, 192 or 256.
Inputpointer to the Input buffer.
Ilengthlength of the Input buffer, must be a multiple of 16.
Outputpointer to the returned buffer.
Return values
AnErrorStatus enumeration value:
  • SUCCESS: Operation done
  • ERROR: Operation failed

Definition at line 106 of file stm32f4xx_cryp_aes.c.

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.

Parameters
Modeencryption or decryption Mode. This parameter can be one of the following values:
  • MODE_ENCRYPT: Encryption
  • MODE_DECRYPT: Decryption
InitVectorsInitialisation Vectors used for AES algorithm.
KeyKey used for AES algorithm.
Keysizelength of the Key, must be a 128, 192 or 256.
Inputpointer to the Input buffer.
Ilengthlength of the Input buffer in bytes, must be a multiple of 16.
Headerpointer to the header buffer.
Hlengthlength of the header buffer in bytes, must be a multiple of 16.
Outputpointer to the returned buffer.
AuthTAGpointer to the authentication TAG buffer.
Return values
AnErrorStatus enumeration value:
  • SUCCESS: Operation done
  • ERROR: Operation failed

Definition at line 670 of file stm32f4xx_cryp_aes.c.

void CRYP_Cmd ( FunctionalState  NewState)

Enables or disables the CRYP peripheral.

Parameters
NewStatenew state of the CRYP peripheral. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 403 of file stm32f4xx_cryp.c.

void CRYP_DataIn ( uint32_t  Data)

Writes data in the Data Input register (DIN).

Note
After the DIN register has been read once or several times, the FIFO must be flushed (using CRYP_FIFOFlush() function).
Parameters
Datadata to write in Data Input register
Return values
None

Definition at line 446 of file stm32f4xx_cryp.c.

uint32_t CRYP_DataOut ( void  )

Returns the last data entered into the output FIFO.

Parameters
None
Return values
Lastdata entered into the output FIFO.

Definition at line 456 of file stm32f4xx_cryp.c.

void CRYP_DeInit ( void  )

Deinitializes the CRYP peripheral registers to their default reset values.

Parameters
None
Return values
None

Definition at line 219 of file stm32f4xx_cryp.c.

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.

Parameters
Modeencryption or decryption Mode. This parameter can be one of the following values:
  • MODE_ENCRYPT: Encryption
  • MODE_DECRYPT: Decryption
KeyKey used for DES algorithm.
InitVectorsInitialisation Vectors used for DES algorithm.
Ilengthlength of the Input buffer, must be a multiple of 8.
Inputpointer to the Input buffer.
Outputpointer to the returned buffer.
Return values
AnErrorStatus enumeration value:
  • SUCCESS: Operation done
  • ERROR: Operation failed

Definition at line 200 of file stm32f4xx_cryp_des.c.

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.

Parameters
Modeencryption or decryption Mode. This parameter can be one of the following values:
  • MODE_ENCRYPT: Encryption
  • MODE_DECRYPT: Decryption
KeyKey used for DES algorithm.
Ilengthlength of the Input buffer, must be a multiple of 8.
Inputpointer to the Input buffer.
Outputpointer to the returned buffer.
Return values
AnErrorStatus enumeration value:
  • SUCCESS: Operation done
  • ERROR: Operation failed

Definition at line 99 of file stm32f4xx_cryp_des.c.

void CRYP_DMACmd ( uint8_t  CRYP_DMAReq,
FunctionalState  NewState 
)

Enables or disables the CRYP DMA interface.

Parameters
CRYP_DMAReqspecifies the CRYP DMA transfer request to be enabled or disabled. This parameter can be any combination of the following values:
  • CRYP_DMAReq_DataOUT: DMA for outgoing(Tx) data transfer
  • CRYP_DMAReq_DataIN: DMA for incoming(Rx) data transfer
NewStatenew state of the selected CRYP DMA transfer request. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 681 of file stm32f4xx_cryp.c.

void CRYP_FIFOFlush ( void  )

Flushes the IN and OUT FIFOs (that is read and write pointers of the FIFOs are reset)

Note
The FIFOs must be flushed only when BUSY flag is reset.
Parameters
None
Return values
None

Definition at line 391 of file stm32f4xx_cryp.c.

FunctionalState CRYP_GetCmdStatus ( void  )

Returns whether CRYP peripheral is enabled or disabled.

Parameters
none.
Return values
Currentstate of the CRYP peripheral (ENABLE or DISABLE).

Definition at line 853 of file stm32f4xx_cryp.c.

FlagStatus CRYP_GetFlagStatus ( uint8_t  CRYP_FLAG)

Checks whether the specified CRYP flag is set or not.

Parameters
CRYP_FLAGspecifies the CRYP flag to check. This parameter can be one of the following values:
  • CRYP_FLAG_IFEM: Input FIFO Empty flag.
  • CRYP_FLAG_IFNF: Input FIFO Not Full flag.
  • CRYP_FLAG_OFNE: Output FIFO Not Empty flag.
  • CRYP_FLAG_OFFU: Output FIFO Full flag.
  • CRYP_FLAG_BUSY: Busy flag.
  • CRYP_FLAG_OUTRIS: Output FIFO raw interrupt flag.
  • CRYP_FLAG_INRIS: Input FIFO raw interrupt flag.
Return values
Thenew state of CRYP_FLAG (SET or RESET).

Definition at line 883 of file stm32f4xx_cryp.c.

ITStatus CRYP_GetITStatus ( uint8_t  CRYP_IT)

Checks whether the specified CRYP interrupt has occurred or not.

Note
This function checks the status of the masked interrupt (i.e the interrupt should be previously enabled).
Parameters
CRYP_ITspecifies the CRYP (masked) interrupt source to check. This parameter can be one of the following values:
  • CRYP_IT_INI: Input FIFO interrupt
  • CRYP_IT_OUTI: Output FIFO interrupt
Return values
Thenew state of CRYP_IT (SET or RESET).

Definition at line 827 of file stm32f4xx_cryp.c.

void CRYP_Init ( CRYP_InitTypeDef CRYP_InitStruct)

Initializes the CRYP peripheral according to the specified parameters in the CRYP_InitStruct.

Parameters
CRYP_InitStructpointer to a CRYP_InitTypeDef structure that contains the configuration information for the CRYP peripheral.
Return values
None

Definition at line 235 of file stm32f4xx_cryp.c.

void CRYP_ITConfig ( uint8_t  CRYP_IT,
FunctionalState  NewState 
)

Enables or disables the specified CRYP interrupts.

Parameters
CRYP_ITspecifies the CRYP interrupt source to be enabled or disabled. This parameter can be any combination of the following values:
  • CRYP_IT_INI: Input FIFO interrupt
  • CRYP_IT_OUTI: Output FIFO interrupt
NewStatenew state of the specified CRYP interrupt. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 799 of file stm32f4xx_cryp.c.

void CRYP_IVInit ( CRYP_IVInitTypeDef CRYP_IVInitStruct)

Initializes the CRYP Initialization Vectors(IV) according to the specified parameters in the CRYP_IVInitStruct.

Parameters
CRYP_IVInitStructpointer to a CRYP_IVInitTypeDef structure that contains the configuration information for the CRYP Initialization Vectors(IV).
Return values
None

Definition at line 333 of file stm32f4xx_cryp.c.

void CRYP_IVStructInit ( CRYP_IVInitTypeDef CRYP_IVInitStruct)

Fills each CRYP_IVInitStruct member with its default value.

Parameters
CRYP_IVInitStructpointer to a CRYP_IVInitTypeDef Initialization Vectors(IV) structure which will be initialized.
Return values
None

Definition at line 347 of file stm32f4xx_cryp.c.

void CRYP_KeyInit ( CRYP_KeyInitTypeDef CRYP_KeyInitStruct)

Initializes the CRYP Keys according to the specified parameters in the CRYP_KeyInitStruct.

Parameters
CRYP_KeyInitStructpointer to a CRYP_KeyInitTypeDef structure that contains the configuration information for the CRYP Keys.
Return values
None

Definition at line 296 of file stm32f4xx_cryp.c.

void CRYP_KeyStructInit ( CRYP_KeyInitTypeDef CRYP_KeyInitStruct)

Fills each CRYP_KeyInitStruct member with its default value.

Parameters
CRYP_KeyInitStructpointer to a CRYP_KeyInitTypeDef structure which will be initialized.
Return values
None

Definition at line 315 of file stm32f4xx_cryp.c.

void CRYP_PhaseConfig ( uint32_t  CRYP_Phase)

Configures the AES-CCM and AES-GCM phases.

Note
This function is used only with AES-CCM or AES-GCM Algorithms
Parameters
CRYP_Phasespecifies the CRYP AES-CCM and AES-GCM phase to be configured. This parameter can be one of the following values:
  • CRYP_Phase_Init: Initialization phase
  • CRYP_Phase_Header: Header phase
  • CRYP_Phase_Payload: Payload phase
  • CRYP_Phase_Final: Final phase
Return values
None

Definition at line 366 of file stm32f4xx_cryp.c.

void CRYP_RestoreContext ( CRYP_Context CRYP_ContextRestore)

Restores the CRYP peripheral Context.

Note
Since teh DMA transfer is stopped in CRYP_SaveContext() function, after restoring the context, you have to enable the DMA again (if the DMA was previously used).
Parameters
CRYP_ContextRestorepointer to a CRYP_Context structure that contains the repository for saved context.
Note
The data that were saved during context saving must be rewrited into the IN FIFO.
Return values
None

Definition at line 602 of file stm32f4xx_cryp.c.

ErrorStatus CRYP_SaveContext ( CRYP_Context CRYP_ContextSave,
CRYP_KeyInitTypeDef CRYP_KeyInitStruct 
)

Saves the CRYP peripheral Context.

Note
This function stops DMA transfer before to save the context. After restoring the context, you have to enable the DMA again (if the DMA was previously used).
Parameters
CRYP_ContextSavepointer to a CRYP_Context structure that contains the repository for current context.
CRYP_KeyInitStructpointer to a CRYP_KeyInitTypeDef structure that contains the configuration information for the CRYP Keys.
Return values
None

Definition at line 497 of file stm32f4xx_cryp.c.

void CRYP_StructInit ( CRYP_InitTypeDef CRYP_InitStruct)

Fills each CRYP_InitStruct member with its default value.

Parameters
CRYP_InitStructpointer to a CRYP_InitTypeDef structure which will be initialized.
Return values
None

Definition at line 274 of file stm32f4xx_cryp.c.

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.

Parameters
Modeencryption or decryption Mode. This parameter can be one of the following values:
  • MODE_ENCRYPT: Encryption
  • MODE_DECRYPT: Decryption
KeyKey used for TDES algorithm.
InitVectorsInitialisation Vectors used for TDES algorithm.
Inputpointer to the Input buffer.
Ilengthlength of the Input buffer, must be a multiple of 8.
Outputpointer to the returned buffer.
Return values
AnErrorStatus enumeration value:
  • SUCCESS: Operation done
  • ERROR: Operation failed

Definition at line 208 of file stm32f4xx_cryp_tdes.c.

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.

Parameters
Modeencryption or decryption Mode. This parameter can be one of the following values:
  • MODE_ENCRYPT: Encryption
  • MODE_DECRYPT: Decryption
KeyKey used for TDES algorithm.
Ilengthlength of the Input buffer, must be a multiple of 8.
Inputpointer to the Input buffer.
Outputpointer to the returned buffer.
Return values
AnErrorStatus enumeration value:
  • SUCCESS: Operation done
  • ERROR: Operation failed

Definition at line 100 of file stm32f4xx_cryp_tdes.c.



rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 19:59:29