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

SHA-512 (FIPS 180-4) - streaming context and one-shot API. More...

#include <stddef.h>
#include <stdint.h>
#include <mbedtls/sha512.h>

Go to the source code of this file.

Classes

struct  SshSha512Ctx
 Streaming SHA-512 context. More...
 

Macros

#define SSH_SHA512_DIGEST_LEN   64
 SHA-512 digest length in bytes.
 
#define SSH_SHA512_BLOCK_LEN   128
 SHA-512 block size in bytes.
 

Functions

void ssh_sha512_init (SshSha512Ctx *ctx)
 Initialize a streaming SHA-512 context (ctx must not be NULL).
 
void ssh_sha512_update (SshSha512Ctx *ctx, const uint8_t *data, size_t len)
 Feed len bytes of data into the running hash.
 
void ssh_sha512_final (SshSha512Ctx *ctx, uint8_t digest[SSH_SHA512_DIGEST_LEN])
 Finalize the hash and write the 64-byte digest. The context is undefined afterwards; call init() again before reuse.
 
void ssh_sha512 (const uint8_t *data, size_t len, uint8_t digest[SSH_SHA512_DIGEST_LEN])
 One-shot SHA-512: hash len bytes of data into digest (64 bytes).
 

Detailed Description

SHA-512 (FIPS 180-4) - streaming context and one-shot API.

Needed by Ed25519 (RFC 8032), whose signing and verification hash with SHA-512. On Arduino (ESP32) both the streaming context and the one-shot delegate to mbedtls (hardware-accelerated where available); on native builds the software FIPS-180-4 implementation is used. Mirrors the ssh_sha256 dual-path structure.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file ssh_sha512.h.

Macro Definition Documentation

◆ SSH_SHA512_DIGEST_LEN

#define SSH_SHA512_DIGEST_LEN   64

SHA-512 digest length in bytes.

Definition at line 24 of file ssh_sha512.h.

◆ SSH_SHA512_BLOCK_LEN

#define SSH_SHA512_BLOCK_LEN   128

SHA-512 block size in bytes.

Definition at line 27 of file ssh_sha512.h.

Function Documentation

◆ ssh_sha512_init()

void ssh_sha512_init ( SshSha512Ctx ctx)

Initialize a streaming SHA-512 context (ctx must not be NULL).

Definition at line 23 of file ssh_sha512.cpp.

References SshSha512Ctx::mbed.

Referenced by ssh_ed25519_sign(), ssh_ed25519_verify(), ssh_hmac_sha512_final(), and ssh_hmac_sha512_init().

◆ ssh_sha512_update()

void ssh_sha512_update ( SshSha512Ctx ctx,
const uint8_t *  data,
size_t  len 
)

Feed len bytes of data into the running hash.

Definition at line 33 of file ssh_sha512.cpp.

References SshSha512Ctx::mbed.

Referenced by ssh_ed25519_sign(), ssh_ed25519_verify(), ssh_hmac_sha512_final(), ssh_hmac_sha512_init(), and ssh_hmac_sha512_update().

◆ ssh_sha512_final()

void ssh_sha512_final ( SshSha512Ctx ctx,
uint8_t  digest[SSH_SHA512_DIGEST_LEN] 
)

Finalize the hash and write the 64-byte digest. The context is undefined afterwards; call init() again before reuse.

Parameters
digestOutput buffer, SSH_SHA512_DIGEST_LEN bytes.

Definition at line 42 of file ssh_sha512.cpp.

References SshSha512Ctx::mbed.

Referenced by ssh_ed25519_sign(), ssh_ed25519_verify(), and ssh_hmac_sha512_final().

◆ ssh_sha512()

void ssh_sha512 ( const uint8_t *  data,
size_t  len,
uint8_t  digest[SSH_SHA512_DIGEST_LEN] 
)

One-shot SHA-512: hash len bytes of data into digest (64 bytes).

Definition at line 52 of file ssh_sha512.cpp.

Referenced by ssh_ed25519_pubkey(), ssh_ed25519_sign(), ssh_rsa_sign(), and ssh_rsa_verify().