Functions
Crypto Driver AES Register Level Functions

The section has a list of all the AES functions used internally by the driver. More...

Functions

void AES_init (AESRegs *aesBaseAddress)
 
void AES_config (AESRegs *baseAddress, uint32_t config)
 
uint32_t AES_isReady (const AESRegs *aesBaseAddress, uint32_t flag)
 
void AES_setKey1 (AESRegs *baseAddress, const uint8_t *ptrKey, uint32_t keySize)
 
void AES_setKey2 (AESRegs *baseAddress, const uint8_t *ptrKey, uint32_t keySize)
 
void AES_setKey3 (AESRegs *baseAddress, const uint8_t *ptrKey)
 
void AES_setIV (AESRegs *baseAddress, const uint8_t *ptrIVData)
 
void AES_getIV (AESRegs *baseAddress, uint8_t *ptrIVData)
 
void AES_readTag (const AESRegs *baseAddress, uint8_t *ptrTag)
 
void AES_setDataLength (AESRegs *baseAddress, uint64_t dataLen)
 
void AES_setAuthDataLength (AESRegs *baseAddress, uint32_t dataLen)
 
void AES_readDataBlocking (const AESRegs *baseAddress, uint8_t *ptrData, uint32_t dataLen)
 
void AES_writeDataBlocking (AESRegs *baseAddress, const uint8_t *ptrData, uint32_t dataLen)
 
void AES_enableInterrupt (DTHERegs *dtheBaseAddress, AESRegs *aesBaseAddress, uint32_t intFlags)
 
void AES_disableInterrupt (DTHERegs *dtheBaseAddress, AESRegs *aesBaseAddress, uint32_t intFlags)
 
void AES_clearInterrupt (DTHERegs *dtheBaseAddress, uint32_t intFlags)
 
uint32_t AES_getInterruptStatus (DTHERegs *dtheBaseAddress, AESRegs *aesBaseAddress, uint8_t masked)
 

Detailed Description

The section has a list of all the AES functions used internally by the driver.

Function Documentation

void AES_clearInterrupt ( DTHERegs dtheBaseAddress,
uint32_t  intFlags 
)

Description
The function clears the AES interrupts.

Note
The DMA done interrupts are the only interrupts that can be cleared using this function. The remaining interrupts can be disabled using the AES_disableInterrupt() function.
Parameters
[in]dtheBaseAddressBase address of DTHE module memory mapped registers.
[in]intFlagsBit mask for the following interrupt sources. AES_INT_DMA_CONTEXT_IN - Context DMA done interrupt AES_INT_DMA_CONTEXT_OUT - Authentication tag (and IV) DMA done interrupt AES_INT_DMA_DATA_IN - Data input DMA done interrupt AES_INT_DMA_DATA_OUT - Data output DMA done interrupt
Return values
Notapplicable
void AES_config ( AESRegs baseAddress,
uint32_t  config 
)

Description
The function configures the AES module with input configuration parameters.

Parameters
[in]baseAddressBase address of AES module memory mapped registers.
[in]configConfiguration parameters for the AES module. The following bit flags are supported. Direction of the operation: Valid values are: AES_CFG_DIR_ENCRYPT - Encryption mode AES_CFG_DIR_DECRYPT - Decryption mode

Key size: Valid values are: AES_CFG_KEY_SIZE_128BIT - 128 bit key AES_CFG_KEY_SIZE_192BIT - 192 bit key AES_CFG_KEY_SIZE_256BIT - 256 bit key

