aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2011-09-16 23:36:20 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2011-09-18 20:34:15 +0200
commit07abc3406df3b6b37471e10e495efb79003f5679 (patch)
tree73b635f912977b6d3cf5c8e3830d527eb3aef1ed /include
parent1b10b175fcd5c6f205168434cc5f6aca51b1d298 (diff)
downloadlibssh-07abc3406df3b6b37471e10e495efb79003f5679.tar.gz
libssh-07abc3406df3b6b37471e10e495efb79003f5679.tar.xz
libssh-07abc3406df3b6b37471e10e495efb79003f5679.zip
kex: split key selection and sending
Diffstat (limited to 'include')
-rw-r--r--include/libssh/ecdh.h3
-rw-r--r--include/libssh/kex.h7
-rw-r--r--include/libssh/priv.h11
-rw-r--r--include/libssh/session.h4
4 files changed, 18 insertions, 7 deletions
diff --git a/include/libssh/ecdh.h b/include/libssh/ecdh.h
index 5cc208c..e86bbe8 100644
--- a/include/libssh/ecdh.h
+++ b/include/libssh/ecdh.h
@@ -35,5 +35,8 @@
int ssh_client_ecdh_init(ssh_session session);
int ssh_client_ecdh_reply(ssh_session session, ssh_buffer packet);
+#ifdef WITH_SERVER
+int ssh_server_ecdh_init(ssh_session session, ssh_buffer packet);
+#endif /* WITH_SERVER */
#endif /* ECDH_H_ */
diff --git a/include/libssh/kex.h b/include/libssh/kex.h
index ce2a102..dbf69ab 100644
--- a/include/libssh/kex.h
+++ b/include/libssh/kex.h
@@ -25,6 +25,13 @@
#include "libssh/priv.h"
#include "libssh/callbacks.h"
+#define SSH_KEX_METHODS 10
+
+typedef struct ssh_kex_struct {
+ unsigned char cookie[16];
+ char *methods[SSH_KEX_METHODS];
+} KEX;
+
SSH_PACKET_CALLBACK(ssh_packet_kexinit);
#ifdef WITH_SSH1
SSH_PACKET_CALLBACK(ssh_packet_publickey1);
diff --git a/include/libssh/priv.h b/include/libssh/priv.h
index aa22d10..80175ec 100644
--- a/include/libssh/priv.h
+++ b/include/libssh/priv.h
@@ -121,11 +121,6 @@ extern "C" {
#include <sys/time.h>
#endif
-typedef struct kex_struct {
- unsigned char cookie[16];
- char **methods;
-} KEX;
-
struct error_struct {
/* error handling */
int error_code;
@@ -137,6 +132,7 @@ struct error_struct {
struct ssh_message_struct;
struct ssh_common_struct;
+struct ssh_kex_struct;
/* server data */
@@ -197,8 +193,9 @@ void ssh_sock_set_blocking(socket_t sock);
/* in kex.c */
extern const char *ssh_kex_nums[];
int ssh_send_kex(ssh_session session, int server_kex);
-void ssh_list_kex(ssh_session session, KEX *kex);
-int set_kex(ssh_session session);
+void ssh_list_kex(ssh_session session, struct ssh_kex_struct *kex);
+int set_client_kex(ssh_session session);
+int ssh_kex_select_methods(ssh_session session);
int verify_existing_algo(int algo, const char *name);
char **space_tokenize(const char *chain);
int ssh_get_kex1(ssh_session session);
diff --git a/include/libssh/session.h b/include/libssh/session.h
index a1b2a79..ac2ca76 100644
--- a/include/libssh/session.h
+++ b/include/libssh/session.h
@@ -27,6 +27,7 @@
#include "libssh/auth.h"
#include "libssh/channels.h"
#include "libssh/poll.h"
+#include "libssh/kex.h"
/* These are the different states a SSH session can be into its life */
enum ssh_session_state_e {
@@ -122,8 +123,11 @@ struct ssh_session_struct {
struct ssh_agent_state_struct *agent_state;
struct ssh_auth_auto_state_struct *auth_auto_state;
+ /* kex sent by server, client, and mutually elected methods */
KEX server_kex;
KEX client_kex;
+ char *kex_methods[SSH_KEX_METHODS];
+
ssh_buffer in_hashbuf;
ssh_buffer out_hashbuf;
struct ssh_crypto_struct *current_crypto;