09.12.2012 Views

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>RM0090</strong> Hash processor (HASH)<br />

Bits 11:8 NBW: Number of words already pushed<br />

This bitfield reflects the number of words in the message that have already been<br />

pushed into the IN FIFO.<br />

NBW increments (+1) when a write access is performed to the HASH_DIN<br />

register while DINNE = 1.<br />

It goes to 0000 when the INIT bit is written to 1 or when a digest calculation<br />

starts (DCAL written to 1 or DMA end of transfer).<br />

● If the DMA is not used:<br />

0000 and DINNE=0: no word has been pushed into the DIN buffer (the buffer is<br />

empty, both the HASH_DIN register and the IN FIFO are empty)<br />

0000 and DINNE=1: 1 word has been pushed into the DIN buffer (The<br />

HASH_DIN register contains 1 word, the IN FIFO is empty)<br />

0001: 2 words have been pushed into the DIN buffer (the HASH_DIN register<br />

and the IN FIFO contain 1 word each)<br />

...<br />

1111: 16 words have been pushed into the DIN buffer<br />

● If the DMA is used, NBW is the exact number of words that have been<br />

pushed into the IN FIFO.<br />

Bit 18 and bit 7 ALGO[1:0]: Algorithm selection<br />

These bits selects the SHA-1, SHA-224, SHA256 or the MD5 algorithm:<br />

00: SHA-1 algorithm selected<br />

01: MD5 algorithm selected<br />

10: SHA224 algorithm selected<br />

11: SHA256 algorithm selected<br />

Note: This selection is only taken into account when the INIT bit is set. Changing<br />

this bit during a computation has no effect.<br />

Bit 6 MODE: Mode selection<br />

This bit selects the HASH or HMAC mode for the selected algorithm:<br />

0: Hash mode selected<br />

1: HMAC mode selected. LKEY must be set if the key being used is longer than<br />

64 bytes.<br />

Note: This selection is only taken into account when the INIT bit is set. Changing<br />

this bit during a computation has no effect.<br />

Bits 5:4 DATATYPE: Data type selection<br />

Defines the format of the data entered into the HASH_DIN register:<br />

00: 32-bit data. The data written into HASH_DIN are directly used by the HASH<br />

processing, without reordering.<br />

01: 16-bit data, or half-word. The data written into HASH_DIN are considered as<br />

2 half-words, and are swapped before being used by the HASH processing.<br />

10: 8-bit data, or bytes. The data written into HASH_DIN are considered as 4<br />

bytes, and are swapped before being used by the HASH processing.<br />

11: bit data, or bit-string. The data written into HASH_DIN are considered as 32<br />

bits (1st bit of the sting at position 0), and are swapped before being used by the<br />

HASH processing (1st bit of the string at position 31).<br />

Doc ID 018909 Rev 3 608/1416

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!