MSPM0G1X0X_G3X0X Driver Library  1.10.01.05
Data Structures | Macros | Enumerations | Functions
dl_aes.h File Reference

Detailed Description

Advanced Encryption Standard (AES) Driver Library.


#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <ti/devices/msp/msp.h>
#include <ti/driverlib/dl_common.h>
Include dependency graph for dl_aes.h:

Go to the source code of this file.

Data Structures

struct  DL_AES_backupConfig
 Configuration structure to backup AES peripheral state before going to STOP/STANDBY mode. Used by DL_AES_saveConfiguration. More...
 

Macros

#define DL_AES_INTERRUPT_AES_READY   (AES_CPU_INT_IMASK_AESRDY_MASK)
 AES Ready interrupt.
 
#define DL_AES_EVENT_AES_DMA_TRIGGER0   (AES_DMA_TRIG0_IMASK_DMA0_MASK)
 DMA Trigger Event 0.
 
#define DL_AES_EVENT_AES_DMA_TRIGGER1   (AES_DMA_TRIG1_IMASK_DMA1_SET)
 DMA Trigger Event 1.
 
#define DL_AES_EVENT_AES_DMA_TRIGGER2   (AES_DMA_TRIG2_IMASK_DMA2_SET)
 DMA Trigger Event 2.
 

Enumerations

enum  DL_AES_MODE {
  DL_AES_MODE_ENCRYPT_ECB_MODE,
  DL_AES_MODE_ENCRYPT_CBC_MODE,
  DL_AES_MODE_ENCRYPT_OFB_MODE,
  DL_AES_MODE_ENCRYPT_CFB_MODE,
  DL_AES_MODE_DECRYPT_SAME_KEY_ECB_MODE,
  DL_AES_MODE_DECRYPT_SAME_KEY_CBC_MODE,
  DL_AES_MODE_DECRYPT_SAME_KEY_OFB_MODE,
  DL_AES_MODE_DECRYPT_SAME_KEY_CFB_MODE,
  DL_AES_MODE_GEN_FIRST_ROUND_KEY_ECB_MODE,
  DL_AES_MODE_GEN_FIRST_ROUND_KEY_CBC_MODE,
  DL_AES_MODE_GEN_FIRST_ROUND_KEY_OFB_MODE,
  DL_AES_MODE_GEN_FIRST_ROUND_KEY_CFB_MODE,
  DL_AES_MODE_DECRYPT_KEY_IS_FIRST_ROUND_KEY_ECB_MODE,
  DL_AES_MODE_DECRYPT_KEY_IS_FIRST_ROUND_KEY_CBC_MODE,
  DL_AES_MODE_DECRYPT_KEY_IS_FIRST_ROUND_KEY_OFB_MODE,
  DL_AES_MODE_DECRYPT_KEY_IS_FIRST_ROUND_KEY_CFB_MODE
}
 
enum  DL_AES_IIDX {
  DL_AES_IIDX_AES_READY = AES_CPU_INT_IIDX_STAT_AESRDY,
  DL_AES_IIDX_AES_DMA_TRIGGER0 = AES_DMA_TRIG0_IIDX_STAT_DMA0,
  DL_AES_IIDX_AES_DMA_TRIGGER1 = AES_DMA_TRIG1_IIDX_STAT_DMA1,
  DL_AES_IIDX_AES_DMA_TRIGGER2 = AES_DMA_TRIG2_IIDX_STAT_DMA2
}
 
enum  DL_AES_OPERATION {
  DL_AES_OPERATION_ENC = AES_AESACTL0_OPX_OP0,
  DL_AES_OPERATION_DEC_SAME_KEY = AES_AESACTL0_OPX_OP1,
  DL_AES_OPERATION_GEN_FIRST_ROUND = AES_AESACTL0_OPX_OP2,
  DL_AES_OPERATION_DEC_KEY_IS_FIRST_ROUND = AES_AESACTL0_OPX_OP3
}
 
