61. Hash processor (HASH)

61.1 Introduction

The hash processor is a fully compliant implementation of the secure hash algorithm (SHA-1, SHA-2 family, SHA-3 family) and the HMAC (keyed-hash message authentication code) algorithm. HMAC is suitable for applications requiring message authentication.

The hash processor computes FIPS (Federal Information Processing Standards) approved digests of length of 160, 224, 256, 384 and 512 bits, for messages of any length less than 2⁶⁴ bits (for SHA-1, SHA-224 and SHA-256) or less than 2¹²⁸ bits (for SHA-384, SHA-512).

61.2 HASH main features

61.3 HASH implementation

The devices have a single instance of HASH peripheral.

61.4 HASH functional description

61.4.1 HASH block diagram

Figure 565 shows the block diagram of the hash processor.

Figure 565. HASH block diagram

Block diagram of the HASH processor showing internal components and external interfaces.

The block diagram illustrates the internal architecture of the HASH processor. It features a central AHB interface that connects to a 32-bit AHB bus and receives hash_hclk. The AHB interface is linked to a set of Banked Registers (indicated by a dashed box) containing HASH_DIN, HASH_HRx, HASH_SR, HASH_CR, HASH_STR, and HASH_CSRx. HASH_DIN receives Data, key and feeds into a 16x32-bit IN FIFO, which then passes through a SWAP32 block to the HASH Core (SHA-1, SHA-2, SHA-3) + HMAC logic. The core outputs a Secure digest to HASH_HRx. The HASH_CSRx register provides Suspend/Resume control to the core. A Control Logic block interacts with the AHB interface, the banked registers, the core, and the DMA interface and IRQ interface. The DMA interface handles hash_dma signals, and the IRQ interface handles hash_it signals. The diagram is labeled MSv65335V2 in the bottom right corner.

Block diagram of the HASH processor showing internal components and external interfaces.

61.4.2 HASH internal signals

Table 559 describes a list of useful to know internal signals available at HASH level, not at product level (on pads).

Table 559. HASH internal input/output signals

Signal nameSignal typeDescription
hash_hclkdigital inputAHB bus clock
hash_itdigital outputHash processor global interrupt request
hash_dmadigital input/outputDMA burst request/ acknowledge

61.4.3 About secure hash algorithms

The hash processor is a fully compliant implementation of the secure hash algorithm defined by FIPS PUB 180-4 and FIPS PUB 202 standards.

With each algorithm, the HASH computes a condensed representation of a message or data file. More specifically, when a message is presented on the input, the HASH processing core produces a fixed-length output string called a message digest (see Table 560).

Table 560. Information on supported hash algorithms

AlgorithmMessage digest size (in bits)Block size (in bytes)(1)(2)Message lengthBit string message
SHA-116064< 2⁶⁴ bitsYes
SHA2-224224
SHA2-256256
SHA2-384384128< 2¹²⁸ bitsYes
SHA2-512512(3)
SHA3-224224144< 2⁶⁴ bitsNo(4)
SHA3-256256136
SHA3-384384104< 2¹²⁸ bits
SHA3-51251272
SHAKE128Variable output(5)168< 2⁶⁴ bits
SHAKE256136
  1. Block size = (NBWE-1) * 4 bytes. NBWE[5:0] bitfield can be read from the HASH_SR register after ALGO and INIT bits are written in the HASH_CR register.
  2. The block size can be changed using IN_RATE[5:0] bitfield in HASH_SHA3CFGR.
  3. Digest size is 224 bits for SHA2-512/224 and 256 bits for SHA2-512/256 (truncated modes).
  4. Data is fed as byte strings, not bit strings.
  5. When the expected digest length is not reached (unbounded output), a new computation is required by setting DCAL in HASH_STR register. This situation occurs when the digest length is higher than 1600 – block size (in bits). Note that the output length cannot be greater than the block size (or input rate).

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 since 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-2 and SHA-3 functions supported by the hash processor are qualified as “secure” by NIST 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 (SHA-1 does not qualify as secure since February 2017). Any change to a message in transit results, with very high probability, in a different message digest, and the signature fails to verify.

An extendable output function (XOF) SHAKE generates as many bits from its sponge as requested. For example, as per NIST standard, for a message M and an output length d:

61.4.4 Message data feeding

The message (or data file) to be processed by the HASH must be considered as a bit string, except for SHA-3 modes (see Table 560) where the message is a byte string. Per FIPS PUB 180-4 standard 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 each time the register is written with new data. Hence, HASH_DIN and the FIFO form a seventeen 32-bit words length FIFO (named the IN buffer).

In accordance to the kind of data to be processed (for example 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. Figure 566 shows how the hash processing core 32-bit data block M0...31 is constructed from one 32-bit words popped into input FIFO by the driver, according to the DATATYPE bitfield in the HASH control register (HASH_CR)

HASH_DIN data endianness when bit swapping is disabled (DATATYPE = 00) can be described as following: the least significant bit of the message has to be at MSB position in the first word entered into the hash processor, the 32nd bit of the bit string has to be at MSB position in the second word entered into the hash processor and so on.

Figure 566. Message data swapping feature

Figure 566: Message data swapping feature. This diagram illustrates four data swapping modes between the System interface and the HASH core interface. Each mode shows the mapping of 32-bit words (Word0 to Word3) from the System interface to message blocks (M0 to M127) in the HASH core interface. 1. DATATYPE '00': no swapping. Words are mapped directly: Word0 to M0-M31, Word1 to M32-M63, Word2 to M64-M95, Word3 to M96-M127. 2. DATATYPE '01': 16-bit or half-word swapping. 16-bit halves are swapped within each word before mapping. 3. DATATYPE '10': 8-bit or byte swapping. Bytes are swapped within each word before mapping. 4. DATATYPE '11': bit swapping. Bits are swapped within each word before mapping. In all cases, the LSB is written first.

DATATYPE "00": no swapping

LSB written first! System interface MSB

Word0: bit31...bit0
Word1: bit31...bit0
Word2: bit31...bit0
Word3: bit31...bit0

M0 M31 M32 M63 M64 M95 M96 M127

LSB HASH core interface MSB

DATATYPE "01": 16-bit or half-word swapping

LSB written first! System interface MSB

Word0: bit31...bit16 | bit15...bit0
Word1: bit31...bit16 | bit15...bit0
Word2: bit31...bit16 | bit15...bit0
Word3: bit31...bit16 | bit15...bit0

M0 M15 M16 M31 M32 M47 M48 M63 M96 M111 M112 M127

LSB HASH core interface MSB

DATATYPE "10": 8-bit or byte swapping

LSB written first! System interface MSB

Word0: bit31..24 | bit23..16 | bit15..8 | bit7..0
Word1: bit31..24 | bit23..16 | bit15..8 | bit7..0
Word2: bit31..24 | bit23..16 | bit15..8 | bit7..0
Word3: bit31..24 | bit23..16 | bit15..8 | bit7..0

M0..7 M8..15 M16..23 M24..31 M96..103 M112..119 M120..127

LSB HASH core interface MSB

DATATYPE "11": bit swapping

LSB written first! System interface MSB

Word0: bit31 | bit30 | bit29 | bit28 | bit27 | bit26 | bit25 | bit24 | bit23 | bit22 | bit21 | bit20 | bit19 | bit18 | bit17 | bit16 | bit15 | bit14 | bit13 | bit12 | bit11 | bit10 | bit9 | bit8 | bit7 | bit6 | bit5 | bit4 | bit3 | bit2 | bit1 | bit0
Word1: bit31 | bit30 | bit29 | bit28 | bit27 | bit26 | bit25 | bit24 | bit23 | bit22 | bit21 | bit20 | bit19 | bit18 | bit17 | bit16 | bit15 | bit14 | bit13 | bit12 | bit11 | bit10 | bit9 | bit8 | bit7 | bit6 | bit5 | bit4 | bit3 | bit2 | bit1 | bit0
Word2: bit31 | bit30 | bit29 | bit28 | bit27 | bit26 | bit25 | bit24 | bit23 | bit22 | bit21 | bit20 | bit19 | bit18 | bit17 | bit16 | bit15 | bit14 | bit13 | bit12 | bit11 | bit10 | bit9 | bit8 | bit7 | bit6 | bit5 | bit4 | bit3 | bit2 | bit1 | bit0
Word3: bit31 | bit30 | bit29 | bit28 | bit27 | bit26 | bit25 | bit24 | bit23 | bit22 | bit21 | bit20 | bit19 | bit18 | bit17 | bit16 | bit15 | bit14 | bit13 | bit12 | bit11 | bit10 | bit9 | bit8 | bit7 | bit6 | bit5 | bit4 | bit3 | bit2 | bit1 | bit0

M0 M1 M2 M29 M30 M31 M32 M33 M34 M61 M62 M63 M96 M97 M98 M126 M127 M128

LSB HASH core interface MSB

MSv41984V4

Figure 566: Message data swapping feature. This diagram illustrates four data swapping modes between the System interface and the HASH core interface. Each mode shows the mapping of 32-bit words (Word0 to Word3) from the System interface to message blocks (M0 to M127) in the HASH core interface. 1. DATATYPE '00': no swapping. Words are mapped directly: Word0 to M0-M31, Word1 to M32-M63, Word2 to M64-M95, Word3 to M96-M127. 2. DATATYPE '01': 16-bit or half-word swapping. 16-bit halves are swapped within each word before mapping. 3. DATATYPE '10': 8-bit or byte swapping. Bytes are swapped within each word before mapping. 4. DATATYPE '11': bit swapping. Bits are swapped within each word before mapping. In all cases, the LSB is written first.

61.4.5 Message digest computing

The hash processor sequentially processes several blocks when computing the message digest. Block sizes can be found in Table 560: Information on supported hash algorithms.

Each time the DMA or the CPU writes a block to the hash processor, the HASH automatically starts computing the message digest. This operation is known as partial digest computation.

As described in Section 61.4.4: Message data feeding, the message to be processed is entered into the HASH 32-bit word at a time, writing to the HASH_DIN register to fill the input FIFO. In order to perform the hash computation on this data the application must follow below sequence.

  1. 1. Initialize the hash processor using the HASH_CR register:
    • – Write to the HASH_CR register to select the right algorithm using the ALGO bitfield, and set the INIT bit (other bits are kept at zero). Then read the NBWE bitfield from the HASH_SR register to deduce the algorithm block size, which equals (NBWE-1)*4. This step is not required if the block size is already known (see Table 560 for details).
    • – Select the right algorithm using the ALGO[3:0] field. If needed, program the correct swapping operation on the message input words using the DATATYPE[1:0] bitfield.
    • – When HMAC mode is required, set the MODE bit as well as the LKEY bit if the HMAC key size is greater than the known block size of the algorithm (otherwise keep LKEY cleared). Refer to Section 61.4.7: HMAC operation for details.
    • – Update NBLW[4:0] in the HASH_STR register to define the number of valid bits in the last word of the message if it is different from 32 bits. NBLW information is used to correctly perform the automatic message padding before the final message digest computation.
  2. 2. Complete the initialization by setting the INIT bit in HASH_CR register. Also set the DMAE bit if data are transferred via DMA.

Caution: When programming step 2, it is important that the correct configuration values (ALGO, DATATYPE, HMAC mode, key length, NBLW) are set up before or at the same time.

  1. 3. Start filling data by writing to the HASH_DIN register, unless data are automatically transferred via DMA. Note that the processing of a block can start only once the last value of the block has entered the input FIFO. The way the partial or final digest computation is managed depends on the way data are fed into the processor:
    • – Data are filled by software:
      Partial digest computations are triggered each time the application writes the first word of the next block, the block size being defined by NBWE bits in HASH_SR. Once the processor is ready again (DINIS = 1 in HASH_SR), the software can write new data to HASH_DIN. This mechanism avoids the introduction of wait states by the HASH.
      The final digest computation is triggered when the last block is entered and the software sets the DCAL bit. If the message length is not an exact multiple of the block size, the NBLW field in HASH_STR register must be written prior to writing DCAL bit (see Section 61.4.6 for details).
    • – Data are filled as a single DMA transfer (MDMAT = 0):
      Partial digest computations are triggered automatically each time the FIFO is full. The final digest computation is triggered automatically when the last block has been transferred to the HASH_DIN register by DMA (DCAL bit is set by hardware). If the message length is not an exact multiple of the block size, the NBLW field in HASH_STR register must be written prior to enabling the DMA (see Section 61.4.6 for details).
    • – Data are filled using multiple DMA transfers (MDMAT = 1):
      Partial digest computations are triggered as for single DMA transfers (refer to the above description). However, the final digest computation is not triggered automatically when the last block has been transferred by DMA to the HASH_DIN register (DCAL bit is not set by hardware). It enables the hash processor to receive a new DMA transfer as part of this digest computation. To launch the final digest computation, the software must clear MDMAT bit before the last DMA

transfer in order to trigger the final digest computation as it is done for single DMA transfers.

  1. 4. Once the digest calculation is completed (DCIS = 1), the resulting digest can be read from the output registers, as described in Table 561.
  2. 5. For SHAKE128 or SHAKE256, a single computation may not be sufficient (actual number of computation = expected output length divided by the block size). For each additional computation, execute the sequence below after step 4:
    1. a) Set DCAL in HASH_STR register.
    2. b) Wait for DCIS = 1, then read the new resulting digest from the same output registers. If an additional computation is required, go to step a.

