Extended processing functions.
More...
|
| void | HAL_CRYPEx_Read_IVRegisters (CRYP_HandleTypeDef *hcryp, uint8_t *Output) |
| | In case of message processing suspension, read the Initialization Vector. More...
|
| |
| void | HAL_CRYPEx_Write_IVRegisters (CRYP_HandleTypeDef *hcryp, uint8_t *Input) |
| | In case of message processing resumption, rewrite the Initialization Vector in the AES_IVRx registers. More...
|
| |
| void | HAL_CRYPEx_Read_SuspendRegisters (CRYP_HandleTypeDef *hcryp, uint8_t *Output) |
| | In case of message GCM/GMAC (CCM/CMAC when applicable) processing suspension, read the Suspend Registers. More...
|
| |
| void | HAL_CRYPEx_Write_SuspendRegisters (CRYP_HandleTypeDef *hcryp, uint8_t *Input) |
| | In case of message GCM/GMAC (CCM/CMAC when applicable) processing resumption, rewrite the Suspend Registers in the AES_SUSPxR registers. More...
|
| |
| void | HAL_CRYPEx_Read_KeyRegisters (CRYP_HandleTypeDef *hcryp, uint8_t *Output, uint32_t KeySize) |
| | In case of message GCM/GMAC (CCM/CMAC when applicable) processing suspension, read the Key Registers. More...
|
| |
| void | HAL_CRYPEx_Write_KeyRegisters (CRYP_HandleTypeDef *hcryp, uint8_t *Input, uint32_t KeySize) |
| | In case of message GCM/GMAC (CCM/CMAC when applicable) processing resumption, rewrite the Key Registers in the AES_KEYRx registers. More...
|
| |
| void | HAL_CRYPEx_Read_ControlRegister (CRYP_HandleTypeDef *hcryp, uint8_t *Output) |
| | In case of message GCM/GMAC (CCM/CMAC when applicable) processing suspension, read the Control Register. More...
|
| |
| void | HAL_CRYPEx_Write_ControlRegister (CRYP_HandleTypeDef *hcryp, uint8_t *Input) |
| | In case of message GCM/GMAC (CCM/CMAC when applicable) processing resumption, rewrite the Control Registers in the AES_CR register. More...
|
| |
| void | HAL_CRYPEx_ProcessSuspend (CRYP_HandleTypeDef *hcryp) |
| | Request CRYP processing suspension when in polling or interruption mode. More...
|
| |
Extended processing functions.
==============================================================================
##### AES extended suspension and resumption functions #####
==============================================================================
[..] This section provides functions allowing to:
(+) save in memory the Initialization Vector, the Key registers, the Control register or
the Suspend registers when a process is suspended by a higher priority message
(+) write back in CRYP hardware block the saved values listed above when the suspended
lower priority message processing is resumed.
◆ HAL_CRYPEx_ProcessSuspend()
Request CRYP processing suspension when in polling or interruption mode.
- Parameters
-
| hcryp | pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module. |
- Note
- Set the handle field SuspendRequest to the appropriate value so that the on-going CRYP processing is suspended as soon as the required conditions are met.
-
It is advised not to suspend the CRYP processing when the DMA controller is managing the data transfer
- Return values
-
Definition at line 2098 of file stm32l4xx_hal_cryp_ex.c.
HAL_SuspendTypeDef SuspendRequest
◆ HAL_CRYPEx_Read_ControlRegister()
In case of message GCM/GMAC (CCM/CMAC when applicable) processing suspension, read the Control Register.
- Parameters
-
| hcryp | pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module. |
| Output | Pointer to the buffer containing the saved Control Register. |
- Note
- This values has to be stored for reuse by writing back the AES_CR register as soon as the interrupted processing has to be resumed.
- Return values
-
Definition at line 2065 of file stm32l4xx_hal_cryp_ex.c.
2067 *(uint32_t*)(
void *)(Output) = hcryp->
Instance->CR;
◆ HAL_CRYPEx_Read_IVRegisters()
In case of message processing suspension, read the Initialization Vector.
- Parameters
-
| hcryp | pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module. |
| Output | Pointer to the buffer containing the saved Initialization Vector. |
- Note
- This value has to be stored for reuse by writing the AES_IVRx registers as soon as the interrupted processing has to be resumed. Applicable to all chaining modes.
-
AES must be disabled when reading or resetting the IV values.
- Return values
-
Definition at line 1864 of file stm32l4xx_hal_cryp_ex.c.
1866 uint32_t outputaddr = (uint32_t)Output;
1868 *(uint32_t*)(outputaddr) = __REV(hcryp->
Instance->IVR3);
1870 *(uint32_t*)(outputaddr) = __REV(hcryp->
Instance->IVR2);
1872 *(uint32_t*)(outputaddr) = __REV(hcryp->
Instance->IVR1);
1874 *(uint32_t*)(outputaddr) = __REV(hcryp->
Instance->IVR0);
◆ HAL_CRYPEx_Read_KeyRegisters()
| void HAL_CRYPEx_Read_KeyRegisters |
( |
CRYP_HandleTypeDef * |
hcryp, |
|
|
uint8_t * |
Output, |
|
|
uint32_t |
KeySize |
|
) |
| |
In case of message GCM/GMAC (CCM/CMAC when applicable) processing suspension, read the Key Registers.
- Parameters
-
| hcryp | pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module. |
| Output | Pointer to the buffer containing the saved Key Registers. |
| KeySize | Indicates the key size (128 or 256 bits). |
- Note
- These values have to be stored for reuse by writing back the AES_KEYRx registers as soon as the interrupted processing has to be resumed.
- Return values
-
Definition at line 1995 of file stm32l4xx_hal_cryp_ex.c.
1997 uint32_t keyaddr = (uint32_t)Output;
1999 if (KeySize == CRYP_KEYSIZE_256B)
2001 *(uint32_t*)(keyaddr) = __REV(hcryp->
Instance->KEYR7);
2003 *(uint32_t*)(keyaddr) = __REV(hcryp->
Instance->KEYR6);
2005 *(uint32_t*)(keyaddr) = __REV(hcryp->
Instance->KEYR5);
2007 *(uint32_t*)(keyaddr) = __REV(hcryp->
Instance->KEYR4);
2011 *(uint32_t*)(keyaddr) = __REV(hcryp->
Instance->KEYR3);
2013 *(uint32_t*)(keyaddr) = __REV(hcryp->
Instance->KEYR2);
2015 *(uint32_t*)(keyaddr) = __REV(hcryp->
Instance->KEYR1);
2017 *(uint32_t*)(keyaddr) = __REV(hcryp->
Instance->KEYR0);
◆ HAL_CRYPEx_Read_SuspendRegisters()
In case of message GCM/GMAC (CCM/CMAC when applicable) processing suspension, read the Suspend Registers.
- Parameters
-
| hcryp | pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module. |
| Output | Pointer to the buffer containing the saved Suspend Registers. |
- Note
- These values have to be stored for reuse by writing back the AES_SUSPxR registers as soon as the interrupted processing has to be resumed.
- Return values
-
Definition at line 1912 of file stm32l4xx_hal_cryp_ex.c.
1914 uint32_t outputaddr = (uint32_t)Output;
1917 if (READ_BIT(hcryp->
Instance->CR, (AES_CR_CHMOD|AES_CR_GCMPH|AES_CR_MODE)) == (CRYP_CHAINMODE_AES_GCM_GMAC|CRYP_PAYLOAD_PHASE|CRYP_ALGOMODE_ENCRYPT))
1922 hcryp->
ErrorCode |= HAL_CRYP_BUSY_ERROR;
1928 #if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1) 1937 *(uint32_t*)(outputaddr) = __REV(hcryp->
Instance->SUSP7R);
1939 *(uint32_t*)(outputaddr) = __REV(hcryp->
Instance->SUSP6R);
1941 *(uint32_t*)(outputaddr) = __REV(hcryp->
Instance->SUSP5R);
1943 *(uint32_t*)(outputaddr) = __REV(hcryp->
Instance->SUSP4R);
1945 *(uint32_t*)(outputaddr) = __REV(hcryp->
Instance->SUSP3R);
1947 *(uint32_t*)(outputaddr) = __REV(hcryp->
Instance->SUSP2R);
1949 *(uint32_t*)(outputaddr) = __REV(hcryp->
Instance->SUSP1R);
1951 *(uint32_t*)(outputaddr) = __REV(hcryp->
Instance->SUSP0R);
void(* ErrorCallback)(struct __CRYP_HandleTypeDef *hcryp)
__IO HAL_CRYP_STATETypeDef State
static HAL_StatusTypeDef CRYP_WaitOnBusyFlagReset(CRYP_HandleTypeDef const *const hcryp, uint32_t Timeout)
Wait for Busy Flag to be reset during a GCM payload encryption process suspension.
void HAL_CRYP_ErrorCallback(CRYP_HandleTypeDef *hcryp)
CRYP error callback.
◆ HAL_CRYPEx_Write_ControlRegister()
In case of message GCM/GMAC (CCM/CMAC when applicable) processing resumption, rewrite the Control Registers in the AES_CR register.
- Parameters
-
| hcryp | pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module. |
| Input | Pointer to the buffer containing the saved Control Register to write back in the CRYP hardware block. |
- Return values
-
Definition at line 2079 of file stm32l4xx_hal_cryp_ex.c.
2081 hcryp->
Instance->CR = *(uint32_t*)(
void *)(Input);
__IO HAL_CRYP_STATETypeDef State
◆ HAL_CRYPEx_Write_IVRegisters()
In case of message processing resumption, rewrite the Initialization Vector in the AES_IVRx registers.
- Parameters
-
| hcryp | pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module. |
| Input | Pointer to the buffer containing the saved Initialization Vector to write back in the CRYP hardware block. |
- Note
- Applicable to all chaining modes.
-
AES must be disabled when reading or resetting the IV values.
- Return values
-
Definition at line 1888 of file stm32l4xx_hal_cryp_ex.c.
1890 uint32_t ivaddr = (uint32_t)Input;
1892 hcryp->
Instance->IVR3 = __REV(*(uint32_t*)(ivaddr));
1894 hcryp->
Instance->IVR2 = __REV(*(uint32_t*)(ivaddr));
1896 hcryp->
Instance->IVR1 = __REV(*(uint32_t*)(ivaddr));
1898 hcryp->
Instance->IVR0 = __REV(*(uint32_t*)(ivaddr));
◆ HAL_CRYPEx_Write_KeyRegisters()
| void HAL_CRYPEx_Write_KeyRegisters |
( |
CRYP_HandleTypeDef * |
hcryp, |
|
|
uint8_t * |
Input, |
|
|
uint32_t |
KeySize |
|
) |
| |
In case of message GCM/GMAC (CCM/CMAC when applicable) processing resumption, rewrite the Key Registers in the AES_KEYRx registers.
- Parameters
-
| hcryp | pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module. |
| Input | Pointer to the buffer containing the saved key registers to write back in the CRYP hardware block. |
| KeySize | Indicates the key size (128 or 256 bits) |
- Return values
-
Definition at line 2030 of file stm32l4xx_hal_cryp_ex.c.
2032 uint32_t keyaddr = (uint32_t)Input;
2034 if (KeySize == CRYP_KEYSIZE_256B)
2036 hcryp->
Instance->KEYR7 = __REV(*(uint32_t*)(keyaddr));
2038 hcryp->
Instance->KEYR6 = __REV(*(uint32_t*)(keyaddr));
2040 hcryp->
Instance->KEYR5 = __REV(*(uint32_t*)(keyaddr));
2042 hcryp->
Instance->KEYR4 = __REV(*(uint32_t*)(keyaddr));
2046 hcryp->
Instance->KEYR3 = __REV(*(uint32_t*)(keyaddr));
2048 hcryp->
Instance->KEYR2 = __REV(*(uint32_t*)(keyaddr));
2050 hcryp->
Instance->KEYR1 = __REV(*(uint32_t*)(keyaddr));
2052 hcryp->
Instance->KEYR0 = __REV(*(uint32_t*)(keyaddr));
◆ HAL_CRYPEx_Write_SuspendRegisters()
In case of message GCM/GMAC (CCM/CMAC when applicable) processing resumption, rewrite the Suspend Registers in the AES_SUSPxR registers.
- Parameters
-
| hcryp | pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module. |
| Input | Pointer to the buffer containing the saved suspend registers to write back in the CRYP hardware block. |
- Return values
-
Definition at line 1963 of file stm32l4xx_hal_cryp_ex.c.
1965 uint32_t ivaddr = (uint32_t)Input;
1967 hcryp->
Instance->SUSP7R = __REV(*(uint32_t*)(ivaddr));
1969 hcryp->
Instance->SUSP6R = __REV(*(uint32_t*)(ivaddr));
1971 hcryp->
Instance->SUSP5R = __REV(*(uint32_t*)(ivaddr));
1973 hcryp->
Instance->SUSP4R = __REV(*(uint32_t*)(ivaddr));
1975 hcryp->
Instance->SUSP3R = __REV(*(uint32_t*)(ivaddr));
1977 hcryp->
Instance->SUSP2R = __REV(*(uint32_t*)(ivaddr));
1979 hcryp->
Instance->SUSP1R = __REV(*(uint32_t*)(ivaddr));
1981 hcryp->
Instance->SUSP0R = __REV(*(uint32_t*)(ivaddr));