
DocID024597 Rev 5
855/1830
RM0351
Hash processor (HASH)
875
29.3.3
About secure hash algorithms
The hash processor is a fully compliant implementation of the secure hash algorithm
defined by FIPS PUB 180-1 standard (SHA1), FIPS PUB 180-2 standard (SHA-224, SHA-
256) and the IETF RFC1321 publication (MD5).
With each algorithm, the HASH computes a condensed representation of a message or data
file. More specifically, when a message of any length below 2
64
bits is provided on input, the
SHA-1, SHA-224, SHA-256 and MD5 processing core produces respectively a 160-bit, 224
bit, 256 bit and 128-bit output string called a message digest. The message digest can then
be processed with a digital signature algorithm in order to generate or verify the signature
for the message.
Signing the message digest rather than the message often improves the efficiency of the
process because the message digest is usually much smaller in size than the message. The
verifier of a digital signature has to use the same hash algorithm as the one used by the
creator of the digital signature.
The SHA-1, SHA-224, SHA-256 and MD5 are qualified as “secure” because it is
computationally infeasible to find a message that corresponds to a given message digest, or
to find two different messages that produce the same message digest. Any change to a
message in transit will, with very high probability, result in a different message digest, and
the signature will fail to verify.
29.3.4
Message data feeding
The message (or data file) to be processed by the HASH should be considered as a bit
string. Per FIPS PUB 180-1 and 180-2 standards this message bit string grows from left to
right, with hexadecimal words expressed in “big-endian” convention, so that within each
word, the most significant bit is stored in the left-most bit position. For example message
string “abc” with a bit string representation of “
01100001 01100010 01100011
” is
represented by a 32-bit word
0x00636261
, and 8-bit words
0x61626300
.
Data are entered into the HASH one 32-bit word at a time, by writing them into the
HASH_DIN register. The current contents of the HASH_DIN register are transferred to the
16 words input FIFO (IN FIFO) each time the register is written with new data. Hence
HASH_DIN and the input FIFO form a seventeen 32-bit words length FIFO (named the IN
buffer).
In accordance to the kind of data to be processed (e.g. byte swapping when data are ASCII
text stream) there must be a bit, byte, half-word or no swapping operation to be performed
on data from the input FIFO before entering the little-endian hash processing core.
shows how the hash processing core 32-bit data block M0...31 is constructed
from one 32-bit words popped into IN FIFO by the driver, according to the DATATYPE
bitfield in the HASH control register (HASH_CR).
Table 180. HASH internal input/output signals
Signal name
Signal type
Description
hash_hclk2
digital input
AHB2 bus clock
hash_it
digital output
Hash processor global interrupt request
hash_in_dma
digital input/output DMA burst request/ acknowledge