Table 561. Hash processor outputs

AlgorithmValid output registersMost significant bitDigest size (in bits)
SHA-1HASH_H0 to HASH_H4HASH_H0[31]160
SHA2-224HASH_H0 to HASH_H6HASH_H0[31]224
SHA2-256HASH_H0 to HASH_H7256
SHA2-384HASH_H0 to HASH_H11HASH_H0[31]384
SHA2-512HASH_H0 to HASH_H15512(1)
SHA3-224HASH_H0 to HASH_H6HASH_H0[31]224
SHA3-256HASH_H0 to HASH_H7256
SHA3-384HASH_H0 to HASH_H11384
SHA3-512HASH_H0 to HASH_H15512
SHAKE128HASH_H0 to HASH_H41Variable output(2)
SHAKE256HASH_H0 to HASH_H33

1. Digest size is 224 bits for SHA2-512/224 and 256 bits for SHA2-512/256 (truncated modes)

2. Unbounded in the upper limit (extendable output functions), see Table 560.

For more information about HMAC detailed instructions, refer to Section 61.4.7: HMAC operation.

61.4.6 Message padding

Overview

When computing a condensed representation of a message, the process of feeding data into the hash processor (with automatic partial digest computation every block size transfer) loops until the last bits of the original message are written to the HASH_DIN register.

As the length (number of bits) of a message can be any integer value, the last word written to the hash processor may have a valid number of bits between 1 and 32. This number of valid bits in the last word, NBLW, has to be written to the HASH_STR register, so that message padding is correctly performed before the final message digest computation.

Note: When a SHA-3 mode is selected in HASH_CR register, the message is defined as a number of bytes with the last word having a valid number of bytes between 1 and 4. Consequently NBLW bits 0 to 2 are always zero in HASH_STR register.

Padding processing

Detailed padding sequences, with DMA enabled or disabled, are described in Section 61.4.5: Message digest computing.

Padding example

As specified by Federal Information Processing Standards PUB 180-4, message padding consists in appending a “1” followed by k “0”s, itself followed by a 64-bit integer that is equal to the length L in bits of the message. These three padding operations generate a padded message of length L + 1 + k + 64, which by construction is a multiple of 512 bits.

For the hash processor, the “1” is added to the last word written to the HASH_DIN register at the bit position defined by the NBLW bitfield, and the remaining upper bits are cleared (“0”s).

Example from FIPS PUB180-4

Let us assume that the original message is the ASCII binary-coded form of “abc”, of length L = 24:

byte 0 byte 1 byte 2 byte 3 01100001 01100010 01100011 UUUUUUUU <-- 1st word written to HASH_DIN -->

NBLW has to be loaded with the value 24: a “1” is appended at bit location 24 in the bit string (starting counting from left to right in the above bit string), which corresponds to bit 31 in the HASH_DIN register (little-endian convention):

01100001 01100010 01100011 1UUUUUUU

Since L = 24, the number of bits in the above bit string is 25, and 423 “0” bits are appended, making now 448 bits.

This gives in hexadecimal (byte words in big-endian format):

61626380 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

The message length value, L, in two-word format (that is 00000000 00000018) is appended. Hence, the final padded message in hexadecimal (byte words in big-endian format):

61626380 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000018

