aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2019-03-17 15:45:24 -0400
committerAndreas Schneider <asn@cryptomilk.org>2019-04-04 08:00:23 +0200
commit7551857d0862a3c170fd84459b3bb1ef0e06b31e (patch)
treed6bfcc9ce70d9c724c895793a14aaa32e9fc7265 /include
parent30d97979a29953f7094522fd0b6fd031dae0070e (diff)
downloadlibssh-7551857d0862a3c170fd84459b3bb1ef0e06b31e.tar.gz
libssh-7551857d0862a3c170fd84459b3bb1ef0e06b31e.tar.xz
libssh-7551857d0862a3c170fd84459b3bb1ef0e06b31e.zip
dh: Move DH key handling into a separate file.
In preparation for adding crypto-libraries specific backends. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'include')
-rw-r--r--include/libssh/dh.h38
1 files changed, 21 insertions, 17 deletions
diff --git a/include/libssh/dh.h b/include/libssh/dh.h
index fbfce85d..0d6720ee 100644
--- a/include/libssh/dh.h
+++ b/include/libssh/dh.h
@@ -30,14 +30,30 @@ struct dh_ctx;
#define DH_CLIENT_KEYPAIR 0
#define DH_SERVER_KEYPAIR 1
-int ssh_dh_init(void);
-void ssh_dh_finalize(void);
+/* functions implemented by crypto backends */
+int ssh_dh_init_common(struct ssh_crypto_struct *crypto);
+void ssh_dh_cleanup(struct ssh_crypto_struct *crypto);
-int ssh_dh_import_next_pubkey_blob(ssh_session session, ssh_string pubkey_blob);
+int ssh_dh_get_parameters(struct dh_ctx *ctx,
+ const_bignum *modulus, const_bignum *generator);
+int ssh_dh_set_parameters(struct dh_ctx *ctx,
+ const bignum modulus, const bignum generator);
+
+int ssh_dh_keypair_gen_keys(struct dh_ctx *ctx, int peer);
+int ssh_dh_keypair_get_keys(struct dh_ctx *ctx, int peer,
+ const_bignum *priv, const_bignum *pub);
+int ssh_dh_keypair_set_keys(struct dh_ctx *ctx, int peer,
+ const bignum priv, const bignum pub);
int ssh_dh_compute_shared_secret(struct dh_ctx *ctx, int local, int remote,
bignum *dest);
-int ssh_client_dh_init(ssh_session session);
+
+/* common functions */
+int ssh_dh_init(void);
+void ssh_dh_finalize(void);
+
+int ssh_dh_import_next_pubkey_blob(ssh_session session,
+ ssh_string pubkey_blob);
ssh_key ssh_dh_get_current_server_publickey(ssh_session session);
int ssh_dh_get_current_server_publickey_blob(ssh_session session,
@@ -46,22 +62,10 @@ ssh_key ssh_dh_get_next_server_publickey(ssh_session session);
int ssh_dh_get_next_server_publickey_blob(ssh_session session,
ssh_string *pubkey_blob);
+int ssh_client_dh_init(ssh_session session);
#ifdef WITH_SERVER
void ssh_server_dh_init(ssh_session session);
#endif /* WITH_SERVER */
-
-int ssh_dh_init_common(struct ssh_crypto_struct *crypto);
-void ssh_dh_cleanup(struct ssh_crypto_struct *crypto);
int ssh_server_dh_process_init(ssh_session session, ssh_buffer packet);
-int ssh_dh_get_parameters(struct dh_ctx *ctx,
- const_bignum *modulus, const_bignum *generator);
-int ssh_dh_set_parameters(struct dh_ctx *ctx,
- bignum modulus, bignum generator);
-int ssh_dh_keypair_gen_keys(struct dh_ctx *ctx, int peer);
-int ssh_dh_keypair_get_keys(struct dh_ctx *ctx, int peer,
- const_bignum *priv, const_bignum *pub);
-int ssh_dh_keypair_set_keys(struct dh_ctx *ctx, int peer,
- bignum priv, bignum pub);
-
#endif /* DH_H_ */