Functions | |
uint32_t | CRYPTOAesLoadKey (uint32_t *pui32AesKey, uint32_t ui32KeyLocation) |
Write the key into the Key Ram. More... | |
uint32_t | CRYPTOAesEcb (uint32_t *pui32MsgIn, uint32_t *pui32MsgOut, uint32_t ui32KeyLocation, bool bEncrypt, bool bIntEnable) |
Start an AES-ECB operation (encryption or decryption). More... | |
uint32_t | CRYPTOAesEcbStatus (void) |
Check the result of an AES ECB operation. More... | |
static void | CRYPTOAesEcbFinish (void) |
Finish the encryption operation by resetting the operation mode. More... | |
uint32_t | CRYPTOCcmAuthEncrypt (bool bEncrypt, uint32_t ui32AuthLength, uint32_t *pui32Nonce, uint32_t *pui32PlainText, uint32_t ui32PlainTextLength, uint32_t *pui32Header, uint32_t ui32HeaderLength, uint32_t ui32KeyLocation, uint32_t ui32FieldLength, bool bIntEnable) |
Start CCM operation. More... | |
uint32_t | CRYPTOCcmAuthEncryptStatus (void) |
Check the result of an AES CCM operation. More... | |
uint32_t | CRYPTOCcmAuthEncryptResultGet (uint32_t ui32TagLength, uint32_t *pui32CcmTag) |
Get the result of an AES CCM operation. More... | |
uint32_t | CRYPTOCcmInvAuthDecrypt (bool bDecrypt, uint32_t ui32AuthLength, uint32_t *pui32Nonce, uint32_t *pui32CipherText, uint32_t ui32CipherTextLength, uint32_t *pui32Header, uint32_t ui32HeaderLength, uint32_t ui32KeyLocation, uint32_t ui32FieldLength, bool bIntEnable) |
Start a CCM Decryption and Inverse Authentication operation. More... | |
uint32_t | CRYPTOCcmInvAuthDecryptStatus (void) |
Checks CCM decrypt and Inverse Authentication result. More... | |
uint32_t | CRYPTOCcmInvAuthDecryptResultGet (uint32_t ui32AuthLength, uint32_t *pui32CipherText, uint32_t ui32CipherTextLength, uint32_t *pui32CcmTag) |
Get the result of the CCM operation. More... | |
static uint32_t | CRYPTODmaStatus (void) |
Get the current status of the Crypto DMA controller. More... | |
void | CRYPTODmaEnable (uint32_t ui32Channels) |
Enable Crypto DMA operation. More... | |
void | CRYPTODmaDisable (uint32_t ui32Channels) |
Disable Crypto DMA operation. More... | |
static void | CRYPTOIntEnable (uint32_t ui32IntFlags) |
Enables individual Crypto interrupt sources. More... | |
static void | CRYPTOIntDisable (uint32_t ui32IntFlags) |
Disables individual CRYPTO interrupt sources. More... | |
static uint32_t | CRYPTOIntStatus (bool bMasked) |
Gets the current interrupt status. More... | |
static void | CRYPTOIntClear (uint32_t ui32IntFlags) |
Clears Crypto interrupt sources. More... | |
static void | CRYPTOIntRegister (void(*pfnHandler)(void)) |
Registers an interrupt handler for a Crypto interrupt. More... | |
static void | CRYPTOIntUnregister (void) |
Unregisters an interrupt handler for a Crypto interrupt. More... | |
uint32_t CRYPTOAesEcb | ( | uint32_t * | pui32MsgIn, |
uint32_t * | pui32MsgOut, | ||
uint32_t | ui32KeyLocation, | ||
bool | bEncrypt, | ||
bool | bIntEnable | ||
) |
Start an AES-ECB operation (encryption or decryption).
The ui32KeyLocation
parameter is an enumerated type which specifies the Key Ram location in which the key is stored.
pui32MsgIn | is a pointer to the input data. |
pui32MsgOut | is a pointer to the output data. |
ui32KeyLocation | is the location of the key in Key RAM. This parameter can have any of the following values: |
bEncrypt | is set true to encrypt or set false to decrypt. |
bIntEnable | is set true to enable Crypto interrupts or false to disable Crypto interrupt. |
Definition at line 202 of file crypto.c.
|
inlinestatic |
Finish the encryption operation by resetting the operation mode.
This function should be called after CRYPTOAesEcbStatus() has reported that the operation is finished successfully.
uint32_t CRYPTOAesEcbStatus | ( | void | ) |
Check the result of an AES ECB operation.
This function should be called after CRYPTOAesEcb() function to check if the AES ECB operation was successful.
Definition at line 317 of file crypto.c.
uint32_t CRYPTOAesLoadKey | ( | uint32_t * | pui32AesKey, |
uint32_t | ui32KeyLocation | ||
) |
Write the key into the Key Ram.
The ui32KeyLocation
parameter is an enumerated type which specifies the Key Ram location in which the key is stored.
The pointer pui8AesKey
has the address where the Key is stored.
pui32AesKey | is a pointer to an AES Key. |
ui32KeyLocation | is the location of the key in Key RAM. This parameter can have any of the following values: |
Definition at line 85 of file crypto.c.
uint32_t CRYPTOCcmAuthEncrypt | ( | bool | bEncrypt, |
uint32_t | ui32AuthLength, | ||
uint32_t * | pui32Nonce, | ||
uint32_t * | pui32PlainText, | ||
uint32_t | ui32PlainTextLength, | ||
uint32_t * | pui32Header, | ||
uint32_t | ui32HeaderLength, | ||
uint32_t | ui32KeyLocation, | ||
uint32_t | ui32FieldLength, | ||
bool | bIntEnable | ||
) |
Start CCM operation.
The ui32KeyLocation
is an enumerated type which specifies the Key Ram location in which the key is stored.
bEncrypt | determines whether to run encryption or not. |
ui32AuthLength | is the the length of the authentication field - 0, 2, 4, 6, 8, 10, 12, 14 or 16 octets. |
pui32Nonce | is a pointer to 13-byte or 12-byte Nonce (Number used once). |
pui32PlainText | is a pointer to the octet string input message. |
ui32PlainTextLength | is the length of the message. |
pui32Header | is the length of the header (Additional Authentication Data or AAD). |
ui32HeaderLength | is the length of the header in octets. |
ui32KeyLocation | is the location in Key RAM where the key is stored. This parameter can have any of the following values: |
ui32FieldLength | is the size of the length field (2 or 3). |
bIntEnable | enables interrupts. |
Definition at line 357 of file crypto.c.
uint32_t CRYPTOCcmAuthEncryptResultGet | ( | uint32_t | ui32TagLength, |
uint32_t * | pui32CcmTag | ||
) |
Get the result of an AES CCM operation.
This function should be called after CRYPTOCcmAuthEncryptStatus().
ui32TagLength | is length of the Tag. |
pui32CcmTag | is the location of the authentication Tag. |
Get the result of an AES CCM operation.
Definition at line 629 of file crypto.c.
uint32_t CRYPTOCcmAuthEncryptStatus | ( | void | ) |
Check the result of an AES CCM operation.
This function should be called after CRYPTOCcmAuthEncrypt() function to check if the AES CCM operation was successful.
Definition at line 590 of file crypto.c.
uint32_t CRYPTOCcmInvAuthDecrypt | ( | bool | bDecrypt, |
uint32_t | ui32AuthLength, | ||
uint32_t * | pui32Nonce, | ||
uint32_t * | pui32CipherText, | ||
uint32_t | ui32CipherTextLength, | ||
uint32_t * | pui32Header, | ||
uint32_t | ui32HeaderLength, | ||
uint32_t | ui32KeyLocation, | ||
uint32_t | ui32FieldLength, | ||
bool | bIntEnable | ||
) |
Start a CCM Decryption and Inverse Authentication operation.
The ui32KeyLocation
is an enumerated type which specifies the Key Ram location in which the key is stored.
bDecrypt | determines whether to run decryption or not. |
ui32AuthLength | is the the length of the authentication field - 0, 2, 4, 6, 8, 10, 12, 14 or 16 octets. |
pui32Nonce | is a pointer to 13-byte or 12-byte Nonce (Number used once). |
pui32CipherText | is a pointer to the octet string encrypted message. |
ui32CipherTextLength | is the length of the encrypted message. |
pui32Header | is the length of the header (Additional Authentication Data or AAD). |
ui32HeaderLength | is the length of the header in octets. |
ui32KeyLocation | is the location in Key RAM where the key is stored. This parameter can have any of the following values: |
ui32FieldLength | is the size of the length field (2 or 3). |
bIntEnable | enables interrupts. |
Definition at line 678 of file crypto.c.
uint32_t CRYPTOCcmInvAuthDecryptResultGet | ( | uint32_t | ui32AuthLength, |
uint32_t * | pui32CipherText, | ||
uint32_t | ui32CipherTextLength, | ||
uint32_t * | pui32CcmTag | ||
) |
Get the result of the CCM operation.
ui32AuthLength | is the the length of the authentication field - 0, 2, 4, 6, 8, 10, 12, 14 or 16 octets. |
pui32CipherText | is a pointer to the octet string encrypted message. |
ui32CipherTextLength | is the length of the encrypted message. |
pui32CcmTag | is the location of the authentication Tag. |
Definition at line 952 of file crypto.c.
uint32_t CRYPTOCcmInvAuthDecryptStatus | ( | void | ) |
Checks CCM decrypt and Inverse Authentication result.
Definition at line 913 of file crypto.c.
void CRYPTODmaDisable | ( | uint32_t | ui32Channels | ) |
Disable Crypto DMA operation.
The specified Crypto DMA channels are disabled.
ui32Channels | is a bitwise OR of the channels to disable. |
void CRYPTODmaEnable | ( | uint32_t | ui32Channels | ) |
Enable Crypto DMA operation.
The specified Crypto DMA channels are enabled.
ui32Channels | is a bitwise OR of the channels to enable. |
|
inlinestatic |
Get the current status of the Crypto DMA controller.
This function is used to poll the Crypto DMA controller to check if it is ready for a new operation or if an error has occurred.
The CRYPTO_DMA_BUS_ERROR can also be caught using the crypto event handler.
|
inlinestatic |
Clears Crypto interrupt sources.
The specified Crypto interrupt sources are cleared, so that they no longer assert. This function must be called in the interrupt handler to keep the interrupt from being recognized again immediately upon exit.
ui32IntFlags | is a bit mask of the interrupt sources to be cleared. |
|
inlinestatic |
Disables individual CRYPTO interrupt sources.
This function disables the indicated Crypto interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt. Disabled sources have no effect on the processor.
ui32IntFlags | is the bitwise OR of the interrupt sources to be enabled. |
|
inlinestatic |
Enables individual Crypto interrupt sources.
This function enables the indicated Crypto interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt. Disabled sources have no effect on the processor.
ui32IntFlags | is the bitwise OR of the interrupt sources to be enabled. |
|
inlinestatic |
Registers an interrupt handler for a Crypto interrupt.
This function does the actual registering of the interrupt handler. This function enables the global interrupt in the interrupt controller; specific UART interrupts must be enabled via CRYPTOIntEnable(). It is the interrupt handler's responsibility to clear the interrupt source.
pfnHandler | is a pointer to the function to be called when the UART interrupt occurs. |
Definition at line 675 of file crypto.h.
|
inlinestatic |
Gets the current interrupt status.
This function returns the interrupt status for the specified Crypto. Either the raw interrupt status or the status of interrupts that are allowed to reflect to the processor can be returned.
bMasked | whether to use raw or masked interrupt status:
|
|
inlinestatic |
Unregisters an interrupt handler for a Crypto interrupt.
This function does the actual unregistering of the interrupt handler. It clears the handler to be called when a Crypto interrupt occurs. This function also masks off the interrupt in the interrupt controller so that the interrupt handler no longer is called.
Definition at line 704 of file crypto.h.
#define AES_DMA_BSY 11 |
Definition at line 146 of file crypto.h.
Referenced by CRYPTOAesEcbStatus(), CRYPTOCcmAuthEncryptStatus(), and CRYPTOCcmInvAuthDecryptStatus().
#define AES_DMA_BUS_ERROR 3 |
Definition at line 141 of file crypto.h.
Referenced by CRYPTOAesEcbStatus(), CRYPTOCcmAuthEncrypt(), CRYPTOCcmAuthEncryptStatus(), CRYPTOCcmInvAuthDecrypt(), and CRYPTOCcmInvAuthDecryptStatus().
#define AES_ECB_LENGTH 16 |
Definition at line 104 of file crypto.h.
Referenced by CRYPTOAesEcb().
#define AES_KEYSTORE_READ_ERROR 1 |
Definition at line 139 of file crypto.h.
Referenced by CRYPTOAesEcb(), CRYPTOAesLoadKey(), CRYPTOCcmAuthEncrypt(), and CRYPTOCcmInvAuthDecrypt().
#define AES_SUCCESS 0 |
Definition at line 138 of file crypto.h.
Referenced by CRYPTOAesEcb(), CRYPTOAesEcbStatus(), CRYPTOAesLoadKey(), CRYPTOCcmAuthEncrypt(), CRYPTOCcmAuthEncryptResultGet(), CRYPTOCcmAuthEncryptStatus(), CRYPTOCcmInvAuthDecrypt(), CRYPTOCcmInvAuthDecryptResultGet(), and CRYPTOCcmInvAuthDecryptStatus().
#define CCM_AUTHENTICATION_FAILED 4 |
Definition at line 142 of file crypto.h.
Referenced by CRYPTOCcmInvAuthDecryptResultGet().
#define CRYPTO_AES128_DECRYPT 0x00000008 |
Definition at line 125 of file crypto.h.
Referenced by CRYPTOAesEcb().
#define CRYPTO_AES128_ENCRYPT 0x0000000C |
Definition at line 124 of file crypto.h.
Referenced by CRYPTOAesEcb().
#define CRYPTO_AES_CCM 3 |
Definition at line 182 of file crypto.h.
Referenced by CRYPTOCcmAuthEncrypt(), and CRYPTOCcmInvAuthDecrypt().
#define CRYPTO_AES_CTR_128 0x3 |
Definition at line 193 of file crypto.h.
Referenced by CRYPTOCcmAuthEncrypt(), and CRYPTOCcmInvAuthDecrypt().
#define CRYPTO_AES_ECB 2 |
Definition at line 181 of file crypto.h.
Referenced by CRYPTOAesEcb().
#define CRYPTO_AES_KEYL0AD 1 |
Definition at line 180 of file crypto.h.
Referenced by CRYPTOAesLoadKey().
#define CRYPTO_AES_NONE 0 |
Definition at line 179 of file crypto.h.
Referenced by CRYPTOAesEcbStatus(), CRYPTOAesLoadKey(), CRYPTOCcmAuthEncryptResultGet(), CRYPTOCcmAuthEncryptStatus(), CRYPTOCcmInvAuthDecryptResultGet(), and CRYPTOCcmInvAuthDecryptStatus().
#define CRYPTO_DMA_BSY 0x00000003 |
Definition at line 128 of file crypto.h.
Referenced by CRYPTOAesEcbStatus(), CRYPTOCcmAuthEncryptStatus(), and CRYPTOCcmInvAuthDecryptStatus().
#define CRYPTO_DMA_BUS_ERR 0x80000000 |
Definition at line 114 of file crypto.h.
Referenced by CRYPTOCcmAuthEncrypt(), and CRYPTOCcmInvAuthDecrypt().
#define CRYPTO_DMA_BUS_ERROR 0x00020000 |
Definition at line 129 of file crypto.h.
Referenced by CRYPTOAesEcbStatus(), CRYPTOCcmAuthEncryptStatus(), and CRYPTOCcmInvAuthDecryptStatus().
#define CRYPTO_DMA_CHAN0 0x00000001 |
Definition at line 121 of file crypto.h.
Referenced by CRYPTODmaDisable(), and CRYPTODmaEnable().
#define CRYPTO_DMA_CHAN1 0x00000002 |
Definition at line 122 of file crypto.h.
Referenced by CRYPTODmaDisable(), and CRYPTODmaEnable().
#define CRYPTO_DMA_IN_DONE 0x00000002 |
Definition at line 112 of file crypto.h.
Referenced by CRYPTOCcmAuthEncrypt(), CRYPTOCcmInvAuthDecrypt(), CRYPTOIntClear(), CRYPTOIntDisable(), and CRYPTOIntEnable().
#define CRYPTO_INT_LEVEL 0x00000001 |
Definition at line 118 of file crypto.h.
Referenced by CRYPTOAesEcb(), CRYPTOAesLoadKey(), CRYPTOCcmAuthEncrypt(), CRYPTOCcmInvAuthDecrypt(), and CRYPTOIntEnable().
#define CRYPTO_KEY_AREA_0 0 |
Definition at line 165 of file crypto.h.
Referenced by CRYPTOAesLoadKey().
#define CRYPTO_KEY_AREA_1 1 |
Definition at line 166 of file crypto.h.
Referenced by CRYPTOAesLoadKey().
#define CRYPTO_KEY_AREA_2 2 |
Definition at line 167 of file crypto.h.
Referenced by CRYPTOAesLoadKey().
#define CRYPTO_KEY_AREA_3 3 |
Definition at line 168 of file crypto.h.
Referenced by CRYPTOAesLoadKey().
#define CRYPTO_KEY_AREA_4 4 |
Definition at line 169 of file crypto.h.
Referenced by CRYPTOAesLoadKey().
#define CRYPTO_KEY_AREA_5 5 |
Definition at line 170 of file crypto.h.
Referenced by CRYPTOAesLoadKey().
#define CRYPTO_KEY_AREA_6 6 |
Definition at line 171 of file crypto.h.
Referenced by CRYPTOAesLoadKey().
#define CRYPTO_KEY_AREA_7 7 |
Definition at line 172 of file crypto.h.
Referenced by CRYPTOAesLoadKey().
#define CRYPTO_KEY_ST_RD_ERR 0x20000000 |
Definition at line 116 of file crypto.h.
Referenced by CRYPTOAesEcb(), CRYPTOCcmAuthEncrypt(), and CRYPTOCcmInvAuthDecrypt().
#define CRYPTO_RESULT_RDY 0x00000001 |
Definition at line 113 of file crypto.h.
Referenced by CRYPTOCcmAuthEncrypt(), CRYPTOIntClear(), CRYPTOIntDisable(), and CRYPTOIntEnable().
#define KEY_BLENGTH 16 |
Definition at line 150 of file crypto.h.
Referenced by CRYPTOAesLoadKey().
#define KEY_STORE_SIZE_128 0x00000001 |
Definition at line 153 of file crypto.h.
Referenced by CRYPTOAesLoadKey(), CRYPTOCcmAuthEncrypt(), and CRYPTOCcmInvAuthDecrypt().