AES Module¶
The AES module driver provides a method for performing encryption and decryption operations on blocks of 128-bits of data. The configuration and feature highlights are: 1. Supports ECB, CBC, CTR, ICM, CFB, CBC-MAC, GCM, CCM, XTS, F8, and F9 operating modes. 2. The cipher block handles keys of 128-bits, 192-bits, and 256 bits. 3. In modes that require authentication, a hash tag is generated. 4. Controls uDMA triggers for context and data transfers.
-
group
aes_api
Defines
-
AES_INT_CONTEXT_IN
0x00000001U¶ Context-In Interrupt.
-
AES_INT_CONTEXT_OUT
0x00000008U¶ Context-Out Interrupt.
-
AES_INT_DATA_IN
0x00000002U¶ Data-In Interrupt.
-
AES_INT_DATA_OUT
0x00000004U¶ Data-Out Interrupt.
-
AES_AESINT_M
(AES_INT_CONTEXT_IN| \
AES_INT_CONTEXT_OUT| \
AES_INT_DATA_IN| \
AES_INT_DATA_OUT)¶
-
AES_DMA_EN_DATA_IN
0x00000020U¶ Enable DMA for data i/p request.
-
AES_DMA_EN_DATA_OUT
0x00000040U¶ Enable DMA for data o/p request.
-
AES_DMA_EN_CONTEXT_IN
0x00000080U¶ Enable DMA for ctx i/p request.
-
AES_DMA_EN_CONTEXT_OUT
0x00000100U¶ Enable DMA for ctx o/p request.
-
AES_DMA_EN_M
(AES_DMA_EN_DATA_IN | AES_DMA_EN_DATA_OUT| \
AES_DMA_EN_CONTEXT_IN | AES_DMA_EN_CONTEXT_OUT)¶
-
AES_CONFIG_M
((uint32_t)AES_CTRL_DIRECTION| \
(uint32_t)
AES_CTRL_MODE| \
(uint32_t)
AES_CTRL_KEY_SIZE_M| \
(uint32_t)
AES_CTRL_CTR| \
(uint32_t)
AES_CTRL_CTR_WIDTH_M| \
(uint32_t)
AES_CTRL_ICM| \
(uint32_t)
AES_CTRL_CFB| \
(uint32_t)
AES_CTRL_XTS_M| \
(uint32_t)
AES_CTRL_F8| \
(uint32_t)
AES_CTRL_F9| \
(uint32_t)
AES_CTRL_CBCMAC| \
(uint32_t)
AES_CTRL_GCM_M| \
(uint32_t)
AES_CTRL_CCM| \
(uint32_t)
AES_CTRL_CCM_L_M| \
(uint32_t)
AES_CTRL_CCM_M_M)¶
Enums
-
enum
AES_Direction
¶ Values that can be passed to AES_configureModule() as the config parameter’s direction member.
Values:
-
enumerator
AES_DIRECTION_DECRYPT
= 0x00000000U¶ Select Decryption Mode.
-
enumerator
AES_DIRECTION_ENCRYPT
= 0x00000004U¶ Select Encryption Mode.
-
enumerator
-
enum
AES_KeySize
¶ Values that can be passed to AES_configureModule() as the config parameter’s keySize member.
Values:
-
enumerator
AES_KEY_SIZE_128BIT
= 0x00000008U¶ Select 128-bit key.
-
enumerator
AES_KEY_SIZE_192BIT
= 0x00000010U¶ Select 192-bit key.
-
enumerator
AES_KEY_SIZE_256BIT
= 0x00000018U¶ Select 256-bit key.
-
enumerator
-
enum
AES_OpMode
¶ Values that can be passed to AES_configureModule() as the config parameter’s opMode member.
Values:
-
enumerator
AES_OPMODE_ECB
= 0x00000000U¶ Select ECB mode.
-
enumerator
AES_OPMODE_CBC
= 0x00000020U¶ Select CBC mode.
-
enumerator
AES_OPMODE_CTR
= 0x00000040U¶ Select CTR mode.
-
enumerator
AES_OPMODE_ICM
= 0x00000200U¶ Select ICM mode.
-
enumerator
AES_OPMODE_CFB
= 0x00000400U¶ Select CFB mode.
-
enumerator
AES_OPMODE_XTS_TWEAKJL
= 0x00000800U¶ Select XTS TWEAKJL mode.
-
enumerator
AES_OPMODE_XTS_K2NJL
= 0x00001000U¶ Select XTS K2IJL mode.
-
enumerator
AES_OPMODE_XTS_K2NLJ0
= 0x00001800U¶ Select XTS K2ILJ0 mode.
-
enumerator
AES_OPMODE_F8
= 0x00002000U¶ Select F8 mode.
-
enumerator
AES_OPMODE_F9
= 0x20004000U¶ Select F9 mode.
-
enumerator
AES_OPMODE_CBCMAC
= 0x20008000U¶ Select CBC-MAC mode.
-
enumerator
AES_OPMODE_GCM_HLY0ZERO
= 0x20010000U¶ Select GCM HLY0ZERO mode.
-
enumerator
AES_OPMODE_GCM_HLY0CALC
= 0x20020040U¶ Select GCM HLY0CALC mode.
-
enumerator
AES_OPMODE_GCM_HY0CALC
= 0x20030040U¶ Select GCM HY0CALC mode.
-
enumerator
AES_OPMODE_CCM
= 0x20040040U¶ Select CCM mode.
-
enumerator
-
enum
AES_CounterWidth
¶ Values that can be passed to AES_configureModule() as the config parameter’s ctrWidth member.
Values:
-
enumerator
AES_CTR_WIDTH_32BIT
= 0x00000000U¶ Select 32-bit counter.
-
enumerator
AES_CTR_WIDTH_64BIT
= 0x00000080U¶ Select 64-bit counter.
-
enumerator
AES_CTR_WIDTH_96BIT
= 0x00000100U¶ Select 96-bit counter.
-
enumerator
AES_CTR_WIDTH_128BIT
= 0x00000180U¶ Select 128-bit counter.
-
enumerator
-
enum
AES_CCMLenWidth
¶ Values that can be passed to AES_configureModule() as the config parameter’s ccmLenWidth member.
Values:
-
enumerator
AES_CCM_L_1
= 0x00000000U¶ CCM Length width = 1 byte.
-
enumerator
AES_CCM_L_2
= 0x00080000U¶ CCM Length width = 2 bytes.
-
enumerator
AES_CCM_L_4
= 0x00180000U¶ CCM Length width = 4 bytes.
-
enumerator
AES_CCM_L_8
= 0x00380000U¶ CCM Length width = 8 bytes.
-
enumerator
-
enum
AES_CCMAuthLenWidth
¶ Values that can be passed to AES_configureModule() as the config parameter’s ccmAuthLenWidth member.
Values:
-
enumerator
AES_CCM_M_0
= 0x00000000U¶ CCM Auth Length width at reset.
-
enumerator
AES_CCM_M_4
= 0x00400000U¶ CCM Auth Length width = 4 bytes.
-
enumerator
AES_CCM_M_6
= 0x00800000U¶ CCM Auth Length width = 6 bytes.
-
enumerator
AES_CCM_M_8
= 0x00C00000U¶ CCM Auth Length width = 8 bytes.
-
enumerator
AES_CCM_M_10
= 0x01000000U¶ CCM Auth Length width = 10 bytes.
-
enumerator
AES_CCM_M_12
= 0x01400000U¶ CCM Auth Length width = 12 bytes.
-
enumerator
AES_CCM_M_14
= 0x01800000U¶ CCM Auth Length width = 14 bytes.
-
enumerator
AES_CCM_M_16
= 0x01C00000U¶ CCM Auth Length width = 16 bytes.
-
enumerator
Functions
-
void
AES_performSoftReset
(uint32_t base)¶ Resets the AES module.
This function performs a soft-reset of the AES module.
- Parameters
base
: is the base address of the AES module.
- Return
None.
-
void
AES_setDataLength
(uint32_t base, uint64_t length)¶ Used to set the write crypto data length in the AES module.
This function stores the cryptographic data length in blocks for all modes. Data lengths up to (2^61 - 1) bytes are allowed. For GCM, any value up to (2^36 - 32) bytes are allowed because a 32-bit block counter is used. For basic modes (ECB/CBC/CTR/ICM/CFB128), zero can be programmed into the length field, indicating that the length is infinite.
- Parameters
base
: is the base address of the AES module.length
: is the crypto data length in bytes.
When this function is called, the engine is triggered to start using this context.
- Note
This length does not include the authentication-only data used in some modes. Use the AES_setAuthDataLength() function to specify the authentication data length.
- Return
None
-
void
AES_setAuthDataLength
(uint32_t base, uint32_t authLength)¶ Sets the authentication data length in the AES module.
This function is only used to write the authentication data length in the combined modes (GCM or CCM) and XTS mode. Supported AAD lengths for CCM are from 0 to (2^16 - 2^8) bytes. For GCM, any value up to (2^32 - 1) can be used. For XTS mode, this register is used to load j. Loading of j is only required if j != 0. j represents the sequential number of the 128-bit blocks inside the data unit. Consequently, j must be multiplied by 16 before it is passed to this function, thereby placing the block number in bits [31:4] of the register.
- Parameters
base
: is the base address of the AES module.authLength
: is the authentication data length in bytes.
When this function is called, the engine is triggered to start using this context for GCM and CCM.
- Return
None
-
void
AES_enableInterrupt
(uint32_t base, uint32_t intFlags)¶ Enables AES core interrupts.
This function enables the core interrupts in the AES module. The
intFlags parameter is the logical OR of any of the following:- Parameters
base
: is the base address of the AES module.intFlags
: is a bit mask of the interrupt sources to enable.
AES_INT_CONTEXT_IN - Context interrupt
AES_INT_CONTEXT_OUT - Authentication tag (and IV) interrupt
AES_INT_DATA_IN - Data input interrupt
AES_INT_DATA_OUT - Data output interrupt
- Note
Interrupts that have been previously been enabled are not disabled when this function is called.
- See
AES_enableGlobalInterrupt() to enable global interrupt at wrapper level. Global interrupt needs to be enabled along with core level interrupts to enable interrupts at module level.
- Return
None.
-
void
AES_disableInterrupt
(uint32_t base, uint32_t intFlags)¶ Disables AES core interrupts.
This function disables the core interrupt sources in the AES module. The
intFlags parameter is the logical OR of any of the following:- Parameters
base
: is the base address of the AES module.intFlags
: is a bit mask of the interrupt sources to disable.
AES_INT_CONTEXT_IN - Context interrupt
AES_INT_CONTEXT_OUT - Authentication tag (and IV) interrupt
AES_INT_DATA_IN - Data input interrupt
AES_INT_DATA_OUT - Data output interrupt
- See
AES_disableGlobalInterrupt() to disable global interrupt at wrapper level.
- Return
None.
-
void
AES_enableGlobalInterrupt
(uint32_t wrapperBase)¶ Enables AES module global interrupt.
This function enables the global interrupt in the AES module at wrappper level.
- Parameters
wrapperBase
: is the base address of the AES module wrapper.
- Note
Global interrupts needs to be enabled along with individual AES core interrupts like AES_INT_CONTEXT_IN, AES_INT_CONTEXT_OUT, AES_INT_DATA_IN and AES_INT_DATA_OUT.
- Return
None.
-
void
AES_disableGlobalInterrupt
(uint32_t wrapperBase)¶ Disables AES module global interrupt.
This function disables the global interrupt in the AES module at wrapper level.
- Parameters
wrapperBase
: is the base address of the AES module wrapper.
- Note
Global interrupts needs to be enabled along with individual AES interrupts like AES_INT_CONTEXT_IN, AES_INT_CONTEXT_OUT, AES_INT_DATA_IN, and AES_INT_DATA_OUT.
- Return
None.
-
void
AES_clearGlobalInterrupt
(uint32_t wrapperBase)¶ Clears AES module global interrupt flag.
This function clears the global interrupt flag in the AES module at wrapper level.
- Parameters
wrapperBase
: is the base address of the AES module wrapper.
- Return
None.
-
bool
AES_getGlobalInterruptStatus
(uint32_t wrapperBase)¶ Returns the AES module global interrupt status.
This function returns the AES global interrupt status flag at wrapper level.
- Parameters
wrapperBase
: is the base address of the AES module wrapper.
- Return
Returns the global interrupt status.
true - Global interrupt is flagged
false - Global interrupt is not flagged
-
void
AES_registerInterrupt
(uint32_t base, void (*fnHandler)(void))¶ Registers an interrupt handler for the AES module.
This function registers the interrupt handler in the interrupt vector table, and enables AES interrupts on the interrupt controller; specific AES interrupt sources must be enabled using
AES_enableInterrupt(). The interrupt handler being registered must clear the source of the interrupt using AES_clearInterruptStatus().- Parameters
base
: is the base address of AES peripheral.fnHandler
: is a pointer to the function to be called when the enabled AES interrupts occur.
If the application is using a static interrupt vector table stored in flash, then it is not necessary to register the interrupt handler this way. Instead, Interrupt_enable() is used to enable AES interrupts on the interrupt controller.
The base parameter can take following value: AESA_BASE
- See
Interrupt_registerHandler() for important information about registering interrupt handlers.
- Return
None.
-
void
AES_unregisterInterrupt
(uint32_t intNum)¶ Unregisters an interrupt handler for the AES module.
This function unregisters the previously registered interrupt handler and disables the interrupt in the interrupt controller.
- Parameters
intNum
: is the interrupt number for AES interrupt.
The intNum parameter can take following value: AES_INT
- See
Interrupt_registerHandler() for important information about registering interrupt handlers.
- Return
None.
-
void
AES_enableDMARequest
(uint32_t base, uint32_t reqFlags)¶ Enables uDMA requests for the AES module.
This function enables the uDMA request sources in the AES module. The
reqFlags parameter is the logical OR of any of the following:- Parameters
base
: is the base address of the AES module.reqFlags
: is a bit mask of the uDMA requests to be enabled.
AES_DMA_EN_DATA_IN
AES_DMA_EN_DATA_OUT
AES_DMA_EN_CONTEXT_IN
AES_DMA_EN_CONTEXT_OUT
- Return
None.
-
void
AES_disableDMARequest
(uint32_t base, uint32_t reqFlags)¶ Disables uDMA requests for the AES module.
This function disables the uDMA request sources in the AES module. The
reqFlags parameter is the logical OR of any of the following:- Parameters
base
: is the base address of the AES module.reqFlags
: is a bit mask of the uDMA requests to be disabled.
AES_DMA_EN_DATA_IN
AES_DMA_EN_DATA_OUT
AES_DMA_EN_CONTEXT_IN
AES_DMA_EN_CONTEXT_OUT
- Return
None.
-
void
AES_configureModule
(uint32_t base, const AES_ConfigParams *config)¶ Configures the AES module.
This function configures the AES module based on the specified parameters. It does not change any DMA- or interrupt-related parameters.
- Parameters
base
: is the base address of the AES module.config
: is the configuration of the AES module.
The config parameter is a structure with members specifying valid AES mode configurations.
The direction of the operation is specified with following enum members:
AES_DIRECTION_ENCRYPT - Encryption mode
AES_DIRECTION_DECRYPT - Decryption mode
The key size is specified with following enum members:
AES_KEY_SIZE_128BIT - Key size of 128 bits
AES_KEY_SIZE_192BIT - Key size of 192 bits
AES_KEY_SIZE_256BIT - Key size of 256 bits
The mode of operation is specified with following enum members:
AES_OPMODE_ECB - Electronic codebook mode
AES_OPMODE_CBC - Cipher-block chaining mode
AES_OPMODE_CFB - Cipher feedback mode
AES_OPMODE_CTR - Counter mode
AES_OPMODE_ICM - Integer counter mode
AES_OPMODE_XTS_TWEAKJL - XEX-based tweaked-codebook mode with ciphertext stealing with previous/intermediate tweak value and j loaded
AES_OPMODE_XTS_K2IJL - XEX-based tweaked-codebook mode with ciphertext stealing with key2, i and j loaded
AES_OPMODE_XTS_K2ILJ0 - XEX-based tweaked-codebook mode with ciphertext stealing with key2 and i loaded, j = 0
AES_OPMODE_F8 - F8 mode
AES_OPMODE_F9 - F9 mode
AES_OPMODE_CBCMAC - Cipher block chaining message authentication code mode
AES_OPMODE_GCM_HLY0ZERO - Galois/counter mode with GHASH with H loaded, Y0-encrypted forced to zero and counter is not enabled.
AES_OPMODE_GCM_HLY0CALC - Galois/counter mode with GHASH with H loaded, Y0-encrypted calculated internally and counter is enabled.
AES_OPMODE_GCM_HY0CALC - Galois/Counter mode with autonomous GHASH (both H and Y0-encrypted calculated internally) and counter is enabled.
AES_OPMODE_CCM - Counter with CBC-MAC mode
The following enums are used to specify the counter width. It is only required to be defined when using CTR, CCM, or GCM modes, only one of the following defines must be used to specify the counter width length:
AES_CTR_WIDTH_32BIT - Counter is 32 bits
AES_CTR_WIDTH_64BIT - Counter is 64 bits
AES_CTR_WIDTH_96BIT - Counter is 96 bits
AES_CTR_WIDTH_128BIT - Counter is 128 bits
Only one of the following defines must be used to specify the length field for CCM operations (L):
AES_CCM_L_1 - 1 byte
AES_CCM_L_2 - 2 bytes
AES_CCM_L_4 - 4 bytes
AES_CCM_L_8 - 8 bytes
Only one of the following enum members must be used to specify the length of authentication field for CCM operations (M) through the config argument member in the AES_configureModule() function:
AES_CCM_M_0 - reset value
AES_CCM_M_4 - 4 bytes
AES_CCM_M_6 - 6 bytes
AES_CCM_M_8 - 8 bytes
AES_CCM_M_10 - 10 bytes
AES_CCM_M_12 - 12 bytes
AES_CCM_M_14 - 14 bytes
AES_CCM_M_16 - 16 bytes
- Note
When performing a basic GHASH operation for used with GCM mode, use the AES_OPMODE_GCM_HLY0ZERO and do not specify a direction.
- Return
None.
-
void
AES_setKey1
(uint32_t base, const uint32_t key[], AES_KeySize keySize)¶ Writes the key 1 configuration registers, which are used for encryption or decryption.
This function writes key 1 configuration registers based on the key size. This function is used in all modes.
- Parameters
base
: is the base address for the AES module.key
: is an array of 32-bit words, containing the key to be configured. The least significant word is at the 0th index. The key array data values are expected to be in big-endian format.keySize
: is the size of the key, which must be one of the following enum values: AES_KEY_SIZE_128BIT, AES_KEY_SIZE_192BIT, or AES_KEY_SIZE_256BIT.
- Return
None.
-
void
AES_setKey2
(uint32_t base, const uint32_t key[], AES_KeySize keySize)¶ Writes the key 2 configuration registers, which are used for encryption or decryption.
This function writes the key 2 configuration registers based on the key size. This function is used in the F8, F9, XTS, CCM, and CBC-MAC modes.
- Parameters
base
: is the base address for the AES module.key
: is an array of 32-bit words, containing the key to be configured. The least significant word in the 0th index. The key array data values are expected to be in big-endian format.keySize
: is the size of the key, which must be one of the following enum values: AES_KEY_SIZE_128BIT, AES_KEY_SIZE_192BIT, or AES_KEY_SIZE_256BIT.
- Return
None.
-
void
AES_setKey3
(uint32_t base, const uint32_t key[])¶ Writes key 3 configuration registers, which are used for encryption or decryption.
This function writes the key 2 configuration registers with key 3 data used in CBC-MAC and F8 modes. This key is always 128 bits.
- Parameters
base
: is the base address for the AES module.key
: is a pointer to an array of 4 words (128 bits), containing the key to be configured. The least significant word is in the 0th index. The key array data values are expected to be in big-endian format.
- Return
None.
-
void
AES_setInitializationVector
(uint32_t base, const uint32_t iniVector[])¶ Writes the Initial Vector (IV) register, needed in some of the AES Modes.
This function writes the initial vector registers in the AES module.
- Parameters
base
: is the base address of the AES module.iniVector
: is an array of 4 words (128 bits), containing the IV value to be configured. The least significant word is in the 0th index. The IV array data values are expected to be in big-endian format.
- Return
None.
-
void
AES_readInitializationVector
(uint32_t base, uint32_t iniVector[])¶ Saves the Initial Vector (IV) registers to a user-defined location.
This function stores the IV for use in authenticated encryption and decryption operations. It is assumed that the AES_CTRL_SAVE_CONTEXT bit is set in the AES_CTRL register.
- Parameters
base
: is the base address of the AES module.iniVector
: is pointer to the location that stores the IV data. The least significant word is in the 0th index. The IV data values are expected to be in big-endian format.
- Return
None.
-
void
AES_readTag
(uint32_t base, uint32_t tagData[])¶ Saves the tag registers to a user-defined location.
This function stores the tag data for use in authenticated encryption and decryption operations. It is assumed that the AES_CTRL_SAVE_CONTEXT bit is set in the AES_CTRL register.
- Parameters
base
: is the base address of the AES module.tagData
: is pointer to the location that stores the tag data. The least significant word is in the 0th index. The tag array data values are expected to be in big-endian format.
- Return
None.
-
bool
AES_readDataNonBlocking
(uint32_t base, uint32_t destArray[])¶ Reads plaintext/ciphertext from data registers without blocking.
This function reads a block of either plaintext or ciphertext out of the AES module. If the output data is not ready, the function returns false. If the read completed successfully, the function returns true. A block is 16 bytes or 4 words.
- Parameters
base
: is the base address of the AES module.destArray
: is a pointer to an array of words of data. The least significant word is in the 0th index. The read data values are expected to be in big-endian format.
- Return
Returns true or false.
-
void
AES_readDataBlocking
(uint32_t base, uint32_t destArray[])¶ Reads plaintext/ciphertext from data registers with blocking.
This function reads a block of either plaintext or ciphertext out of the AES module. If the output is not ready, the function waits until it is ready. A block is 16 bytes or 4 words.
- Parameters
base
: is the base address of the AES module.destArray
: is a pointer to an array of words. The least significant word is in the 0th index. The read data values are expected to be in big-endian format.
- Return
None.
-
bool
AES_writeDataNonBlocking
(uint32_t base, const uint32_t srcArray[])¶ Writes plaintext/ciphertext to data registers without blocking.
This function writes a block of either plaintext or ciphertext into the AES module. If the input is not ready, the function returns false. If the write completed successfully, the function returns true. A block is 16 bytes or 4 words.
- Parameters
base
: is the base address of the AES module.srcArray
: is a pointer to an array of words of data. The least significant word is in the 0th index. The input data values are expected to be in big-endian format.
- Return
True or false.
-
void
AES_writeDataBlocking
(uint32_t base, const uint32_t srcArray[])¶ Writes plaintext/ciphertext to data registers with blocking.
This function writes a block of either plaintext or ciphertext into the AES module. If the input is not ready, the function waits until it is ready before performing the write. A block is 16 bytes or 4 words.
- Parameters
base
: is the base address of the AES module.srcArray
: is a pointer to an array of bytes. The least significant word is in the 0th index. The input data values are expected to be in big-endian format.
- Return
None.
-
bool
AES_processData
(uint32_t base, const uint32_t srcArray[], uint32_t destArray[], uint64_t dataLength)¶ Used to process(transform) blocks of data, either encrypt or decrypt it.
This function iterates the encryption or decryption mechanism number over the data length. Before calling this function, ensure that the AES module is properly configured the key, data size, mode, and so on. Only ECB, CBC, CTR, ICM, CFB, XTS and F8 operating modes should be used. The data is processed in 4-word (16-byte) blocks.
- Parameters
base
: is the base address of the AES module.srcArray
: is a pointer to the memory location where the input data is stored. The data must be padded to the 16-byte boundary. The input data values are expected to be in big-endian format.destArray
: is a pointer to the memory location output is written. The space for written data must be rounded up to the 16-byte boundary. The output data values are expected to be in big-endian format.dataLength
: is the length of the cryptographic data in bytes.
- Return
Returns true if data was processed successfully. Returns false if data processing failed.
-
bool
AES_authenticateData
(uint32_t base, const uint32_t srcArray[], uint64_t dataLength, uint32_t tagArray[])¶ Used to authenticate blocks of data by generating a hash tag.
This function processes data to produce a hash tag that can be used tor authentication. Before calling this function, ensure that the AES module is properly configured the key, data size, mode, and so on. Only CBC-MAC and F9 modes should be used.
- Parameters
base
: is the base address of the AES module.srcArray
: is a pointer to the memory location where the input data is stored. The data must be padded to the 16-byte boundary. The input data values are expected to be in big-endian format.dataLength
: is the length of the cryptographic data in bytes.tagArray
: is a pointer to a 4-word array where the hash tag is written. The output data values are to be expected in big-endian format.
- Return
Returns true if data was processed successfully. Returns false if data processing failed.
-
bool
AES_processDatainAuthMode
(uint32_t base, const uint32_t srcArray[], uint32_t destArray[], uint64_t dataLength, const uint32_t authDataArray[], uint32_t authDataLength, uint32_t tagArray[])¶ Processes and authenticates blocks of data, either encrypts it or decrypts it.
This function encrypts or decrypts blocks of data in addition to authentication data. A hash tag is also produced. Before calling this function, ensure that the AES module is properly configured the key, data size, mode, and so on. Only CCM and GCM modes should be used.
- Parameters
base
: is the base address of the AES module.srcArray
: is a pointer to the memory location where the input data is stored. The data must be padded to the 16-byte boundary. The input data values are expected to be in big-endian format.destArray
: is a pointer to the memory location where the output is written. The space for written data must be rounded up to the 16-byte boundary. The output data values are to be expected in big-endian format.dataLength
: is the length of the cryptographic data in bytes.authDataArray
: is a pointer to the memory location where the additional authentication data is stored. The data must be padded to the 16-byte boundary. The output data values are to be expected in big-endian format.authDataLength
: is the length of the additional authentication data in bytes.tagArray
: is a pointer to a 4-word array where the hash tag is written. The output data values are to be expected in big-endian format.
- Return
Returns true if data was processed successfully. Returns false if data processing failed.
-
uint32_t
AES_getInterruptStatus
(uint32_t base, bool intMask)¶ Returns the current AES module core interrupt status.
AES_INT_CONTEXT_IN - Context interrupt
AES_INT_CONTEXT_OUT - Authentication tag (and IV) interrupt.
AES_INT_DATA_IN - Data input interrupt
AES_INT_DATA_OUT - Data output interrupt
- Return
Returns a bit mask of the core interrupt sources, which is a logical OR of any of the following:
- Parameters
base
: is the base address of the AES module.intMask
: is false if the raw interrupt status is required and true if the masked interrupt status is required.
-
struct
AES_ConfigParams
¶ - #include <aes.h>
Values that can be passed to AES_configureModule() as the config parameter.
-
APIs are available to configure AES module for any of the supported modes; set key and IV if supported by the configured mode; to perform blocking/non-blocking read/write of input/output plain-text/cipher-text and also for reading IV or tag if supported by the configured mode.
APIs are also available to enable/disable/clear data/context related interrupts; get interrupt status & to register/unregister interrupt handler.
For uDMA transfers there are APIs to enable/disable DMA requests for input/output data/context transfers.
The code for this module is contained in driverlib_cm/aes.c and driverlib_cm/aes.h.