26#include "libssh/crypto.h"
30#define DH_CLIENT_KEYPAIR 0
31#define DH_SERVER_KEYPAIR 1
38int ssh_dh_init_common(
struct ssh_crypto_struct *crypto);
39void ssh_dh_cleanup(
struct ssh_crypto_struct *crypto);
41#if !defined(HAVE_LIBCRYPTO) || OPENSSL_VERSION_NUMBER < 0x30000000L
42int ssh_dh_get_parameters(
struct dh_ctx *ctx,
43 const_bignum *modulus, const_bignum *generator);
45int ssh_dh_get_parameters(
struct dh_ctx *ctx,
46 bignum *modulus, bignum *generator);
48int ssh_dh_set_parameters(
struct dh_ctx *ctx,
49 const bignum modulus,
const bignum generator);
51int ssh_dh_keypair_gen_keys(
struct dh_ctx *ctx,
int peer);
52#if !defined(HAVE_LIBCRYPTO) || OPENSSL_VERSION_NUMBER < 0x30000000L
53int ssh_dh_keypair_get_keys(
struct dh_ctx *ctx,
int peer,
54 const_bignum *priv, const_bignum *pub);
56int ssh_dh_keypair_get_keys(
struct dh_ctx *ctx,
int peer,
57 bignum *priv, bignum *pub);
59int ssh_dh_keypair_set_keys(
struct dh_ctx *ctx,
int peer,
60 bignum priv, bignum pub);
62int ssh_dh_compute_shared_secret(
struct dh_ctx *ctx,
int local,
int remote,
65void ssh_dh_debug_crypto(
struct ssh_crypto_struct *c);
69void ssh_dh_finalize(
void);
71int ssh_dh_import_next_pubkey_blob(ssh_session session,
72 ssh_string pubkey_blob);
74ssh_key ssh_dh_get_current_server_publickey(ssh_session session);
75int ssh_dh_get_current_server_publickey_blob(ssh_session session,
76 ssh_string *pubkey_blob);
77ssh_key ssh_dh_get_next_server_publickey(ssh_session session);
78int ssh_dh_get_next_server_publickey_blob(ssh_session session,
79 ssh_string *pubkey_blob);
80int dh_handshake(ssh_session session);
82int ssh_client_dh_init(ssh_session session);
83void ssh_client_dh_remove_callbacks(ssh_session session);
85void ssh_server_dh_init(ssh_session session);
87int ssh_server_dh_process_init(ssh_session session, ssh_buffer packet);
88int ssh_fallback_group(uint32_t pmax, bignum *p, bignum *g);
89bool ssh_dh_is_known_group(bignum modulus, bignum generator);