38.6.2.4 Start Modes
The Start mode field in the Control A Register (CTRLA.STARTMODE) allows the selection of encryption start mode.
- Manual Start Mode
In the Manual Start Mode the sequence is as follows:
- Write the 128/192/256 bit key in the Key Register (KEYWORD)
- Write the initialization vector or counter in the Initialization Vector Register (INTVECT). The initialization vector concerns all modes except ECB
- Enable interrupts in Interrupt Enable Set Register (INTENSET), depending on whether an interrupt is required or not at the end of processing.
- Write the data to be encrypted or decrypted in the Data Registers (DATA).
- Set the START bit in Control B Register (CTRLB.START) to begin the encryption or the decryption process.
- When the processing completes, the Encryption Complete bit in the Interrupt Flag Register (INTFLAG.ENCCMP) raises. If Encryption Complete interrupt has been enabled, the interrupt line of the AES is activated.
- When the software reads one of the Output Data Registers (DATA), INTFLAG.ENCCMP bit is automatically cleared.
- Auto start Mode
The Auto Start Mode is similar to the manual one, except in this mode, as soon as the correct number of input data registers is written, processing is automatically started without setting the START bit in the Control B Register. DMA operation uses this mode.
- Last Output Data Mode (LOD)
This mode is used to generate message authentication code (MAC) on data in CCM mode of operation. The CCM mode combines counter mode for encryption and CBC-MAC generation for authentication.
When LOD is disabled in CCM mode then counter mode of encryption is performed on the input data block.
When LOD is enabled in CCM mode then CBC-MAC generation is performed. Zero block is used as the initialization vector by the hardware. Also software read from the Output Data Register (DATA) is not required to clear the ENCCMP flag. The ENCCMP flag is automatically cleared by writing into the Input Data Register (DATA). This allows retrieval of only the last data in several encryption/decryption processes. No output data register reads are necessary between each block of encryption/decryption process.
Note that assembling message depending on the security level identifier in CCM* has to be done in software.