From ff515b55282a62cb7c39d7c72d48fa8e1d2b11e4 Mon Sep 17 00:00:00 2001 From: Aris Adamantiadis Date: Tue, 17 Jun 2008 01:06:53 +0000 Subject: gcrypt + SSH1 bug resolved git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@174 7dcaeef0-15fb-0310-b436-a5af3365683c --- libssh/dh.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'libssh/dh.c') diff --git a/libssh/dh.c b/libssh/dh.c index bfbab9c..35d130c 100644 --- a/libssh/dh.c +++ b/libssh/dh.c @@ -67,22 +67,19 @@ static bignum g; static bignum p; static int ssh_crypto_inited=0; -/* maybe it might be enhanced .... */ -/* XXX Do it. */ int ssh_get_random(void *where, int len, int strong){ - if(strong){ + #ifdef HAVE_LIBGCRYPT - gcry_randomize(where,len,GCRY_VERY_STRONG_RANDOM); - return 1; - } else { - gcry_randomize(where,len,GCRY_STRONG_RANDOM); - return 1; + // not using GCRY_VERY_STRONG_RANDOM which is a bit overkill + gcry_randomize(where,len,GCRY_STRONG_RANDOM); + return 1; #elif defined HAVE_LIBCRYPTO + if(strong){ return RAND_bytes(where,len); } else { return RAND_pseudo_bytes(where,len); -#endif } +#endif } -- cgit