SHA operates on a block size of data and to use
the mode the peripheral has individually addressable registers to access the input
or output data. Additionally the control register must be written every time to
indicate a new block of data is available for processing. However when processing a
very large data block the CPU has to be involved to set the appropriate control
bits.
To reduce the complexity of implementation, the SHA peripheral features an auto-feed
mode using a fixed data register SHAW_DATA_FIXED (offset 0x1100). The use of the
mode is described below:
- The CPU sets all the control information which includes mode, length.
- The DMA channel is programmed with the source address as the location of
data to be hashed and destination as the SHAW_DATA_FIXED.
- The DMA is started by priming the SHAW_DMA_START_TRIGGER register which
generates a DMA request and the DMA transfer one block size of data from the
source to the SHA peripheral.
- The auto-feed mechanism automatically generates the control signal for the
HASH/HMAC engine.
- Once the data is digested, the next DMA trigger is generated until the
length programmed is less than one block size
- On the last block of the data the auto-feed mechanism generates the last
message block trigger internally and then interrupts the CPU for the hash
data to be read.
Note: When using the auto-feed mode for the SHA peripheral,
the operation must not be interrupted. If the operation is interrupted by a
write or read, the SHA peripheral aborts the hash computation and no
intermediate data provided.
Note: When using the DMA is used as the input to the SHA
accelerator, the max transfer size supported is 256KB. If the user needs to
input more data please use the CPU to feed the input data in.