enum  DL_AES_KEY_LENGTH {
  DL_AES_KEY_LENGTH_128 = AES_AESACTL0_KLX_AES128,
  DL_AES_KEY_LENGTH_256 = AES_AESACTL0_KLX_AES256
}
 
enum  DL_AES_STATUS {
  DL_AES_STATUS_SUCCESS,
  DL_AES_STATUS_UNALIGNED_ACCESS
}
 

Functions

__STATIC_INLINE void DL_AES_enablePower (AES_Regs *aes)
 Enables power on AES module. More...
 
__STATIC_INLINE void DL_AES_disablePower (AES_Regs *aes)
 Disables power on AES module. More...
 
__STATIC_INLINE bool DL_AES_isPowerEnabled (AES_Regs *aes)
 Returns if power enabled on AES module. More...
 
__STATIC_INLINE void DL_AES_reset (AES_Regs *aes)
 Resets AES peripheral. More...
 
__STATIC_INLINE bool DL_AES_isReset (AES_Regs *aes)
 Returns if AES peripheral was reset. More...
 
__STATIC_INLINE void DL_AES_init (AES_Regs *aes, DL_AES_MODE aesConfig, DL_AES_KEY_LENGTH keyLength)
 Initializes AES peripheral. More...
 
__STATIC_INLINE void DL_AES_softwareReset (AES_Regs *aes)
 Immediately resets the complete AES accelerator module even when busy. More...
 
__STATIC_INLINE bool DL_AES_isFaultFlagSet (AES_Regs *aes)
 Returns status of AES error flag. More...
 
__STATIC_INLINE void DL_AES_clearFaultFlag (AES_Regs *aes)
 Clears AES error flag. More...
 
__STATIC_INLINE void DL_AES_enableCipherMode (AES_Regs *aes)
 Enables cipher mode. More...
 
__STATIC_INLINE void DL_AES_disablesCipherMode (AES_Regs *aes)
 Disables cipher mode. More...
 
__STATIC_INLINE void DL_AES_setCipherBlockCounter (AES_Regs *aes, uint32_t count)
 Set cipher block counter value. More...
 
__STATIC_INLINE uint32_t DL_AES_getCipherBlockCounter (AES_Regs *aes)
 Get current cipher block counter value. More...
 
__STATIC_INLINE bool DL_AES_isBusy (AES_Regs *aes)
 Gets the AES module busy status. More...
 
__STATIC_INLINE bool DL_AES_getDataOutReadStatus (AES_Regs *aes)
 Gets the DATAOUT read status. More...
 
__STATIC_INLINE uint8_t DL_AES_getKeyBytesCount (AES_Regs *aes)
 Gets Key byte count. More...
 
__STATIC_INLINE uint8_t DL_AES_getDataInBytesCount (AES_Regs *aes)
 Gets Data In byte count. More...
 
__STATIC_INLINE uint8_t DL_AES_getDataOutBytesCount (AES_Regs *aes)
 Gets Data Out byte count. More...
 
__STATIC_INLINE void DL_AES_setAllDataWritten (AES_Regs *aes)
 Set bit to write all STATE bytes to STATE registers and triggers a new encryption. More...
 
__STATIC_INLINE void DL_AES_setAllKeyWritten (AES_Regs *aes)
 Set bit to write all KEY bytes to KEY register, which is used to encrypt and decrypt data. More...
 
__STATIC_INLINE bool DL_AES_isAllDataWritten (AES_Regs *aes)
 Check if all bytes are to be written to registers containing STATE info. More...
 
__STATIC_INLINE bool DL_AES_isAllKeysWritten (AES_Regs *aes)
 Check if all bytes are to be written to registers containing KEY info. More...
 
DL_AES_STATUS DL_AES_setKey (AES_Regs *aes, const uint8_t *key, DL_AES_KEY_LENGTH keyLength)
 Loads a 128 or 256 bit key to AES module. More...
 