If the hash processor is programmed to swap byte within HASH_DIN input register (DATATYPE = 10 in HASH_CR), the above message has to be entered using following sequence:

  1. 1. 0xUU636261 is written to the HASH_DIN register (where 'U' means don't care)
  2. 2. 0x18 is written to the HASH_STR register (the number of valid bits in the last word written to the HASH_DIN register is 24, as the original message length is 24 bits)
  3. 3. 0x10 is written to the HASH_STR register to start the message padding (described above) and then perform the digest computation.
  4. 4. The hash computing is complete with the message digest available in the HASH_HRx registers (x = 0 to 4) for the SHA-1 algorithm. For this FIPS example, the expected value is as follows:

HASH_HR0 = 0xA9993E36

HASH_HR1 = 0x4706816A

HASH_HR2 = 0xBA3E2571

HASH_HR3 = 0x7850C26C

HASH_HR4 = 0x9CD0D89D

61.4.7 HMAC operation

Overview

As specified by Internet Engineering Task Force RFC2104 and NIST FIPS PUB 198-1, the HMAC algorithm is used for message authentication by irreversibly binding the message being processed to a key chosen by the user. The algorithm consists of two nested hash operations:

\[\text{HMAC}(\text{message}) = \text{Hash}((\text{Key} \mid \text{pad}) \text{ XOR } \text{opad} \mid \text{Hash}((\text{Key} \mid \text{pad}) \text{ XOR } \text{ipad} \mid \text{message}))\]

Where:

Note: HMAC mode of the hash processor can be used with all supported algorithms.

HMAC processing

Four different steps are required to compute the HMAC:

  1. 1. The software sets the INIT bit, with the MODE bit set and the ALGO bits selecting the desired algorithm. The LKEY bit must also be set if the key being used is longer than the block size. In this case, as required by HMAC specifications, the hash processor uses the hash of the key instead of the real key.
  2. 2. The software provides the key to be used for the inner hash function, using the same mechanism as the message string loading that is by writing the key data into

HASH_DIN register and then completing the transfer by setting DCAL bit and the correct NBLW to HASH_STR register.

  1. 3. Once the processor is ready again (DINIS = 1 in HASH_SR), the software can write the message string to HASH_DIN. When the last word of the last block is entered and the software sets DCAL bit in HASH_STR register, the NBLW bitfield must be programmed at the same time to a value different from zero if the message length is not an exact multiple of the block size. Note that the DMA can also be used to feed the message string, as described in Section 61.4.5: Message digest computing.
  2. 4. Once the processor is ready again (DINIS = 1 in HASH_SR), the software provides the key to be used for the outer hash function, writing the key data into HASH_DIN register, and then completing the transfer by setting DCAL bit and programming the correct NBLW to HASH_STR register. The HMAC result can be found in the valid output registers (HASH_HRx) as soon as DCIS bit is set.

Note: The computation latency of the HMAC primitive depends on the lengths of the keys and message, as described in Section 61.4.11: HASH processing time.

Endianness management details can be found in Section 61.4.4: Message data feeding.

HMAC example

Below is an example of HMAC SHA-1 algorithm (ALGO = 00 and MODE = 1 in HASH_CR) as specified by NIST. SHA-1 block size is 64 bytes.

Let us assume that the original message is the ASCII binary-coded form of “Sample message for keylen = blocklen”, of length L = 34 bytes. If the HASH is programmed in no swapping mode (DATATYPE = 00 in HASH_CR), the following data must be loaded sequentially into HASH_DIN register:

  1. 1. Inner hash key input (length = 64, that is, no padding), specified by NIST. As key length = 64, LKEY bit is cleared in HASH_CR register
    000102030405060708090A0B0C0D0E0F1011121314151617
    18191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F
    303132333435363738393A3B3C3D3E3F
  2. 2. Message input (length = 34, that is, padding required). HASH_STR must be set to 0x20 to start message padding and inner hash computation (see ‘U’ as don’t care)
    53616D706C65206D65737361676520666F72206B65796C65
    6E3D626C6F636B6C656EUUUU
  3. 3. Outer hash key input (length = 64, that is, no padding). A key identical to the inner hash key is entered here.
  4. 4. Final outer hash computing is then performed by the HASH. The HMAC-SHA1 digest result is available in the HASH_HRx registers, as shown below:
    HASH_HR0=0x5FD596EE
    HASH_HR1=0x78D5553C
    HASH_HR2=0x8FF4E72D
    HASH_HR3=0x266DFD19
    HASH_HR4=0x2366DA29

61.4.8 HASH suspend/resume operations

Overview

It is possible to interrupt a hash/HMAC operation to perform another processing with a higher priority. The interrupted process completes later when the higher-priority task has been processed, as shown in Figure 567.

Figure 567. HASH suspend/resume mechanism

Flowchart of HASH suspend/resume mechanism showing Message 1 and Message 2 processing paths with suspend and resume sequences.

The diagram illustrates the HASH suspend/resume mechanism. It shows two message processing paths: Message 1 and Message 2. Message 1 consists of a sequence of blocks: Block 1, Block 2, Block 3, Block 4, Block 5, and Block 6, followed by an ellipsis. Message 2 consists of Block 1 and Block 2 (last block). A 'New higher priority message 2 to be processed' event interrupts Message 1 at Block 3. This triggers a 'HASH suspend sequence' which saves the context and then starts Message 2 with Block 1. After Message 2's Block 2 (last block) is processed, a 'HASH resume sequence' restores the context and resumes Message 1 from Block 4. The label 'MSv41985V2' is located in the bottom right corner of the diagram area.

Flowchart of HASH suspend/resume mechanism showing Message 1 and Message 2 processing paths with suspend and resume sequences.

To do so, the context of the interrupted task must be saved from the HASH registers to memory, and then be restored from memory to the HASH registers.

The procedures where the data flow is controlled by software or by DMA are described hereafter.

Data loaded by software

When the DMA is not used to load the message into the hash processor, the context can be saved only when no block processing is ongoing.

To suspend the processing of a message, proceed as follows after writing the number of words defined in NBWE:

  1. 1. In Polling mode, wait for BUSY = 0 then poll if the DINIS status bit is set.
    In Interrupt mode, implement the next step in DINIS interrupt handler (recommended).
  2. 2. Store the contents of the following registers into memory:
    • – HASH_IMR
    • – HASH_STR
    • – HASH_CR and HASH_SHA3CFGR
    • – HASH_CSR0 to HASH_CSR37, when SHA-1 or SHA2-256 is selected, plus HASH_CSR38 to HASH_CSR53 if an HMAC operation was ongoing
    • – HASH_CSR0 to HASH_CSR90, when SHA2-384 or SHA2-512 (truncated or not) is selected, plus HASH_CSR91 to HASH_CSR102 if an HMAC operation was ongoing.
    • – HASH_CSR0 to HASH_CSR71, when SHA-3 is selected, plus HASH_CSR72 to HASH_CSR87 if a SHA3-384 or SHA3-512 HMAC operation was ongoing.

To resume the processing of a message, proceed as follows:

  1. 1. Write the following registers with the values saved in memory: HASH_IMR, HASH_STR, HASH_CR. Then, write the saved value to HASH_SHA3CFGR register.
  2. 2. Initialize the hash processor by setting the INIT bit in the HASH_CR register
  3. 3. Write the HASH_CSRx registers with the values saved in memory.
  4. 4. Restart the processing from the point where it has been interrupted.

Data loaded by DMA

When the DMA is used to load the message into the hash processor, it is recommended to suspend and then restore a secure digest computing as described below.

In this sequence the DMA channel allocated to the hash peripheral remains allocated to the processing of message 1 (see Figure 567).

To suspend the processing of a message using DMA, proceed as follows:

  1. 1. Clear the DMAE bit to disable the DMA interface. The hash peripheral automatically fetches enough data via the DMA to complete the current burst transfer.
  2. 2. Wait until the last DMA transfer is complete (DMAS = 0 in HASH_SR).
  3. 3. Disable the DMA channel.
  4. 4. In Polling or Interrupt mode (recommended), wait until the hash processor is ready (no block is being processed), that is wait for DINIS = 1 in HASH_SR. If DCIS is also set in
  1. HASH_SR, the hash result is available and the context swapping is useless. Else go to step 5.
  2. 5. Save HASH_IMR, HASH_STR and HASH_CR registers. Also save a number of HASH_CSRx registers depending on the SHA algorithm that is used:
    • – When SHA-1 or SHA2-256 is selected, save HASH_CSR0 to HASH_CSR37, plus HASH_CSR38 to HASH_CSR53 if an HMAC operation was ongoing.
    • – When SHA2-384 or SHA2-512 is selected, save HASH_CSR0 to HASH_CSR90, plus HASH_CSR91 to HASH_CSR102 if an HMAC operation was ongoing.
    • – When SHA3 is selected, save HASH_CSR0 to HASH_CSR71, plus HASH_CSR72 to HASH_CSR87 if a SHA3-384 or SHA3-512 HMAC operation was ongoing.
  3. 6. Save HASH_SHA3CFGR register.

To resume the processing of a message using DMA, proceed as follows:

  1. 1. Reconfigure the DMA controller so that it proceeds with the transfer of the message up to the end if it is not interrupted again.
  2. 2. Program the values saved in memory to HASH_IMR, HASH_STR and HASH_CR registers. Then, write the saved value to HASH_SHA3CFGR register.
  3. 3. Initialize the hash processor by setting the INIT bit in the HASH_CR register.
  4. 4. Program the values saved in memory to the HASH_CSRx registers.
  5. 5. Restart the processing from the point where it was interrupted by setting the DMAE bit.

61.4.9 HASH DMA interface

The HASH supports both single and fixed DMA burst transfers of four words.

The hash processor provides an interface to connect to the DMA controller. This DMA can be used to write data to the HASH by setting the DMAE bit in the HASH_CR register. When this bit is set, the HASH initiates a DMA request each time a block has to be written to the HASH_DIN register.

Once four 32-bit words have been received, the HASH automatically triggers a new request to the DMA. For more information, refer to Section 61.4.5: Message digest computing.

Before starting the DMA transfer, the software must program the number of valid bits in the last word that is copied into HASH_DIN register. This is done by writing in HASH_STR register the following value:

NBLW = Len(Message) % 32 where “x%32” gives the remainder of x divided by 32.

Note: While a SHA-3 algorithm is selected in HASH_CR register bits 0 to 2 of NBLW are always zero (processing of bytes, not bits).

The DMAS bit of the HASH_SR register provides information on the DMA interface activity. This bit is set with DMAE and cleared when DMAE is cleared and no DMA transfer is ongoing.

Note: No interrupt is associated to DMAS bit.

When MDMAT is set, the size of the transfer must be a multiple of four words.

61.4.10 HASH error management

No error flags are generated by the hash processor.

61.4.11 HASH processing time

Table 562 summarizes the time required to process an intermediate block for each mode of operation.

Table 562. Processing time (in clock cycle)

Mode of operationBlock size (in bytes)FIFO load(1)Computation phaseTotal
SHA-164166682
SHA2-224165066
SHA2-256
SHA2-384128326698
SHA2-512(2)
SHA3-2241443624(3)60
SHA3-2561363458
SHA3-3841042650
SHA3-512721842
  1. 1. Add the time required to load the block into the processor.
  2. 2. SHA2-512 includes SHA2-512/224 and SHA2-512/256 modes.
  3. 3. One cycle per round, 24 rounds required for these operations.

The time required to process the last block of a message (or of a key in HMAC) can be longer. This time depends on the length of the last block and the size of the key (in HMAC mode).

Compared to the processing of an intermediate block, it can be increased by the factor below:

61.5 HASH interrupts

Two individual maskable interrupt sources are generated by the hash processor to signal the following events:

Both interrupt sources are connected to the same global interrupt request signal (hash_it), which is in turn connected to the device interrupt controller. Each interrupt source can

individually be enabled or disabled by changing the mask bits in the HASH_IMR register. Setting the appropriate mask bit enables the interrupt.

The status of each maskable interrupt source can be read from the HASH_SR register.

Table 563 gives a summary of the available features.

Table 563. HASH interrupt requests

Interrupt acronymInterrupt eventEvent flagEnable control bitInterrupt clear method
HASHDigest computation completedDCISDCIEClear DCIS or set INIT
Data input buffer ready to get a new blockDINISDINIEClear DINIS or write to HASH_DIN

61.6 HASH registers

The hash core is associated with several control and status registers and several message digest registers. All these registers are accessible through 32-bit word accesses only, else an AHB error is generated.

61.6.1 HASH control register (HASH_CR)

Address offset: 0x000

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.ALGO[3:0]LKEY
rwrwrwrwrw
1514131211109876543210
Res.Res.MDMATDINNENBW[3:0]Res.MODEDATATYPE[1:0]DMAEINITRes.Res.
rwrrrrrrwrwrwrwrw

Bits 31:21 Reserved, must be kept at reset value.

Bits 20:17 ALGO[3:0]: Algorithm selection

These bits select the hash algorithm. This selection is only taken into account when the INIT bit is set. Changing this bitfield during a computation has no effect

When the ALGO bitfield is equal to 10XX, an advanced application can use HASH_SHA3CFGR to tune the behavior of the hash processor.

When the ALGO bitfield is updated and INIT bit is set, NBWE in HASH_SR is automatically updated to 0x11 when ALGO = 0x00XX.

0000: SHA-1

0001: reserved

0010: SHA2-224

0011: SHA2-256

1100: SHA2-384

1101: SHA2-512/224

1110: SHA2-512/256

1111: SHA2-512

0100: SHA3-224

0101: SHA3-256

0110: SHA3-384

0111: SHA3-512

1000: SHAKE128

1001: SHAKE256

Others: reserved, must not be used

Bit 16 LKEY: Long key selection

The application must set this bit if the HMAC key is greater than the block size corresponding to the hash algorithm (see Table 560: Information on supported hash algorithms for details). For example the block size is 64 bytes for SHA2-256.

This selection is only taken into account when the INIT and MODE bits are set (HMAC mode selected). Changing this bit during a computation has no effect.

0: HMAC key is shorter or equal to the block size (short key). The actual key value written in HASH_DIN is used during the HMAC computation.

1: HMAC key is longer than the block size (long key). The hash of the key is used instead of the real key during the HMAC computation.

Bit 15 Reserved, must be kept at reset value.

Bit 14 Reserved, must be kept at reset value.

Bit 13 MDMAT: Multiple DMA transfers

This bit is set when hashing large files when multiple DMA transfers are needed.

0: DCAL is automatically set at the end of a DMA transfer.

1: DCAL is not automatically set at the end of a DMA transfer.

Bit 12 DINNE: DIN not empty

Refer to DINNE bit of HASH_SR for a description of DINNE bit.

This bit is read-only.

Bits 11:8 NBW[3:0]: Number of words already pushed

Refer to NBWP[3:0] bitfield of HASH_SR for a description of NBW[3:0] bitfield.

This bit is read-only.

Bit 7 Reserved, must be kept at reset value.

Bit 6 MODE: Mode selection

This bit selects the normal or the keyed HMAC mode for the selected algorithm. This selection is only taken into account when the INIT bit is set. Changing this bit during a computation has no effect.

0: Hash mode selected

1: HMAC mode selected. LKEY bit must be set if the key being used is longer than the algorithm block size.

Bits 5:4 DATATYPE[1:0]: Data type selection

This bitfield defines the format of the data entered into the HASH_DIN register:

00: 32-bit data. The data written into HASH_DIN are directly used by the HASH processing, without reordering.

01: 16-bit data or half-word. The data written into HASH_DIN are considered as two half-words, and are swapped before being used by the HASH processing.

10: 8-bit data or bytes. The data written into HASH_DIN are considered as four bytes, and are swapped before being used by the HASH processing.

11: bit data or bit string. The data written into HASH_DIN are considered as 32 bits (1st bit of the string at position 0), and are swapped before being used by the HASH processing (1st bit of the string at position 31).

Bit 3 DMAE: DMA enable

Setting this bit enables DMA transfers. After this bit is set, it is cleared by hardware while the last data of the message is written into the hash processor.

Clearing this bit while a DMA transfer is ongoing does not abort the current transfer. Instead, the DMA interface of the HASH remains internally enabled until the transfer is complete or INIT is set.

Setting INIT bit does not clear DMAE bit.

0: DMA transfers disabled

1: DMA transfers enabled. A DMA request is sent as soon as the hash core is ready to receive data.

Bit 2 INIT: Initialize message digest calculation

Setting this bit resets the hash processor core, so that the HASH is ready to compute the message digest of a new message.

Clearing this bit has no effect. Reading this bit always returns 0.

Bits 1:0 Reserved, must be kept at reset value.

61.6.2 HASH data input register (HASH_DIN)

Address offset: 0x004

Reset value: 0x0000 0000

HASH_DIN is the data input register. It is 32-bit wide. This register is used to enter the message by blocks defined by the hash algorithm (see Table 560: Information on supported hash algorithms for details). For example the block size is 64 bytes for SHA2-256.

When the HASH_DIN register is programmed, the value presented on the AHB bus is 'pushed' into the hash core and the register takes the new value presented on the AHB bus. To get a correct message format, the DATATYPE bits must have been previously configured in the HASH_CR register.

When a complete block has been written to the HASH_DIN register, an intermediate digest calculation is launched:

When the last block has been written to the HASH_DIN register, the final digest calculation (including padding) is launched by setting the DCAL bit in the HASH_STR register (final digest calculation). This operation is automatic if the DMA is used and MDMAT bit is cleared.

Reading the HASH_DIN register returns zeros.

Note: When the HASH is busy, a write access to the HASH_DIN register might stall the AHB bus if the digest calculation (intermediate or final) is not complete.

31302928272625242322212019181716
DATAIN[31:16]
wwwwwwwwwwwwwwww
1514131211109876543210
DATAIN[15:0]
wwwwwwwwwwwwwwww

Bits 31:0 DATAIN[31:0]: Data input

Writing this register pushes the current register content into the FIFO, and the register takes the new value presented on the AHB bus.

Reading this register returns zeros.

61.6.3 HASH start register (HASH_STR)

Address offset: 0x008

Reset value: 0x0000 0000

The HASH_STR register has two functions:

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.DCALRes.Res.Res.NBLW[4:0]
rwrwrwrwrwrw
ST logo
ST logo

Bits 31:9 Reserved, must be kept at reset value.

Bit 8 DCAL: Digest calculation

Setting this bit starts the message padding using the previously written value of NBLW, and starts the calculation of the final message digest with all the data words written to the input FIFO since the INIT bit was last set.

Reading this bit returns 0.

Bits 7:5 Reserved, must be kept at reset value.

Bits 4:0 NBLW[4:0]: Number of valid bits in the last word

When the last word of the message bit string is written to HASH_DIN register, the hash processor takes only the valid bits, specified as below, after internal data swapping.

The above mechanism is valid only if DCAL = 0. If NBLW bits are written while DCAL is set, the NBLW bitfield remains unchanged. In other words it is not possible to configure NBLW and set DCAL at the same time.

Reading NBLW bits returns the last value written to NBLW.

0x00: All the 32 bits of the last data written are valid message bits, that is M[31:0]

0x01: Only one bit of the last data written (after swapping) is valid, that is M[0]

0x02: Only two bits of the last data written (after swapping) are valid, that is M[1:0]

0x03: Only three bits of the last data written (after swapping) are valid that is M[2:0]

...

0x1F: Only 31 bits of the last data written (after swapping) are valid that is M[30:0]

Note: When SHA-3 is selected, bits 0 to 2 are kept at zero (byte oriented input).

61.6.4 HASH digest registers

These registers contain the message digest result defined as follows:

In all cases, the digest most significant bit is stored in HASH_HR0[31], and unused HASH_HRx registers reads as zero. For SHA-3 algorithms, all HASH_HRx registers up to the block size are used (see Table 560 for details).

If a read access to one of these registers is performed while the hash core is calculating an intermediate digest or a final message digest (DCIS bit equals 0), then the read operation returns zeros.

Note: When starting a digest computation for a new message (by setting the INIT bit), HASH_HRx registers are forced to their reset values.

HASH_HR0 to HASH_HR4 registers can be accessed through two different addresses (register aliasing).

HASH aliased digest register x (HASH_HRAx)

Address offset: 0x00C+0x4*x, (x = 0 to 4)

Reset value: 0x0000 0000

The content of the HASH_HRAx registers is identical to the one of the HASH_HRx registers located at address offset 0x310.

31302928272625242322212019181716
Hx[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
Hx[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 Hx[31:0]: Hash data x

Refer to Section 61.6.4: HASH digest registers introduction.

HASH digest register x (HASH_HRx)

Address offset: 0x310+0x4*x, (x = 0 to 4)

Reset value: 0x0000 0000

31302928272625242322212019181716
Hx[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
Hx[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 Hx[31:0]: Hash data x

Refer to Section 61.6.4: HASH digest registers introduction.

HASH supplementary digest register x (HASH_HRx)

Address offset: 0x310+0x4*x, (x = 5 to 49)

Reset value: 0x0000 0000

31302928272625242322212019181716
Hx[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
Hx[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 Hx[31:0]: Hash data x

Refer to Section 61.6.4: HASH digest registers introduction.

61.6.5 HASH interrupt enable register (HASH_IMR)

Address offset: 0x020

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DCIEDINIE
rwrw

Bits 31:2 Reserved, must be kept at reset value.

Bit 1 DCIE: Digest calculation completion interrupt enable

0: Digest calculation completion interrupt disabled

1: Digest calculation completion interrupt enabled.

Bit 0 DINIE: Data input interrupt enable

0: Data input interrupt disabled

1: Data input interrupt enabled

61.6.6 HASH status register (HASH_SR)

Address offset: 0x024

Reset value: 0x0011 0001

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.NBWE[5:0]
rrrrrr
1514131211109876543210
DINNENBWP[5:0]Res.Res.Res.Res.Res.BUSYDMASDCISDINIS
rrrrrrrrrrc_w0rc_w0

Bits 31:22 Reserved, must be kept at reset value.

Bits 21:16 NBWE[5:0]: Number of words expected

This bitfield reflects the number of words in the message that must be pushed into the FIFO to trigger a partial computation. NBWE is decremented by 1 when a write access is performed to the HASH_DIN register.

NBWE is set to the expected block size +1 in words when INIT bit is set in HASH_CR. It is set to the expected block size when the partial digest calculation ends.

Bit 15 DINNE: DIN not empty

This bit is set when the HASH_DIN register holds valid data (that is after being written at least once). It is cleared when either the INIT bit (initialization) or the DCAL bit (completion of the previous message processing) is set.

0: No data are present in the data input buffer

1: The input buffer contains at least one word of data

Bits 14:9 NBWP[5:0]: Number of words already pushed

This bitfield is the exact number of words in the message that have already been pushed into the FIFO. NBWP is incremented by 1 when a write access is performed to the HASH_DIN register.

When a digest calculation starts, NBWP is updated to NBWP- block size (in words), and NBWP goes to zero when the INIT bit is set.

Bits 8:4 Reserved, must be kept at reset value.

Bit 3 BUSY: Busy bit

0: No block is currently being processed

1: The hash core is processing a block of data

Bit 2 DMAS: DMA Status

This bit provides information on the DMA interface activity. It is set with DMAE and cleared when DMAE = 0 and no DMA transfer is ongoing. No interrupt is associated with this bit.

0: DMA interface is disabled (DMAE = 0) and no transfer is ongoing

1: DMA interface is enabled (DMAE = 1) or a transfer is ongoing

Bit 1 DCIS: Digest calculation completion interrupt status

This bit is set by hardware when a digest becomes ready (the whole message has been processed). It is cleared by writing it to 0 or by setting the INIT bit in the HASH_CR register.

0: No digest available in the HASH_HRx registers (zeros are returned)

1: Digest calculation complete, a digest is available in the HASH_HRx registers. An interrupt is generated if the DCIE bit is set in the HASH_IMR register.

Bit 0 DINIS: Data input interrupt status

This bit is set by hardware when the FIFO is ready to get a new block (16 locations are free). It is cleared by writing it to 0 or by writing the HASH_DIN register.

When DINIS = 0, HASH_CSRx registers reads as zero.

0: Less than 16 locations are free in the input buffer

1: A new block can be entered into the input buffer. An interrupt is generated if the DINIE bit is set in the HASH_IMR register.

61.6.7 HASH SHA-3 configuration register (HASH_SHA3CFGR)

Address offset: 0x028

Reset value: 0x0000 0000

This register is automatically initialized when selecting a SHA-3 algorithm using ALGO bits in HASH_CR. An advanced user application can always update this register to change the behavior of the hash processor after setting the INIT bit in HASH_CR register.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.IN_RATE[5:0]END_RND[4:2]
rwrwrwrwrwrwrwrwrw
1514131211109876543210
END_RND[1:0]START_RND[4:0]PAD
CONFIG
PADBYTE[7:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:25 Reserved, must be kept at reset value.

Bits 24:19 IN_RATE[5:0]: Input rate

This bitfield defines the number of 32-bit words corresponding to the input block size. It is also known as input rate. IN_RATE[5:0] must be greater than 0 and lower or equal to 50, else the written value is ignored.

Defining the security target of a given sponge function involves defining:

where capacity size = 1600 - block_size, in bits.

The HASH processor uses the following default input rate values for the algorithm selected through ALGO[3:0] bits:

010010: rate = block_size = 18 * 32 = 576 bits, capacity = 1024 bits, default value for SHA3-512

011010: rate = block_size = 26 * 32=832 bits, capacity = 768 bits, default value for SHA3-384

100010: rate = block_size =34 * 32 = 1088 bits, capacity = 512 bits, default value for SHA3-256 or SHAKE256

100100: rate =block_size = 36 * 32=1152 bits, capacity = 448 bits, default for SHA3-224

101010: rate =block_size = 42 * 32=1344 bits, capacity = 256 bits, default for SHAKE128

More generally, IN_RATE (in bits) = (1600 - capacity) / 32.

IN_RATE[5:0] represents the maximum digest output that can be read after each computation, started by setting DCAL bit. Successive settings of DCAL bit are required until the expected digest length is reached (unbounded output used for SHAKE). The number of computations equals the expected output length divided by the block size (IN_RATE[5:0]).

Bits 18:14 END_RND[4:0]: Last round number

This bitfield defines the last round of basic block function permutation. The first round starts at START_RND[4:0].

If END_RND[4:0] is programmed to a value greater than 24 or lower than START_RND[4:0], the HASH processor keeps the previous value.

Bits 13:9 START_RND[4:0]: Starting round number

This bitfield defines the first round of basic block function permutation. The last round ends at END_RND[4:0].

If START_RND[4:0] is programmed to a value greater than END_RND[4:0], the HASH processor keeps the previous value.

Bit 8 PADCONFIG: Padding bit configuration

0: Padding bit is 0

1: Padding bit is 1

Bits 7:0 PADBYTE[7:0]: Padding byte value

This bitfield defines the padding byte value to apply.

61.6.8 HASH context swap registers

These registers contain the complete internal register states of the hash processor. They are useful when a suspend/resume operation has to be performed because a high-priority task needs to use the hash processor while it is already used by another task.

When such an event occurs, the HASH_CSRx registers have to be read and the read values have to be saved in the system memory space. Then the hash processor can be used by the preemptive task. When the hash computation is complete, the saved context can be read from memory and written back into the HASH_CSRx registers.

HASH_CSRx registers can be read only when DINIS equals to 1, otherwise zeros are returned.

HASH context swap register x (HASH_CSRx)

Address offset: 0x0F8+0x4*x, (x = 0 to 102)

Reset value: 0x0022 0002 (HASH_CSR0)

Reset value: 0x0020 0000 (HASH_CSR2)

Reset value: 0x0000 0000 (others)

61.6.8column_2Bits 13:9 Bit 8 Bits 7:0 returned.column_4END_RND[4:0]. PADCONFIG: 0: Padding bit is 0 1: Padding bit is 1 PADBYTE[7:0]:column_6column_7column_8column_9column_10column_11column_12column_13column_14column_15RM0457
313029282726252423 CSx[31:16]22212019181716
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
151413121110987 CSx[15:0]6543210
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
Bits 31:0CSx[31:0]:Context swap x
Refer toSection 61.6.8: HASH context swap registersintroduction.

Bits 31:0 CSx[31:0]: Context swap x

Refer to Section 61.6.8: HASH context swap registers introduction.

61.6.9 HASH hardware configuration register (HASH_HWCFGR)

Address offset: 0x3F0

Reset value: 0x0001 0113

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.CFG5[3:0]
rrrr
1514131211109876543210
CFG4[3:0]CFG3[3:0]CFG2[3:0]CFG1[3:0]
rrrrrrrrrrrrrrrr

Bits 31:20 Reserved, must be kept at reset value.

Bits 19:16 CFG5[3:0]: HW generic 5

This bitfield reflects that the SHA384 and SHA512 algorithms are supported.

Bits 15:12 CFG4[3:0]: HW generic 4

This bitfield is read as zero.

Bits 11:8 CFG3[3:0]: HW generic 3

This bitfield reflects that the SHA3 algorithm is supported.

Bits 7:4 CFG2[3:0]: HW generic 2

This bitfield reflects that the HMAC is supported.

Bits 3:0 CFG1[3:0]: HW generic 1

this bitfield reflects the DMA type connected to this HASH peripheral.

61.6.10 HASH version register (HASH_VERR)

Address offset: 0x3F4

Reset value: 0x0000 0041

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.MAJREV[3:0]MINREV[3:0]
rrrrrrrr

Bits 31:8 Reserved, must be kept at reset value.

Bits 7:4 MAJREV[3:0]: Major revision

These bits return the HASH major revision

Bits 3:0 MINREV[3:0]: Minor revision

These bits return the HASH minor revision

61.6.11 HASH identification register (HASH_IPIDR)

Address offset: 0x3F8

Reset value: 0x0017 0031

31302928272625242322212019181716
ID[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
ID[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 ID[31:0]: Identifier

These bits return the unique identifier of the HASH peripheral.

61.6.12 HASH size identification register (HASH_SIDR)

Address offset: 0x3FC

Reset value: 0xA3C5 DD01

31302928272625242322212019181716
SID[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
SID[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 SID[31:0]: Size identification code

This bitfield returns the size identification code of the HASH peripheral as defined below:

Bits[31:8] = 0xA3C5DD (fixed code)

Bits[7:0] = 0x01 (1-Kbyte address decoding)

61.6.13 HASH register map

Table 564. HASH1 register map and reset values

OffsetRegister name
Reset value
313029282726252423222120191817161514131211109876543210
0x000HASH_CRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.ALGO[3:2]ALGO[1:0]LKEYRes.Res.MDMATDINNENBW[3:0]Res.MODEDATATYPE[1:0]DMAEINITRes.Res.
Reset value00000000000000000
0x004HASH_DINDATAIN[31:0]
Reset value000000000000000000000000000000000

Table 564. HASH1 register map and reset values (continued)

OffsetRegister name
Reset value
313029282726252423222120191817161514131211109876543210
0x008HASH_STRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DCALRes.Res.Res.NBLW[4:0]
Reset value000000
0x00C +
0x4 * x, (x
= 0 to 4)
Last
address:
0x01C
HASH_HRAxHx[31:0]
Reset value0000000000000000000000000000000
0x020HASH_IMRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DCIEDINIE
Reset value000
0x024HASH_SRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.NBWE[5]NBWE[4:0]DINNENBWP[5]NBWP[4:0]Res.Res.Res.Res.Res.BUSYDMASDCISDINIS
Reset value0100010000000001
0x028HASH_SHA3CFGRRes.Res.Res.Res.Res.Res.Res.IN_RATE[5:0]END_RND[4:0]START_RND[4:0]PADCONFIGPADBYTE[7:0]
Reserved
0x0F8HASH_CSR0CSR0[31:0]
Reset value00000000001000100000000000000010
0x0FCHASH_CSR1CSR1[31:0]
Reset value00000000000000000000000000000000
0x100HASH_CSR2CSR2[31:0]
Reset value00000000001000000000000000000000
...
0x1CCHASH_CSR53CSR53[31:0]
Reset value00000000000000000000000000000000
...
0x290HASH_CSR102CSR102[31:0]
Reset value00000000000000000000000000000000
Reserved
0x310 +
0x4 * x, (x
= 0 to 4)
Last
address:
0x320
HASH_HRxHx[31:0]
Reset value00000000000000000000000000000000

Table 564. HASH1 register map and reset values (continued)

OffsetRegister name
Reset value
313029282726252423222120191817161514131211109876543210
0x310 +
0x4 * x, (x
= 5 to 49)
Last
address:
0x3D4
HASH_HRxHx[31:0]
Reset value00000000000000000000000000000000
0x3F0HASH_HWCFGRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.CFG5[3:0]CFG4[3:0]CFG3[3:0]CFG2[3:0]CFG1[3:0]
Reset value0x0001 0113
0x3F4HASH_VERRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.MAJREV[3:0]MINREV[3:0]
Reset value010000001
0x3F8HASH_IPIDRID[31:0]
Reset value00000000000101110000000000110001
0x3FCHASH_SIDRSID[31:0]
Reset value10100011110001011101110100000001
Refer to Section 2.4: Memory organization for the register boundary addresses.