SPRUJB6B November 2024 – May 2025 AM2612
To start a new hash, follow these steps:
When the configuration is complete, the INPUT_READY status bit equals 1 in the SHA Interrupt Status () register (regardless of whether or not the M_INPUT_READY bit in the register is set). When this bit is set, it indicates the SHA engine can receive the data to process. Data must be written to the 16 × 32-bit S_DATAn_IN registers that provide storage for one 64-byte block of data. Unless the CLOSE_HASH bit is set, all of the S_DATAn_IN input buffers must be filled. Data can be written by single write accesses to the 16 registers from a processor or by a DMA transfer.
For DMA transfers, the SDMA_EN bit must be set in the register, and the appropriate mask bits must be set in the S_SHA_IMST register before starting the new hash. If the DMA is used for transfers, the S_IRQENABLE register should be clear so all interrupts are generated through the DMA interrupt registers.
The DMA must be configured to transfer 16 data words of 32 bits each time it is triggered by a DMA request from the SHA/MD5 module. The 16 data words written are sent to the 16 S_DATAn_IN registers.
The module detects that a 64-byte block is available, then moves the data to a working register space for processing and asserts the INPUT_READY bit in the S_IRQSTATUS register to 1. If the SDMA_EN bit in the S_SYSCONFIG register has been set to 1, a new DMA request triggers a new block transfer; otherwise, the processor polls the INPUT_READY bit and writes the 16 data words of 32 bits when it equals 1.
This operation is repeated until the length of the message to hash is reached. The OUPUT_READY bit in the S_IRQSTATUS register then indicates that the hash operation is complete. If the SIT_EN bit in the S_SYSCONFIG register is set, an interrupt (active low) is also generated to indicate the hash completion.
The processor can then read the sixteen digest registers A to P that contain the hash or HMAC result. If the hash is an intermediate result of a larger hash, the digest count register must also be read and saved.
The number of digest registers used depends on the algorithm selected for the SHA/MD5 module (MD5, SHA-1, SHA-224, SHA-256, SHA-384 or SHA-512).