ProtoCore v0.0.1
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
ssh_kexhash.h File Reference

One key-exchange digest that dispatches SHA-256 or SHA-512 by the negotiated method. More...

#include "crypto/hash/sha256.h"
#include "crypto/hash/sha512.h"
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Classes

struct  SshKexHash
 A key-exchange digest bound to one of the SSH KEX hashes (SHA-256 or SHA-512). More...
 

Macros

#define SSH_KEXHASH_MAX_LEN   64
 longest exchange-hash / session_id (SHA-512)
 

Detailed Description

One key-exchange digest that dispatches SHA-256 or SHA-512 by the negotiated method.

RFC 4253 §8 ties the exchange hash H (and the §7.2 key derivation) to the KEX method's hash: the -sha256 methods (curve25519-sha256, ecdh-sha2-nistp256, dh-group14-sha256, mlkem768x25519-sha256) use SHA-256; -sha512 methods (sntru.nosp@m.p761.nosp@m.x2551.nosp@m.9-sh.nosp@m.a512@.nosp@m.open.nosp@m.ssh.c.nosp@m.om) use SHA-512. Rather than fork every hash site, the exchange hash and the KDF run over this small wrapper, so adding a KEX with a different hash is a one-line change (SshKexHash + ssh_kex_hash_is512()), not a new code path.

The digest length is 32 (SHA-256) or 64 (SHA-512); H and the session_id are sized to the max (64).

Definition in file ssh_kexhash.h.

Macro Definition Documentation

◆ SSH_KEXHASH_MAX_LEN

#define SSH_KEXHASH_MAX_LEN   64

longest exchange-hash / session_id (SHA-512)

Definition at line 25 of file ssh_kexhash.h.