include/libssh/priv.h

00001 /*
00002 Copyright 2003,04 Aris Adamantiadis
00003 
00004 This file is part of the SSH Library
00005 
00006 The SSH Library is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU Lesser General Public License as published by
00008 the Free Software Foundation; either version 2.1 of the License, or (at your
00009 option) any later version.
00010 
00011 The SSH Library is distributed in the hope that it will be useful, but
00012 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00013 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00014 License for more details.
00015 
00016 You should have received a copy of the GNU Lesser General Public License
00017 along with the SSH Library; see the file COPYING.  If not, write to
00018 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00019 MA 02111-1307, USA. */
00020 
00021 /* priv.h file */
00022 /* This include file contains everything you shouldn't deal with in user programs. */
00023 /* Consider that anything in this file might change without notice; libssh.h file will keep */
00024 /* backward compatibility on binary & source */
00025 
00026 #ifndef _LIBSSH_PRIV_H
00027 #define _LIBSSH_PRIV_H
00028 #include "config.h"
00029 #include "libssh/libssh.h"
00030 
00031 /* Debugging constants */
00032 
00033 /* Define this if you want to debug crypto systems */
00034 /* it's usefull when you are debugging the lib */
00035 /*#define DEBUG_CRYPTO */
00036 
00037 /* some constants */
00038 #define MAX_PACKET_LEN 262144
00039 #define ERROR_BUFFERLEN 1024
00040 #define CLIENTBANNER1 "SSH-1.5-" LIBSSH_VERSION
00041 #define CLIENTBANNER2 "SSH-2.0-" LIBSSH_VERSION
00042 #define KBDINT_MAX_PROMPT 256 /* more than openssh's :) */
00043 /* some types for public keys */
00044 #define TYPE_DSS 1
00045 #define TYPE_RSA 2
00046 #define TYPE_RSA1 3
00047 
00048 /* profiling constants. Don't touch them unless you know what you do */
00049 #ifdef HAVE_LIBCRYPTO
00050 #define OPENSSL_BIGNUMS
00051 #endif
00052 
00053 #ifdef __cplusplus
00054 extern "C" {
00055 #endif
00056 
00057 /* wrapper things */
00058 #ifdef HAVE_LIBGCRYPT
00059 #include <gcrypt.h>
00060 typedef gcry_md_hd_t SHACTX;
00061 typedef gcry_md_hd_t MD5CTX;
00062 typedef gcry_md_hd_t HMACCTX;
00063 #ifdef MD5_DIGEST_LEN
00064     #undef MD5_DIGEST_LEN
00065 #endif
00066 #define SHA_DIGEST_LEN 20
00067 #define MD5_DIGEST_LEN 16
00068 #define EVP_MAX_MD_SIZE 36
00069 
00070 typedef gcry_mpi_t bignum;
00071 
00072 #define bignum_new() gcry_mpi_new(0)
00073 #define bignum_free(num) gcry_mpi_release(num)
00074 #define bignum_set_word(bn,n) gcry_mpi_set_ui(bn,n)
00075 #define bignum_bin2bn(bn,datalen,data) gcry_mpi_scan(data,GCRYMPI_FMT_USG,bn,datalen,NULL)
00076 #define bignum_bn2dec(num) my_gcry_bn2dec(num)
00077 #define bignum_dec2bn(num, data) my_gcry_dec2bn(data, num)
00078 #define bignum_bn2hex(num,data) gcry_mpi_aprint(GCRYMPI_FMT_HEX,data,NULL,num)
00079 #define bignum_hex2bn(num,datalen,data) gcry_mpi_scan(num,GCRYMPI_FMT_HEX,data,datalen,NULL)
00080 #define bignum_rand(num,bits) gcry_mpi_randomize(num,bits,GCRY_STRONG_RANDOM),gcry_mpi_set_bit(num,bits-1),gcry_mpi_set_bit(num,0)
00081 #define bignum_mod_exp(dest,generator,exp,modulo) gcry_mpi_powm(dest,generator,exp,modulo)
00082 #define bignum_num_bits(num) gcry_mpi_get_nbits(num)
00083 #define bignum_num_bytes(num) ((gcry_mpi_get_nbits(num)+7)/8)
00084 #define bignum_is_bit_set(num,bit) gcry_mpi_test_bit(num,bit)
00085 #define bignum_bn2bin(num,datalen,data) gcry_mpi_print(GCRYMPI_FMT_USG,data,datalen,NULL,num)
00086 #define bignum_cmp(num1,num2) gcry_mpi_cmp(num1,num2)
00087 
00088 #elif defined HAVE_LIBCRYPTO
00089 #include <openssl/dsa.h>
00090 #include <openssl/rsa.h>
00091 #include <openssl/sha.h>
00092 #include <openssl/md5.h>
00093 #include <openssl/hmac.h>
00094 typedef SHA_CTX* SHACTX;
00095 typedef MD5_CTX*  MD5CTX;
00096 typedef HMAC_CTX* HMACCTX;
00097 #ifdef MD5_DIGEST_LEN
00098     #undef MD5_DIGEST_LEN
00099 #endif
00100 #define SHA_DIGEST_LEN SHA_DIGEST_LENGTH
00101 #define MD5_DIGEST_LEN MD5_DIGEST_LENGTH
00102 
00103 #endif /* OPENSSL_CRYPTO */
00104 #ifdef OPENSSL_BIGNUMS
00105 #include <openssl/bn.h>
00106 typedef BIGNUM*  bignum;
00107 typedef BN_CTX* bignum_CTX;
00108 
00109 #define bignum_new() BN_new()
00110 #define bignum_free(num) BN_clear_free(num)
00111 #define bignum_set_word(bn,n) BN_set_word(bn,n)
00112 #define bignum_bin2bn(bn,datalen,data) BN_bin2bn(bn,datalen,data)
00113 #define bignum_bn2dec(num) BN_bn2dec(num)
00114 #define bignum_dec2bn(bn,data) BN_dec2bn(data,bn)
00115 #define bignum_bn2hex(num) BN_bn2hex(num)
00116 #define bignum_rand(rnd, bits, top, bottom) BN_rand(rnd,bits,top,bottom)
00117 #define bignum_ctx_new() BN_CTX_new()
00118 #define bignum_ctx_free(num) BN_CTX_free(num)
00119 #define bignum_mod_exp(dest,generator,exp,modulo,ctx) BN_mod_exp(dest,generator,exp,modulo,ctx)
00120 #define bignum_num_bytes(num) BN_num_bytes(num)
00121 #define bignum_num_bits(num) BN_num_bits(num)
00122 #define bignum_is_bit_set(num,bit) BN_is_bit_set(num,bit)
00123 #define bignum_bn2bin(num,ptr) BN_bn2bin(num,ptr)
00124 #define bignum_cmp(num1,num2) BN_cmp(num1,num2)
00125 
00126 #endif /* OPENSSL_BIGNUMS */
00127 
00128 #ifdef HAVE_SYS_TIME_H
00129 #include <sys/time.h>
00130 #endif
00131 
00132 /* wrapper.c */
00133 MD5CTX md5_init(void);
00134 void md5_update(MD5CTX c, const void *data, unsigned long len);
00135 void md5_final(unsigned char *md,MD5CTX c);
00136 SHACTX sha1_init(void);
00137 void sha1_update(SHACTX c, const void *data, unsigned long len);
00138 void sha1_final(unsigned char *md,SHACTX c);
00139 void sha1(unsigned char *digest,int len,unsigned char *hash);
00140 #define HMAC_SHA1 1
00141 #define HMAC_MD5 2
00142 HMACCTX hmac_init(const void *key,int len,int type);
00143 void hmac_update(HMACCTX c, const void *data, unsigned long len);
00144 void hmac_final(HMACCTX ctx,unsigned char *hashmacbuf,unsigned int *len);
00145 
00146 /* strings and buffers */
00147 /* must be 32 bits number + immediatly our data */
00148 struct string_struct {
00149         u32 size;
00150         unsigned char string[MAX_PACKET_LEN];
00151 } __attribute__ ((packed));
00152 
00155 struct buffer_struct {
00156     char *data;
00157     int used;
00158     int allocated;
00159     int pos;
00160 };
00161 
00162 /* i should remove it one day */
00163 typedef struct packet_struct {
00164         int valid;
00165         u32 len;
00166         u8 type;
00167 } PACKET;
00168 
00169 typedef struct kex_struct {
00170         unsigned char cookie[16];
00171         char **methods;
00172 } KEX;
00173 
00174 struct public_key_struct {
00175     int type;
00176     char *type_c; /* Don't free it ! it is static */
00177 #ifdef HAVE_LIBGCRYPT
00178     gcry_sexp_t dsa_pub;
00179     gcry_sexp_t rsa_pub;
00180 #elif HAVE_LIBCRYPTO
00181     DSA *dsa_pub;
00182     RSA *rsa_pub;
00183 #endif
00184 };
00185 
00186 struct private_key_struct {
00187     int type;
00188 #ifdef HAVE_LIBGCRYPT
00189     gcry_sexp_t dsa_priv;
00190     gcry_sexp_t rsa_priv;
00191 #elif defined HAVE_LIBCRYPTO
00192     DSA *dsa_priv;
00193     RSA *rsa_priv;
00194 #endif
00195 };
00196 
00197 typedef struct signature_struct {
00198     int type;
00199 #ifdef HAVE_LIBGCRYPT
00200     gcry_sexp_t dsa_sign;
00201     gcry_sexp_t rsa_sign;
00202 #elif defined HAVE_LIBCRYPTO
00203     DSA_SIG *dsa_sign;
00204     STRING *rsa_sign;
00205 #endif
00206 } SIGNATURE;
00207 
00208 struct ssh_options_struct {
00209     char *banner; /* explicit banner to send */
00210     char *username;
00211     char *host;
00212     char *bindaddr;
00213     int bindport;
00214     char *identity;
00215     char *ssh_dir;
00216     char *known_hosts_file;
00217     int fd; /* specificaly wanted file descriptor, don't connect host */
00218     int port;
00219     int dont_verify_hostkey; /* Don't spare time, don't check host key ! unneeded to say it's dangerous and not safe */
00220     int use_nonexisting_algo; /* if user sets a not supported algorithm for kex, don't complain */
00221     char *wanted_methods[10]; /* the kex methods can be choosed. better use the kex fonctions to do that */
00222     void *wanted_cookie; /* wants a specific cookie to be sent ? if null, generate a new one */
00223     void *passphrase_function; /* this functions will be called if a keyphrase is needed. look keyfiles.c for more info */
00224     void (*connect_status_function)(void *arg, float status); /* status callback function */
00225     void *connect_status_arg; /* arbitrary argument */
00226     long timeout; /* seconds */
00227     long timeout_usec;
00228     int ssh2allowed;
00229     int ssh1allowed;
00230     char *dsakey;
00231     char *rsakey; /* host key for server implementation */
00232 };
00233 
00234 typedef struct ssh_crypto_struct {
00235     bignum e,f,x,k,y;
00236     unsigned char session_id[SHA_DIGEST_LEN];
00237     
00238     unsigned char encryptIV[SHA_DIGEST_LEN*2];
00239     unsigned char decryptIV[SHA_DIGEST_LEN*2];
00240 
00241     unsigned char decryptkey[SHA_DIGEST_LEN*2];
00242     unsigned char encryptkey[SHA_DIGEST_LEN*2];
00243 
00244     unsigned char encryptMAC[SHA_DIGEST_LEN];
00245     unsigned char decryptMAC[SHA_DIGEST_LEN];
00246     unsigned char hmacbuf[EVP_MAX_MD_SIZE];
00247     struct crypto_struct *in_cipher, *out_cipher; /* the cipher structures/objects */
00248     STRING *server_pubkey;
00249     char *server_pubkey_type;
00250     int do_compress_out; /* idem */
00251     int do_compress_in; /* don't set them, set the option instead */
00252     void *compress_out_ctx; /* don't touch it */
00253     void *compress_in_ctx; /* really, don't */
00254 } CRYPTO;
00255 
00256 struct channel_struct {
00257     struct channel_struct *prev;
00258     struct channel_struct *next;
00259     SSH_SESSION *session; /* SSH_SESSION pointer */
00260     u32 local_channel;
00261     u32 local_window;
00262     int local_eof;
00263     u32 local_maxpacket;
00264 
00265     u32 remote_channel;
00266     u32 remote_window;
00267     int remote_eof; /* end of file received */
00268     u32 remote_maxpacket;
00269     int open; /* shows if the channel is still opened */
00270     int delayed_close;
00271     BUFFER *stdout_buffer;
00272     BUFFER *stderr_buffer;
00273     void *userarg;
00274     int version;
00275     int blocking;
00276 };
00277 
00278 
00279 struct error_struct {
00280 /* error handling */
00281     int error_code;
00282     char error_buffer[ERROR_BUFFERLEN];
00283 };
00284 
00285 
00286 struct ssh_session {
00287     struct error_struct error;
00288     int fd;
00289     SSH_OPTIONS *options;
00290     char *serverbanner;
00291     char *clientbanner;
00292     int protoversion;
00293     int server;
00294     int client;
00295     u32 send_seq;
00296     u32 recv_seq;
00297 /* status flags */
00298     int closed;
00299     int closed_by_except;
00300     
00301     int connected; 
00302     /* !=0 when the user got a session handle */
00303     int alive;
00304     /* two previous are deprecated */
00305     int auth_service_asked;
00306     
00307 /* socket status */
00308     int data_to_read; /* reading now on socket will 
00309                          not block */
00310     int data_to_write;
00311     int data_except;
00312     int blocking; // functions should block
00313     
00314     STRING *banner; /* that's the issue banner from 
00315                        the server */
00316     char *remotebanner; /* that's the SSH- banner from
00317                            remote host. */
00318     char *discon_msg; /* disconnect message from 
00319                          the remote host */
00320     BUFFER *in_buffer;
00321     PACKET in_packet;
00322     BUFFER *out_buffer;
00323     
00324     BUFFER *out_socket_buffer;
00325     BUFFER *in_socket_buffer;
00326     
00327     /* the states are used by the nonblocking stuff to remember */
00328     /* where it was before being interrupted */
00329     int packet_state;
00330     int dh_handshake_state;
00331     STRING *dh_server_signature; //information used by dh_handshake.
00332     
00333     KEX server_kex;
00334     KEX client_kex;
00335     BUFFER *in_hashbuf;
00336     BUFFER *out_hashbuf;
00337     CRYPTO *current_crypto;
00338     CRYPTO *next_crypto;  /* next_crypto is going to be used after a SSH2_MSG_NEWKEYS */
00339 
00340     int channel_bytes_toread; /* left number of bytes 
00341                                  in the channel buffers
00342                                  */
00343     CHANNEL *channels; /* linked list of channels */
00344     int maxchannel;
00345     int exec_channel_opened; /* version 1 only. more 
00346                                 info in channels1.c */
00347 
00348 /* keyb interactive data */
00349     struct ssh_kbdint *kbdint;
00350     int version; /* 1 or 2 */
00351     /* server host keys */
00352     PRIVATE_KEY *rsa_key;
00353     PRIVATE_KEY *dsa_key;
00354     /* auths accepted by server */
00355     int auth_methods; 
00356     int hostkeys; /* contains type of host key wanted by client, in server impl */
00357     struct ssh_message *ssh_message; /* ssh message */
00358 };
00359 
00360 struct ssh_kbdint {
00361     u32 nprompts;
00362     char *name;
00363     char *instruction;
00364     char **prompts;
00365     unsigned char *echo; /* bool array */
00366     char **answers;
00367 };
00368 
00369 /* server data */
00370 
00371 struct ssh_bind_struct {
00372     struct error_struct error;
00373     int bindfd;
00374     SSH_OPTIONS *options;
00375     int blocking;
00376     int toaccept;
00377 };
00378 
00379 struct ssh_auth_request {
00380     char *username;
00381     int method;
00382     char *password;
00383 };
00384 
00385 struct ssh_channel_request_open {
00386     int type;
00387     u32 sender;
00388     u32 window;
00389     u32 packet_size;
00390     char *originator;
00391     u16 orignator_port;
00392     char *destination;
00393     u16 destination_port;
00394 };
00395 
00396 struct ssh_channel_request {
00397     int type;
00398     CHANNEL *channel;
00399     u8 want_reply;
00400     /* pty-req type specifics */
00401     char *TERM;
00402     u32 width;
00403     u32 height;
00404     u32 pxwidth;
00405     u32 pxheight;
00406     STRING *modes;
00407     
00408     /* env type request */
00409     char *var_name;
00410     char *var_value;
00411     /* exec type request */
00412     char *command;
00413     /* subsystem */
00414     char *subsystem;
00415 };
00416 
00417 struct ssh_message {
00418     SSH_SESSION *session;
00419     int type;
00420     struct ssh_auth_request auth_request;
00421     struct ssh_channel_request_open channel_request_open;
00422     struct ssh_channel_request channel_request;
00423 };
00424 
00425 /* session.c */
00426 
00427 void ssh_cleanup(SSH_SESSION *session);
00428 
00429 /* client.c */
00430 
00431 int ssh_send_banner(SSH_SESSION *session, int is_server);
00432 char *ssh_get_banner(SSH_SESSION *session);
00433 
00434 /* errors.c */
00435 void ssh_set_error(void *error,int code,char *descr,...);
00436 
00437 /* in dh.c */
00438 /* DH key generation */
00439 void dh_generate_e(SSH_SESSION *session);
00440 void ssh_print_bignum(char *which,bignum num);
00441 void dh_generate_x(SSH_SESSION *session);
00442 void dh_generate_y(SSH_SESSION *session);
00443 void dh_generate_f(SSH_SESSION *session);
00444 
00445 STRING *dh_get_e(SSH_SESSION *session);
00446 STRING *dh_get_f(SSH_SESSION *session);
00447 void dh_import_f(SSH_SESSION *session,STRING *f_string);
00448 void dh_import_e(SSH_SESSION *session, STRING *e_string);
00449 void dh_import_pubkey(SSH_SESSION *session,STRING *pubkey_string);
00450 void dh_build_k(SSH_SESSION *session);
00451 void make_sessionid(SSH_SESSION *session);
00452 /* add data for the final cookie */
00453 void hashbufin_add_cookie(SSH_SESSION *session,unsigned char *cookie);
00454 void hashbufout_add_cookie(SSH_SESSION *session);
00455 void generate_session_keys(SSH_SESSION *session);
00456 /* returns 1 if server signature ok, 0 otherwise. The NEXT crypto is checked, not the current one */
00457 int signature_verify(SSH_SESSION *session,STRING *signature);
00458 bignum make_string_bn(STRING *string);
00459 STRING *make_bignum_string(bignum num);
00460 
00461 /* in crypt.c */
00462 u32 packet_decrypt_len(SSH_SESSION *session,char *crypted);
00463 int packet_decrypt(SSH_SESSION *session, void *packet,unsigned int len);
00464 unsigned char *packet_encrypt(SSH_SESSION *session,void *packet,unsigned int len);
00465  /* it returns the hmac buffer if exists*/
00466 int packet_hmac_verify(SSH_SESSION *session,BUFFER *buffer,unsigned char *mac);
00467 
00468 /* in packet.c */
00469 void packet_clear_out(SSH_SESSION *session);
00470 void packet_parse(SSH_SESSION *session);
00471 int packet_send(SSH_SESSION *session);
00472 
00473 int packet_read(SSH_SESSION *session);
00474 int packet_translate(SSH_SESSION *session);
00475 int packet_wait(SSH_SESSION *session,int type,int blocking);
00476 int packet_flush(SSH_SESSION *session, int enforce_blocking);
00477 /* connect.c */
00478 SSH_SESSION *ssh_session_new();
00479 int ssh_connect_host(SSH_SESSION *session, const char *host,const char 
00480         *bind_addr, int port, long timeout, long usec);
00481 
00482 /* in kex.c */
00483 extern char *ssh_kex_nums[];
00484 void ssh_send_kex(SSH_SESSION *session,int server_kex);
00485 void ssh_list_kex(KEX *kex);
00486 int set_kex(SSH_SESSION *session);
00487 int ssh_get_kex(SSH_SESSION *session, int server_kex);
00488 int verify_existing_algo(int algo,char *name);
00489 char **space_tokenize(char *chain);
00490 int ssh_get_kex1(SSH_SESSION *session);
00491 char *ssh_find_matching(char *in_d, char *what_d);
00492 
00493 /* in keyfiles.c */
00494 
00495 PRIVATE_KEY  *_privatekey_from_file(void *session,char *filename,int type);
00496 
00497 /* in keys.c */
00498 char *ssh_type_to_char(int type);
00499 PUBLIC_KEY *publickey_make_dss(BUFFER *buffer);
00500 PUBLIC_KEY *publickey_make_rsa(BUFFER *buffer,char *type);
00501 PUBLIC_KEY *publickey_from_string(STRING *pubkey_s);
00502 SIGNATURE *signature_from_string(STRING *signature,PUBLIC_KEY *pubkey,int needed_type);
00503 void signature_free(SIGNATURE *sign);
00504 STRING *ssh_do_sign(SSH_SESSION *session,BUFFER *sigbuf, 
00505         PRIVATE_KEY *privatekey);
00506 STRING *ssh_sign_session_id(SSH_SESSION *session, PRIVATE_KEY *privatekey);
00507 STRING *ssh_encrypt_rsa1(SSH_SESSION *session, STRING *data, PUBLIC_KEY *key);
00508 /* channel.c */
00509 void channel_handle(SSH_SESSION *session, int type);
00510 CHANNEL *channel_new(SSH_SESSION *session);
00511 void channel_default_bufferize(CHANNEL *channel, void *data, int len,
00512         int is_stderr);
00513 u32 ssh_channel_new_id(SSH_SESSION *session);
00514 CHANNEL *ssh_channel_from_local(SSH_SESSION *session,u32 num);
00515 
00516 /* options.c */
00517 
00518 void ssh_options_free(SSH_OPTIONS *opt);
00519 /* this function must be called when no specific username has been asked. it has to guess it */
00520 int ssh_options_default_username(SSH_OPTIONS *opt);
00521 int ssh_options_default_ssh_dir(SSH_OPTIONS *opt);
00522 int ssh_options_default_known_hosts_file(SSH_OPTIONS *opt);
00523 
00524 /* buffer.c */
00525 void buffer_add_ssh_string(BUFFER *buffer,STRING *string);
00526 void buffer_add_u8(BUFFER *buffer, u8 data);
00527 void buffer_add_u32(BUFFER *buffer, u32 data);
00528 void buffer_add_u64(BUFFER *buffer,u64 data);
00529 void buffer_add_data(BUFFER *buffer, void *data, int len);
00530 void buffer_add_data_begin(BUFFER *buffer,void *data,int len);
00531 void buffer_add_buffer(BUFFER *buffer, BUFFER *source);
00532 void buffer_reinit(BUFFER *buffer);
00533 
00534 /* buffer_get_rest returns a pointer to the current position into the buffer */
00535 void *buffer_get_rest(BUFFER *buffer);
00536 /* buffer_get_rest_len returns the number of bytes which can be read */
00537 int buffer_get_rest_len(BUFFER *buffer);
00538 
00539 /* buffer_read_*() returns the number of bytes read, except for ssh strings */
00540 int buffer_get_u8(BUFFER *buffer,u8 *data);
00541 int buffer_get_u32(BUFFER *buffer,u32 *data);
00542 int buffer_get_u64(BUFFER *buffer, u64 *data);
00543 
00544 int buffer_get_data(BUFFER *buffer,void *data,int requestedlen);
00545 /* buffer_get_ssh_string() is an exception. if the String read is too large or invalid, it will answer NULL. */
00546 STRING *buffer_get_ssh_string(BUFFER *buffer);
00547 /* gets a string out of a SSH-1 mpint */
00548 STRING *buffer_get_mpint(BUFFER *buffer);
00549 /* buffer_pass_bytes acts as if len bytes have been read (used for padding) */
00550 int buffer_pass_bytes_end(BUFFER *buffer,int len);
00551 int buffer_pass_bytes(BUFFER *buffer, int len);
00552 
00553 /* in base64.c */
00554 BUFFER *base64_to_bin(char *source);
00555 unsigned char *bin_to_base64(unsigned char *source, int len);
00556 
00557 /* gzip.c */
00558 int compress_buffer(SSH_SESSION *session,BUFFER *buf);
00559 int decompress_buffer(SSH_SESSION *session,BUFFER *buf);
00560 
00561 /* wrapper.c */
00562 int crypt_set_algorithms(SSH_SESSION *);
00563 int crypt_set_algorithms_server(SSH_SESSION *session);
00564 CRYPTO *crypto_new();
00565 void crypto_free(CRYPTO *crypto);
00566 
00567 /* crc32.c */
00568 u32 ssh_crc32(char *buffer, int len);
00569 
00570 /* auth1.c */
00571 int ssh_userauth1_none(SSH_SESSION *session, char *username);
00572 int ssh_userauth1_offer_pubkey(SSH_SESSION *session, char *username,
00573         int type, STRING *pubkey);
00574 int ssh_userauth1_password(SSH_SESSION *session, char *username, 
00575         char *password);
00576 /* in misc.c */
00577 /* gets the user home dir. */
00578 char *ssh_get_user_home_dir();
00579 int ssh_file_readaccess_ok(char *file);
00580 
00581 /* macro for byte ordering */
00582 u64 ntohll(u64);
00583 #define htonll(x) ntohll(x)
00584 
00585 /* channels1.c */
00586 int channel_open_session1(CHANNEL *channel);
00587 int channel_request_pty_size1(CHANNEL *channel, char *terminal,int cols, 
00588         int rows);
00589 int channel_change_pty_size1(CHANNEL *channel, int cols, int rows);
00590 int channel_request_shell1(CHANNEL *channel);
00591 int channel_request_exec1(CHANNEL *channel, char *cmd);
00592 void channel_handle1(SSH_SESSION *session,int type);
00593 int channel_write1(CHANNEL *channel, void *data, int len);
00594 
00595 /* session.c */
00596 
00597 int ssh_handle_packets(SSH_SESSION *session);
00598 
00599 #ifdef HAVE_LIBGCRYPT
00600 /* gcrypt_missing.c */
00601 int my_gcry_dec2bn(bignum *bn, const char *data);
00602 char *my_gcry_bn2dec(bignum bn);
00603 #endif /* !HAVE_LIBGCRYPT */
00604 
00605 #ifdef __cplusplus
00606 } ;
00607 #endif
00608 
00609 #endif /* _LIBSSH_PRIV_H */

Generated on Thu Aug 16 16:17:23 2007 for libssh by  doxygen 1.5.3