ProtoCore v0.0.2
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
hmac_sha512.cpp File Reference

HMAC-SHA2-512 implementation (RFC 2104). See hmac_sha512.h. More...

Go to the source code of this file.

Namespaces

namespace  PC_CRYPTO_HOT
 

Functions

void PC_CRYPTO_HOT::build_key_block (const uint8_t *key, size_t key_len, uint8_t block[PC_SHA512_BLOCK_LEN], uint8_t pad_byte)
 
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.
 

Detailed Description

HMAC-SHA2-512 implementation (RFC 2104). See hmac_sha512.h.

HMAC(K, m) = H((K XOR opad) || H((K XOR ipad) || m)), H = SHA-512, block = 128 bytes, ipad = 0x36 repeated, opad = 0x5c repeated.

Definition in file hmac_sha512.cpp.

Function Documentation

◆ pc_hmac_sha512_init()

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().

◆ pc_hmac_sha512_update()

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().

◆ pc_hmac_sha512_final()

void pc_hmac_sha512_final ( pc_hmac_sha512_ctx ctx,
uint8_t  mac[PC_HMAC_SHA512_LEN] 
)

◆ 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().