Software APIs
Data Fields
sha512_state Struct Reference

A type that holds the context for an ongoing SHA-512 operation. More...

#include <sw/device/lib/crypto/impl/sha2/sha512.h>

Data Fields

uint32_t H [kSha512StateWords]
 Working state for a SHA-512 or SHA-384 computation.
 
uint32_t partial_block [kSha512MessageBlockWords]
 Partial block, if any. More...
 
sha512_message_length_t total_len
 Total message length so far, in bits.
 

Detailed Description

A type that holds the context for an ongoing SHA-512 operation.

IMPORTANT: Every member of this struct should be a word-aligned type and have a size divisible by sizeof(uint32_t); otherwise sha512_state_t will not be suitable for hardened_memcpy().

Definition at line 93 of file sha512.h.

Field Documentation

◆ H

uint32_t sha512_state::H[kSha512StateWords]

Working state for a SHA-512 or SHA-384 computation.

Definition at line 97 of file sha512.h.

◆ partial_block

uint32_t sha512_state::partial_block[kSha512MessageBlockWords]

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 % kSha512MessageBlockBytes) bytes.

Definition at line 106 of file sha512.h.

◆ total_len

sha512_message_length_t sha512_state::total_len

Total message length so far, in bits.

Definition at line 110 of file sha512.h.