SPRUJB6B November 2024 – May 2025 AM2612
The (or ) to 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 (or ) register. Only the relevant digest registers for the selected algorithm must be written:
When ALGO_CONSTANT = 1 in the register, the SHA Inner Digest n (S_IDIGEST_n or S_HASH512_IDIGEST_n) registers do not need to be written by the application because they are overwritten with the appropriate algorithm constants.
When HMAC_KEY_PROC is 1, these registers must be written with the upper 256 bits (or 512 bits in SHA-512) of the HMAC key to be processed in little-endian format (first byte of key string in bits [7:0]).
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 order of the bytes within the digest is such that it can be fed back unmodified into the little-endian data input when preprocessing HMAC keys larger than 64 bytes, or it can typically be inserted unmodified into a little-endian data stream (for example, IPSEC packets), regardless of the selected algorithm.
The HMAC key or inner digest is not preserved. If another block must be authenticated using the same key, the key or inner digest must be reloaded by the host. If the same key must be used many times, 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.