diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2005-08-19 11:12:29 +0000 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2005-08-19 11:12:29 +0000 |
commit | f23685f92b91aa53546a81bf7793c38a45df15d3 (patch) | |
tree | 026ff7769a0fd003d8930d421f5146bf731f97d3 /libssh | |
parent | d95242d2cde747151953387053a9649bd525d265 (diff) | |
download | libssh-f23685f92b91aa53546a81bf7793c38a45df15d3.tar.gz libssh-f23685f92b91aa53546a81bf7793c38a45df15d3.tar.xz libssh-f23685f92b91aa53546a81bf7793c38a45df15d3.zip |
stdint.patch, debug_output.patch, ssh_12_select.patch,
solaris_7.patch and args_in_decl.patch from Norbert.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@12 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh')
-rw-r--r-- | libssh/kex.c | 6 | ||||
-rw-r--r-- | libssh/options.c | 17 |
2 files changed, 16 insertions, 7 deletions
diff --git a/libssh/kex.c b/libssh/kex.c index a7d3a175..6716fc92 100644 --- a/libssh/kex.c +++ b/libssh/kex.c @@ -287,13 +287,17 @@ static STRING *make_rsa1_string(STRING *e, STRING *n){ static void build_session_id1(SSH_SESSION *session, STRING *servern, STRING *hostn){ MD5CTX *md5=md5_init(); +#ifdef DEBUG_CRYPTO ssh_print_hexa("host modulus",hostn->string,string_len(hostn)); ssh_print_hexa("server modulus",servern->string,string_len(servern)); +#endif md5_update(md5,hostn->string,string_len(hostn)); md5_update(md5,servern->string,string_len(servern)); md5_update(md5,session->server_kex.cookie,8); md5_final(session->next_crypto->session_id,md5); +#ifdef DEBUG_CRYPTO ssh_print_hexa("session_id",session->next_crypto->session_id,MD5_DIGEST_LEN); +#endif } STRING *encrypt_session_key(SSH_SESSION *session, PUBLIC_KEY *svrkey, @@ -307,7 +311,9 @@ STRING *encrypt_session_key(SSH_SESSION *session, PUBLIC_KEY *svrkey, memcpy(buffer,session->next_crypto->encryptkey,32); memcpy(session->next_crypto->decryptkey, session->next_crypto->encryptkey,32); +#ifdef DEBUG_CRYPTO ssh_print_hexa("session key",buffer,32); +#endif /* xor session key with session_id */ for (i=0;i<16;++i) buffer[i]^=session->next_crypto->session_id[i]; diff --git a/libssh/options.c b/libssh/options.c index e1c166d5..3695a83e 100644 --- a/libssh/options.c +++ b/libssh/options.c @@ -34,7 +34,11 @@ SSH_OPTIONS *ssh_options_new(){ option->port=22; /* set the default port */ option->fd=-1; option->ssh2allowed=1; +#ifdef HAVE_SSH1 + option->ssh1allowed=1; +#else option->ssh1allowed=0; +#endif option->bindport=22; return option; } @@ -283,7 +287,11 @@ int ssh_options_getopt(SSH_OPTIONS *options, int *argcptr, char **argv){ char *identity=NULL; char **save=malloc(argc * sizeof(char *)); int current=0; +#ifdef HAVE_SSH1 + int ssh1=1; +#else int ssh1=0; +#endif int ssh2=1; int saveoptind=optind; /* need to save 'em */ @@ -384,13 +392,8 @@ int ssh_options_getopt(SSH_OPTIONS *options, int *argcptr, char **argv){ ssh_options_set_bind(options,localaddr,0); ssh_options_set_port(options,port); options->bindport=port; - if(ssh1){ - ssh_options_allow_ssh1(options,1); - ssh_options_allow_ssh2(options,0); - } else { // default behaviour - ssh_options_allow_ssh1(options,0); - ssh_options_allow_ssh2(options,1); - } + ssh_options_allow_ssh1(options,ssh1); + ssh_options_allow_ssh2(options,ssh2); if(!cont){ return -1; |