SHA/MD5 Functional Description
www.ti.com
702
SWRU543–January 2019
Submit Documentation Feedback
Copyright © 2019, Texas Instruments Incorporated
SHA/MD5 Accelerator
4. Enable HMAC key processing by setting the HMAC_KEY_PROC bit in the SHAMD5_MODE register.
5. Select the SHA-1 hash function by programming the ALGO bit in the SHAMD5_MODE register to 0x1.
6. Select the already loaded key by programming the ALGO_CONSTANT bit in the SHAMD5_MODE
register to 0x0.
7. Set the CLOSE_HASH bit and the HMAC_OUTER_HASH bit in the SHAMD5_MODE register so that
appropriate padding is inserted and the outer hash is performed immediately after the inner hash has
finished.
8. Program the SHAMD5_LENGTH register with the block length. Writing this register triggers the HMAC
engine to begin processing.
NOTE: If more than one pass is used during the process (SHAMD5_MODE[4] CLOSE_HASH ==
0x0), the block length value must be a 64-byte multiple. From this point, three operational
modes are possible to continue with the processing: polling, interrupt, and DMA. For more
information, see Section 19.1.4.1.5.
19.1.4.1.3 Subsequence - Continuing a Prior HMAC Using the SHA-1 Hash Function
The procedure in Table 19-7 continues a prior HMAC calculation interrupted from a high priority task.
Table 19-7. Continuing a Prior HMAC
Step Register/Bit Field/Programming Model Value
Load the initial digest for the used hash algorithm. SHAMD5_IDIGEST_i[31:0] DATA –
Restore the digest counter with the value before the
switch to the high-priority task.
SHAMD5_DIGEST_COUNT[31:0] COUNT –
Use the already loaded in the engine key. SHAMD5_MODE[5] HMAC_KEY_PROC 0x0
Do not use the constants of the selected hash
algorithm.
SHAMD5_MODE[3] ALGO_CONSTANT 0x0
Select the SHA-1 hash algorithm. SHAMD5_MODE[2:1] ALGO 0x1
IF: This is the last 64-byte data block from the input
message?
User decision
Close the hash; an appropriate padding is added. SHAMD5_MODE[4] CLOSE_HASH 0x1
ENDIF
Load the block length; this is the trigger to start
processing.
SHAMD5_LENGTH[31:0] LENGTH –
NOTE: This initial digest is the intermediate digest from the previous calculation before switching to
the high priority task. The value is equal to context1 in . Ref to Figure 19-3?
The value is equal to context2 in . Ref to Figure 19-3?
The block length is equal to the context3 value in . Ref to Figure 19-3?
19.1.4.1.4 Subsequence - Hashing a Key Bigger than 512 Bits with the SHA-1 Hash Function
The procedure in Table 19-8 creates a hash value from the key in only one pass.
Table 19-8. SHA-1 Apply on the Key
Step Register/Bit Field/Programming Model Value
Load the first part of the key. (Here, the key is like a
message.)
SHAMD5_DATA_n_IN (i = 0 to 15) –
Select the SHA-1 hash function. SHAMD5_MODE[2:1] ALGO 0x1
Select a new hash operation. SHAMD5_MODE[3] ALGO_CONSTANT 0x1
Close the hash; the key is processed in single pass. SHAMD5_MODE[4] CLOSE_HASH 0x1