SHA/MD5 Functional Description
1591
SLAU723A – October 2017 – Revised October 2018
Copyright © 2017–2018, Texas Instruments Incorporated
SHA/MD5 Accelerator
Table 25-4. Inner Digest Registers (continued)
Register
Address
MD5
(Read/Write)
SHA-1
(Read/Write)
SHA-2
(Read/Write)
SHA-256
(Read/Write)
HMAC Key
Processing
(write)
SHA_IDIGEST_H
0x03C
Inner
digest[31:0]
HMAC key
[511:480]
NOTE:
Inner digests are initial, intermediate, and result digests.
25.1.5.1.1.1 Outer Digest Registers
The SHA_ODIGEST_A to SHA_ODIGEST_H registers are relevant only for HMAC operations; the
contents are ignored for hash operations.
Before writing to the digest registers, the operation must be configured in the SHA Mode (SHA_MODE)
register. For HMAC operations without key processing, the HMAC_KEY_PROC bit must be clear in the
SHA_MODE register before starting operations. Once the algorithm has been programmed in the
SHA_MODE register, only the relevant digest registers for the selected algorithm must be written:
•
SHA_ODIGEST_A to SHA_ODIGEST_D registers for MD5
•
SHA_ODIGEST_A to SHA_ODIGEST_E registers for SHA-1
•
SHA_ODIGEST_A to SHA_ODIGEST_H registers for SHA-2 (224 to 256)
When HMAC key processing is enabled (HMAC_KEY_PROC =1), these registers must be written with the
lower 256 bits of the HMAC key to be processed in little-endian format (first byte of key string in bits [7:0]).
NOTE:
If the HMAC key is less than 512 bits, it must be properly padded with zeros: all 16 HMAC
key registers must be written explicitly; the core does not pad. Additionally, if the HMAC key
is larger than 512 bits, the host must perform a preprocessing step to reduce it to one 512-bit
block. This involves hashing the large key and padding the hash result with zeros until it is
512 bits wide.
The computed outer digest can be read from these registers when the SHA Interrupt Status
(SHA_IRQSTATUS) register when the OUTPUT_READY bit has been set indicating that the operation is
done.
NOTE:
If no HMAC key processing is performed, the value read is identical to the value written
initially. The MD5 outer digest is available from registers SHA_ODIGEST_A to
SHA_ODIGEST_D, the SHA-1 outer digest from registers SHA_ODIGEST_A to
SHA_ODIGEST_E, and the SHA-224 and SHA-256 outer digest from registers
SHA_ODIGEST_A to SHA_ODIGEST_H.
NOTE:
The HMAC key is not preserved. If another block must be authenticated using the same key,
the key must be reloaded by the host. If the same key must be used many times, it is
advisable to do a HMAC key processing-only pass to obtain the inner and outer digest
precomputes and load these precomputes for subsequent passes (only the inner digest must
be reloaded if the outer digest is not modified by the host), because this saves two hash
blocks worth of computation time.
25.1.5.1.1.2 Inner Digest Registers
The SHA_IDIGEST_A to SHA_IDIGEST_H registers are used for HMAC and hash operations.
The inner/initial digest for HMAC and hash continue operations (HMAC_KEY_PROC = 0 and
ALGO_CONSTANT = 0) must be written to these registers before starting the operation by writing to the
SHA_MODE register. Only the relevant digest registers for the selected algorithm must be written: