DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
ssh_hmac_sha512.h File Reference

HMAC-SHA2-512 (RFC 2104 + FIPS 198-1). More...

#include "network_drivers/presentation/ssh/crypto/ssh_sha512.h"
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Classes

struct  SshHmacSha512Ctx
 Streaming HMAC-SHA2-512 context (stores the opad key block + inner hash state). More...
 

Macros

#define SSH_HMAC_SHA512_LEN   64
 HMAC-SHA2-512 output length in bytes.
 

Functions

void ssh_hmac_sha512_init (SshHmacSha512Ctx *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 ssh_hmac_sha512_update (SshHmacSha512Ctx *ctx, const uint8_t *data, size_t len)
 Feed len message bytes.
 
void ssh_hmac_sha512_final (SshHmacSha512Ctx *ctx, uint8_t mac[SSH_HMAC_SHA512_LEN])
 Finish, writing the 64-byte MAC.
 
void ssh_hmac_sha512 (const uint8_t *key, size_t key_len, const uint8_t *data, size_t len, uint8_t mac[SSH_HMAC_SHA512_LEN])
 One-shot HMAC-SHA2-512 over a single buffer.
 

Detailed Description

HMAC-SHA2-512 (RFC 2104 + FIPS 198-1).

The MAC for the hmac-sha2-512 and hmac-.nosp@m.sha2.nosp@m.-512-.nosp@m.etm@.nosp@m.opens.nosp@m.sh.c.nosp@m.om SSH integrity algorithms. Implemented over the ssh_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.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file ssh_hmac_sha512.h.

Macro Definition Documentation

◆ SSH_HMAC_SHA512_LEN

#define SSH_HMAC_SHA512_LEN   64

HMAC-SHA2-512 output length in bytes.

Definition at line 24 of file ssh_hmac_sha512.h.

Function Documentation

◆ ssh_hmac_sha512_init()

void ssh_hmac_sha512_init ( SshHmacSha512Ctx 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 34 of file ssh_hmac_sha512.cpp.

References SshHmacSha512Ctx::inner, SshHmacSha512Ctx::okey, SSH_SHA512_BLOCK_LEN, ssh_sha512_init(), and ssh_sha512_update().

Referenced by ssh_hmac_sha512().

◆ ssh_hmac_sha512_update()

void ssh_hmac_sha512_update ( SshHmacSha512Ctx ctx,
const uint8_t *  data,
size_t  len 
)

Feed len message bytes.

Definition at line 43 of file ssh_hmac_sha512.cpp.

References SshHmacSha512Ctx::inner, and ssh_sha512_update().

Referenced by ssh_hmac_sha512().

◆ ssh_hmac_sha512_final()

void ssh_hmac_sha512_final ( SshHmacSha512Ctx ctx,
uint8_t  mac[SSH_HMAC_SHA512_LEN] 
)

◆ ssh_hmac_sha512()

void ssh_hmac_sha512 ( const uint8_t *  key,
size_t  key_len,
const uint8_t *  data,
size_t  len,
uint8_t  mac[SSH_HMAC_SHA512_LEN] 
)

One-shot HMAC-SHA2-512 over a single buffer.

Definition at line 59 of file ssh_hmac_sha512.cpp.

References ssh_hmac_sha512_final(), ssh_hmac_sha512_init(), and ssh_hmac_sha512_update().