Mode of operation: Valid values are: AES_CFG_MODE_ECB - Electronic codebook mode AES_CFG_MODE_CBC - Cipher-block chaining mode AES_CFG_MODE_CFB - Cipher feedback mode AES_CFG_MODE_CTR - Counter mode AES_CFG_MODE_ICM - Integer counter mode AES_CFG_MODE_XTS - Ciphertext stealing mode AES_CFG_MODE_XTS_TWEAKJL - XEX-baseAddressd tweaked-codebook mode with ciphertext stealing with previous/intermediate tweak value and j loaded AES_CFG_MODE_XTS_K2IJL - XEX-baseAddressd tweaked-codebook mode with ciphertext stealing with key2, i and j loaded AES_CFG_MODE_XTS_K2ILJ0 - XEX-baseAddressd tweaked-codebook mode with ciphertext stealing with key2 and i loaded, j = 0 AES_CFG_MODE_F8 - F8 mode AES_CFG_MODE_F9 - F9 mode AES_CFG_MODE_CBCMAC - Cipher block chaining message authentication code mode AES_CFG_MODE_GCM - Galois/counter mode AES_CFG_MODE_GCM_HLY0ZERO - Galois/counter mode with GHASH with H loaded and Y0-encrypted forced to zero AES_CFG_MODE_GCM_HLY0CALC - Galois/counter mode with GHASH with H loaded and Y0-encrypted calculated internally AES_CFG_MODE_GCM_HY0CALC - Galois/Counter mode with autonomous GHASH (both H and Y0-encrypted calculated internally) AES_CFG_MODE_CCM - Counter with CBC-MAC mode

Counter width: MUST be defined for CTR, CCM or GCM modes. Valid values are: AES_CFG_CTR_WIDTH_32 - 32 bit counter AES_CFG_CTR_WIDTH_64 - 64 bit counter AES_CFG_CTR_WIDTH_96 - 96 bit counter AES_CFG_CTR_WIDTH_128 - 128 bit counter

Length for CCM operation. Valid values for CCM_L are: AES_CFG_CCM_L_2 - 2 bytes AES_CFG_CCM_L_4 - 4 bytes AES_CFG_CCM_L_8 - 8 bytes

Length for CCM operation. Valid values for CCM_M are: AES_CFG_CCM_M_4 - 4 bytes AES_CFG_CCM_M_6 - 6 bytes AES_CFG_CCM_M_8 - 8 bytes AES_CFG_CCM_M_10 - 10 bytes AES_CFG_CCM_M_12 - 12 bytes AES_CFG_CCM_M_14 - 14 bytes AES_CFG_CCM_M_16 - 16 bytes

Return values
Notapplicable
void AES_disableInterrupt ( DTHERegs dtheBaseAddress,
AESRegs aesBaseAddress,
uint32_t  intFlags 
)

Description
The function disables the AES interrupts.

Note
The DMA done interrupts are the only interrupts that can be cleared. The remaining interrupts can be disabled instead using this function.
Parameters
[in]dtheBaseAddressBase address of DTHE module memory mapped registers.
[in]aesBaseAddressBase address of AES module memory mapped registers.
[in]intFlagsBit mask for the following interrupt sources. 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 values
Notapplicable
void AES_enableInterrupt ( DTHERegs dtheBaseAddress,
AESRegs aesBaseAddress,
uint32_t  intFlags 
)

Description
The function enables the AES interrupts.

Parameters
[in]dtheBaseAddressBase address of DTHE module memory mapped registers.
[in]aesBaseAddressBase address of AES module memory mapped registers.
[in]intFlagsBit mask for the following interrupt sources. 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 values
Notapplicable
uint32_t AES_getInterruptStatus ( DTHERegs dtheBaseAddress,
AESRegs aesBaseAddress,
uint8_t  masked 
)

Description
The function returns the interrupt status.

Parameters
[in]dtheBaseAddressBase address of DTHE module memory mapped registers.
[in]aesBaseAddressBase address of AES module memory mapped registers.
[in]masked0 - Raw interrupt status is read. 1 - Masked interrupt status is read.
Return values
Bitmask for the following interrupt sources. 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
void AES_getIV ( AESRegs baseAddress,
uint8_t *  ptrIVData 
)

Description
The function reads the value in Initialization Vector input registers to a user specified buffer.

Parameters
[in]baseAddressBase address of AES module memory mapped registers.
[out]ptrIVDataPointer to the read IV data. IVdata MUST be atleast 16 bytes.
Return values
Notapplicable
void AES_init ( AESRegs aesBaseAddress)

Description
The function Initialize the AES module.

Parameters
[in]aesBaseAddressBase address of AES module memory mapped registers.
Return values
Notapplicable
uint32_t AES_isReady ( const AESRegs aesBaseAddress,
uint32_t  flag 
)

Description
The function checks if the control register is ready for operation indicated by flag.

Parameters
[in]aesBaseAddressBase address of AES module memory mapped registers.
[in]flagIndicates the bit positions to check if ready.
Return values
0- Not ready for access 1 - Ready for access
void AES_readDataBlocking ( const AESRegs baseAddress,
uint8_t *  ptrData,
uint32_t  dataLen 
)

