GD32F20x User Manual
221
The last block computing can be started when CALEN bit in the HAU_CFG register is 1.
11.4.3.
Hash mode
The hash mode is selected when the HMS bit in the HAU_CTL register is set as 0. And when
the START bit in the HAU_CTL register is 1, SHA-1, SHA-224, SHA-256 and MD5 mode
computation is chosen by the ALGM bits.
After a message block of 512 bit has been received through the HAU_DI register and the
input FIFO, the processor starts the calculation with the information from DMA or the status
of the CALEN bit.
The results can be finally read from the HAU_DO0..7 registers.
11.4.4.
HMAC mode
HMAC mode is used for message authentication with a unique key chosen by the user. More
information about the HMAC specifications please refer
to “HMAC: keyed-hashing for
message authentication, H. Krawczyk, M. Bellare, R. Canetti, February
1997”.
The HMAC algorithm can be represented as:
HMAC(input) = HASH[((key | opad) XOR 0x5c) | HASH(((key | ipad) XOR 0x36) | input)]
where ipad and opad are
used to extend the key to 512 bits with several “0” and | is the
concatenation operator.
There are four different phases in the HMAC mode:
1.
Configure the HMS bit in the HAU_CTL register as 1 and set the ALGM bits as the
desired algorithm. If the key size is longer than 64 bytes, then the KLM bit in the
HAU_CTL register should also be set. After that, start the HAU core by set the START
bit.
2.
The key is used as the input message to complete the calculation in HASH mode.
3.
The new key is elaborated when the last word is accessed and computation has started.
4.
After the first hash round, the new key can be used for the outer hash function. And when
the last word of the key is entered and computation starts, the results are available in the
HAU_DO registers.
11.5.
HAU interrupt
There are two types of interrupt registers in HAU, which are both in HAU_STAT register. In
HAU, the interrupt is used to indicate the situation of the input FIFO and the status of whether
the digest calculation is completed.
Any of interrupts can be enabled or disabled by configuring the HAU interrupt enable register
Содержание GD32F20 Series
Страница 1: ...GigaDevice Semiconductor Inc GD32F20x ARM Cortex M3 32 bit MCU User Manual Revision 2 2 Oct 2019 ...
Страница 191: ...GD32F20x User Manual 191 Bits Fields Descriptions 31 0 TRNDATA 31 0 32 Bit Random data ...
Страница 290: ...GD32F20x User Manual 290 conversion is ongoing ...
Страница 325: ...GD32F20x User Manual 325 15 0 ALRM 15 0 RTC alarm value low ...
Страница 385: ...GD32F20x User Manual 385 ...
Страница 523: ...GD32F20x User Manual 523 clears AERR bit by writing 0 to it ...