To perform encryption:
- Set OPx = 0x0 to select
encryption. Note that changing the OPx bits clears the KEYWR flag and a new key
must be loaded in the next step.
- Load the key as described in
Section 23.2.2.
- Load the STATE (data) as
described in Section 23.2.3. After the data is loaded, the AES module starts the
encryption process.
- Wait for the operation to complete (wait for the BUSY flag
to clear).
- After the encryption is complete,
the result can be read from AESADOUT as described in Section 23.2.4.
- To encrypt additional data with
the same key loaded in step 2, write the new data into AESADIN after the results
of the operation on the previous data were read from AESADOUT. When an
additional 16 data bytes are written, the module automatically starts the
encryption using the key loaded in step 2.
Note: Setting the DINWR bit in the AESASTAT register triggers another encryption,
and the AES accelerator starts the encryption using the output data from the
previous encryption as the input data. This is useful in certain block cipher
modes with feedback.
The encryption process is given in
Figure 23-3 (128-bit key
with 10 rounds shown).