diff options
author | Jean-Philippe Garcia Ballester <giga@le-pec.org> | 2005-11-25 09:31:33 +0000 |
---|---|---|
committer | Jean-Philippe Garcia Ballester <giga@le-pec.org> | 2005-11-25 09:31:33 +0000 |
commit | ac4fd091775805b6849774f3c4b7e59dc1ab6bde (patch) | |
tree | 0e2b654829aa923b68fecbe67e056a71a71e3f07 /libssh/kex.c | |
parent | d923851664f20f7143981dde3562ae9d6ce0b72e (diff) | |
download | libssh-ac4fd091775805b6849774f3c4b7e59dc1ab6bde.tar.gz libssh-ac4fd091775805b6849774f3c4b7e59dc1ab6bde.tar.xz libssh-ac4fd091775805b6849774f3c4b7e59dc1ab6bde.zip |
Added support for known_hosts format version 1
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@51 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/kex.c')
-rw-r--r-- | libssh/kex.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libssh/kex.c b/libssh/kex.c index 5097b06c..1d66f28b 100644 --- a/libssh/kex.c +++ b/libssh/kex.c @@ -312,22 +312,29 @@ static void build_session_id1(SSH_SESSION *session, STRING *servern, static int modulus_smaller(PUBLIC_KEY *k1, PUBLIC_KEY *k2){ bignum n1; bignum n2; + int res; #ifdef HAVE_LIBGCRYPT gcry_sexp_t sexp; sexp=gcry_sexp_find_token(k1->rsa_pub,"n",0); - n1=gcry_sexp_nth_mpi(sexp,1,GCRYMPI_FMT_STD); + n1=gcry_sexp_nth_mpi(sexp,1,GCRYMPI_FMT_USG); gcry_sexp_release(sexp); sexp=gcry_sexp_find_token(k2->rsa_pub,"n",0); - n2=gcry_sexp_nth_mpi(sexp,1,GCRYMPI_FMT_STD); + n2=gcry_sexp_nth_mpi(sexp,1,GCRYMPI_FMT_USG); gcry_sexp_release(sexp); #elif defined HAVE_LIBCRYPTO n1=k1->rsa_pub->n; n2=k2->rsa_pub->n; #endif if(bignum_cmp(n1,n2)<0) - return 1; + res=1; else - return 0; + res=0; +#ifdef HAVE_LIBGCRYPT + bignum_free(n1); + bignum_free(n2); +#endif + return res; + } #define ABS(A) ( (A)<0 ? -(A):(A) ) |