Standard setup for the SHA module is
performed in four parts:
- Setup of SHA state
monitoring
-
The CPU can be
notified of SHA state changes via two methods (Triggered
Interrupts and Register Polling). If SHA Interrupts are used to
monitor state changes, these interrupts need to be configured
and enabled prior to using the SHA module.
- Setup SHA data length
- The SHA data length
needs to be configured before using the SHA module
- The data length must
be specified in bytes with the SHA mode includes
- The SHA module can
then be notified that the mode and data length are available
- Setup up of MAC key (Only for
HMAC mode)
- If using the SHA HMAC
mode, the module must be given a MAC key to use for encryption
before using the SHA module
- The MAC key must be
written to the SHA module in words, including the total key
size
- The SHA module must
then be notified that the key is available
- The SHA module must
be notified that it can begin processing the key
- Finally, the CPU must
wait until the SHA module is done processing
- Setup of Direct Memory Access
(DMA)
-
The SHA module
operates on blocks of data and must be manually fed data for the
module to digest. To perform this, the data could be fed via the
CPU or via a DMA transfer. If using a DMA transfer, the DMA
channel must be setup prior to using the SHA module.
- The DMA source
address must point to the start of the message to be hashed
- The DMA destination
address must point to the SHAW_DATA_FIXED register
- The DMA message
length must be set to the message length in words
- The DMA source and
destination width must be the size of a word
- The DMA source must
be configured in single increment mode and the destination must not
change
- The DMA trigger must
be set to the SHAW_TRIGGER
- Finally, the DMA
channel can be enabled