|
ProtoCore v0.0.2
Deterministic, zero-heap network stack for embedded targets
|
HMAC-SHA2-512 (RFC 2104 + FIPS 198-1) - streaming context and one-shot API. More...
Go to the source code of this file.
Classes | |
| struct | pc_hmac_sha512_ctx |
| Streaming HMAC-SHA2-512 context (stores the opad key block + inner hash state). More... | |
Macros | |
| #define | PC_HMAC_SHA512_LEN 64 |
| HMAC-SHA2-512 output length in bytes. | |
Functions | |
| void | pc_hmac_sha512_init (pc_hmac_sha512_ctx *ctx, const uint8_t *key, size_t key_len) |
Begin an HMAC-SHA2-512 over key (keys > 128 bytes are pre-hashed per RFC 2104). | |
| void | pc_hmac_sha512_update (pc_hmac_sha512_ctx *ctx, const uint8_t *data, size_t len) |
Feed len message bytes. | |
| void | pc_hmac_sha512_final (pc_hmac_sha512_ctx *ctx, uint8_t mac[PC_HMAC_SHA512_LEN]) |
| Finish, writing the 64-byte MAC. | |
| void | pc_hmac_sha512 (const uint8_t *key, size_t key_len, const uint8_t *data, size_t len, uint8_t mac[PC_HMAC_SHA512_LEN]) |
| One-shot HMAC-SHA2-512 over a single buffer. | |
HMAC-SHA2-512 (RFC 2104 + FIPS 198-1) - streaming context and one-shot API.
The shared HMAC-SHA512 primitive. Backs the SSH hmac-sha2-512 / hmac-.nosp@m.sha2.nosp@m.-512-.nosp@m.etm@.nosp@m.opens.nosp@m.sh.c.nosp@m.om integrity algorithms. Built over the pc_sha512 streaming functions (SHA-512 block size 128 bytes). SSH-derived MAC keys are 64 bytes (<= the block size), so the key is zero-padded, not pre-hashed. Pure crypto; the protocol layer that uses it owns the verify-before-act ordering.
Definition in file hmac_sha512.h.
| #define PC_HMAC_SHA512_LEN 64 |
HMAC-SHA2-512 output length in bytes.
Definition at line 25 of file hmac_sha512.h.
| void pc_hmac_sha512_init | ( | pc_hmac_sha512_ctx * | ctx, |
| const uint8_t * | key, | ||
| size_t | key_len | ||
| ) |
Begin an HMAC-SHA2-512 over key (keys > 128 bytes are pre-hashed per RFC 2104).
Definition at line 40 of file hmac_sha512.cpp.
References pc_hmac_sha512_ctx::inner, pc_hmac_sha512_ctx::okey, PC_SHA512_BLOCK_LEN, pc_sha512_init(), and pc_sha512_update().
Referenced by pc_hmac_sha512().
| void pc_hmac_sha512_update | ( | pc_hmac_sha512_ctx * | ctx, |
| const uint8_t * | data, | ||
| size_t | len | ||
| ) |
Feed len message bytes.
Definition at line 49 of file hmac_sha512.cpp.
References pc_hmac_sha512_ctx::inner, and pc_sha512_update().
Referenced by pc_hmac_sha512().
| void pc_hmac_sha512_final | ( | pc_hmac_sha512_ctx * | ctx, |
| uint8_t | mac[PC_HMAC_SHA512_LEN] | ||
| ) |
Finish, writing the 64-byte MAC.
Definition at line 54 of file hmac_sha512.cpp.
References pc_hmac_sha512_ctx::inner, pc_hmac_sha512_ctx::okey, PC_SHA512_BLOCK_LEN, PC_SHA512_DIGEST_LEN, pc_sha512_final(), pc_sha512_init(), and pc_sha512_update().
Referenced by pc_hmac_sha512().
| void pc_hmac_sha512 | ( | const uint8_t * | key, |
| size_t | key_len, | ||
| const uint8_t * | data, | ||
| size_t | len, | ||
| uint8_t | mac[PC_HMAC_SHA512_LEN] | ||
| ) |
One-shot HMAC-SHA2-512 over a single buffer.
Definition at line 65 of file hmac_sha512.cpp.
References pc_hmac_sha512_final(), pc_hmac_sha512_init(), and pc_hmac_sha512_update().