ECB — AES electronic codebook mode encryption

The AES electronic codebook mode encryption (ECB) can be used for a range of cryptographic functions like hash generation, digital signatures, and keystream generation for data encryption/decryption. The ECB encryption block supports 128 bit AES encryption (encryption only, not decryption).

AES ECB operates with EasyDMA access to system Data RAM for in-place operations on cleartext and ciphertext during encryption. ECB uses the same AES core as the CCM and AAR blocks, and is an asynchronous operation which may not complete if the AES core is busy.

AES ECB features:

AES ECB performs a 128 bit AES block encrypt. At the STARTECB task, data and key is loaded into the algorithm by EasyDMA. When output data has been written back to memory, the ENDECB event is triggered.

AES ECB can be stopped by triggering the STOPECB task.

Shared resources

The ECB, CCM, and AAR share the same AES module. The ECB will always have lowest priority, and if there is a sharing conflict during encryption, the ECB operation will be aborted and an ERRORECB event will be generated.

EasyDMA

The ECB implements an EasyDMA mechanism for reading and writing to the Data RAM. This DMA cannot access the program memory or any other parts of the memory area except RAM.

If the ECBDATAPTR is not pointing to the Data RAM region, an EasyDMA transfer may result in a HardFault or RAM corruption. See Memory for more information about the different memory regions.

The EasyDMA will have finished accessing the Data RAM when the ENDECB or ERRORECB is generated.

ECB data structure

Block encrypt input and output is stored in the same data structure. ECBDATAPTR should point to this data structure before STARTECB is initiated.

Table 1. ECB data structure overview
PropertyAddress offsetDescription
KEY016 byte AES key
CLEARTEXT1616 byte AES cleartext input block
CIPHERTEXT3216 byte AES ciphertext output block

Registers

Instances

InstanceBase addressDescription
ECB0x4000E000AES electronic code book (ECB) mode block encryption

Register overview

RegisterOffsetDescription
TASKS_STARTECB0x000Start ECB block encrypt
TASKS_STOPECB0x004Abort a possible executing ECB operation
EVENTS_ENDECB0x100ECB block encrypt complete
EVENTS_ERRORECB0x104ECB block encrypt aborted because of a STOPECB task or due to an error
INTENSET0x304Enable interrupt
INTENCLR0x308Disable interrupt
ECBDATAPTR0x504ECB block encrypt memory pointers

TASKS_STARTECB

Address offset: 0x000

Start ECB block encrypt

If a crypto operation is already running in the AES core, the STARTECB task will not start a new encryption and an ERRORECB event will be triggered.

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
AWTASKS_STARTECB

Start ECB block encrypt

If a crypto operation is already running in the AES core, the STARTECB task will not start a new encryption and an ERRORECB event will be triggered.

Trigger1Trigger task

TASKS_STOPECB

Address offset: 0x004

Abort a possible executing ECB operation

If a running ECB operation is aborted by STOPECB, the ERRORECB event is triggered.

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
AWTASKS_STOPECB

Abort a possible executing ECB operation

If a running ECB operation is aborted by STOPECB, the ERRORECB event is triggered.

Trigger1Trigger task

EVENTS_ENDECB

Address offset: 0x100

ECB block encrypt complete

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWEVENTS_ENDECBECB block encrypt complete
NotGenerated0Event not generated
Generated1Event generated

EVENTS_ERRORECB

Address offset: 0x104

ECB block encrypt aborted because of a STOPECB task or due to an error

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWEVENTS_ERRORECBECB block encrypt aborted because of a STOPECB task or due to an error
NotGenerated0Event not generated
Generated1Event generated

INTENSET

Address offset: 0x304

Enable interrupt

Bit number313029282726252423222120191817161514131211109876543210
IDBA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWENDECBWrite '1' to enable interrupt for event ENDECB
Set1Enable
Disabled0Read: Disabled
Enabled1Read: Enabled
BRWERRORECBWrite '1' to enable interrupt for event ERRORECB
Set1Enable
Disabled0Read: Disabled
Enabled1Read: Enabled

INTENCLR

Address offset: 0x308

Disable interrupt

Bit number313029282726252423222120191817161514131211109876543210
IDBA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWENDECBWrite '1' to disable interrupt for event ENDECB
Clear1Disable
Disabled0Read: Disabled
Enabled1Read: Enabled
BRWERRORECBWrite '1' to disable interrupt for event ERRORECB
Clear1Disable
Disabled0Read: Disabled
Enabled1Read: Enabled

ECBDATAPTR

Address offset: 0x504

ECB block encrypt memory pointers

Bit number313029282726252423222120191817161514131211109876543210
IDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWECBDATAPTRPointer to the ECB data structure (see Table 1 ECB data structure overview)

Electrical specification

ECB Electrical Specification

SymbolDescriptionMin.Typ.Max.Units
tECBRun time per 16 byte block in all modes7.2µs