void DL_AES_setKeyAligned (AES_Regs *aes, const uint32_t *keyAligned, DL_AES_KEY_LENGTH keyLength)
 Loads a 128 or 256 bit key to AES module. More...
 
DL_AES_STATUS DL_AES_xorData (uint8_t *data, uint8_t *xorData, uint8_t *xorOutputData)
 XORs an AES 128-bit block of data in software. More...
 
void DL_AES_xorDataAligned (uint32_t *dataAligned, uint32_t *xorDataAligned, uint32_t *xorOutputDataAligned)
 XORs an aligned 128-bit data block in software. More...
 
DL_AES_STATUS DL_AES_loadDataIn (AES_Regs *aes, const uint8_t *data)
 Encrypts a block of data using the AES module. More...
 
void DL_AES_loadDataInAligned (AES_Regs *aes, const uint32_t *dataAligned)
 Encrypts a block of data using the AES module. More...
 
DL_AES_STATUS DL_AES_getDataOut (AES_Regs *aes, uint8_t *data)
 Gets output of encrypted data. More...
 
void DL_AES_getDataOutAligned (AES_Regs *aes, uint32_t *dataAligned)
 Gets output of encrypted data. More...
 
DL_AES_STATUS DL_AES_loadXORDataIn (AES_Regs *aes, const uint8_t *data)
 Data is XORed with the current word of the state and then block of data is encrypted. Encryption or decryption is started immediately after loading data. More...
 
void DL_AES_loadXORDataInAligned (AES_Regs *aes, const uint32_t *dataAligned)
 Data is XORed with the current word of the state and then block of data is encrypted. Encryption or decryption is started immediately after loading data. More...
 
DL_AES_STATUS DL_AES_loadXORDataInWithoutTrigger (AES_Regs *aes, const uint8_t *data)
 Data is XORed with the current word of the state and then block of data is encrypted. Encryption or decryption is NOT started after loading data. More...
 
void DL_AES_loadXORDataInWithoutTriggerAligned (AES_Regs *aes, const uint32_t *dataAligned)
 Data is XORed with the current word of the state and then block of data is encrypted. Encryption or decryption is NOT started after loading data. More...
 
__STATIC_INLINE void DL_AES_enableInterrupt (AES_Regs *aes)
 Enable AES Ready interrupt. More...
 
__STATIC_INLINE void DL_AES_enableDMATrigger0Interrupt (AES_Regs *aes)
 Enables DMA trigger 0 to publish AES events to the DMA. More...
 
__STATIC_INLINE void DL_AES_enableDMATrigger1Interrupt (AES_Regs *aes)
 Enables DMA trigger 1 to publish AES events to the DMA. More...
 
__STATIC_INLINE void DL_AES_enableDMATrigger2Interrupt (AES_Regs *aes)
 Enables DMA trigger 2 to publish AES events to the DMA. More...
 
__STATIC_INLINE void DL_AES_disableInterrupt (AES_Regs *aes)
 Disable AES Ready interrupt. More...
 
__STATIC_INLINE void DL_AES_disableDMATrigger0Event (AES_Regs *aes)
 Disable DMA Trigger 0 Event. More...
 
__STATIC_INLINE void DL_AES_disableDMATrigger1Event (AES_Regs *aes)
 Disable DMA Trigger 1 Event. More...
 
__STATIC_INLINE void DL_AES_disableDMATrigger2Event (AES_Regs *aes)
 Disable DMA Trigger 2 Event. More...
 
__STATIC_INLINE uint32_t DL_AES_getEnabledInterrupts (AES_Regs *aes)
 Check if AES Ready interrupt is enabled. More...
 
__STATIC_INLINE uint32_t DL_AES_getEnabledDMATrigger0Event (AES_Regs *aes)
 Check if DMA Trigger 0 Event is enabled. More...
 
