A type that holds the context for an ongoing SHA-256 operation. More...
#include <sw/device/lib/crypto/impl/sha2/sha256.h>
Data Fields | |
uint32_t | H [kSha256StateWords] |
Working state for a SHA-256 or SHA-384 computation. | |
uint32_t | partial_block [kSha256MessageBlockWords] |
Partial block, if any. More... | |
uint64_t | total_len |
Total message length so far, in bits. | |
A type that holds the context for an ongoing SHA-256 operation.
IMPORTANT: Every member of this struct should be a word-aligned type and have a size divisible by sizeof(uint32_t)
; otherwise sha256_state_t
will not be suitable for hardened_memcpy()
.
uint32_t sha256_state::H[kSha256StateWords] |
uint32_t sha256_state::partial_block[kSha256MessageBlockWords] |
Partial block, if any.
If we get an update() with a message that isn't an even number of blocks, there's no way to know if we should pad it or not until we get the next update() or final(). The length of actual data in this block is always (total_len % kSha256MessageBlockBytes) bytes.