Driverlib AES API

Module: Driverlib (AM13E232X) APIs

More…

Structures

Name

struct

DL_AES_Config
Configuration structure for the AES module. It contains the superset of configurable information for the control module.

Types

Name

enum

DL_AES_IIDX { DL_AES_IIDX_INPUT_CONTEXT_READY = AES_INT_EVENT0_IIDX_STAT_CNTXTRDY, DL_AES_IIDX_SAVED_OUTPUT_CONTEXT_READY = AES_INT_EVENT0_IIDX_STAT_SAVEDCNTXTRDY, DL_AES_IIDX_INPUT_READY = AES_INT_EVENT0_IIDX_STAT_INPUTRDY, DL_AES_IIDX_OUTPUT_READY = AES_INT_EVENT0_IIDX_STAT_OUTPUTRDY, DL_AES_IIDX_DMA_INPUT_TRIGGER = AES_INT_EVENT1_IIDX_STAT_TRIG0, DL_AES_IIDX_DMA_OUTPUT_TRIGGER = AES_INT_EVENT2_IIDX_STAT_TRIG1}
DL_AES_IIDX.

enum

DL_AES_MODE { DL_AES_MODE_ECB = 0x00, DL_AES_MODE_CBC = (AES_CTRL_CBC_ENABLE), DL_AES_MODE_CTR = (AES_CTRL_CTR_ENABLE), DL_AES_MODE_ICM = (AES_CTRL_ICM_ENABLE), DL_AES_MODE_CFB = (AES_CTRL_CFB_ENABLE), DL_AES_MODE_OFB = (AES_CTRL_OFB_GCM_CCM_CONT_OFB), DL_AES_MODE_CMAC = (0x02000000

enum

DL_AES_KEY_SIZE { DL_AES_KEY_SIZE_128_BIT = AES_CTRL_KEYSIZE_K128, DL_AES_KEY_SIZE_256_BIT = AES_CTRL_KEYSIZE_K256}
DL_AES_KEY_SIZE.

enum

DL_AES_DIR { DL_AES_DIR_ENCRYPT = AES_CTRL_DIR_ENCRYPT, DL_AES_DIR_DECRYPT = AES_CTRL_DIR_DECRYPT}
DL_AES_DIR.

enum

DL_AES_CTR_WIDTH { DL_AES_CTR_WIDTH_32_BIT = AES_CTRL_CTR_WIDTH_CTR32, DL_AES_CTR_WIDTH_64_BIT = AES_CTRL_CTR_WIDTH_CTR64, DL_AES_CTR_WIDTH_96_BIT = AES_CTRL_CTR_WIDTH_CTR96, DL_AES_CTR_WIDTH_128_BIT = AES_CTRL_CTR_WIDTH_CTR128}
DL_AES_CTR_WIDTH.

enum

DL_AES_FB_WIDTH { DL_AES_FB_WIDTH_128 = AES_CTRL_CTR_WIDTH_CFB128}
DL_AES_FB_WIDTH.

enum

DL_AES_CCM_CTR_WIDTH { DL_AES_CCM_CTR_WIDTH_2_BYTES = ((uint32_t)1U << AES_CTRL_CCML_OFS), DL_AES_CCM_CTR_WIDTH_3_BYTES = ((uint32_t)2 << AES_CTRL_CCML_OFS), DL_AES_CCM_CTR_WIDTH_4_BYTES = ((uint32_t)3 << AES_CTRL_CCML_OFS), DL_AES_CCM_CTR_WIDTH_5_BYTES = ((uint32_t)4 << AES_CTRL_CCML_OFS), DL_AES_CCM_CTR_WIDTH_6_BYTES = ((uint32_t)5 << AES_CTRL_CCML_OFS), DL_AES_CCM_CTR_WIDTH_7_BYTES = ((uint32_t)6 << AES_CTRL_CCML_OFS), DL_AES_CCM_CTR_WIDTH_8_BYTES = ((uint32_t)7 << AES_CTRL_CCML_OFS)}
DL_AES_CCM_CTR_WIDTH.

enum

DL_AES_CCM_TAG_WIDTH { DL_AES_CCM_TAG_WIDTH_1_BYTE = ((uint32_t)0 << AES_CTRL_CCMM_OFS), DL_AES_CCM_TAG_WIDTH_2_BYTES = ((uint32_t)1 << AES_CTRL_CCMM_OFS), DL_AES_CCM_TAG_WIDTH_3_BYTES = ((uint32_t)2 << AES_CTRL_CCMM_OFS), DL_AES_CCM_TAG_WIDTH_4_BYTES = ((uint32_t)3 << AES_CTRL_CCMM_OFS), DL_AES_CCM_TAG_WIDTH_5_BYTES = ((uint32_t)4 << AES_CTRL_CCMM_OFS), DL_AES_CCM_TAG_WIDTH_6_BYTES = ((uint32_t)5 << AES_CTRL_CCMM_OFS), DL_AES_CCM_TAG_WIDTH_7_BYTES = ((uint32_t)6 << AES_CTRL_CCMM_OFS), DL_AES_CCM_TAG_WIDTH_8_BYTES = ((uint32_t)7 << AES_CTRL_CCMM_OFS)}
DL_AES_CCM_TAG_WIDTH.

enum

DL_AES_STATUS { DL_AES_STATUS_SUCCESS, DL_AES_STATUS_UNALIGNED_ACCESS}
DL_AES_STATUS.

Functions

Name

__STATIC_INLINE void

DL_AES_enablePower(AES_Regs * AES)
Enables power on AES module.

__STATIC_INLINE void

DL_AES_disablePower(AES_Regs * AES)
Disables power on AES module.

__STATIC_INLINE bool

DL_AES_isPowerEnabled(AES_Regs * AES)
Returns if power enabled on AES module.

__STATIC_INLINE void

DL_AES_reset(AES_Regs * AES)
Resets AES module.

__STATIC_INLINE bool

DL_AES_isReset(AES_Regs * AES)
Returns if AES module was reset.

__STATIC_INLINE bool

DL_AES_isOutputReady(AES_Regs * AES)
Returns if an AES output block is available to be read.

__STATIC_INLINE bool

DL_AES_isInputReady(AES_Regs * AES)
Returns if the input buffer is empty, and more data can be written.

__STATIC_INLINE void

DL_AES_setDirection(AES_Regs * AES, DL_AES_DIR direction)
Sets the direction of the engine (encrypt/decrypt)

__STATIC_INLINE DL_AES_DIR

DL_AES_getDirection(AES_Regs * AES)
Returns the direction of the AES peripheral (encrypt/decrypt)

__STATIC_INLINE void

DL_AES_setKeySize(AES_Regs * AES, DL_AES_KEY_SIZE size)
Sets the key size of the AES peripheral.

__STATIC_INLINE DL_AES_KEY_SIZE

DL_AES_getKeySize(AES_Regs * AES)
Returns the current key size of the AES peripheral.

__STATIC_INLINE void

DL_AES_setMode(AES_Regs * AES, DL_AES_MODE mode)
Sets the AES algorithm mode.

__STATIC_INLINE DL_AES_MODE

DL_AES_getMode(AES_Regs * AES)
Returns the current selected mode.

__STATIC_INLINE void

DL_AES_setFeedbackWidth(AES_Regs * AES, DL_AES_FB_WIDTH fbWidth)
Sets the feedback width of the AES peripheral.

__STATIC_INLINE DL_AES_FB_WIDTH

DL_AES_getFeedbackWidth(AES_Regs * AES)
Returns the current feedback width.

__STATIC_INLINE void

DL_AES_setCounterWidth(AES_Regs * AES, DL_AES_CTR_WIDTH ctrWidth)
Sets the counter width of the AES peripheral.

__STATIC_INLINE DL_AES_CTR_WIDTH

DL_AES_getCounterWidth(AES_Regs * AES)
Returns the current counter width.

__STATIC_INLINE void

DL_AES_setCCMCounterWidth(AES_Regs * AES, DL_AES_CCM_CTR_WIDTH ccm_ctrWidth)
Sets the CCM counter width of the AES peripheral.

__STATIC_INLINE DL_AES_CCM_CTR_WIDTH

DL_AES_getCCMCounterWidth(AES_Regs * AES)
Returns the current CCM-specific counter width.

__STATIC_INLINE void

DL_AES_setCCMTagWidth(AES_Regs * AES, DL_AES_CCM_TAG_WIDTH ccm_tagWidth)
Sets the CCM authentication tag width of the AES peripheral.

__STATIC_INLINE DL_AES_CCM_TAG_WIDTH

DL_AES_getCCMTagWidth(AES_Regs * AES)
Returns the current CCM-specific authentication tag width.

__STATIC_INLINE void

DL_AES_haltOperationAndGenerateDigest(AES_Regs * AES)
Halt operation and generate intermediate Digest for CCM/GCM.

__STATIC_INLINE void

DL_AES_resumeAADPhase(AES_Regs * AES, DL_AES_MODE mode)
Resume GCM or CCM operation in the AAD phase.

__STATIC_INLINE void

DL_AES_resumeDataPhase(AES_Regs * AES, DL_AES_MODE mode)
Resume GCM or CCM operation in the Data phase.

__STATIC_INLINE void

DL_AES_enableSavedOutputContext(AES_Regs * AES)
Enables the storage and return of a tag or result IV.

__STATIC_INLINE void

DL_AES_disableSavedOutputContext(AES_Regs * AES)
Disables the storage and return of a tag or result IV.

__STATIC_INLINE bool

DL_AES_isSavedOutputContextEnabled(AES_Regs * AES)
Returns whether the storage of additional context is enabled.

__STATIC_INLINE bool

DL_AES_isSavedOutputContextReady(AES_Regs * AES)
Returns whether additional output context is available to be read.

__STATIC_INLINE bool

DL_AES_isInputContextWriteable(AES_Regs * AES)
Returns whether the input context can be written by the application.

__STATIC_INLINE void

DL_AES_setLowerCryptoLength(AES_Regs * AES, uint32_t lowerLength)
Sets the lower 32 bits of the crypto input data length in bytes.

__STATIC_INLINE void

DL_AES_setUpperCryptoLength(AES_Regs * AES, uint32_t upperLength)
Sets the upper 29 bits of the crypto input data length in bytes.

__STATIC_INLINE void

DL_AES_setAADLength(AES_Regs * AES, uint32_t aadLength)
Sets the length of additional authentication data (AAD)

__STATIC_INLINE void

DL_AES_enableDMAOperation(AES_Regs * AES)
Enables DMA Operation for the AES module.

__STATIC_INLINE void

DL_AES_disableDMAOperation(AES_Regs * AES)
Disables DMA Operation for the AES module.

__STATIC_INLINE bool

DL_AES_isDMAOperationEnabled(AES_Regs * AES)
Returns if DMA Operation is enabled.

__STATIC_INLINE bool

DL_AES_isUserKeyWriteEnabled(AES_Regs * AES)
Returns if User Writes to the Key Registers on the AES are allowed.

DL_AES_STATUS

DL_AES_setKey(AES_Regs * AES, const uint8_t * key, DL_AES_KEY_SIZE keySize)
Loads a 128 or 256 bit regular key to the AES module.

void

DL_AES_setKeyAligned(AES_Regs * AES, const uint32_t * keyAligned, DL_AES_KEY_SIZE keySize)
Loads a 128 or 256 bit regular key to the AES module.

DL_AES_STATUS

DL_AES_setGCMHashKey(AES_Regs * AES, const uint8_t * hashKey)
set the hash key

void

DL_AES_setGCMHashKeyAligned(AES_Regs * AES, const uint32_t * hashKeyAligned)
set the hash key

DL_AES_STATUS

DL_AES_setSecondKey(AES_Regs * AES, const uint8_t * secondKey)
Loads the CBC-MAC second key.

void

DL_AES_setSecondKeyAligned(AES_Regs * AES, const uint32_t * secondKeyAligned)
Loads the CBC-MAC second key.

DL_AES_STATUS

DL_AES_setThirdKey(AES_Regs * AES, const uint8_t * thirdKey)
Loads the CBC-MAC third key.

void

DL_AES_setThirdKeyAligned(AES_Regs * AES, const uint32_t * thirdKeyAligned)
Loads the CBC-MAC third key.

DL_AES_STATUS

DL_AES_loadIntermediateTAG(AES_Regs * AES, const uint8_t * tag)
Loads either zero or an intermediate 128-bit TAG to resume GCM/CCM.

void

DL_AES_loadIntermediateTAGAligned(AES_Regs * AES, const uint32_t * tagAligned)
Loads either zero or an intermediate 128-bit TAG to resume GCM/CCM.

DL_AES_STATUS

DL_AES_loadInitializationVector(AES_Regs * AES, uint8_t * iv)
Loads the 128-bit initialization vector to the AES module.

void

DL_AES_loadInitializationVectorAligned(AES_Regs * AES, uint32_t * ivAligned)
Loads the 128-bit initialization vector to the AES module.

DL_AES_STATUS

DL_AES_readInitializationVector(AES_Regs * AES, uint8_t * iv)
Reads the 128-bit initialization vector from the AES Module.

void

DL_AES_readInitializationVectorAligned(AES_Regs * AES, uint32_t * ivAligned)
Reads the 128-bit initialization vector from the AES Module.

void

DL_AES_loadCCMNonceAndCounter(AES_Regs * AES, uint8_t * nonce, DL_AES_CCM_CTR_WIDTH ctrWidth)
Loads the CCM Nonce And Counter IV, also called A0.

DL_AES_STATUS

DL_AES_loadInputData(AES_Regs * AES, uint8_t * data)
loads 128 bits (4 words) of input data

void

DL_AES_loadInputDataAligned(AES_Regs * AES, uint32_t * dataAligned)
loads 128 bits (4 words) of input data

DL_AES_STATUS

DL_AES_readOutputData(AES_Regs * AES, uint8_t * data)
reads 128-bits of output data that has been encrypted/decrypted.

void

DL_AES_readOutputDataAligned(AES_Regs * AES, uint32_t * dataAligned)
reads 128-bits of output data that has been encrypted/decrypted.

DL_AES_STATUS

DL_AES_readTAG(AES_Regs * AES, uint8_t * tag)
reads 128-bit output tag at the conclusion of operation/halt

void

DL_AES_readTAGAligned(AES_Regs * AES, uint32_t * tagAligned)
reads 128-bit output tag at the conclusion of operation/halt

__STATIC_INLINE void

DL_AES_forceInputDataAvailable(AES_Regs * AES)
Forces AES to begin processing input data.

__STATIC_INLINE void

DL_AES_setCCMAlignWord(AES_Regs * AES, uint32_t alignWord)
Set the CCM AAD align data word.

__STATIC_INLINE uint32_t

DL_AES_getCCMAlignWord(AES_Regs * AES)
Get the CCM AAD align data word.

__STATIC_INLINE void

DL_AES_setLowerBlockCount(AES_Regs * AES, uint32_t lowerBlockCount)
Sets the lower 32-bits of the data blocks remaining in an operation.

__STATIC_INLINE uint32_t

DL_AES_getLowerBlockCount(AES_Regs * AES)
Gets the lower 32-bits of the data blocks remaining in an operation.

__STATIC_INLINE void

DL_AES_setUpperBlockCount(AES_Regs * AES, uint32_t upperBlockCount)
Sets the upper 25-bits of the data blocks remaining in an operation.

__STATIC_INLINE uint32_t

DL_AES_getUpperBlockCount(AES_Regs * AES)
Gets the upper 25-bits of the data blocks remaining in an operation.

__STATIC_INLINE void

DL_AES_enableInterrupt(AES_Regs * AES, uint32_t interruptMask)
Enable AES interrupts.

__STATIC_INLINE void

DL_AES_disableInterrupt(AES_Regs * AES, uint32_t interruptMask)
Disable AES interrupts.

__STATIC_INLINE uint32_t

DL_AES_getEnabledInterrupts(AES_Regs * AES, uint32_t interruptMask)
Check if AES Ready interrupt is enabled.

__STATIC_INLINE uint32_t

DL_AES_getEnabledInterruptStatus(AES_Regs * AES, uint32_t interruptMask)
Check interrupt flag of enabled AES interrupts.

__STATIC_INLINE uint32_t

DL_AES_getRawInterruptStatus(AES_Regs * AES, uint32_t interruptMask)
Check interrupt flag of any AES interrupts.

__STATIC_INLINE DL_AES_IIDX

DL_AES_getPendingInterrupt(AES_Regs * AES)
Get highest priority pending AES interrupt.

__STATIC_INLINE void

DL_AES_clearInterruptStatus(AES_Regs * AES, uint32_t interruptMask)
Clear pending AES Interrupts.

__STATIC_INLINE void

DL_AES_enableDMAInputTriggerEvent(AES_Regs * AES)
Enables DMA input trigger to publish AES write requests to the DMA.

__STATIC_INLINE void

DL_AES_enableDMAOutputTriggerEvent(AES_Regs * AES)
Enables DMA output trigger to publish AES read requests to the DMA.

__STATIC_INLINE void

DL_AES_disableDMAInputTriggerEvent(AES_Regs * AES)
Disable DMA input trigger event.

__STATIC_INLINE void

DL_AES_disableDMAOutputTriggerEvent(AES_Regs * AES)
Disable DMA output trigger event.

__STATIC_INLINE uint32_t

DL_AES_getEnabledDMAInputTriggerEvent(AES_Regs * AES)
Check if the DMA input trigger event is enabled.

__STATIC_INLINE uint32_t

DL_AES_getEnabledDMAOutputTriggerEvent(AES_Regs * AES)
Check if the DMA output trigger event is enabled.

__STATIC_INLINE uint32_t

DL_AES_getEnabledDMAInputTriggerEventStatus(AES_Regs * AES)
Check interrupt flag of DMA input trigger event.

__STATIC_INLINE uint32_t

DL_AES_getEnabledDMAOutputTriggerEventStatus(AES_Regs * AES)
Check interrupt flag of DMA output trigger event.

__STATIC_INLINE uint32_t

DL_AES_getRawDMAInputTriggerEventStatus(AES_Regs * AES)
Check interrupt flag of DMA input trigger event.

__STATIC_INLINE uint32_t

DL_AES_getRawDMAOutputTriggerEventStatus(AES_Regs * AES)
Check interrupt flag of DMA output trigger event.

__STATIC_INLINE DL_AES_IIDX

DL_AES_getPendingDMAInputTriggerEvent(AES_Regs * AES)
Get highest priority pending DMA input trigger event.

__STATIC_INLINE DL_AES_IIDX

DL_AES_getPendingDMAOutputTriggerEvent(AES_Regs * AES)
Get highest priority pending DMA output trigger event.

__STATIC_INLINE void

DL_AES_clearDMAInputTriggerEventStatus(AES_Regs * AES)
Clear pending DMA input trigger event.

__STATIC_INLINE void

DL_AES_clearDMAOutputTriggerEventStatus(AES_Regs * AES)
Clear pending DMA output trigger event.

__STATIC_INLINE uintptr_t

DL_AES_getDATAINAddr(AES_Regs * AES)
Returns the address of the AES input data register.

__STATIC_INLINE uintptr_t

DL_AES_getDATAOUTAddr(AES_Regs * AES)
Returns the address of the AES output data register.

void

DL_AES_initECB(AES_Regs * AES, DL_AES_Config * config)
Initializes the engine in the Electronic Codebook (ECB) mode.

void

DL_AES_initCBC(AES_Regs * AES, DL_AES_Config * config)
Initializes the engine in the Cipher-Block Chaining (CBC) mode.

void

DL_AES_initCFB(AES_Regs * AES, DL_AES_Config * config)
Initializes the engine in the Cipher Feedback (CFB) mode.

void

DL_AES_initOFB(AES_Regs * AES, DL_AES_Config * config)
Initializes the engine in the Output Feedback (OFB) mode.

void

DL_AES_initCTR(AES_Regs * AES, DL_AES_Config * config)
Initializes the engine in the Counter (CTR) mode.

void

DL_AES_initICM(AES_Regs * AES, DL_AES_Config * config)
Initializes the engine in the Integer Counter Mode (ICM)

void

DL_AES_initCMAC(AES_Regs * AES, DL_AES_Config * config)
Initializes the engine in the block cipher-based Message Authentication Code (CMAC)

void

DL_AES_initCBCMAC(AES_Regs * AES, DL_AES_Config * config)
Initializes the engine in the Cipher Block Chaining Message Authenication Code (CBC-MAC)

void

DL_AES_initGCM(AES_Regs * AES, DL_AES_Config * config)
Initializes the engine in the Galois/Counter Mode (GCM)

void

DL_AES_initCCM(AES_Regs * AES, DL_AES_Config * config)
Initializes the engine in the Counter & CBC-MAC (CCM)mode.

Defines

Name

DL_AES_INTERRUPT_OUTPUT_READY
AES Output Ready interrupt.

DL_AES_INTERRUPT_INPUT_READY
AES Input Ready interrupt.

DL_AES_INTERRUPT_SAVED_OUTPUT_CONTEXT_READY
AES Saved Context Ready interrupt. TAG and/or IV blocks are available to be retrieved by the CPU.

DL_AES_INTERRUPT_INPUT_CONTEXT_READY
AES Context Ready interrupt. Context bits can be overwritten.

DL_AES_EVENT_DMA_DATA_INPUT_TRIGGER
DMA Trigger Event used to request the DMA write to DATAIN.

DL_AES_EVENT_DMA_DATA_OUTPUT_TRIGGER
DMA Trigger Event used to request the DMA read from DATAOUT.

DL_AES_MODE_MASK
AES Mode mask for all modes.

Detailed Description

The AES DriverLib allows full configuration of the AES module. The AES accelerator module accelerates encryption and decryption operations in hardware based on the FIPS PUB 197 advanced encryption standard (AES).

Types Documentation

enum DL_AES_IIDX

Enumerator

Value

Description

DL_AES_IIDX_INPUT_CONTEXT_READY

AES_INT_EVENT0_IIDX_STAT_CNTXTRDY

AES interrupt index for input context ready to be written

DL_AES_IIDX_SAVED_OUTPUT_CONTEXT_READY

AES_INT_EVENT0_IIDX_STAT_SAVEDCNTXTRDY

AES interrupt index for saved output context (tag/IV) available

DL_AES_IIDX_INPUT_READY

AES_INT_EVENT0_IIDX_STAT_INPUTRDY

AES interrupt index indicating the engine can take more input. Not compatible with DL_AES_enableDMAOperation

DL_AES_IIDX_OUTPUT_READY

AES_INT_EVENT0_IIDX_STAT_OUTPUTRDY

AES interrupt index indicating the engine has available output data. Not compatible with DL_AES_enableDMAOperation

DL_AES_IIDX_DMA_INPUT_TRIGGER

AES_INT_EVENT1_IIDX_STAT_TRIG0

AES interrupt index for enabling DMA input request trigger event

DL_AES_IIDX_DMA_OUTPUT_TRIGGER

AES_INT_EVENT2_IIDX_STAT_TRIG1

AES interrupt index for enabling DMA output request trigger event

DL_AES_IIDX.

enum DL_AES_MODE

Enumerator

Value

Description

DL_AES_MODE_ECB

0x00

Electronic Codebook (ECB) mode

DL_AES_MODE_CBC

(AES_CTRL_CBC_ENABLE)

Cipher Block Chaining (CBC) mode

DL_AES_MODE_CTR

(AES_CTRL_CTR_ENABLE)

Counter (CTR) mode

DL_AES_MODE_ICM

(AES_CTRL_ICM_ENABLE)

Integer Counter Mode (ICM). ICM is a variant of CTR with a 16-bit wide counter

DL_AES_MODE_CFB

(AES_CTRL_CFB_ENABLE)

Cipher Feedback (CFB) mode

DL_AES_MODE_OFB

(AES_CTRL_OFB_GCM_CCM_CONT_OFB)

Output Feedback (OFB) mode

DL_AES_MODE_CMAC

(0x02000000 | AES_CTRL_CBC_ENABLE)

Cipher-based message authentication code (CMAC).

DL_AES_MODE_CBCMAC

(AES_CTRL_CBCMAC_ENABLE)

Cipher block chaining message authentication code (CBC-MAC) mode

DL_AES_MODE_GCM_FORCE_ZERO

(AES_CTRL_GCM_FORCE_ZERO) | (AES_CTRL_CTR_ENABLE)

Galois/Counter Mode (GCM) with GHASH (GHASH_H loaded and Y0-encrypted forced to 0)

DL_AES_MODE_GCM_LOAD_HASH_KEY

(AES_CTRL_GCM_LOAD_HASH_KEY) | (AES_CTRL_CTR_ENABLE)

Galois/Counter Mode (GCM) with GHASH (H loaded Y0-encrypted calculated internally)

DL_AES_MODE_GCM_AUTONOMOUS

(AES_CTRL_GCM_AUTONOMOUS) | (AES_CTRL_CTR_ENABLE)

Galois/Counter Mode (GCM) with Autonomous GHASH (Both H and Y0-encrypted calculated internally)

DL_AES_MODE_GCM_GHASH_ONLY

(AES_CTRL_GCM_FORCE_ZERO)

Galois/Counter Mode GHASH only. Direction must be Decrypt

DL_AES_MODE_CCM

(AES_CTRL_CCM_ENABLE) | (AES_CTRL_CTR_ENABLE)

Cipher block chaining, message authentication code (CCM) mode

DL_AES_MODE.

enum DL_AES_KEY_SIZE

Enumerator

Value

Description

DL_AES_KEY_SIZE_128_BIT

AES_CTRL_KEYSIZE_K128

128-bit Key Size

DL_AES_KEY_SIZE_256_BIT

AES_CTRL_KEYSIZE_K256

256-bit Key Size

DL_AES_KEY_SIZE.

enum DL_AES_DIR

Enumerator

Value

Description

DL_AES_DIR_ENCRYPT

AES_CTRL_DIR_ENCRYPT

Encryption

DL_AES_DIR_DECRYPT

AES_CTRL_DIR_DECRYPT

Decryption

DL_AES_DIR.

enum DL_AES_CTR_WIDTH

Enumerator

Value

Description

DL_AES_CTR_WIDTH_32_BIT

AES_CTRL_CTR_WIDTH_CTR32

Counter (CTR) mode 32-bit counter

DL_AES_CTR_WIDTH_64_BIT

AES_CTRL_CTR_WIDTH_CTR64

Counter (CTR) mode 64-bit counter

DL_AES_CTR_WIDTH_96_BIT

AES_CTRL_CTR_WIDTH_CTR96

Counter (CTR) mode 96-bit counter

DL_AES_CTR_WIDTH_128_BIT

AES_CTRL_CTR_WIDTH_CTR128

Counter (CTR) mode 128-bit counter

DL_AES_CTR_WIDTH.

enum DL_AES_FB_WIDTH

Enumerator

Value

Description

DL_AES_FB_WIDTH_128

AES_CTRL_CTR_WIDTH_CFB128

DL_AES_FB_WIDTH.

enum DL_AES_CCM_CTR_WIDTH

Enumerator

Value

Description

DL_AES_CCM_CTR_WIDTH_2_BYTES

((uint32_t)1U << AES_CTRL_CCML_OFS)

Counter field width of 2 bytes (value of 1 stored in CCM-L)

DL_AES_CCM_CTR_WIDTH_3_BYTES

((uint32_t)2 << AES_CTRL_CCML_OFS)

Counter field width of 3 bytes (value of 2 stored in CCM-L)

DL_AES_CCM_CTR_WIDTH_4_BYTES

((uint32_t)3 << AES_CTRL_CCML_OFS)

Counter field width of 4 bytes (value of 3 stored in CCM-L)

DL_AES_CCM_CTR_WIDTH_5_BYTES

((uint32_t)4 << AES_CTRL_CCML_OFS)

Counter field width of 5 bytes (value of 4 stored in CCM-L)

DL_AES_CCM_CTR_WIDTH_6_BYTES

((uint32_t)5 << AES_CTRL_CCML_OFS)

Counter field width of 6 bytes (value of 5 stored in CCM-L)

DL_AES_CCM_CTR_WIDTH_7_BYTES

((uint32_t)6 << AES_CTRL_CCML_OFS)

Counter field width of 7 bytes (value of 6 stored in CCM-L)

DL_AES_CCM_CTR_WIDTH_8_BYTES

((uint32_t)7 << AES_CTRL_CCML_OFS)

Counter field width of 8 bytes (value of 7 stored in CCM-L)

DL_AES_CCM_CTR_WIDTH.

enum DL_AES_CCM_TAG_WIDTH

Enumerator

Value

Description

DL_AES_CCM_TAG_WIDTH_1_BYTE

((uint32_t)0 << AES_CTRL_CCMM_OFS)

Authentication field width of 1 byte (value of 0 stored in CCM-M)

DL_AES_CCM_TAG_WIDTH_2_BYTES

((uint32_t)1 << AES_CTRL_CCMM_OFS)

Authentication field width of 2 bytes (value of 1 stored in CCM-M)

DL_AES_CCM_TAG_WIDTH_3_BYTES

((uint32_t)2 << AES_CTRL_CCMM_OFS)

Authentication field width of 3 bytes (value of 2 stored in CCM-M)

DL_AES_CCM_TAG_WIDTH_4_BYTES

((uint32_t)3 << AES_CTRL_CCMM_OFS)

Authentication field width of 4 bytes (value of 3 stored in CCM-M)

DL_AES_CCM_TAG_WIDTH_5_BYTES

((uint32_t)4 << AES_CTRL_CCMM_OFS)

Authentication field width of 5 bytes (value of 4 stored in CCM-M)

DL_AES_CCM_TAG_WIDTH_6_BYTES

((uint32_t)5 << AES_CTRL_CCMM_OFS)

Authentication field width of 6 bytes (value of 5 stored in CCM-M)

DL_AES_CCM_TAG_WIDTH_7_BYTES

((uint32_t)6 << AES_CTRL_CCMM_OFS)

Authentication field width of 7 bytes (value of 6 stored in CCM-M)

DL_AES_CCM_TAG_WIDTH_8_BYTES

((uint32_t)7 << AES_CTRL_CCMM_OFS)

Authentication field width of 8 bytes (value of 7 stored in CCM-M)

DL_AES_CCM_TAG_WIDTH.

enum DL_AES_STATUS

Enumerator

Value

Description

DL_AES_STATUS_SUCCESS

Operation was successful

DL_AES_STATUS_UNALIGNED_ACCESS

Operation was not performed because address was unaligned

DL_AES_STATUS.

Functions Documentation

function DL_AES_enablePower

__STATIC_INLINE void DL_AES_enablePower(
    AES_Regs * AES
)

Enables power on AES module.

Parameters:

  • AES Pointer to the register overlay for the peripheral

function DL_AES_disablePower

__STATIC_INLINE void DL_AES_disablePower(
    AES_Regs * AES
)

Disables power on AES module.

Parameters:

  • AES Pointer to the register overlay for the peripheral

function DL_AES_isPowerEnabled

__STATIC_INLINE bool DL_AES_isPowerEnabled(
    AES_Regs * AES
)

Returns if power enabled on AES module.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Returns:

  • true Power is enabled

  • false Power is disabled

function DL_AES_reset

__STATIC_INLINE void DL_AES_reset(
    AES_Regs * AES
)

Resets AES module.

Parameters:

  • AES Pointer to the register overlay for the peripheral

function DL_AES_isReset

__STATIC_INLINE bool DL_AES_isReset(
    AES_Regs * AES
)

Returns if AES module was reset.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Returns:

  • true Peripheral was reset

  • false Peripheral wasn’t reset

function DL_AES_isOutputReady

__STATIC_INLINE bool DL_AES_isOutputReady(
    AES_Regs * AES
)

Returns if an AES output block is available to be read.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Returns:

  • true AES output block is available

  • false No AES output block is available

function DL_AES_isInputReady

__STATIC_INLINE bool DL_AES_isInputReady(
    AES_Regs * AES
)

Returns if the input buffer is empty, and more data can be written.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Returns:

  • true Input buffer is empty

  • false Input buffer is not empty

function DL_AES_setDirection

__STATIC_INLINE void DL_AES_setDirection(
    AES_Regs * AES,
    DL_AES_DIR direction
)

Sets the direction of the engine (encrypt/decrypt)

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • direction Direction. One of DL_AES_DIR.

Note: CBC-MAC must be configured as encrypt (DL_AES_DIR_ENCRYPT).

function DL_AES_getDirection

__STATIC_INLINE DL_AES_DIR DL_AES_getDirection(
    AES_Regs * AES
)

Returns the direction of the AES peripheral (encrypt/decrypt)

Parameters:

  • AES Pointer to the register overlay for the peripheral

Return: one of DL_AES_DIR

function DL_AES_setKeySize

__STATIC_INLINE void DL_AES_setKeySize(
    AES_Regs * AES,
    DL_AES_KEY_SIZE size
)

Sets the key size of the AES peripheral.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • size Key Size. One of DL_AES_KEY_SIZE.

function DL_AES_getKeySize

__STATIC_INLINE DL_AES_KEY_SIZE DL_AES_getKeySize(
    AES_Regs * AES
)

Returns the current key size of the AES peripheral.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Return: one of DL_AES_KEY_SIZE.

function DL_AES_setMode

__STATIC_INLINE void DL_AES_setMode(
    AES_Regs * AES,
    DL_AES_MODE mode
)

Sets the AES algorithm mode.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • mode Algorithm Mode. One of DL_AES_MODE.

See: DL_AES_resumeAADPhase

Note:

  • Selecting GCM as a mode requires an additional selection of the GHASH parameters expected. Please refer to the TRM for more information.

  • Due to the dual use of the OFB/gcm_ccm_continue_aad bit field, if the resumption of the AAD phase of a GCM/CCM operation is desired, it must be set with the mode using DL_AES_resumeAADPhase, for the bit will be cleared in this function

function DL_AES_getMode

__STATIC_INLINE DL_AES_MODE DL_AES_getMode(
    AES_Regs * AES
)

Returns the current selected mode.

Parameters:

  • AES Pointer to the register overlay for the peripheral

See: DL_AES_setMode

Return: one of DL_AES_MODE.

Note: upon resumption of a AAD phase of operation, the dual-purpose bit of continue AAD/OFB will be read as one. In this case, the mode must be set again for a valid value to be read.

function DL_AES_setFeedbackWidth

__STATIC_INLINE void DL_AES_setFeedbackWidth(
    AES_Regs * AES,
    DL_AES_FB_WIDTH fbWidth
)

Sets the feedback width of the AES peripheral.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • fbWidth Feedback Width. One of DL_AES_FB_WIDTH.

Note: this is only applicable in cipher feeback mode (CFB). OFB always has width 128.

function DL_AES_getFeedbackWidth

__STATIC_INLINE DL_AES_FB_WIDTH DL_AES_getFeedbackWidth(
    AES_Regs * AES
)

Returns the current feedback width.

Parameters:

  • AES Pointer to the register overlay for the peripheral

See: DL_AES_setFeedbackWidth

Return: one of DL_AES_FB_WIDTH.

function DL_AES_setCounterWidth

__STATIC_INLINE void DL_AES_setCounterWidth(
    AES_Regs * AES,
    DL_AES_CTR_WIDTH ctrWidth
)

Sets the counter width of the AES peripheral.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • ctrWidth Counter Width. One of DL_AES_CTR_WIDTH.

See: DL_AES_setCCMCounterWidth

Note:

  • this is only applicable in modes CTR, CCM

  • GCM restricts counter width to 32-bits, which is not required to be set.

  • if using CCM, the counter width must be wide enough to accommodate the chosen CCM length, one of DL_AES_CCM_CTR_WIDTH (in bytes)

function DL_AES_getCounterWidth

__STATIC_INLINE DL_AES_CTR_WIDTH DL_AES_getCounterWidth(
    AES_Regs * AES
)

Returns the current counter width.

Parameters:

  • AES Pointer to the register overlay for the peripheral

See: DL_AES_setCounterWidth

Return: one of DL_AES_CTR_WIDTH.

function DL_AES_setCCMCounterWidth

__STATIC_INLINE void DL_AES_setCCMCounterWidth(
    AES_Regs * AES,
    DL_AES_CCM_CTR_WIDTH ccm_ctrWidth
)

Sets the CCM counter width of the AES peripheral.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • ccm_ctrWidth Counter Width. One of DL_AES_CCM_CTR_WIDTH

See:

Note:

  • this is only applicable in modes CCM

  • The general counter width must be wide enough to accommodate the chosen CCM counter width, one of DL_AES_CTR_WIDTH (in bits). A counter width of 64-bits is sufficient to cover all cases.

Counter with CBC-MAC (CCM) Specific. Sets the width of the counter field that is loaded into the initialization vector along with the nonce. This signal is sometimes referred to as CCM-L. The nonce can be calculated via the following table:

DL_AES_CCM_CTR_WIDTH (bytes)

Nonce Array Length Required (bytes)

2

13

3

12

4

11

5

10

6

9

7

8

8

7

function DL_AES_getCCMCounterWidth

__STATIC_INLINE DL_AES_CCM_CTR_WIDTH DL_AES_getCCMCounterWidth(
    AES_Regs * AES
)

Returns the current CCM-specific counter width.

Parameters:

  • AES Pointer to the register overlay for the peripheral

See: DL_AES_setCCMCounterWidth

Return: one of DL_AES_CCM_CTR_WIDTH.

function DL_AES_setCCMTagWidth

__STATIC_INLINE void DL_AES_setCCMTagWidth(
    AES_Regs * AES,
    DL_AES_CCM_TAG_WIDTH ccm_tagWidth
)

Sets the CCM authentication tag width of the AES peripheral.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • ccm_tagWidth Tag Width. One of DL_AES_CCM_TAG_WIDTH.

Counter with CBC-MAC (CCM) Specific. Sets the width of the authentication field that is retrieved upon completion of the operation. The first bytes of the calculated tag will be returned, and the rest of the tag ignored. This signal is sometimes referred to as CCM-M. The full-width tag will still be calculated, just the least-significant bits will be used as according to this setting.

function DL_AES_getCCMTagWidth

__STATIC_INLINE DL_AES_CCM_TAG_WIDTH DL_AES_getCCMTagWidth(
    AES_Regs * AES
)

Returns the current CCM-specific authentication tag width.

Parameters:

  • AES Pointer to the register overlay for the peripheral

See: DL_AES_setCCMTagWidth

Return: one of DL_AES_CCM_TAG_WIDTH.

function DL_AES_haltOperationAndGenerateDigest

__STATIC_INLINE void DL_AES_haltOperationAndGenerateDigest(
    AES_Regs * AES
)

Halt operation and generate intermediate Digest for CCM/GCM.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Specific to a multi-block CCM/GCM mode. This will interrupt processing at the boundary of a full AES block (128-bits or 16 bytes) and prepare an intermediate digest that can be used to resume operations. If the user is still inputting additional authentication data (AAD), the operation shall be resumed in the AAD phase. If the user is inputting payload data (ciphertext/plaintext), the operation shall be resumed in the data phase. The user is responsible for reading and saving the intermediate digest to preserve the state for a future resumption of the Operation. The user must have at least 1 or more bytes of additional information that needs to be inputted in order for a halt to occur.

function DL_AES_resumeAADPhase

__STATIC_INLINE void DL_AES_resumeAADPhase(
    AES_Regs * AES,
    DL_AES_MODE mode
)

Resume GCM or CCM operation in the AAD phase.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • mode A supported GCM or CCM mode from DL_AES_MODE

See:

Specific to a multi-block CCM/GCM mode that contains Additional Authentication Data to be written after an operation has been halted. This operation should be performed last, after the entire digest for the example has been added. The mode is written in conjunction with the resumption signal, so it must be provided.

function DL_AES_resumeDataPhase

__STATIC_INLINE void DL_AES_resumeDataPhase(
    AES_Regs * AES,
    DL_AES_MODE mode
)

Resume GCM or CCM operation in the Data phase.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • mode A supported GCM or CCM mode from DL_AES_MODE

See:

Specific to a multi-block CCM/GCM mode that contains additional Payload Data (ciphertext/plaintext) to be written after an operation has been halted, and any and all AAD has already been written before the time of halting. This operation should be performed last, after the entire digest for the example has been added. The mode is written in conjunction with the resumption signal, so it must be provided.

function DL_AES_enableSavedOutputContext

__STATIC_INLINE void DL_AES_enableSavedOutputContext(
    AES_Regs * AES
)

Enables the storage and return of a tag or result IV.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Set if a given configuration must require an authentication TAG or result IV to be stored as part of the result context. This will trigger the context output DMA or interrupt assertion after operation completion. Additionally, the saved context ready will now be set high. Th engine will retain the registers until they have been read. Only after an associated TAG/IV has been read will a new DMA request for an input context be sent. Typically, this is set when methods return a TAG (GCM, CCM, CBCMAC) or in case an IV is to be returned for a future continued operation (CBC, CTR, etc.). If not set, the engine will assert a DMA request with the current context.

function DL_AES_disableSavedOutputContext

__STATIC_INLINE void DL_AES_disableSavedOutputContext(
    AES_Regs * AES
)

Disables the storage and return of a tag or result IV.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Set if a given configuration must require an authentication TAG or result IV to be stored as part of the result context. This will trigger the context output DMA or interrupt assertion after operation completion. Additionally, the saved context ready will now be set high. Th engine will retain the registers until they have been read. Typically, this is set when methods return a TAG (GCM, CCM, CBCMAC) or in case an IV is to be returned for a future continued operation (CBC, CTR, etc.). If not set, the engine will assert a DMA request with the current context.

function DL_AES_isSavedOutputContextEnabled

__STATIC_INLINE bool DL_AES_isSavedOutputContextEnabled(
    AES_Regs * AES
)

Returns whether the storage of additional context is enabled.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Returns:

  • true Saved Output Context is enabled.

  • false Saved Output Context is disabled.

See: DL_AES_enableSavedOutputContext

function DL_AES_isSavedOutputContextReady

__STATIC_INLINE bool DL_AES_isSavedOutputContextReady(
    AES_Regs * AES
)

Returns whether additional output context is available to be read.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Returns:

  • true Saved Output Context is ready to be retrieved.

  • false Saved Output Context is unavailable.

See: DL_AES_enableSavedOutputContext

At the end of an operation, if additional result information to the ciphertext/plaintext is available such as TAG/IV(s), this will return true. If this value is high, then the context cannot be written.

function DL_AES_isInputContextWriteable

__STATIC_INLINE bool DL_AES_isInputContextWriteable(
    AES_Regs * AES
)

Returns whether the input context can be written by the application.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Returns:

  • true Context can be safely written to by the application

  • false Context cannot be written, AES Authentication TAGs or IV’s are available and must be read before context can be interrupted

Determines if the context (mode, IV, key, etc.) can be modified from its current state in the application by reading the CNTXT_RDY bit. This does not mean that a previous operation has necessarily finished, just that a new context may be written. Writing a new context before completion of the current context will cancel the current operation.

function DL_AES_setLowerCryptoLength

__STATIC_INLINE void DL_AES_setLowerCryptoLength(
    AES_Regs * AES,
    uint32_t lowerLength
)

Sets the lower 32 bits of the crypto input data length in bytes.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • lowerLength Lower 32-bits of crypto data length that will be inputted

See:

Note: This sets the context for the register, and thus should be called last in the configuration for non-combined modes

The entire length of crypto input data that can be provided is 61-bits long, and is thus set in two separate functions. The lower 32-bits will be set and decremented as the operation continues. Setting the crypto length to 0 for basic modes (CBC, CTR, ICM, CFB, OFB) will configure the AES module to expect an infinite input stream for the device. For GCM and CCM, this mode does not include Additional Authentication Data, this is set separately. If there is a positive AAD length, it is not required for this register to have a nonzero value. Reads from this register return all zeros, so reads are not necessary. For modes that do not allow partial blocks such as CBC, this number must be a multiple of 16.

function DL_AES_setUpperCryptoLength

__STATIC_INLINE void DL_AES_setUpperCryptoLength(
    AES_Regs * AES,
    uint32_t upperLength
)

Sets the upper 29 bits of the crypto input data length in bytes.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • upperLength Upper 29 bits of the crypto data length in bytes that will be inputted

See: DL_AES_setLowerCryptoLength

Note: This sets the context for the register in combined modes (GCM/CCM), and thus should be called last in the configuration

The entire length of crypto input data that can be provided is 61-bits long, and is thus set in two separate functions. The upper 29-bits will be set in this function should a length larger than or equal to 2^32 be necessary. Bits 29-31 are to be zeroed out upon a write.

function DL_AES_setAADLength

__STATIC_INLINE void DL_AES_setAADLength(
    AES_Regs * AES,
    uint32_t aadLength
)

Sets the length of additional authentication data (AAD)

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • aadLength length of AAD in bytes.

See: DL_AES_setLowerLength

Specific to CCM/GCM modes. Sets length of AAD for these modes and 0 otherwise. Can be zero if no AAD, or can be nonzero with a zero crypto length for authentication-only operation. A write to this register triggers the engine to start the context, and should be written after Crypto Length. For GCM this can be any value < 2^32, for CCM this value must be less than 2^16 - 2^8.

function DL_AES_enableDMAOperation

__STATIC_INLINE void DL_AES_enableDMAOperation(
    AES_Regs * AES
)

Enables DMA Operation for the AES module.

Parameters:

  • AES Pointer to the register overlay for the peripheral

See: DL_AES_disableDMAOperation

Sets the AES module to run with Data Inputs using the DMA to read/write data rather than using register input/output

function DL_AES_disableDMAOperation

__STATIC_INLINE void DL_AES_disableDMAOperation(
    AES_Regs * AES
)

Disables DMA Operation for the AES module.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Default behavior. Sets the AES module to run using register input output with data provided by the CPU rather than using the DMA

function DL_AES_isDMAOperationEnabled

__STATIC_INLINE bool DL_AES_isDMAOperationEnabled(
    AES_Regs * AES
)

Returns if DMA Operation is enabled.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Returns:

  • true Configured to read/write data using the DMA

  • false Configured to read/write data using the CPU (Default)

function DL_AES_isUserKeyWriteEnabled

__STATIC_INLINE bool DL_AES_isUserKeyWriteEnabled(
    AES_Regs * AES
)

Returns if User Writes to the Key Registers on the AES are allowed.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Returns:

  • true User Writes to the Key Registers are allowed

  • false The user cannot write to the Key Registers

Note: If user key writes are disabled but desired, a module reset is required

function DL_AES_setKey

DL_AES_STATUS DL_AES_setKey(
    AES_Regs * AES,
    const uint8_t * key,
    DL_AES_KEY_SIZE keySize
)

Loads a 128 or 256 bit regular key to the AES module.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • key Pointer to an uint8_t array with a length that contains the cipher key

  • keySize Key Size. One of DL_AES_KEY_SIZE

Return: Status of operation. Operation will fail if not 32-bit aligned. One of DL_AES_STATUS.

Note: This function adds additional cycles in order to verify no unaligned access, if this is not necessary, consider using uint32_t pointers and DL_AES_setKeyAligned

function DL_AES_setKeyAligned

void DL_AES_setKeyAligned(
    AES_Regs * AES,
    const uint32_t * keyAligned,
    DL_AES_KEY_SIZE keySize
)

Loads a 128 or 256 bit regular key to the AES module.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • keyAligned Pointer to an uint32_t array with a length that contains the cipher key

  • keySize Key Size. One of DL_AES_KEY_SIZE

See: DL_AES_setKey

function DL_AES_setGCMHashKey

DL_AES_STATUS DL_AES_setGCMHashKey(
    AES_Regs * AES,
    const uint8_t * hashKey
)

set the hash key

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • hashKey Pointer to an uint8_t array of length 16 that contains the hash key

Return: Status of operation. Operation will fail if not 32-bit aligned. One of DL_AES_STATUS.

Note: This function adds additional cycles in order to verify no unaligned access, if this is not necessary, consider using uint32_t pointers and DL_AES_setGCMHashKeyAligned

GCM-Specific. Sets the GHASH Hash key (sometimes referred to as H) if in a GCM mode other than DL_AES_MODE_GCM_AUTONOMOUS.

function DL_AES_setGCMHashKeyAligned

void DL_AES_setGCMHashKeyAligned(
    AES_Regs * AES,
    const uint32_t * hashKeyAligned
)

set the hash key

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • hashKeyAligned Pointer to an uint32_t array of length 4 that contains the hash key

See: DL_AES_setGCMHashKey

GCM-Specific. Sets the GHASH Hash key (sometimes referred to as H) if in a GCM mode other than DL_AES_MODE_GCM_AUTONOMOUS.

function DL_AES_setSecondKey

DL_AES_STATUS DL_AES_setSecondKey(
    AES_Regs * AES,
    const uint8_t * secondKey
)

Loads the CBC-MAC second key.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • secondKey Pointer to an uint8_t array of length 16 containing the second key

Return: Status of operation. Operation will fail if not 32-bit aligned. One of DL_AES_STATUS.

Note: This function adds additional cycles in order to verify no unaligned access, if this is not necessary, consider using uint32_t pointers and DL_AES_setSecondKeyAligned

Specific to CBC-MAC operation. Pre-calculated second key to perform a final XOR operation on the last input data block.

function DL_AES_setSecondKeyAligned

void DL_AES_setSecondKeyAligned(
    AES_Regs * AES,
    const uint32_t * secondKeyAligned
)

Loads the CBC-MAC second key.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • secondKeyAligned Pointer to an uint32_t array of length 4 containing the second key

See: DL_AES_setSecondKey

Specific to CBC-MAC operation. Pre-calculated second key to perform a final XOR operation on the last input data block.

function DL_AES_setThirdKey

DL_AES_STATUS DL_AES_setThirdKey(
    AES_Regs * AES,
    const uint8_t * thirdKey
)

Loads the CBC-MAC third key.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • thirdKey Pointer to an uint8_t array of length 16 containing the third key

Return: Status of operation. Operation will fail if not 32-bit aligned. One of DL_AES_STATUS.

Note: This function adds additional cycles in order to verify no unaligned access, if this is not necessary, consider using uint32_t pointers and DL_AES_setThirdKeyAligned

Specific to CBC-MAC operation. Pre-calculated third key to perform a final XOR operation on the last input data block.

function DL_AES_setThirdKeyAligned

void DL_AES_setThirdKeyAligned(
    AES_Regs * AES,
    const uint32_t * thirdKeyAligned
)

Loads the CBC-MAC third key.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • thirdKeyAligned Pointer to an uint32_t array of length 4 containing the third key

See: DL_AES_setThirdKey

Specific to CBC-MAC operation. Pre-calculated third key to perform a final XOR operation on the last input data block.

function DL_AES_loadIntermediateTAG

DL_AES_STATUS DL_AES_loadIntermediateTAG(
    AES_Regs * AES,
    const uint8_t * tag
)

Loads either zero or an intermediate 128-bit TAG to resume GCM/CCM.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • tag Pointer to an uint8_t array of length 16 containing zeroes or the intermediate digest

Return: Status of operation. Operation will fail if not 32-bit aligned. One of DL_AES_STATUS.

Note: This function adds additional cycles in order to verify no unaligned access, if this is not necessary, consider using uint32_t pointers and DL_AES_loadIntermediateTAGAligned

Specific to the GCM/CCM modes. During initialization and beginning of a new combined operation mode (GCM or CCM only), this must be set to 0. However, during continuation this tag is part of the saved intermediate digest that must be restored.

function DL_AES_loadIntermediateTAGAligned

void DL_AES_loadIntermediateTAGAligned(
    AES_Regs * AES,
    const uint32_t * tagAligned
)

Loads either zero or an intermediate 128-bit TAG to resume GCM/CCM.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • tagAligned Pointer to an uint32_t array of length 4 containing zeroes or the intermediate digest

See: DL_AES_loadIntermediateTAG

Specific to the GCM/CCM modes. During initialization and beginning of a new combined operation mode (GCM or CCM only), this must be set to 0. However, during continuation this tag is part of the saved intermediate digest that must be restored.

function DL_AES_loadInitializationVector

DL_AES_STATUS DL_AES_loadInitializationVector(
    AES_Regs * AES,
    uint8_t * iv
)

Loads the 128-bit initialization vector to the AES module.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • iv Pointer to an uint8_t array of length 16 containing the initialization vector

See: DL_AES_loadCCMNonceAndCounter

Return: Status of operation. Operation will fail if not 32-bit aligned. One of DL_AES_STATUS.

Note:

  • For CCM, this iv must be written with the CCM-specific value A0. This value consists of the concatenation of A0 flags, the nonce, and the counter. There is a specialized function that can load this type of IV found at DL_AES_loadCCMNonceAndCounter.

  • This function adds additional cycles in order to verify no unaligned access, if this is not necessary, consider using uint32_t pointers and DL_AES_loadInitializationVectorAligned

When used with GCM, the upper word iv[127:96] needs to be written with 0x01000000 in order to appropriately mark the initial counter value of 1.

function DL_AES_loadInitializationVectorAligned

void DL_AES_loadInitializationVectorAligned(
    AES_Regs * AES,
    uint32_t * ivAligned
)

Loads the 128-bit initialization vector to the AES module.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • ivAligned Pointer to an uint32_t array of length 4 containing the initialization vector

See:

Note: For CCM, this iv must be written with the CCM-specific value A0. This value consists of the concatenation of A0 flags, the nonce, and the counter. There is a specialized function that can load this type of IV found at DL_AES_loadCCMNonceAndCounter.

When used with GCM, the upper word iv[127:96] needs to be written with 0x01000000 in order to appropriately mark the initial counter value of 1.

function DL_AES_readInitializationVector

DL_AES_STATUS DL_AES_readInitializationVector(
    AES_Regs * AES,
    uint8_t * iv
)

Reads the 128-bit initialization vector from the AES Module.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • iv Pointer to an uint8_t array of length 16 where the iv will be written

Return: Status of operation. Operation will fail if not 32-bit aligned. One of DL_AES_STATUS.

Note: This function adds additional cycles in order to verify no unaligned access, if this is not necessary, consider using uint32_t pointers and DL_AES_readInitializationVectorAligned

Contains the latest 128-bit initialization vector output from the engine.

function DL_AES_readInitializationVectorAligned

void DL_AES_readInitializationVectorAligned(
    AES_Regs * AES,
    uint32_t * ivAligned
)

Reads the 128-bit initialization vector from the AES Module.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • ivAligned Pointer to an uint32_t array of length 4 where the iv will be written

See: DL_AES_readInitializationVector

Contains the latest 128-bit initialization vector output from the engine.

function DL_AES_loadCCMNonceAndCounter

void DL_AES_loadCCMNonceAndCounter(
    AES_Regs * AES,
    uint8_t * nonce,
    DL_AES_CCM_CTR_WIDTH ctrWidth
)

Loads the CCM Nonce And Counter IV, also called A0.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • nonce Pointer to the uint8_t nonce Value for CCM, should be unique and length calculated as above.

  • ctrWidth Counter Width. One of DL_AES_CCM_CTR_WIDTH. Should match width provided in control register.

See:

Note: During halting and resumption of CCM operations, it is required to use the DL_AES_loadInitializationVector and DL_AES_readInitializationVector functions as this preserves the current counter state. This function is designed for initialization of the operation only.

CCM-Specific use of the IV field called A0. The A0 field is formatted as follows:

LSB MSB (5’b00000 concat 3’b counterWidth - 1) | Nonce | Counter IV (always 0’s)

the counter width is set as one of DL_AES_CCM_CTR_WIDTH (equal to counterWidth -1). For example, a 5-byte width for the counter (and thus the data payload width) will correspond to a Counter IV of 40-bits. The counter width taking 8 bits, and the Nonce taking the remaining 80-bits (10 bytes). An 8-byte counter width would yield a counter IV width of 64-bits with a Nonce taking the remaining 54-bits (7 bytes). The LSB of the IV will then be 8’b00000111 or 0x07 (one less than the byte width) Thus, the Nonce should be sufficiently wide to fit the bits that are remaining for the nonce, and this will vary with the counter field width provided. The LSB of the IV will be 0x04 (one less than the byte width)

The following table describes the Nonce array lengths that should be used:

DL_AES_CCM_CTR_WIDTH (bytes)

Nonce Array Length Required (bytes)

2

13

3

12

4

11

5

10

6

9

7

8

8

7

function DL_AES_loadInputData

DL_AES_STATUS DL_AES_loadInputData(
    AES_Regs * AES,
    uint8_t * data
)

loads 128 bits (4 words) of input data

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • data Pointer to uint8_t bit data array of length 16 to be inputted.

See: DL_AES_readOutputData

Return: Status of operation. Operation will fail if not 32-bit aligned. One of DL_AES_STATUS.

Note: This function adds additional cycles in order to verify no unaligned access, if this is not necessary, consider using uint32_t pointers and DL_AES_loadInputDataAligned

Loads the next 128 bits of input data. Either AAD (GCM/CCM) or Crypto Data. If less than 128 bits are left (or if the width of data is less than 128 bits ex. CCM), it is still necessary to pad 0’s to the remaining bits in order for the engine to start the operation. For GCM/CCM, the last AAD block can have less than 128 bits, and should be padded with 0’s rather than appended to the crypto data. For authentication modes (GCM, CCM, CBC-MAC), refer to the TRM for additional information about necessary padding.

function DL_AES_loadInputDataAligned

void DL_AES_loadInputDataAligned(
    AES_Regs * AES,
    uint32_t * dataAligned
)

loads 128 bits (4 words) of input data

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • dataAligned Pointer to uint32_t bit data array of length 4 to be inputted.

See:

Loads the next 128 bits of input data. Either AAD (GCM/CCM) or Crypto Data. If less than 128 bits are left (or if the width of data is less than 128 bits ex. CCM), it is still necessary to pad 0’s to the remaining bits in order for the engine to start the operation. For GCM/CCM, the last AAD block can have less than 128 bits, and should be padded with 0’s rather than appended to the crypto data. For authentication modes (GCM, CCM, CBC-MAC), refer to the TRM for additional information about necessary padding.

function DL_AES_readOutputData

DL_AES_STATUS DL_AES_readOutputData(
    AES_Regs * AES,
    uint8_t * data
)

reads 128-bits of output data that has been encrypted/decrypted.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • data Pointer to the data that will be read, uint8_t requiring length of at least 16 to not overwrite other variables.

Return: Status of operation. Operation will fail if not 32-bit aligned. One of DL_AES_STATUS.

Note: This function adds additional cycles in order to verify no unaligned access, if this is not necessary, consider using uint32_t pointers and DL_AES_readOutputDataAligned

Reads the ciphertext/plaintext outputted by the AES module. If less than 128 bits is expected, there still must be 128-bits read, which must mean the data pointer has at least 128 bits to spare.

Inputting Additional Authentication Data (AAD) will not place any information into the output buffer, thus a read is not required.

function DL_AES_readOutputDataAligned

void DL_AES_readOutputDataAligned(
    AES_Regs * AES,
    uint32_t * dataAligned
)

reads 128-bits of output data that has been encrypted/decrypted.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • dataAligned Pointer to the data that will be read, uint32_t requiring length of at least 4 to not overwrite other variables.

See: DL_AES_readOutputData

Reads the ciphertext/plaintext outputted by the AES module. If less than 128 bits is expected, there still must be 128-bits read, which must mean the data pointer has at least 128 bits to spare.

Inputting Additional Authentication Data (AAD) will not place any information into the output buffer, thus a read is not required.

function DL_AES_readTAG

DL_AES_STATUS DL_AES_readTAG(
    AES_Regs * AES,
    uint8_t * tag
)

reads 128-bit output tag at the conclusion of operation/halt

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • tag Pointer to the tag to be read, a uint8_t array of length 16

See: DL_AES_isSavedOutputContextReady

Return: Status of operation. Operation will fail if not 32-bit aligned. One of DL_AES_STATUS.

Note: This function adds additional cycles in order to verify no unaligned access, if this is not necessary, consider using uint32_t pointers and DL_AES_readTAGAligned

Specific to authentication-enabled modes. Reads the tag. Only valid at the conclusion of an operation, or because an operation has been halted and requires a digest. In the case of a halted operation, the output will be an intermediate tag for CCM or GCM.

function DL_AES_readTAGAligned

void DL_AES_readTAGAligned(
    AES_Regs * AES,
    uint32_t * tagAligned
)

reads 128-bit output tag at the conclusion of operation/halt

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • tagAligned Pointer to the tag to be read, a uint32_t array of length 4

See: DL_AES_isSavedOutputContextReady

Specific to authentication-enabled modes. Reads the tag. Only valid at the conclusion of an operation, or because an operation has been halted and requires a digest. In the case of a halted operation, the output will be an intermediate tag for CCM or GCM.

function DL_AES_forceInputDataAvailable

__STATIC_INLINE void DL_AES_forceInputDataAvailable(
    AES_Regs * AES
)

Forces AES to begin processing input data.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Note: To use, DL_AES_enableDMAOperation must not be in use

This function will validate the input data buffer and force AES to begin processing data. Any value can be used in order to force processing data.

function DL_AES_setCCMAlignWord

__STATIC_INLINE void DL_AES_setCCMAlignWord(
    AES_Regs * AES,
    uint32_t alignWord
)

Set the CCM AAD align data word.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • alignWord AAD alignment word of type uint32_t

Specific to CCM mode. Writes the alignment data word used to concatenate to the next block of additional authentication data (AAD). Will need to be set during initialization or during the resumption of a halted CCM operation.

function DL_AES_getCCMAlignWord

__STATIC_INLINE uint32_t DL_AES_getCCMAlignWord(
    AES_Regs * AES
)

Get the CCM AAD align data word.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Return: Current AAD alignment word of type uint32_t

Specific to CCM mode. Reads the alignment data word used to concatenate to the next block of additional authentication data (AAD).

function DL_AES_setLowerBlockCount

__STATIC_INLINE void DL_AES_setLowerBlockCount(
    AES_Regs * AES,
    uint32_t lowerBlockCount
)

Sets the lower 32-bits of the data blocks remaining in an operation.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • lowerBlockCount Lower 32-bits of the overall data blocks remaining

See:

Specific to GCM/CCM mode. The block count is 57-bits and represents the number of remaining AES cryptographic payload blocks (non-AAD) in an operation. During an interruption of a GCM/CCM operation, this number needs to be saved and restored before resumption.

function DL_AES_getLowerBlockCount

__STATIC_INLINE uint32_t DL_AES_getLowerBlockCount(
    AES_Regs * AES
)

Gets the lower 32-bits of the data blocks remaining in an operation.

Parameters:

  • AES Pointer to the register overlay for the peripheral

See: DL_AES_setLowerBlockCount

Return: Lower 32-bits of overall data blocks remaining

Specific to GCM/CCM mode. The block count is 57-bits and represents the number of remaining AES cryptographic payload blocks (non-AAD) in an operation. During an interruption of a GCM/CCM operation, this number needs to be saved and restored before resumption.

function DL_AES_setUpperBlockCount

__STATIC_INLINE void DL_AES_setUpperBlockCount(
    AES_Regs * AES,
    uint32_t upperBlockCount
)

Sets the upper 25-bits of the data blocks remaining in an operation.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • upperBlockCount Upper 25-bits of the overall data blocks remaining (bits [25:31] are ignored)

See:

Specific to GCM/CCM mode. The block count is 57-bits and represents the number of remaining AES cryptographic payload blocks (non-AAD) in an operation. During an interruption of a GCM/CCM operation, this number needs to be saved and restored before resumption.

function DL_AES_getUpperBlockCount

__STATIC_INLINE uint32_t DL_AES_getUpperBlockCount(
    AES_Regs * AES
)

Gets the upper 25-bits of the data blocks remaining in an operation.

Parameters:

  • AES Pointer to the register overlay for the peripheral

See: DL_AES_setUpperBlockCount

Return: Upper 25-bits of overall data blocks remaining (bits [25:31] are 0)

Specific to GCM/CCM mode. The block count is 57-bits and represents the number of remaining AES cryptographic payload blocks (non-AAD) in an operation. During an interruption of a GCM/CCM operation, this number needs to be saved and restored before resumption.

function DL_AES_enableInterrupt

__STATIC_INLINE void DL_AES_enableInterrupt(
    AES_Regs * AES,
    uint32_t interruptMask
)

Enable AES interrupts.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • interruptMask Bit mask of interrupts to enable. Bitwise OR of [DL_AES_INTERRUPT]

function DL_AES_disableInterrupt

__STATIC_INLINE void DL_AES_disableInterrupt(
    AES_Regs * AES,
    uint32_t interruptMask
)

Disable AES interrupts.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • interruptMask Bit mask of interrupts to enable. Bitwise OR of [DL_AES_INTERRUPT]

function DL_AES_getEnabledInterrupts

__STATIC_INLINE uint32_t DL_AES_getEnabledInterrupts(
    AES_Regs * AES,
    uint32_t interruptMask
)

Check if AES Ready interrupt is enabled.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • interruptMask Bit mask of interrupts to check. Bitwise OR of [DL_AES_INTERRUPT]

Returns:

  • Bitwise OR of [DL_AES_INTERRUPT] values

Return: Which of the requested AES interrupts are enabled

function DL_AES_getEnabledInterruptStatus

__STATIC_INLINE uint32_t DL_AES_getEnabledInterruptStatus(
    AES_Regs * AES,
    uint32_t interruptMask
)

Check interrupt flag of enabled AES interrupts.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • interruptMask Bit mask of interrupts to check. Bitwise OR of [DL_AES_INTERRUPT]

Returns:

  • Bitwise OR of [DL_AES_INTERRUPT]

See: DL_AES_enableInterrupt

Return: Which of the requested and enabled AES interrupts are pending

Checks if any of the AES interrupts that was previously enabled are pending.

function DL_AES_getRawInterruptStatus

__STATIC_INLINE uint32_t DL_AES_getRawInterruptStatus(
    AES_Regs * AES,
    uint32_t interruptMask
)

Check interrupt flag of any AES interrupts.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • interruptMask Bit mask of interrupts to check. Bitwise OR of [DL_AES_INTERRUPT]

Returns:

  • Bitwise OR of [DL_AES_INTERRUPT]

Return: Which of the requested AES interrupts are pending

Checks if any of the AES interrupts are pending. Interrupts do not have to be previously enabled.

function DL_AES_getPendingInterrupt

__STATIC_INLINE DL_AES_IIDX DL_AES_getPendingInterrupt(
    AES_Regs * AES
)

Get highest priority pending AES interrupt.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Returns:

Return: The highest priority pending AES interrupt

Checks if any AES interrupts are pending. Interrupt does not have to be previously enabled.

function DL_AES_clearInterruptStatus

__STATIC_INLINE void DL_AES_clearInterruptStatus(
    AES_Regs * AES,
    uint32_t interruptMask
)

Clear pending AES Interrupts.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • interruptMask Bit mask of interrupts to clear. Bitwise OR of [DL_AES_INTERRUPT]

function DL_AES_enableDMAInputTriggerEvent

__STATIC_INLINE void DL_AES_enableDMAInputTriggerEvent(
    AES_Regs * AES
)

Enables DMA input trigger to publish AES write requests to the DMA.

Parameters:

  • AES Pointer to the register overlay for the peripheral

function DL_AES_enableDMAOutputTriggerEvent

__STATIC_INLINE void DL_AES_enableDMAOutputTriggerEvent(
    AES_Regs * AES
)

Enables DMA output trigger to publish AES read requests to the DMA.

Parameters:

  • AES Pointer to the register overlay for the peripheral

function DL_AES_disableDMAInputTriggerEvent

__STATIC_INLINE void DL_AES_disableDMAInputTriggerEvent(
    AES_Regs * AES
)

Disable DMA input trigger event.

Parameters:

  • AES Pointer to the register overlay for the peripheral

function DL_AES_disableDMAOutputTriggerEvent

__STATIC_INLINE void DL_AES_disableDMAOutputTriggerEvent(
    AES_Regs * AES
)

Disable DMA output trigger event.

Parameters:

  • AES Pointer to the register overlay for the peripheral

function DL_AES_getEnabledDMAInputTriggerEvent

__STATIC_INLINE uint32_t DL_AES_getEnabledDMAInputTriggerEvent(
    AES_Regs * AES
)

Check if the DMA input trigger event is enabled.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Returns:

  • DL_AES_EVENT_DMA_DATA_INPUT_TRIGGER if DMA input trigger event is enabled

  • 0 if DMA input trigger event is not enabled

Return: If DMA input trigger event is enabled

function DL_AES_getEnabledDMAOutputTriggerEvent

__STATIC_INLINE uint32_t DL_AES_getEnabledDMAOutputTriggerEvent(
    AES_Regs * AES
)

Check if the DMA output trigger event is enabled.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Returns:

  • DL_AES_EVENT_DMA_DATA_OUTPUT_TRIGGER if DMA output trigger event is enabled

  • 0 if DMA output trigger event is not enabled

Return: If DMA output trigger event is enabled

function DL_AES_getEnabledDMAInputTriggerEventStatus

__STATIC_INLINE uint32_t DL_AES_getEnabledDMAInputTriggerEventStatus(
    AES_Regs * AES
)

Check interrupt flag of DMA input trigger event.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Returns:

  • DL_AES_EVENT_DMA_DATA_INPUT_TRIGGER if DMA input trigger event is pending

  • 0 if DMA input trigger event is not pending

See: DL_AES_enableDMAInputTriggerEvent

Return: If DMA input trigger event is pending

Checks if DMA input trigger event that was previously enabled is pending.

function DL_AES_getEnabledDMAOutputTriggerEventStatus

__STATIC_INLINE uint32_t DL_AES_getEnabledDMAOutputTriggerEventStatus(
    AES_Regs * AES
)

Check interrupt flag of DMA output trigger event.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Returns:

  • DL_AES_EVENT_DMA_DATA_OUTPUT_TRIGGER if DMA output trigger event is pending

  • 0 if DMA output trigger event is not pending

See: DL_AES_enableDMAOutputTriggerEvent

Return: If DMA output trigger event is pending

Checks if DMA output trigger event that was previously enabled is pending.

function DL_AES_getRawDMAInputTriggerEventStatus

__STATIC_INLINE uint32_t DL_AES_getRawDMAInputTriggerEventStatus(
    AES_Regs * AES
)

Check interrupt flag of DMA input trigger event.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Returns:

  • DL_AES_EVENT_DMA_DATA_INPUT_TRIGGER if DMA input trigger event is pending

  • 0 if DMA input trigger event is not pending

Return: If DMA input trigger event is pending

Checks if DMA input trigger event is pending. Event does not have to be previously enabled.

function DL_AES_getRawDMAOutputTriggerEventStatus

__STATIC_INLINE uint32_t DL_AES_getRawDMAOutputTriggerEventStatus(
    AES_Regs * AES
)

Check interrupt flag of DMA output trigger event.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Returns:

  • DL_AES_EVENT_DMA_DATA_INPUT_TRIGGER if DMA output trigger event is pending

  • 0 if DMA output trigger event is not pending

Return: If DMA output trigger event is pending

Checks if DMA output trigger event is pending. Event does not have to be previously enabled.

function DL_AES_getPendingDMAInputTriggerEvent

__STATIC_INLINE DL_AES_IIDX DL_AES_getPendingDMAInputTriggerEvent(
    AES_Regs * AES
)

Get highest priority pending DMA input trigger event.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Return: The highest priority pending DMA input trigger event

Checks if DMA input trigger event is pending. Event does not have to be previously enabled.

function DL_AES_getPendingDMAOutputTriggerEvent

__STATIC_INLINE DL_AES_IIDX DL_AES_getPendingDMAOutputTriggerEvent(
    AES_Regs * AES
)

Get highest priority pending DMA output trigger event.

Parameters:

  • AES Pointer to the register overlay for the peripheral

Return: The highest priority pending DMA output trigger event

Checks if DMA output trigger event is pending. Event does not have to be previously enabled.

function DL_AES_clearDMAInputTriggerEventStatus

__STATIC_INLINE void DL_AES_clearDMAInputTriggerEventStatus(
    AES_Regs * AES
)

Clear pending DMA input trigger event.

Parameters:

  • AES Pointer to the register overlay for the peripheral

function DL_AES_clearDMAOutputTriggerEventStatus

__STATIC_INLINE void DL_AES_clearDMAOutputTriggerEventStatus(
    AES_Regs * AES
)

Clear pending DMA output trigger event.

Parameters:

  • AES Pointer to the register overlay for the peripheral

function DL_AES_getDATAINAddr

__STATIC_INLINE uintptr_t DL_AES_getDATAINAddr(
    AES_Regs * AES
)

Returns the address of the AES input data register.

Parameters:

  • AES Pointer to the register overlay for the peripheral

See: DL_AES_enableDMAOperation

Return: Address of the AES input data register

This API can be used with DL_DMA_setDestAddr to set the destination address when using DMA transfers. The Data should be written as 128-bit block writes (4 32-bit words) to a region of memory starting at the provided address. Use with the DL_AES_enableDMAOperation The DMA output request use DL_AES_EVENT_DMA_DATA_OUTPUT_TRIGGER

function DL_AES_getDATAOUTAddr

__STATIC_INLINE uintptr_t DL_AES_getDATAOUTAddr(
    AES_Regs * AES
)

Returns the address of the AES output data register.

Parameters:

  • AES Pointer to the register overlay for the peripheral

See: DL_AES_enableDMAOperation

Return: Address of the AES output data register

This API can be used with DL_DMA_setDestAddr to set the destination address when using DMA transfers. The Data should be read as 128-bit block read (4 32-bit words) to a region of memory starting at the provided address. Use with the DL_AES_enableDMAOperation The DMA output request use DL_AES_EVENT_DMA_DATA_OUTPUT_TRIGGER

function DL_AES_initECB

void DL_AES_initECB(
    AES_Regs * AES,
    DL_AES_Config * config
)

Initializes the engine in the Electronic Codebook (ECB) mode.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • config Pointer to configuration struct with valid values for: direction, lowerCryptoLength, upperCryptoLength

See: DL_AES_setKey

This function is designed to place the engine in Electronic Codebook (ECB) mode with all necessary control context. The primary key, however, must be set into the AES engine before this function is called. This is because the key could come from either the KEYSTORECTL or from plaintext depending on system setting.

function DL_AES_initCBC

void DL_AES_initCBC(
    AES_Regs * AES,
    DL_AES_Config * config
)

Initializes the engine in the Cipher-Block Chaining (CBC) mode.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • config Pointer to configuration struct with valid values for: direction, iv, lowerCryptoLength, upperCryptoLength

See: DL_AES_setKey

This function is designed to place the engine in Cipher Block Chaining (CBC) mode with all necessary control context. The primary key, however, must be set into the AES engine before this function is called. This is because the key could come from either the KEYSTORECTL or from plaintext depending on system setting.

function DL_AES_initCFB

void DL_AES_initCFB(
    AES_Regs * AES,
    DL_AES_Config * config
)

Initializes the engine in the Cipher Feedback (CFB) mode.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • config Pointer to configuration struct with valid values for: direction, iv, lowerCryptoLength, upperCryptoLength, cfb_fbWidth

See: DL_AES_setKey

This function is designed to place the engine in Cipher Feedback (CFB) mode with all necessary control context. The primary key, however, must be set into the AES engine before this function is called. This is because the key could come from either the KEYSTORECTL or from plaintext depending on system setting.

function DL_AES_initOFB

void DL_AES_initOFB(
    AES_Regs * AES,
    DL_AES_Config * config
)

Initializes the engine in the Output Feedback (OFB) mode.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • config Pointer to configuration struct with valid values for: direction, iv, lowerCryptoLength, upperCryptoLength

See: DL_AES_setKey

This function is designed to place the engine in Output Feedback (OFB) mode with all necessary control context. The primary key, however, must be set into the AES engine before this function is called. This is because the key could come from either the KEYSTORECTL or from plaintext depending on system setting.

function DL_AES_initCTR

void DL_AES_initCTR(
    AES_Regs * AES,
    DL_AES_Config * config
)

Initializes the engine in the Counter (CTR) mode.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • config Pointer to configuration struct with valid values for: direction iv, lowerCryptoLength, upperCryptoLength, ctr_ctrWidth. IV is typically 0x00000001

See: DL_AES_setKey

This function is designed to place the engine in Counter (CTR) mode with all necessary control context. The primary key, however, must be set into the AES engine before this function is called. This is because the key could come from either the KEYSTORECTL or from plaintext depending on system setting.

function DL_AES_initICM

void DL_AES_initICM(
    AES_Regs * AES,
    DL_AES_Config * config
)

Initializes the engine in the Integer Counter Mode (ICM)

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • config Pointer to configuration struct with valid values for: direction iv, lowerCryptoLength, upperCryptoLength. IV is typically 0x00000001

See: DL_AES_setKey

This function is designed to place the engine in Integer Counter Mode (ICM) with all necessary control context. ICM is a variant of CTR mode with a 16- bit wide counter value. The primary key, however, must be set into the AES engine before this function is called. This is because the key could come from either the KEYSTORECTL or from plaintext depending on system setting.

function DL_AES_initCMAC

void DL_AES_initCMAC(
    AES_Regs * AES,
    DL_AES_Config * config
)

Initializes the engine in the block cipher-based Message Authentication Code (CMAC)

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • config Pointer to configuration struct with valid values for: K1, K2, lowerCryptoLength, upperCryptoLength.

See: DL_AES_setKey

This function is designed to place the engine in block cipher-based Message Authentication Code: CMAC. CMAC is strictly authentication and does not generate any ciphertext or plaintext, but only a tag. CMAC is also recommended by NIST in SP 800-38B for authentication. It consists of a primary key as well as derived keys K1 and K2 which must be provided in the configuration. The engine will not derive K1 and K2, and these must be calculated beforehand and included in the config struct. The primary key from which K1 and K2 are derived, however, must be set in the AES engine before this function is called. This is because the key could come from either the KEYSTORECTL or from plaintext depending on system setting.

function DL_AES_initCBCMAC

void DL_AES_initCBCMAC(
    AES_Regs * AES,
    DL_AES_Config * config
)

Initializes the engine in the Cipher Block Chaining Message Authenication Code (CBC-MAC)

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • config Pointer to configuration struct with valid values for: lowerCryptoLength, upperCryptoLength.

See: DL_AES_setKey

This function is designed to place the engine in Cipher Block Chaining Message Authenication Code (CBC-MAC). CBC-MAC is strictly authentication and does not generate any ciphertext or plaintext, but only a tag. The primary key, however, must be set into the AES engine before this function is called. This is because the key could come from either the KEYSTORECTL or from plaintext depending on system setting.

function DL_AES_initGCM

void DL_AES_initGCM(
    AES_Regs * AES,
    DL_AES_Config * config
)

Initializes the engine in the Galois/Counter Mode (GCM)

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • config Pointer to configuration struct with valid values for: mode (one of the GCM operations), direction, iv, lowerCryptoLength, upperCryptoLength, aadLength. IV is typically 0x00000001. The maximum length in bytes is 2^36 - 32.

See:

This function is designed to place the engine in Galois/Counter Mode (GCM). GCM is both authentication and data encryption, and will generate both ciphertext/plaintext and the corresponding tag. The primary key and hash key (if expected from DL_AES_MODE) must be set into the AES engine before this function is called. This is because the key could come from either the KEYSTORECTL or from plaintext depending on system setting. After this function has completed, the user is to first input all additional authentication data (AAD) before entering the crypto payload.

function DL_AES_initCCM

void DL_AES_initCCM(
    AES_Regs * AES,
    DL_AES_Config * config
)

Initializes the engine in the Counter & CBC-MAC (CCM)mode.

Parameters:

  • AES Pointer to the register overlay for the peripheral

  • config Pointer to configuration struct with valid values for: direction, nonce, ccm_ctrWidth, ccm_tagWidth, lowerCryptoLength, upperCryptoLength, aadLength IV is typically 0x00000001. The maximum AAD Length is 2^16-2^8

See: DL_AES_setKey

This function is designed to place the engine in Counter and Cipher-Block Chaining Message Authentication Code (CCM) mode. CCM is both authentication and data encryption, and will generate both ciphertext/plaintext and the corresponding tag. To calculate the length of the nonce and the counter width, please refer to DL_AES_loadCCMNonceAndCounter. After this function has completed, the user is to first input all additional authentication data (AAD) before entering the crypto payload.

Macros Documentation

define DL_AES_INTERRUPT_OUTPUT_READY

#define DL_AES_INTERRUPT_OUTPUT_READY (AES_INT_EVENT0_IMASK_OUTPUTRDY_SET)

AES Output Ready interrupt.

Note: Not compatible with the use of DL_AES_enableDMAOperation

define DL_AES_INTERRUPT_INPUT_READY

#define DL_AES_INTERRUPT_INPUT_READY (AES_INT_EVENT0_IMASK_INPUTRDY_SET)

AES Input Ready interrupt.

Note: Not compatible with the use of DL_AES_enableDMAOperation

define DL_AES_INTERRUPT_SAVED_OUTPUT_CONTEXT_READY

#define DL_AES_INTERRUPT_SAVED_OUTPUT_CONTEXT_READY (AES_INT_EVENT0_IMASK_SAVEDCNTXTRDY_SET)

AES Saved Context Ready interrupt. TAG and/or IV blocks are available to be retrieved by the CPU.

define DL_AES_INTERRUPT_INPUT_CONTEXT_READY

#define DL_AES_INTERRUPT_INPUT_CONTEXT_READY (AES_INT_EVENT0_IMASK_CNTXTRDY_SET)

AES Context Ready interrupt. Context bits can be overwritten.

define DL_AES_EVENT_DMA_DATA_INPUT_TRIGGER

#define DL_AES_EVENT_DMA_DATA_INPUT_TRIGGER (AES_INT_EVENT1_IMASK_TRIG0_SET)

DMA Trigger Event used to request the DMA write to DATAIN.

define DL_AES_EVENT_DMA_DATA_OUTPUT_TRIGGER

#define DL_AES_EVENT_DMA_DATA_OUTPUT_TRIGGER (AES_INT_EVENT2_IMASK_TRIG1_SET)

DMA Trigger Event used to request the DMA read from DATAOUT.

define DL_AES_MODE_MASK

#define DL_AES_MODE_MASK     ((AES_CTRL_CBC_MASK) | (AES_CTRL_CTR_MASK) | (AES_CTRL_ICM_MASK) | (AES_CTRL_CFB_MASK) | (AES_CTRL_CBCMAC_MASK) | \
     (AES_CTRL_GCM_MASK) | (AES_CTRL_CCM_MASK) | (AES_CTRL_OFB_GCM_CCM_CONT_MASK) | 0x02000000)

AES Mode mask for all modes.