__STATIC_INLINE uint32_t DL_AES_getEnabledDMATrigger1Event (AES_Regs *aes)
 Check if DMA Trigger 1 Event is enabled. More...
 
__STATIC_INLINE uint32_t DL_AES_getEnabledDMATrigger2Event (AES_Regs *aes)
 Check if DMA Trigger 2 Event is enabled. More...
 
__STATIC_INLINE uint32_t DL_AES_getEnabledInterruptStatus (AES_Regs *aes)
 Check interrupt flag of AES Ready interrupt. More...
 
__STATIC_INLINE uint32_t DL_AES_getEnabledDMATrigger0EventStatus (AES_Regs *aes)
 Check interrupt flag of DMA Trigger 0 Event. More...
 
__STATIC_INLINE uint32_t DL_AES_getEnabledDMATrigger1EventStatus (AES_Regs *aes)
 Check interrupt flag of DMA Trigger 1 Event. More...
 
__STATIC_INLINE uint32_t DL_AES_getEnabledDMATrigger2EventStatus (AES_Regs *aes)
 Check interrupt flag of DMA Trigger 2 Event. More...
 
__STATIC_INLINE uint32_t DL_AES_getRawInterruptStatus (AES_Regs *aes)
 Check interrupt flag of AES Ready interrupt. More...
 
__STATIC_INLINE uint32_t DL_AES_getRawDMATrigger0EventStatus (AES_Regs *aes)
 Check interrupt flag of DMA Trigger 0 Event. More...
 
__STATIC_INLINE uint32_t DL_AES_getRawDMATrigger1EventStatus (AES_Regs *aes)
 Check interrupt flag of DMA Trigger 1 Event. More...
 
__STATIC_INLINE uint32_t DL_AES_getRawDMATrigger2EventStatus (AES_Regs *aes)
 Check interrupt flag of DMA Trigger 2 Event. More...
 
__STATIC_INLINE DL_AES_IIDX DL_AES_getPendingInterrupt (AES_Regs *aes)
 Get highest priority pending AES interrupt. More...
 
__STATIC_INLINE DL_AES_IIDX DL_AES_getPendingDMATrigger0Event (AES_Regs *aes)
 Get highest priority pending DMA Trigger 0 Event. More...
 
__STATIC_INLINE DL_AES_IIDX DL_AES_getPendingDMATrigger1Event (AES_Regs *aes)
 Get highest priority pending DMA Trigger 1 Event. More...
 
__STATIC_INLINE DL_AES_IIDX DL_AES_getPendingDMATrigger2Event (AES_Regs *aes)
 Get highest priority pending DMA Trigger 2 Event. More...
 
__STATIC_INLINE void DL_AES_clearInterruptStatus (AES_Regs *aes)
 Clear pending AES Ready Interrupt. More...
 
__STATIC_INLINE void DL_AES_clearDMATrigger0EventStatus (AES_Regs *aes)
 Clear pending DMA Trigger 0 Event. More...
 
__STATIC_INLINE void DL_AES_clearDMATrigger1EventStatus (AES_Regs *aes)
 Clear pending DMA Trigger 1 Event. More...
 
__STATIC_INLINE void DL_AES_clearDMATrigger2EventStatus (AES_Regs *aes)
 Clear pending DMA Trigger 2 Event. More...
 
bool DL_AES_saveConfiguration (AES_Regs *aes, DL_AES_backupConfig *ptr)
 Save AES configuration before entering a power loss state. Note that operation-specific variables (intermediate data, key, IV) will need to be re-loaded after picking up the peripheral from a powerloss state. More...
 
bool DL_AES_restoreConfiguration (AES_Regs *aes, DL_AES_backupConfig *ptr)
 Restore AES configuration after leaving a power loss state. Note that operation-specific variables (intermediate data, key, IV) will need to be re-loaded after picking up the peripheral from a powerloss state. More...
 
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale