aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libssh/libssh.h13
-rw-r--r--include/libssh/priv.h25
-rw-r--r--include/libssh/server.h18
-rw-r--r--include/libssh/ssh2.h2
4 files changed, 48 insertions, 10 deletions
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h
index 0fc40178..1986c8a8 100644
--- a/include/libssh/libssh.h
+++ b/include/libssh/libssh.h
@@ -103,10 +103,12 @@ void ssh_set_verbosity(int num);
/* 0 : important messages only */
/* -1 : no messages */
-/* in client.c */
-
+/* session.c */
SSH_SESSION *ssh_new();
void ssh_set_options(SSH_SESSION *session, SSH_OPTIONS *options);
+int ssh_get_fd(SSH_SESSION *session);
+
+/* client.c */
int ssh_connect();
void ssh_disconnect(SSH_SESSION *session);
int ssh_service_request(SSH_SESSION *session,char *service);
@@ -134,15 +136,12 @@ void ssh_crypto_init();
/* useful for debug */
void ssh_print_hexa(char *descr,unsigned char *what, int len);
-void ssh_get_random(void *,int);
+int ssh_get_random(void *where,int len,int strong);
/* this one can be called by the client to see the hash of the public key before accepting it */
int ssh_get_pubkey_hash(SSH_SESSION *session,char hash[MD5_DIGEST_LEN]);
STRING *ssh_get_pubkey(SSH_SESSION *session);
-/* deprecated */
-int pubkey_get_hash(SSH_SESSION *session,char hash[MD5_DIGEST_LEN]);
-
/* in connect.c */
int ssh_fd_poll(SSH_SESSION *session);
int ssh_select(CHANNEL **channels,CHANNEL **outchannels, int maxfd, fd_set *readfds, struct timeval *timeout);
@@ -152,6 +151,8 @@ void publickey_free(PUBLIC_KEY *key);
/* in keyfiles.c */
PRIVATE_KEY *privatekey_from_file(SSH_SESSION *session,char *filename,int type,char *passphrase);
+STRING *publickey_to_string(PUBLIC_KEY *key);
+PUBLIC_KEY *publickey_from_privatekey(PRIVATE_KEY *prv);
void private_key_free(PRIVATE_KEY *prv);
STRING *publickey_from_file(SSH_SESSION *session, char *filename,int *_type);
STRING *publickey_from_next_file(SSH_SESSION *session,char **pub_keys_path,char **keys_path,
diff --git a/include/libssh/priv.h b/include/libssh/priv.h
index 7edb8d00..1def7d45 100644
--- a/include/libssh/priv.h
+++ b/include/libssh/priv.h
@@ -177,10 +177,12 @@ struct ssh_options_struct {
long timeout_usec;
int ssh2allowed;
int ssh1allowed;
+ char *dsakey;
+ char *rsakey; /* host key for server implementation */
};
typedef struct ssh_crypto_struct {
- bignum e,f,x,k;
+ bignum e,f,x,k,y;
char session_id[SHA_DIGEST_LEN];
char encryptIV[SHA_DIGEST_LEN*2];
@@ -286,6 +288,10 @@ struct ssh_session {
/* keyb interactive data */
struct ssh_kbdint *kbdint;
int version; /* 1 or 2 */
+ /* server host keys */
+ PRIVATE_KEY *rsa_key;
+ PRIVATE_KEY *dsa_key;
+ int hostkeys; /* contains type of host key wanted by client, in server impl */
};
struct ssh_kbdint {
@@ -303,6 +309,7 @@ void ssh_cleanup(SSH_SESSION *session);
/* client.c */
int ssh_send_banner(SSH_SESSION *session, int is_server);
+char *ssh_get_banner(SSH_SESSION *session);
/* errors.c */
void ssh_set_error(void *error,int code,char *descr,...);
@@ -311,8 +318,13 @@ void ssh_set_error(void *error,int code,char *descr,...);
/* DH key generation */
void dh_generate_e(SSH_SESSION *session);
void dh_generate_x(SSH_SESSION *session);
+void dh_generate_y(SSH_SESSION *session);
+void dh_generate_f(SSH_SESSION *session);
+
STRING *dh_get_e(SSH_SESSION *session);
+STRING *dh_get_f(SSH_SESSION *session);
void dh_import_f(SSH_SESSION *session,STRING *f_string);
+void dh_import_e(SSH_SESSION *session, STRING *e_string);
void dh_import_pubkey(SSH_SESSION *session,STRING *pubkey_string);
void dh_build_k(SSH_SESSION *session);
void make_sessionid(SSH_SESSION *session);
@@ -348,13 +360,18 @@ int ssh_connect_host(SSH_SESSION *session, const char *host,const char
/* in kex.c */
extern char *ssh_kex_nums[];
-void send_kex(SSH_SESSION *session,int server_kex);
-void list_kex(KEX *kex);
+void ssh_send_kex(SSH_SESSION *session,int server_kex);
+void ssh_list_kex(KEX *kex);
int set_kex(SSH_SESSION *session);
int ssh_get_kex(SSH_SESSION *session, int server_kex);
int verify_existing_algo(int algo,char *name);
char **space_tokenize(char *chain);
int ssh_get_kex1(SSH_SESSION *session);
+char *ssh_find_matching(char *in_d, char *what_d);
+
+/* in keyfiles.c */
+
+PRIVATE_KEY *_privatekey_from_file(void *session,char *filename,int type);
/* in keys.c */
char *ssh_type_to_char(int type);
@@ -365,6 +382,7 @@ SIGNATURE *signature_from_string(STRING *signature,PUBLIC_KEY *pubkey,int needed
void signature_free(SIGNATURE *sign);
STRING *ssh_do_sign(SSH_SESSION *session,BUFFER *sigbuf,
PRIVATE_KEY *privatekey);
+STRING *ssh_sign_session_id(SSH_SESSION *session, PRIVATE_KEY *privatekey);
STRING *ssh_encrypt_rsa1(SSH_SESSION *session, STRING *data, PUBLIC_KEY *key);
/* channel.c */
void channel_handle(SSH_SESSION *session, int type);
@@ -420,6 +438,7 @@ int decompress_buffer(SSH_SESSION *session,BUFFER *buf);
/* wrapper.c */
int crypt_set_algorithms(SSH_SESSION *);
+int crypt_set_algorithms_server(SSH_SESSION *session);
CRYPTO *crypto_new();
void crypto_free(CRYPTO *crypto);
bignum bignum_new();
diff --git a/include/libssh/server.h b/include/libssh/server.h
index 8e68f137..ef86febe 100644
--- a/include/libssh/server.h
+++ b/include/libssh/server.h
@@ -43,5 +43,23 @@ int ssh_bind_get_fd(SSH_BIND *ssh_bind);
int ssh_bind_set_toaccept(SSH_BIND *ssh_bind);
SSH_SESSION *ssh_bind_accept(SSH_BIND *ssh_bind);
+int ssh_accept(SSH_SESSION *session);
+
+/* messages.c */
+
+struct ssh_auth_request {
+ char *username;
+ int method;
+ char *password;
+};
+
+struct ssh_message {
+ int type;
+ struct ssh_auth_request auth_request;
+};
+
+typedef struct ssh_message SSH_MESSAGE;
+
+SSH_MESSAGE *ssh_message_get(SSH_SESSION *session);
#endif
diff --git a/include/libssh/ssh2.h b/include/libssh/ssh2.h
index e6dc04f5..bd89f4e1 100644
--- a/include/libssh/ssh2.h
+++ b/include/libssh/ssh2.h
@@ -11,7 +11,7 @@
#define SSH2_MSG_KEXINIT 20
#define SSH2_MSG_NEWKEYS 21
-#define SSH2_MSG_KEXDH_INIT 30
+#define SSH2_MSG_KEXDH_INIT 30
#define SSH2_MSG_KEXDH_REPLY 31
#define SSH2_MSG_KEX_DH_GEX_REQUEST_OLD 30