CARME-M4 BSP
V1.5
|
CRYP driver modules. More...
Modules | |
CRYP_Exported_Constants | |
CRYP_Private_Functions | |
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... | |
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... | |
CRYP driver modules.
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.
Mode | encryption or decryption Mode. This parameter can be one of the following values:
|
InitVectors | Initialisation Vectors used for AES algorithm. |
Key | Key used for AES algorithm. |
Keysize | length of the Key, must be a 128, 192 or 256. |
Input | pointer to the Input buffer. |
Ilength | length of the Input buffer, must be a multiple of 16. |
Output | pointer to the returned buffer. |
An | ErrorStatus enumeration value:
|
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.
Mode | encryption or decryption Mode. This parameter can be one of the following values:
|
Nonce | the nounce used for AES algorithm. It shall be unique for each processing. |
Key | Key used for AES algorithm. |
Keysize | length of the Key, must be a 128, 192 or 256. |
Input | pointer to the Input buffer. |
Ilength | length of the Input buffer in bytes, must be a multiple of 16. |
Header | pointer to the header buffer. |
Hlength | length of the header buffer in bytes. |
HBuffer | pointer to temporary buffer used to append the header HBuffer size must be equal to Hlength + 21 |
Output | pointer to the returned buffer. |
AuthTAG | pointer to the authentication TAG buffer. |
TAGSize | the size of the TAG (called also MAC). |
An | ErrorStatus enumeration value:
|
Definition at line 1135 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.
Mode | encryption or decryption Mode. This parameter can be one of the following values:
|
InitVectors | Initialisation Vectors used for AES algorithm. |
Key | Key used for AES algorithm. |
Keysize | length of the Key, must be a 128, 192 or 256. |
Input | pointer to the Input buffer. |
Ilength | length of the Input buffer, must be a multiple of 16. |
Output | pointer to the returned buffer. |
An | ErrorStatus enumeration value:
|
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.
Mode | encryption or decryption Mode. This parameter can be one of the following values:
|
Key | Key used for AES algorithm. |
Keysize | length of the Key, must be a 128, 192 or 256. |
Input | pointer to the Input buffer. |
Ilength | length of the Input buffer, must be a multiple of 16. |
Output | pointer to the returned buffer. |
An | ErrorStatus enumeration value:
|
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.
Mode | encryption or decryption Mode. This parameter can be one of the following values:
|
InitVectors | Initialisation Vectors used for AES algorithm. |
Key | Key used for AES algorithm. |
Keysize | length of the Key, must be a 128, 192 or 256. |
Input | pointer to the Input buffer. |
Ilength | length of the Input buffer in bytes, must be a multiple of 16. |
Header | pointer to the header buffer. |
Hlength | length of the header buffer in bytes, must be a multiple of 16. |
Output | pointer to the returned buffer. |
AuthTAG | pointer to the authentication TAG buffer. |
An | ErrorStatus enumeration value:
|
Definition at line 670 of file stm32f4xx_cryp_aes.c.
void CRYP_Cmd | ( | FunctionalState | NewState | ) |
Enables or disables the CRYP peripheral.
NewState | new state of the CRYP peripheral. This parameter can be: ENABLE or DISABLE. |
None |
Definition at line 403 of file stm32f4xx_cryp.c.
void CRYP_DataIn | ( | uint32_t | Data | ) |
Writes data in the Data Input register (DIN).
Data | data to write in Data Input register |
None |
Definition at line 446 of file stm32f4xx_cryp.c.
uint32_t CRYP_DataOut | ( | void | ) |
Returns the last data entered into the output FIFO.
None |
Last | data 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.
None |
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.
Mode | encryption or decryption Mode. This parameter can be one of the following values:
|
Key | Key used for DES algorithm. |
InitVectors | Initialisation Vectors used for DES algorithm. |
Ilength | length of the Input buffer, must be a multiple of 8. |
Input | pointer to the Input buffer. |
Output | pointer to the returned buffer. |
An | ErrorStatus enumeration value:
|
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.
Mode | encryption or decryption Mode. This parameter can be one of the following values:
|
Key | Key used for DES algorithm. |
Ilength | length of the Input buffer, must be a multiple of 8. |
Input | pointer to the Input buffer. |
Output | pointer to the returned buffer. |
An | ErrorStatus enumeration value:
|
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.
CRYP_DMAReq | specifies the CRYP DMA transfer request to be enabled or disabled. This parameter can be any combination of the following values:
|
NewState | new state of the selected CRYP DMA transfer request. This parameter can be: ENABLE or DISABLE. |
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)
None |
None |
Definition at line 391 of file stm32f4xx_cryp.c.
FunctionalState CRYP_GetCmdStatus | ( | void | ) |
Returns whether CRYP peripheral is enabled or disabled.
none. |
Current | state 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.
CRYP_FLAG | specifies the CRYP flag to check. This parameter can be one of the following values:
|
The | new 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.
CRYP_IT | specifies the CRYP (masked) interrupt source to check. This parameter can be one of the following values:
|
The | new 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.
CRYP_InitStruct | pointer to a CRYP_InitTypeDef structure that contains the configuration information for the CRYP peripheral. |
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.
CRYP_IT | specifies the CRYP interrupt source to be enabled or disabled. This parameter can be any combination of the following values:
|
NewState | new state of the specified CRYP interrupt. This parameter can be: ENABLE or DISABLE. |
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.
CRYP_IVInitStruct | pointer to a CRYP_IVInitTypeDef structure that contains the configuration information for the CRYP Initialization Vectors(IV). |
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.
CRYP_IVInitStruct | pointer to a CRYP_IVInitTypeDef Initialization Vectors(IV) structure which will be initialized. |
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.
CRYP_KeyInitStruct | pointer to a CRYP_KeyInitTypeDef structure that contains the configuration information for the CRYP Keys. |
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.
CRYP_KeyInitStruct | pointer to a CRYP_KeyInitTypeDef structure which will be initialized. |
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.
CRYP_Phase | specifies the CRYP AES-CCM and AES-GCM phase to be configured. This parameter can be one of the following values:
|
None |
Definition at line 366 of file stm32f4xx_cryp.c.
void CRYP_RestoreContext | ( | CRYP_Context * | CRYP_ContextRestore | ) |
Restores the CRYP peripheral Context.
CRYP_ContextRestore | pointer to a CRYP_Context structure that contains the repository for saved context. |
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.
CRYP_ContextSave | pointer to a CRYP_Context structure that contains the repository for current context. |
CRYP_KeyInitStruct | pointer to a CRYP_KeyInitTypeDef structure that contains the configuration information for the CRYP Keys. |
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.
CRYP_InitStruct | pointer to a CRYP_InitTypeDef structure which will be initialized. |
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.
Mode | encryption or decryption Mode. This parameter can be one of the following values:
|
Key | Key used for TDES algorithm. |
InitVectors | Initialisation Vectors used for TDES algorithm. |
Input | pointer to the Input buffer. |
Ilength | length of the Input buffer, must be a multiple of 8. |
Output | pointer to the returned buffer. |
An | ErrorStatus enumeration value:
|
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.
Mode | encryption or decryption Mode. This parameter can be one of the following values:
|
Key | Key used for TDES algorithm. |
Ilength | length of the Input buffer, must be a multiple of 8. |
Input | pointer to the Input buffer. |
Output | pointer to the returned buffer. |
An | ErrorStatus enumeration value:
|
Definition at line 100 of file stm32f4xx_cryp_tdes.c.