|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
SHA-384 (FIPS 180-4) - streaming and one-shot digest. More...
#include "protocore_config.h"Go to the source code of this file.
Classes | |
| struct | Sha384Ns |
| Dispatch table. Addressed by offset, so the layout is asserted below. More... | |
Macros | |
| #define | PROTOCORE_SHA384_DIGEST_LEN 48 |
| SHA-384 digest length in bytes. | |
| #define | PROTOCORE_SHA384_BLOCK_LEN 128 |
| SHA-384 block size in bytes. | |
Functions | |
| PROTOCORE_NS_LAYOUT (Sha384Ns, init, update, final, hash) | |
| proto_bool | protocore_sha384_init (uint8_t *work) |
| Start a digest. | |
| proto_bool | protocore_sha384_update (uint8_t *work, const uint8_t *data, size_t len) |
| Feed the running digest a chunk. | |
| proto_bool | protocore_sha384_final (uint8_t *work, uint8_t *out) |
| Pad, compress the last block, write the 48 bytes out. | |
| proto_bool | protocore_sha384_hash (uint8_t *work, const uint8_t *data, size_t len, uint8_t *out) |
| Init, update and final in one call, for a message already whole. | |
Variables | |
| PROTOCORE_NS Sha384Ns Sha384 | PROTOCORE_UNUSED |
| Module namespace. | |
SHA-384 (FIPS 180-4) - streaming and one-shot digest.
The SHA-384 primitive: the TLS 1.3 SHA-384 cipher suites hash their transcript and run their key schedule on it. The entries below are one surface over both arms: a part with a hashing peripheral compresses on it, a part without runs the FIPS 180-4 rounds. Mirrors the sha512 structure at the SHA-384 seed and digest length.
Sha384Ns::final leaves the running digest where it was: the padded blocks compress into a copy of the state, so the hash keeps taking data afterwards. That is what lets a TLS transcript be read at every stage the handshake asks for without snapshotting anything.
work is PROTOCORE_SHA384_BORROW secure bytes the CALLER took, at an address it knows. It is not held past the call, so nothing here aliases it. The caller releases it, and the pool wipes on release; this module neither takes it, holds it, releases it, nor wipes it. The borrow IS the digest, so two running hashes are two borrows and never collide.
Definition in file sha384.h.
| #define PROTOCORE_SHA384_DIGEST_LEN 48 |
| #define PROTOCORE_SHA384_BLOCK_LEN 128 |
| PROTOCORE_NS_LAYOUT | ( | Sha384Ns | , |
| init | , | ||
| update | , | ||
| final | , | ||
| hash | |||
| ) |
| proto_bool protocore_sha384_init | ( | uint8_t * | work | ) |
Start a digest.
| work | PROTOCORE_SHA384_BORROW bytes the caller took. Not held past the call. |
| proto_bool protocore_sha384_update | ( | uint8_t * | work, |
| const uint8_t * | data, | ||
| size_t | len | ||
| ) |
Feed the running digest a chunk.
| work | PROTOCORE_SHA384_BORROW bytes the caller took. Not held past the call. |
| data | the bytes |
| len | how many |
| proto_bool protocore_sha384_final | ( | uint8_t * | work, |
| uint8_t * | out | ||
| ) |
Pad, compress the last block, write the 48 bytes out.
| work | PROTOCORE_SHA384_BORROW bytes the caller took. Not held past the call. |
| out | PROTOCORE_SHA384_DIGEST_LEN bytes |
| proto_bool protocore_sha384_hash | ( | uint8_t * | work, |
| const uint8_t * | data, | ||
| size_t | len, | ||
| uint8_t * | out | ||
| ) |
Init, update and final in one call, for a message already whole.
| work | PROTOCORE_SHA384_BORROW bytes the caller took. Not held past the call. |
| data | the message |
| len | its length |
| out | PROTOCORE_SHA384_DIGEST_LEN bytes |
| PROTOCORE_NS Sha384Ns Sha384 PROTOCORE_UNUSED |
Module namespace.