51#ifndef PROTOCORE_SSH_DH_H
52#define PROTOCORE_SSH_DH_H
124void ssh_dh_derive_keys_sid(uint8_t i,
const uint8_t K_be[256],
const uint8_t *H,
const uint8_t *session_id,
125 uint8_t cipher_alg, uint8_t mac_alg,
bool k_is_string =
false,
130#define SSH_KDF_MAX (4 * PC_SHA256_DIGEST_LEN)
142void ssh_kdf_derive(
const uint8_t K_be[256],
const uint8_t *H,
const uint8_t *session_id,
char label, uint8_t *out,
2048-bit big-integer arithmetic for DH-group14 and RSA-2048.
User-facing configuration for ProtoCore.
SHA-256 (FIPS 180-4) - streaming context and one-shot API.
#define PC_SHA256_DIGEST_LEN
SHA-256 digest length in bytes.
void ssh_rng_fill(uint8_t *buf, size_t len)
Fill len bytes of buf with cryptographically random data.
void ssh_dh_derive_keys(uint8_t i, const uint8_t K_be[256], const uint8_t H[PC_SHA256_DIGEST_LEN])
Derive the six session keys from shared secret K and exchange hash H.
void ssh_dh_derive_keys_sid(uint8_t i, const uint8_t K_be[256], const uint8_t *H, const uint8_t *session_id, uint8_t cipher_alg, uint8_t mac_alg, bool k_is_string=false, size_t h_len=PC_SHA256_DIGEST_LEN, size_t sid_len=PC_SHA256_DIGEST_LEN, bool is512=false)
Derive session keys with an explicit session id (RFC 4253 §7.2).
void ssh_kdf_derive(const uint8_t K_be[256], const uint8_t *H, const uint8_t *session_id, char label, uint8_t *out, size_t out_len, bool k_is_string=false, size_t h_len=PC_SHA256_DIGEST_LEN, size_t sid_len=PC_SHA256_DIGEST_LEN, bool is512=false)
RFC 4253 §7.2 key derivation for any length up to SSH_KDF_MAX.
int ssh_dh_generate(uint8_t i)
Generate the server ephemeral DH key pair for connection slot i.
SSH session key material - types, pools, and security model.