Description
The function reads the ciphered or plain text data into the user specified buffer. If the data is not ready, the function will block the caller.

Parameters
[in]baseAddressBase address of AES module memory mapped registers.
[out]ptrDataPointer to the data buffer.
[in]dataLenData length in bytes. Valid values are 1 to 16.
Return values
Notapplicable
void AES_readTag ( const AESRegs baseAddress,
uint8_t *  ptrTag 
)

Description
The function stores the value in tag registers to a user specified buffer.

Parameters
[in]baseAddressBase address of AES module memory mapped registers.
[out]ptrTagPointer to the read tag data. Tag MUST be atleast 16 bytes.
Return values
Notapplicable
void AES_setAuthDataLength ( AESRegs baseAddress,
uint32_t  dataLen 
)

Description
The function configures the authentication data length in the XTS mode and combined modes for GCM/CCM. Supported AAD lengths are: CCM are from 0 to (2^16 - 28) bytes. GCM, any value up to (2^32 - 1) can be used. 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 when passed to this function, thereby placing the block number in bits [31:4] of the register.

When this function is called, the engine is triggered to start using this context for GCM and CCM modes.

Parameters
[in]baseAddressBase address of AES module memory mapped registers.
[in]dataLenData length in bytes.
Return values
Notapplicable
void AES_setDataLength ( AESRegs baseAddress,
uint64_t  dataLen 
)

Description
The function configures the 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 - 2) 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.

When this function is called, the engine is triggered to start using this context.

Parameters
[in]baseAddressBase address of AES module memory mapped registers.
[in]dataLenData length in bytes.
Note
This length does not include the authentication-only data used in some modes. Use the aesSetAuthDataLength() function to specify the authentication data length.
Return values
Notapplicable
void AES_setIV ( AESRegs baseAddress,
const uint8_t *  ptrIVData 
)

Description
The function writes the Initialization Vector input registers.

Parameters
[in]baseAddressBase address of AES module memory mapped registers.
[in]ptrIVDataPointer to the IV data. IV size is always 128 bits.
Return values
Notapplicable
void AES_setKey1 ( AESRegs baseAddress,
const uint8_t *  ptrKey,
uint32_t  keySize 
)

Description
The function writes the key1 registers based on the key length. This function will be used to configure the keys in all AES modes.

Parameters
[in]baseAddressBase address of AES module memory mapped registers.
[in]ptrKeyPointer to the keys.
[in]keySizeSize of the keys. Valid values are: AES_CFG_KEY_SIZE_128BIT AES_CFG_KEY_SIZE_192BIT AES_CFG_KEY_SIZE_256BIT
Return values
Notapplicable
void AES_setKey2 ( AESRegs baseAddress,
const uint8_t *  ptrKey,
uint32_t  keySize 
)

Description
The function writes the key2 registers based on the key length. This function will be used to configure the keys in F8, F9, XTS, CCM, and CBC-MAC AES modes.

Parameters
[in]baseAddressBase address of AES module memory mapped registers.
[in]ptrKeyPointer to the keys.
[in]keySizeSize of the keys. Valid values are: AES_CFG_KEY_SIZE_128BIT AES_CFG_KEY_SIZE_192BIT AES_CFG_KEY_SIZE_256BIT
Return values
Notapplicable
void AES_setKey3 ( AESRegs baseAddress,
const uint8_t *  ptrKey 
)

Description
The function writes to the upper key2 registers. This function will be used to configure the keys in F8 and CBC-MAC AES modes.

Parameters
[in]baseAddressBase address of AES module memory mapped registers.
[in]ptrKeyPointer to the keys. Key size is always 128 bits.
Return values
Notapplicable
void AES_writeDataBlocking ( AESRegs baseAddress,
const uint8_t *  ptrData,
uint32_t  dataLen 
)

Description
The function writes the ciphered or plain text data into the data registers. If the data registers are not ready, the function will block the caller.

Parameters
[in]baseAddressBase address of AES module memory mapped registers.
[in]ptrDataPointer to the data buffer.
[in]dataLenData length in bytes. Valid values are 1 to 16.
Return values
Notapplicable

Copyright 2018, Texas Instruments Incorporated