321
8331B–AVR–03/12
Atmel AVR XMEGA AU
Figure 25-1.
Register file usage during DES encryption/decryption.
Executing one DES instruction performs one round in the DES algorithm. Sixteen rounds must
be executed in increasing order to form the correct DES ciphertext or plaintext. Intermediate
results are stored in the register file (R0-R15) after each DES instruction. After sixteen rounds,
the key is located in R8-R16 and the encrypted/decrypted ciphertext/plaintext is located in R0-
R7. The instruction's operand (K) determines which round is executed, and the half carry flag (H)
in the CPU status register determines whether encryption or decryption is performed. If the half
carry flag is set, decryption is performed, and if the flag is cleared, encryption is performed.
For more details on the DES instruction, refer to the AVR instruction set manual.
25.4
AES Crypto Module
The AES crypto module performs encryption and decryption according to the Advanced Encryp-
tion Standard (FIPS-197). The 128-bit key block and 128-bit data block (plaintext or ciphertext)
must be loaded into the key and state memories in the AES crypto module. This is done by writ-
ing the AES KEY register and STATE register sequentially with 16 bytes.
It is software selectable whether the module should perform encryption or decryption. It is also
possible to enable XOR mode, where all new data loaded to the state key is XORed with the cur-
rent data in the state memory.
The AES module uses 375 clock cycles before the encrypted/decrypted plaintext/ciphertext is
available for readout in the state memory.
Register File
R0
R1
R2
R3
R4
R5
R6
R7
R8
R9
R10
R11
R12
R13
R14
R15
R16
...
R31
data0
data1
data2
data3
data4
data5
data6
data7
key0
key1
key2
key3
key4
key5
key6
key7
data
key