![STMicroelectronics STM32F405 Скачать руководство пользователя страница 743](http://html1.mh-extra.com/html/stmicroelectronics/stm32f405/stm32f405_reference-manual_1381062743.webp)
DocID018909 Rev 11
743/1731
RM0090
Cryptographic processor (CRYP)
757
Note:
Writing to the KEYSIZE, DATATYPE, ALGOMODE and ALGODIR bits while BUSY=1 has
no effect. These bits can only be configured when BUSY=0.
The FFLUSH bit has to be set only when BUSY=0. If not, the FIFO is flushed, but the block
being processed may be pushed into the output FIFO just after the flush operation, resulting
in a nonempty FIFO condition.
Bits 19 and 5:3
ALGOMODE[3:0]:
Algorithm mode
0000: TDES-ECB (triple-DES Electronic codebook): no feedback between
blocks of data. Initialization vectors (CRYP_IV0(L/R)) are not used, three key
vectors (K1, K2, and K3) are used (K0 is not used).
0001: TDES-CBC (triple-DES Cipher block chaining): output block is XORed
with the subsequent input block before its entry into the algorithm. Initialization
vectors (CRYP_IV0L/R) must be initialized, three key vectors (K1, K2, and K3)
are used (K0 is not used).
0010: DES-ECB (simple DES Electronic codebook): no feedback between
blocks of data. Initialization vectors (CRYP_IV0L/R) are not used, only one key
vector (K1) is used (K0, K2, K3 are not used).
0011: DES-CBC (simple DES Cipher block chaining): output block is XORed with
the subsequent input block before its entry into the algorithm. Initialization
vectors (CRYP_IV0L/R) must be initialized. Only one key vector (K1) is used
(K0, K2, K3 are not used).
0100: AES-ECB (AES Electronic codebook): no feedback between blocks of
data. Initialization vectors (CRYP_IV0L/R...1L/R) are not used. All four key
vectors (K0...K3) are used.
0101: AES-CBC (AES Cipher block chaining): output block is XORed with the
subsequent input block before its entry into the algorithm. Initialization vectors
(CRYP_IV0L/R...1L/R) must be initialized. All four key vectors (K0...K3) are
used.
0110: AES-CTR (AES Counter mode): output block is XORed with the
subsequent input block before its entry into the algorithm. Initialization vectors
(CRYP_IV0L/R...1L/R) must be initialized. All four key vectors (K0...K3) are
used. CTR decryption does not differ from CTR encryption, since the core
always encrypts the current counter block to produce the key stream that will be
XORed with the plaintext or cipher in input. Thus, ALGODIR is don’t care when
ALGOMODE = 110b, and the key must NOT be unrolled (prepared) for
decryption.
0111: AES key preparation for decryption mode. Writing this value when
CRYPEN = 1 immediately starts an AES round for key preparation. The secret
key must have previously been loaded into the K0...K3 registers. The BUSY bit
in the CRYP_SR register is set during the key preparation. After key processing,
the resulting key is copied back into the K0...K3 registers, and the BUSY bit is
cleared.
1000: Galois Counter Mode (GCM). This algorithm mode is also used for the
GMAC algorithm.
1001: Counter with CBC-MAC (CCM). This algorithm mode is also used for the
CMAC algorithm.
Bit 2
ALGODIR:
Algorithm direction
0: Encrypt
1: Decrypt
Bits 1:0 Reserved, must be kept to 0.