From 3e314e863cb70f8594b0c9b79d14edb3a929d708 Mon Sep 17 00:00:00 2001 From: Aris Adamantiadis Date: Sat, 26 Sep 2009 01:15:48 +0200 Subject: More include file splitting --- include/libssh/dh.h | 57 ++++++++++++++ include/libssh/keys.h | 84 +++++++++++++++++++++ include/libssh/misc.h | 69 +++++++++++++++++ include/libssh/options.h | 9 +++ include/libssh/poll.h | 41 ++++++++++ include/libssh/priv.h | 192 +---------------------------------------------- include/libssh/session.h | 1 + include/libssh/wrapper.h | 6 +- libssh/agent.c | 1 + libssh/auth.c | 1 + libssh/channels.c | 1 + libssh/client.c | 1 + libssh/dh.c | 2 + libssh/init.c | 2 + libssh/kex.c | 2 + libssh/keyfiles.c | 2 + libssh/keys.c | 2 + libssh/messages.c | 3 + libssh/misc.c | 1 + libssh/options.c | 1 + libssh/server.c | 3 + libssh/session.c | 2 +- libssh/sftp.c | 1 + libssh/sftpserver.c | 1 + 24 files changed, 294 insertions(+), 191 deletions(-) create mode 100644 include/libssh/dh.h create mode 100644 include/libssh/keys.h create mode 100644 include/libssh/misc.h diff --git a/include/libssh/dh.h b/include/libssh/dh.h new file mode 100644 index 00000000..ece7c019 --- /dev/null +++ b/include/libssh/dh.h @@ -0,0 +1,57 @@ +/* + * This file is part of the SSH Library + * + * Copyright (c) 2009 by Aris Adamantiadis + * + * The SSH Library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * The SSH Library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with the SSH Library; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#ifndef DH_H_ +#define DH_H_ +#include "config.h" + +/* DH key generation */ +#include "libssh/keys.h" + +void ssh_print_bignum(const char *which,bignum num); +int dh_generate_e(ssh_session session); +int dh_generate_f(ssh_session session); +int dh_generate_x(ssh_session session); +int dh_generate_y(ssh_session session); + +int ssh_crypto_init(void); +void ssh_crypto_finalize(void); + +ssh_string dh_get_e(ssh_session session); +ssh_string dh_get_f(ssh_session session); +int dh_import_f(ssh_session session,ssh_string f_string); +int dh_import_e(ssh_session session, ssh_string e_string); +void dh_import_pubkey(ssh_session session,ssh_string pubkey_string); +int dh_build_k(ssh_session session); +int make_sessionid(ssh_session session); +/* add data for the final cookie */ +int hashbufin_add_cookie(ssh_session session, unsigned char *cookie); +int hashbufout_add_cookie(ssh_session session); +int generate_session_keys(ssh_session session); +int sig_verify(ssh_session session, ssh_public_key pubkey, + SIGNATURE *signature, unsigned char *digest, int size); +/* returns 1 if server signature ok, 0 otherwise. The NEXT crypto is checked, not the current one */ +int signature_verify(ssh_session session,ssh_string signature); +bignum make_string_bn(ssh_string string); +ssh_string make_bignum_string(bignum num); + + +#endif /* DH_H_ */ diff --git a/include/libssh/keys.h b/include/libssh/keys.h new file mode 100644 index 00000000..13e759e4 --- /dev/null +++ b/include/libssh/keys.h @@ -0,0 +1,84 @@ +/* + * This file is part of the SSH Library + * + * Copyright (c) 2009 by Aris Adamantiadis + * + * The SSH Library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * The SSH Library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with the SSH Library; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#ifndef KEYS_H_ +#define KEYS_H_ + +#include "config.h" +#include "libssh/libssh.h" +#include "libssh/wrapper.h" + +struct ssh_public_key_struct { + int type; + const char *type_c; /* Don't free it ! it is static */ +#ifdef HAVE_LIBGCRYPT + gcry_sexp_t dsa_pub; + gcry_sexp_t rsa_pub; +#elif HAVE_LIBCRYPTO + DSA *dsa_pub; + RSA *rsa_pub; +#endif +}; + +struct ssh_private_key_struct { + int type; +#ifdef HAVE_LIBGCRYPT + gcry_sexp_t dsa_priv; + gcry_sexp_t rsa_priv; +#elif defined HAVE_LIBCRYPTO + DSA *dsa_priv; + RSA *rsa_priv; +#endif +}; + +typedef struct signature_struct { + int type; +#ifdef HAVE_LIBGCRYPT + gcry_sexp_t dsa_sign; + gcry_sexp_t rsa_sign; +#elif defined HAVE_LIBCRYPTO + DSA_SIG *dsa_sign; + ssh_string rsa_sign; +#endif +} SIGNATURE; + +const char *ssh_type_to_char(int type); +int ssh_type_from_name(const char *name); +ssh_buffer ssh_userauth_build_digest(ssh_session session, ssh_message msg, char *service); + +ssh_private_key privatekey_make_dss(ssh_session session, ssh_buffer buffer); +ssh_private_key privatekey_make_rsa(ssh_session session, ssh_buffer buffer, + const char *type); +ssh_private_key privatekey_from_string(ssh_session session, ssh_string privkey_s); + +ssh_public_key publickey_make_dss(ssh_session session, ssh_buffer buffer); +ssh_public_key publickey_make_rsa(ssh_session session, ssh_buffer buffer, int type); +ssh_public_key publickey_from_string(ssh_session session, ssh_string pubkey_s); +SIGNATURE *signature_from_string(ssh_session session, ssh_string signature,ssh_public_key pubkey,int needed_type); +void signature_free(SIGNATURE *sign); +ssh_string ssh_do_sign_with_agent(struct ssh_session_struct *session, + struct ssh_buffer_struct *buf, struct ssh_public_key_struct *publickey); +ssh_string ssh_do_sign(ssh_session session,ssh_buffer sigbuf, + ssh_private_key privatekey); +ssh_string ssh_sign_session_id(ssh_session session, ssh_private_key privatekey); +ssh_string ssh_encrypt_rsa1(ssh_session session, ssh_string data, ssh_public_key key); + +#endif /* KEYS_H_ */ diff --git a/include/libssh/misc.h b/include/libssh/misc.h new file mode 100644 index 00000000..21104c78 --- /dev/null +++ b/include/libssh/misc.h @@ -0,0 +1,69 @@ +/* + * This file is part of the SSH Library + * + * Copyright (c) 2009 by Aris Adamantiadis + * + * The SSH Library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * The SSH Library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with the SSH Library; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#ifndef MISC_H_ +#define MISC_H_ + +/* in misc.c */ +/* gets the user home dir. */ +char *ssh_get_user_home_dir(void); +int ssh_file_readaccess_ok(const char *file); + +/* macro for byte ordering */ +uint64_t ntohll(uint64_t); +#define htonll(x) ntohll(x) + +/* list processing */ + +struct ssh_list { + struct ssh_iterator *root; + struct ssh_iterator *end; +}; + +struct ssh_iterator { + struct ssh_iterator *next; + const void *data; +}; + +struct ssh_list *ssh_list_new(void); +void ssh_list_free(struct ssh_list *list); +struct ssh_iterator *ssh_list_get_iterator(const struct ssh_list *list); +int ssh_list_add(struct ssh_list *list, const void *data); +void ssh_list_remove(struct ssh_list *list, struct ssh_iterator *iterator); + +/** @brief fetch the head element of a list and remove it from list + * @param list the ssh_list to use + * @return the first element of the list + */ +const void *_ssh_list_get_head(struct ssh_list *list); + +#define ssh_iterator_value(type, iterator)\ + ((type)((iterator)->data)) + +/** @brief fetch the head element of a list and remove it from list + * @param type type of the element to return + * @param list the ssh_list to use + * @return the first element of the list + */ +#define ssh_list_get_head(type, ssh_list)\ + ((type)_ssh_list_get_head(ssh_list)) + +#endif /* MISC_H_ */ diff --git a/include/libssh/options.h b/include/libssh/options.h index 775933ae..8ec07a6d 100644 --- a/include/libssh/options.h +++ b/include/libssh/options.h @@ -22,6 +22,9 @@ #ifndef OPTIONS_H_ #define OPTIONS_H_ +#include "libssh/priv.h" +#include "libssh/callback.h" + struct ssh_options_struct { struct error_struct error; char *banner; @@ -46,4 +49,10 @@ struct ssh_options_struct { }; + +/* this function must be called when no specific username has been asked. it has to guess it */ +int ssh_options_default_username(ssh_options opt); +int ssh_options_default_ssh_dir(ssh_options opt); +int ssh_options_default_known_hosts_file(ssh_options opt); + #endif /* OPTIONS_H_ */ diff --git a/include/libssh/poll.h b/include/libssh/poll.h index 7ba939f9..c792bacd 100644 --- a/include/libssh/poll.h +++ b/include/libssh/poll.h @@ -21,8 +21,47 @@ #ifndef POLL_H_ #define POLL_H_ +#include "config.h" + +#ifdef HAVE_POLL + +#include +typedef struct pollfd ssh_pollfd_t; + +#else /* HAVE_POLL */ + +/* poll emulation support */ + +typedef struct ssh_pollfd_struct { + socket_t fd; /* file descriptor */ + short events; /* requested events */ + short revents; /* returned events */ +} ssh_pollfd_t; /* poll.c */ +#ifndef POLLIN +# define POLLIN 0x001 /* There is data to read. */ +#endif +#ifndef POLLPRI +#define POLLPRI 0x002 /* There is urgent data to read. */ +#endif +#ifndef POLLOUT +#define POLLOUT 0x004 /* Writing now will not block. */ +#endif + +#ifndef POLLERR +#define POLLERR 0x008 /* Error condition. */ +#endif +#ifndef POLLHUP +#define POLLHUP 0x010 /* Hung up. */ +#endif +#ifndef POLLNVAL +#define POLLNVAL 0x020 /* Invalid polling request. */ +#endif + +typedef unsigned long int nfds_t; +#endif /* HAVE_POLL */ + int ssh_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout); typedef struct ssh_poll_ctx SSH_POLL_CTX; typedef struct ssh_poll SSH_POLL; @@ -58,4 +97,6 @@ int ssh_poll_ctx_add(SSH_POLL_CTX *ctx, SSH_POLL *p); void ssh_poll_ctx_remove(SSH_POLL_CTX *ctx, SSH_POLL *p); int ssh_poll_ctx(SSH_POLL_CTX *ctx, int timeout); + + #endif /* POLL_H_ */ diff --git a/include/libssh/priv.h b/include/libssh/priv.h index 5d5545af..bfe355e8 100644 --- a/include/libssh/priv.h +++ b/include/libssh/priv.h @@ -70,42 +70,6 @@ extern "C" { #include #endif -/* poll support */ -#ifdef HAVE_POLL -#include -typedef struct pollfd ssh_pollfd_t; -#else /* HAVE_POLL */ -typedef struct ssh_pollfd_struct { - socket_t fd; /* file descriptor */ - short events; /* requested events */ - short revents; /* returned events */ -} ssh_pollfd_t; - -/* poll.c */ -#ifndef POLLIN -# define POLLIN 0x001 /* There is data to read. */ -#endif -#ifndef POLLPRI -#define POLLPRI 0x002 /* There is urgent data to read. */ -#endif -#ifndef POLLOUT -#define POLLOUT 0x004 /* Writing now will not block. */ -#endif - -#ifndef POLLERR -#define POLLERR 0x008 /* Error condition. */ -#endif -#ifndef POLLHUP -#define POLLHUP 0x010 /* Hung up. */ -#endif -#ifndef POLLNVAL -#define POLLNVAL 0x020 /* Invalid polling request. */ -#endif - -typedef unsigned long int nfds_t; -#endif /* HAVE_POLL */ - - /* i should remove it one day */ typedef struct packet_struct { int valid; @@ -118,50 +82,15 @@ typedef struct kex_struct { char **methods; } KEX; -/* TODO: remove that include */ -#include "libssh/wrapper.h" - -struct ssh_public_key_struct { - int type; - const char *type_c; /* Don't free it ! it is static */ -#ifdef HAVE_LIBGCRYPT - gcry_sexp_t dsa_pub; - gcry_sexp_t rsa_pub; -#elif HAVE_LIBCRYPTO - DSA *dsa_pub; - RSA *rsa_pub; -#endif -}; - -struct ssh_private_key_struct { - int type; -#ifdef HAVE_LIBGCRYPT - gcry_sexp_t dsa_priv; - gcry_sexp_t rsa_priv; -#elif defined HAVE_LIBCRYPTO - DSA *dsa_priv; - RSA *rsa_priv; -#endif -}; - -typedef struct signature_struct { - int type; -#ifdef HAVE_LIBGCRYPT - gcry_sexp_t dsa_sign; - gcry_sexp_t rsa_sign; -#elif defined HAVE_LIBCRYPTO - DSA_SIG *dsa_sign; - ssh_string rsa_sign; -#endif -} SIGNATURE; - - struct error_struct { /* error handling */ int error_code; char error_buffer[ERROR_BUFFERLEN]; }; +/* TODO: remove that include */ +#include "libssh/wrapper.h" + struct ssh_crypto_struct { bignum e,f,x,k,y; unsigned char session_id[SHA_DIGEST_LEN]; @@ -263,12 +192,6 @@ struct ssh_message_struct { struct ssh_service_request service_request; }; - - -/* session.c */ - -void ssh_cleanup(ssh_session session); - /* client.c */ int ssh_send_banner(ssh_session session, int is_server); @@ -280,35 +203,6 @@ int ssh_config_parse_file(ssh_options opt, const char *filename); /* errors.c */ void ssh_set_error(void *error, int code, const char *descr, ...) PRINTF_ATTRIBUTE(3, 4); -/* in dh.c */ -/* DH key generation */ -void ssh_print_bignum(const char *which,bignum num); -int dh_generate_e(ssh_session session); -int dh_generate_f(ssh_session session); -int dh_generate_x(ssh_session session); -int dh_generate_y(ssh_session session); - -int ssh_crypto_init(void); -void ssh_crypto_finalize(void); - -ssh_string dh_get_e(ssh_session session); -ssh_string dh_get_f(ssh_session session); -int dh_import_f(ssh_session session,ssh_string f_string); -int dh_import_e(ssh_session session, ssh_string e_string); -void dh_import_pubkey(ssh_session session,ssh_string pubkey_string); -int dh_build_k(ssh_session session); -int make_sessionid(ssh_session session); -/* add data for the final cookie */ -int hashbufin_add_cookie(ssh_session session, unsigned char *cookie); -int hashbufout_add_cookie(ssh_session session); -int generate_session_keys(ssh_session session); -int sig_verify(ssh_session session, ssh_public_key pubkey, - SIGNATURE *signature, unsigned char *digest, int size); -/* returns 1 if server signature ok, 0 otherwise. The NEXT crypto is checked, not the current one */ -int signature_verify(ssh_session session,ssh_string signature); -bignum make_string_bn(ssh_string string); -ssh_string make_bignum_string(bignum num); - /* in crypt.c */ uint32_t packet_decrypt_len(ssh_session session,char *crypted); int packet_decrypt(ssh_session session, void *packet,unsigned int len); @@ -316,7 +210,6 @@ unsigned char *packet_encrypt(ssh_session session,void *packet,unsigned int len) /* it returns the hmac buffer if exists*/ int packet_hmac_verify(ssh_session session,ssh_buffer buffer,unsigned char *mac); - /* connect.c */ int ssh_regex_init(void); void ssh_regex_finalize(void); @@ -335,36 +228,6 @@ char **space_tokenize(const char *chain); int ssh_get_kex1(ssh_session session); char *ssh_find_matching(const char *in_d, const char *what_d); -/* in keys.c */ -const char *ssh_type_to_char(int type); -int ssh_type_from_name(const char *name); -ssh_buffer ssh_userauth_build_digest(ssh_session session, ssh_message msg, char *service); - -ssh_private_key privatekey_make_dss(ssh_session session, ssh_buffer buffer); -ssh_private_key privatekey_make_rsa(ssh_session session, ssh_buffer buffer, - const char *type); -ssh_private_key privatekey_from_string(ssh_session session, ssh_string privkey_s); - -ssh_public_key publickey_make_dss(ssh_session session, ssh_buffer buffer); -ssh_public_key publickey_make_rsa(ssh_session session, ssh_buffer buffer, int type); -ssh_public_key publickey_from_string(ssh_session session, ssh_string pubkey_s); -SIGNATURE *signature_from_string(ssh_session session, ssh_string signature,ssh_public_key pubkey,int needed_type); -void signature_free(SIGNATURE *sign); -ssh_string ssh_do_sign_with_agent(struct ssh_session_struct *session, - struct ssh_buffer_struct *buf, struct ssh_public_key_struct *publickey); -ssh_string ssh_do_sign(ssh_session session,ssh_buffer sigbuf, - ssh_private_key privatekey); -ssh_string ssh_sign_session_id(ssh_session session, ssh_private_key privatekey); -ssh_string ssh_encrypt_rsa1(ssh_session session, ssh_string data, ssh_public_key key); - - -/* options.c */ - -/* this function must be called when no specific username has been asked. it has to guess it */ -int ssh_options_default_username(ssh_options opt); -int ssh_options_default_ssh_dir(ssh_options opt); -int ssh_options_default_known_hosts_file(ssh_options opt); - /* in base64.c */ ssh_buffer base64_to_bin(const char *source); unsigned char *bin_to_base64(const unsigned char *source, int len); @@ -373,12 +236,6 @@ unsigned char *bin_to_base64(const unsigned char *source, int len); int compress_buffer(ssh_session session,ssh_buffer buf); int decompress_buffer(ssh_session session,ssh_buffer buf, size_t maxlen); -/* wrapper.c */ -int crypt_set_algorithms(ssh_session ); -int crypt_set_algorithms_server(ssh_session session); -struct ssh_crypto_struct *crypto_new(void); -void crypto_free(struct ssh_crypto_struct *crypto); - /* crc32.c */ uint32_t ssh_crc32(const char *buf, uint32_t len); @@ -388,49 +245,6 @@ int ssh_userauth1_offer_pubkey(ssh_session session, const char *username, int type, ssh_string pubkey); int ssh_userauth1_password(ssh_session session, const char *username, const char *password); -/* in misc.c */ -/* gets the user home dir. */ -char *ssh_get_user_home_dir(void); -int ssh_file_readaccess_ok(const char *file); - -/* macro for byte ordering */ -uint64_t ntohll(uint64_t); -#define htonll(x) ntohll(x) - -/* list processing */ - -struct ssh_list { - struct ssh_iterator *root; - struct ssh_iterator *end; -}; - -struct ssh_iterator { - struct ssh_iterator *next; - const void *data; -}; - -struct ssh_list *ssh_list_new(void); -void ssh_list_free(struct ssh_list *list); -struct ssh_iterator *ssh_list_get_iterator(const struct ssh_list *list); -int ssh_list_add(struct ssh_list *list, const void *data); -void ssh_list_remove(struct ssh_list *list, struct ssh_iterator *iterator); - -/** @brief fetch the head element of a list and remove it from list - * @param list the ssh_list to use - * @return the first element of the list - */ -const void *_ssh_list_get_head(struct ssh_list *list); - -#define ssh_iterator_value(type, iterator)\ - ((type)((iterator)->data)) -/** @brief fetch the head element of a list and remove it from list - * @param type type of the element to return - * @param list the ssh_list to use - * @return the first element of the list - */ -#define ssh_list_get_head(type, ssh_list)\ - ((type)_ssh_list_get_head(ssh_list)) - /* channels1.c */ int channel_open_session1(ssh_channel channel); diff --git a/include/libssh/session.h b/include/libssh/session.h index 41b36d06..7eecb69c 100644 --- a/include/libssh/session.h +++ b/include/libssh/session.h @@ -93,5 +93,6 @@ struct ssh_session_struct { }; int ssh_handle_packets(ssh_session session); +void ssh_cleanup(ssh_session session); #endif /* SESSION_H_ */ diff --git a/include/libssh/wrapper.h b/include/libssh/wrapper.h index c053faaf..093f8b74 100644 --- a/include/libssh/wrapper.h +++ b/include/libssh/wrapper.h @@ -92,7 +92,6 @@ typedef BN_CTX* bignum_CTX; #endif /* OPENSSL_CRYPTO */ -/* wrapper.c */ MD5CTX md5_init(void); void md5_update(MD5CTX c, const void *data, unsigned long len); void md5_final(unsigned char *md,MD5CTX c); @@ -106,5 +105,10 @@ HMACCTX hmac_init(const void *key,int len,int type); void hmac_update(HMACCTX c, const void *data, unsigned long len); void hmac_final(HMACCTX ctx,unsigned char *hashmacbuf,unsigned int *len); +int crypt_set_algorithms(ssh_session ); +int crypt_set_algorithms_server(ssh_session session); +struct ssh_crypto_struct *crypto_new(void); +void crypto_free(struct ssh_crypto_struct *crypto); + #endif /* WRAPPER_H_ */ diff --git a/libssh/agent.c b/libssh/agent.c index 1f425b63..a4e0efbf 100644 --- a/libssh/agent.c +++ b/libssh/agent.c @@ -53,6 +53,7 @@ #include "libssh/socket.h" #include "libssh/buffer.h" #include "libssh/session.h" +#include "libssh/keys.h" /* macro to check for "agent failure" message */ #define agent_failed(x) \ diff --git a/libssh/auth.c b/libssh/auth.c index 36e06ae7..3b64e0f6 100644 --- a/libssh/auth.c +++ b/libssh/auth.c @@ -38,6 +38,7 @@ #include "libssh/packet.h" #include "libssh/session.h" #include "libssh/options.h" +#include "libssh/keys.h" /** \defgroup ssh_auth SSH Authentication functions * \brief functions to authenticate to servers diff --git a/libssh/channels.c b/libssh/channels.c index cb7e5439..f96051ef 100644 --- a/libssh/channels.c +++ b/libssh/channels.c @@ -39,6 +39,7 @@ #include "libssh/socket.h" #include "libssh/channels.h" #include "libssh/session.h" +#include "libssh/misc.h" #define WINDOWBASE 128000 #define WINDOWLIMIT (WINDOWBASE/2) diff --git a/libssh/client.c b/libssh/client.c index 3ff92da9..8c5e8ba7 100644 --- a/libssh/client.c +++ b/libssh/client.c @@ -36,6 +36,7 @@ #include "libssh/socket.h" #include "libssh/session.h" #include "libssh/options.h" +#include "libssh/dh.h" #define set_status(opt,status) do {\ if (opt->callbacks && opt->callbacks->connect_status_function) \ diff --git a/libssh/dh.c b/libssh/dh.c index 9088bb9d..abb07629 100644 --- a/libssh/dh.c +++ b/libssh/dh.c @@ -54,6 +54,8 @@ #include "libssh/buffer.h" #include "libssh/session.h" #include "libssh/options.h" +#include "libssh/keys.h" +#include "libssh/dh.h" /* todo: remove it */ #include "libssh/string.h" diff --git a/libssh/init.c b/libssh/init.c index 99288206..bab9cdfb 100644 --- a/libssh/init.c +++ b/libssh/init.c @@ -21,8 +21,10 @@ * MA 02111-1307, USA. */ +#include "config.h" #include "libssh/priv.h" #include "libssh/socket.h" +#include "libssh/dh.h" #ifdef _WIN32 #include diff --git a/libssh/kex.c b/libssh/kex.c index d5eba61e..d8d5b849 100644 --- a/libssh/kex.c +++ b/libssh/kex.c @@ -39,6 +39,8 @@ #include "libssh/session.h" #include "libssh/wrapper.h" #include "libssh/options.h" +#include "libssh/keys.h" +#include "libssh/dh.h" #ifdef HAVE_LIBGCRYPT #define BLOWFISH "blowfish-cbc," diff --git a/libssh/keyfiles.c b/libssh/keyfiles.c index 7ac1161b..193fd115 100644 --- a/libssh/keyfiles.c +++ b/libssh/keyfiles.c @@ -43,6 +43,8 @@ #include "libssh/session.h" #include "libssh/wrapper.h" #include "libssh/options.h" +#include "libssh/misc.h" +#include "libssh/keys.h" /*todo: remove this include */ #include "libssh/string.h" diff --git a/libssh/keys.c b/libssh/keys.c index eea217c3..4908608d 100644 --- a/libssh/keys.c +++ b/libssh/keys.c @@ -33,6 +33,8 @@ #include "libssh/buffer.h" #include "libssh/agent.h" #include "libssh/session.h" +#include "libssh/keys.h" +#include "libssh/dh.h" /** \addtogroup ssh_auth * @{ diff --git a/libssh/messages.c b/libssh/messages.c index 2be7b21c..1540dd66 100644 --- a/libssh/messages.c +++ b/libssh/messages.c @@ -46,6 +46,9 @@ #include "libssh/packet.h" #include "libssh/channels.h" #include "libssh/session.h" +#include "libssh/misc.h" +#include "libssh/keys.h" +#include "libssh/dh.h" static ssh_message message_new(ssh_session session){ ssh_message msg = malloc(sizeof(struct ssh_message_struct)); diff --git a/libssh/misc.c b/libssh/misc.c index bcc79061..690de3a8 100644 --- a/libssh/misc.c +++ b/libssh/misc.c @@ -43,6 +43,7 @@ #endif #include "libssh/priv.h" +#include "libssh/misc.h" #ifdef HAVE_LIBGCRYPT #define GCRYPT_STRING "/gnutls" diff --git a/libssh/options.c b/libssh/options.c index e670f2bb..d7502e64 100644 --- a/libssh/options.c +++ b/libssh/options.c @@ -34,6 +34,7 @@ #include #include "libssh/priv.h" #include "libssh/options.h" +#include "libssh/misc.h" /** \defgroup ssh_options SSH Options * \brief options settings for a new SSH session diff --git a/libssh/server.c b/libssh/server.c index 7e9ad0b8..ebd5dc20 100644 --- a/libssh/server.c +++ b/libssh/server.c @@ -46,6 +46,9 @@ #include "libssh/channels.h" #include "libssh/session.h" #include "libssh/options.h" +#include "libssh/misc.h" +#include "libssh/keys.h" +#include "libssh/dh.h" #ifdef _WIN32 diff --git a/libssh/session.c b/libssh/session.c index 9b646a86..25245608 100644 --- a/libssh/session.c +++ b/libssh/session.c @@ -33,7 +33,7 @@ #include "libssh/packet.h" #include "libssh/session.h" #include "libssh/options.h" - +#include "libssh/misc.h" #define FIRST_CHANNEL 42 // why not ? it helps to find bugs. diff --git a/libssh/sftp.c b/libssh/sftp.c index e0b082ef..ec244a2c 100644 --- a/libssh/sftp.c +++ b/libssh/sftp.c @@ -49,6 +49,7 @@ #include "libssh/buffer.h" #include "libssh/channels.h" #include "libssh/session.h" +#include "libssh/misc.h" #ifdef WITH_SFTP diff --git a/libssh/sftpserver.c b/libssh/sftpserver.c index d42d0eb3..431b40da 100644 --- a/libssh/sftpserver.c +++ b/libssh/sftpserver.c @@ -34,6 +34,7 @@ #include "libssh/ssh2.h" #include "libssh/priv.h" #include "libssh/buffer.h" +#include "libssh/misc.h" SFTP_CLIENT_MESSAGE *sftp_get_client_message(SFTP_SESSION *sftp) { SFTP_PACKET *packet; -- cgit v1.2.3