Datasheet

2010 Microchip Technology Inc. DS39935C-page 133
ENC424J600/624J600
To encrypt a block using CFB mode:
1. Load the encryption key as described in
Section 15.3.1 “Key Support”.
2. Set AESOP<1:0> (ECON1<10:9>) to ‘
00’.
3. Copy the Initialization Value (IV) to TEXTA at
7C20h.
4. Set AESST (ECON1<11>) to initiate the
encryption.
5. Copy the plaintext message to TEXTB at 7C30h.
6. Wait for the hardware to clear AESST.
7. Read the ciphertext message from XOROUT at
7C40h.
8. If more blocks need to be encrypted, set
AESOP<1:0> to
01’. This causes the engine to
read from XOROUT rather than TEXTA.
9. Set AESST to initiate the encryption.
10. Copy the plaintext message to TEXTB at 7C30h.
11. Wait for the hardware to clear AESST.
12. Read the ciphertext message from XOROUT at
7C40h.
13. Repeat steps 9 through 12 for subsequent
blocks. The ciphertext from the previous block
automatically becomes the IV for the following
block.
To decrypt a single block using CFB mode:
1. Load the encryption key as described in
Section 15.3.1 “Key Support”.
2. Set AESOP<1:0> to ‘
00’.
3. Copy the Initialization Value (IV) to TEXTA at
7C20h.
4. Set AESST to initiate the encryption.
5. Copy the ciphertext message to TEXTB at
7C30h.
6. Wait for the hardware to clear AESST.
7. Read the plaintext message from XOROUT at
7C40h.
8. To decipher additional blocks, copy the previous
block’s ciphertext to TEXTA, then repeat steps 4
through 7.
The context for CFB mode consists of both the AES
encryption key and the ciphertext from the most recent
block. Save the ciphertext from the previous block to be
used as the IV when resuming the operation for
additional blocks.
15.3.3.4 Output Feedback Mode (OFB)
Output Feedback mode is nearly identical to CFB
mode, except that in OFB mode, the Initialization Value
(IV) for subsequent blocks is the output of the AES
operation, not the ciphertext. The IV is encrypted using
the AES engine, then XORed with the plaintext to form
the ciphertext. Like CBC and CFB modes, identical
subsequent plaintext blocks will use a different IV, and
therefore, yield different ciphertext blocks. However,
unlike CBC and CFB modes, this IV does not depend
on the plaintext. Figure 15-4 depicts the use of OFB
mode for encryption and decryption.
FIGURE 15-4: OFB ENCRYPTION AND DECRYPTION
IV
ENCRYPTER
DATA KEY
ENCRYPTER
DATA KEY
Key Key
Plaintext
0
Plaintext
1
Ciphertext
0
Ciphertext
1
IV
ENCRYPTER
DATA KEY
ENCRYPTER
DATA KEY
Key
Key
Ciphertext
0
Ciphertext
1
Plaintext
0
Plaintext
1
ENCRYPTION
DECRYPTION