English
Language : 

EFM32WG Datasheet, PDF (737/834 Pages) List of Unclassifed Manufacturers – The EFM32WG Wonder Gecko is the ideal choice for demanding 8-, 16-, and 32-bit energy sensitive applications.
...the world's most energy friendly microcontrollers
Figure 31.1. AES Key and Data Definitions
Pl a i n Te x t
Encrypt ion
Decryption
Ci p h e r Te x t
Pl a i n Ke y
Encrypt ion
Decryption
Ci p h e r Ke y
31.3.1 Encryption/Decryption
The AES module can be set to encrypt or decrypt by clearing/setting the DECRYPT bit in AES_CTRL.
The AES256 bit in AES_CTRL configures the size of the key used for encryption/decryption. The
AES_CTRL register should not be altered while AES is running, as this may lead to unpredictable
behaviour.
An AES encryption/decryption can be started in the following ways:
• Writing a 1 to the START bit in AES_CMD
• Writing 4 times 32 bits to AES_DATA when the DATASTART control bit is set
• Writing 4 times 32 bits to AES_XORDATA when the XORSTART control bit is set
An AES encryption/decryption can be stopped by writing a 1 to the STOP bit in AES_CMD. The
RUNNING bit in AES_STATUS indicates that an AES encryption/decryption is ongoing.
31.3.2 Data and Key Access
The AES module contains a 128-bit DATA (State) register and two 128-bit KEY registers defined as
DATA3-DATA0, KEY3-KEY0 (KEYL) and KEY7-KEY4 (KEYH). In AES128 mode, the 128-bit key is read
from KEYL, while both KEYH and KEYL are used in AES256 mode. The AES module has configurable
byte ordering which is configured in BYTEORDER in AES_CTRL. Figure 31.2 (p. 737) illustrates how
data written to the AES registers is mapped to the key and state defined in the Advanced Encryption
Standard (FIPS-197). The figure presents the key byte order for 256-bit keys. In 128-bit mode with
BYTEORDER cleared, a16 represents the first byte of the 128-bit key. When BYTEORDER is set, a0
represents the first byte in the key. AES encryption/decryption takes two extra cycles when BYTEORDER
is set. BYTEORDER has to be set prior to loading the data and key registers.
Figure 31.2. AES Data and Key Orientation as Defined in the Advanced Encryption Standard
BYTEORDER = 0
DATA
KEYH
KEYL
[ 31:24] S0,0 S0,1 S0,2 S0,3
[ 23:16] S1,0 S1,1 S1,2 S1,3
[ 15:8] S2,0 S2,1 S2,2 S2,3
[ 7 :0 ] S3,0 S3,1 S3,2 S3,3
a0
a4
a8 a12 a16 a20 a24 a28
a1
a5
a9 a13 a17 a21 a25 a29
a2
a6
a10 a14 a18 a22 a26 a30
a3
a7
a11 a15 a19 a23 a27 a31
BYTEORDER = 1
DATA
KEYL
KEYH
[ 7 :0 ] S0,0 S0,1 S0,2 S0,3
[ 15:8] S1,0 S1,1 S1,2 S1,3
[ 23:16] S2,0 S2,1 S2,2 S2,3
[ 31:24] S3,0 S3,1 S3,2 S3,3
a0
a4
a8 a12 a16 a20 a24 a28
a1
a5
a9 a13 a17 a21 a25 a29
a2
a6 a10 a14 a18 a22 a26 a30
a3
a7 a11 a15 a19 a23 a27 a31
The registers DATA3-DATA0, are not memory mapped directly, but can be written/read by accessing
AES_DATA or AES_XORDATA. The same applies for the key registers, KEY3-KEY0 which are
accessed through AES_KEYLn (n=A, B, C or D), while KEY7-KEY4 are accessed through KEYHn
(n=A, B, C or D). Writing DATA3-DATA0 is then done through 4 consecutive writes to AES_DATA (or
AES_XORDATA), starting with the word which is to be written to DATA0. For each write, the words will
2013-05-08 - Wonder Gecko Family - d0233_Rev0.50
737
www.energymicro.com