aboutsummaryrefslogtreecommitdiff
path: root/libssh/kex.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2005-10-25 23:11:41 +0000
committerAris Adamantiadis <aris@0xbadc0de.be>2005-10-25 23:11:41 +0000
commit9a2683f183338da7c82261d502cdeff0855c210c (patch)
tree7a3f8ba8b1b754a1dd49c28bd175403d96d6ec2d /libssh/kex.c
parentd86f0017545f0076a1136b5c6f8b0a7a58366342 (diff)
downloadlibssh-9a2683f183338da7c82261d502cdeff0855c210c.tar.gz
libssh-9a2683f183338da7c82261d502cdeff0855c210c.tar.xz
libssh-9a2683f183338da7c82261d502cdeff0855c210c.zip
added Jean-Philippe's patch for libtools. it doesn't compile on my computer.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@40 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/kex.c')
-rw-r--r--libssh/kex.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/libssh/kex.c b/libssh/kex.c
index e069bf79..5097b06c 100644
--- a/libssh/kex.c
+++ b/libssh/kex.c
@@ -21,6 +21,7 @@ MA 02111-1307, USA. */
#include <string.h>
#include <stdlib.h>
+#include <stdio.h>
#include <netdb.h>
#include "libssh/priv.h"
#include "libssh/ssh2.h"
@@ -309,9 +310,21 @@ static void build_session_id1(SSH_SESSION *session, STRING *servern,
/* returns 1 if the modulus of k1 is < than the one of k2 */
static int modulus_smaller(PUBLIC_KEY *k1, PUBLIC_KEY *k2){
- RSA *r1=k1->rsa_pub;
- RSA *r2=k2->rsa_pub;
- if(BN_cmp(r1->n,r2->n)<0)
+ bignum n1;
+ bignum n2;
+#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);
+ gcry_sexp_release(sexp);
+ sexp=gcry_sexp_find_token(k2->rsa_pub,"n",0);
+ n2=gcry_sexp_nth_mpi(sexp,1,GCRYMPI_FMT_STD);
+ 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;
else
return 0;