5.1.8.3 SHA - Context Switching
Context switching allows for the generation of a digest to be interrupted to do other
functions or to generate other digests. Context switching can be used only in the SHA256
Digest mode, so it can only occur after a SHA Start has been issued and prior to a SHA
Finalize
command. Context switching may happen multiple times
during the course of a digest generation.
- Read_Context - Reads a variable length context from the ATECC608A-TNGLoRaWAN while leaving the context valid within the chip. The total length of the output data parameter is always from 40 to 99 bytes and can either be determined from the length field in the output packet or computed as 40 plus the Least Significant six bits of the first byte in the output.
- Write_Context - Writes a SHA256 context from the host to the ATECC608A-TNGLoRaWAN to allow subsequent update operations to be completed. This context must have previously been read from the chip with the Read_Context mode. The ATECC608A-TNGLoRaWAN determines the size of the context from the first 4 bytes of the data parameter.
After the context has been read, the device may perform any other operations as required. Upon completion of the other operations, the context may be written back to the ATECC608A-TNGLoRaWAN and the SHA256 Digest generation process may continue until it has completed.
Opcode |
Mode |
Param2 |
Data | Description |
---|---|---|---|---|
0x47 | 0x06 | 0x00 00 | 0 bytes | Read the current context |
0x07 | 0x00 [ByteCount] | 40 to 99 bytes | Restore the current context from the prior session |
Name | Mode | Size | Description |
---|---|---|---|
Response | 0x06 |
1 byte |
If error code |
0x07 | 1 byte | 0x00 if successful, otherwise an error code is received |