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

Ed25519 (RFC 8032) sign + verify over edwards25519. More...

Go to the source code of this file.

Functions

void ssh_ed25519_pubkey (uint8_t pub[32], const uint8_t seed[32])
 
void ssh_ed25519_sign (uint8_t sig[64], const uint8_t *msg, size_t mlen, const uint8_t seed[32])
 
bool ssh_ed25519_verify (const uint8_t pub[32], const uint8_t *msg, size_t mlen, const uint8_t sig[64])
 

Detailed Description

Ed25519 (RFC 8032) sign + verify over edwards25519.

Points are held in extended twisted-Edwards coordinates (X, Y, Z, T) as four field elements; scalar multiplication is a constant-time bit-by-bit double-and-add; scalars are reduced mod the group order L. SHA-512 hashes the seed, the nonce input, and R||A||M. Deterministic (no RNG). Validated against the RFC 8032 §7.1 vectors and a reference implementation (test_ssh_ed25519).

The field elements and point arithmetic have two implementations: the portable radix-2^16 ssh_gf (from ssh_curve25519, the native / non-S3 path), and on the ESP32-S3 a canonical uint32[8] layer that does each field multiply as one 256-bit modular multiply on the RSA/MPI accelerator (ssh_fe25519.h, active as DETWS_FE25519_MPI_HW) - the same engine that accelerates the X25519 KEX, here driving the Edwards point arithmetic so the host-key signature runs several times faster. Only the point/field layer differs; the SHA-512 hashing and the scalar arithmetic mod L are shared. Both paths are byte-identical by construction.

Definition in file ssh_ed25519.cpp.

Function Documentation

◆ ssh_ed25519_pubkey()

void ssh_ed25519_pubkey ( uint8_t  pub[32],
const uint8_t  seed[32] 
)

Definition at line 554 of file ssh_ed25519.cpp.

References ssh_sha512().

Referenced by ssh_hostkey_ed25519_set().

◆ ssh_ed25519_sign()

void ssh_ed25519_sign ( uint8_t  sig[64],
const uint8_t *  msg,
size_t  mlen,
const uint8_t  seed[32] 
)

◆ ssh_ed25519_verify()

bool ssh_ed25519_verify ( const uint8_t  pub[32],
const uint8_t *  msg,
size_t  mlen,
const uint8_t  sig[64] 
)

Definition at line 609 of file ssh_ed25519.cpp.

References ssh_sha512_final(), ssh_sha512_init(), and ssh_sha512_update().