![Texas Instruments CC2533 Скачать руководство пользователя страница 154](http://html.mh-extra.com/html/texas-instruments/cc2533/cc2533_user-manual_1094592154.webp)
AES Operation
15.1 AES Operation
To encrypt a message, the following procedure must be followed (ECB, CBC):
•
Load key
•
Load initialization vector (IV)
•
Download and upload data for encryption/decryption.
The AES coprocessor works on blocks of 128 bits. A block of data is loaded into the coprocessor,
encryption is performed, and the result must be read out before the next block can be processed. Before
each block is loaded , a dedicated start command must be sent to the coprocessor.
15.2 Key and IV
Before a key or IV/nonce load starts, an appropriate load key or IV/nonce command must be issued to the
coprocessor. When loading the IV, it is important also to set the correct mode.
A key load or IV load operation aborts any processing that could be running. The key, once loaded, stays
valid until a key reload takes place.
The IV must be downloaded before the beginning of each message (not each block).
Both the key and IV values are cleared by a reset of the device and when PM2 or PM3 is entered.
15.3 Padding of Input Data
The AES coprocessor works on blocks of 128 bits. If the last block contains less than 128 bits, it must be
padded with zeros when written to the coprocessor.
15.4 Interface to CPU
The CPU communicates with the coprocessor using three SFR registers:
•
ENCCS
, encryption control and status register
•
ENCDI
, encryption input register
•
ENCDO
, encryption output register
Read/write to the status register is done directly by the CPU, whereas access to the input/output registers
should be performed using direct memory access (DMA).
When using DMA with the AES coprosessor, two DMA channels must be used, one for input data and one
for output data. The DMA channels must be initialized before a start command is written to
ENCCS
. Writing
a start command generates a DMA trigger, and the transfer is started. After each block is processed, an
interrupt is generated. The interrupt is used to issue a new start command to
ENCCS
.
15.5 Modes of Operation
When using CFB, OFB, or CTR mode, the 128-bit blocks are divided into four 32-bit blocks. The 32 bits
are loaded into the AES coprocessor, and the resulting 32 bits are read out. This continues until all 128
bits have been encrypted. The only time one must consider this is if data is loaded/read directly using the
CPU. When using DMA, this is handled automatically by the DMA triggers generated by the AES
coprocessor; thus, DMA is preferred.
Both encryption and decryption are performed similarly.
The CBC-MAC mode is a variant of the CBC mode. See
for an explanation.
CCM is a combination of CBC-MAC and CTR. Parts of the CCM must therefore be done in software. The
following section gives a short explanation of the necessary steps to be done.
15.6 CBC-MAC
When performing CBC-MAC encryption, data is downloaded to the coprocessor in CBC-MAC mode one
block at a time, except for the last block. Before the last block is loaded, the mode is changed to CBC.
The last block is downloaded and the block uploaded is the message MAC.
154
AES Coprocessor
SWRU191C
–
April 2009
–
Revised January 2012
Copyright
©
2009
–
2012, Texas Instruments Incorporated