summaryrefslogtreecommitdiffstats
path: root/libssh/dh.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2008-06-17 01:06:53 +0000
committerAris Adamantiadis <aris@0xbadc0de.be>2008-06-17 01:06:53 +0000
commitff515b55282a62cb7c39d7c72d48fa8e1d2b11e4 (patch)
tree68217f3e805c54cd9d4c8c6f6922e61b40f32346 /libssh/dh.c
parent507ea1e90f7561c0c3c835d004bacb1b66ee3eeb (diff)
downloadlibssh-ff515b55282a62cb7c39d7c72d48fa8e1d2b11e4.tar.gz
libssh-ff515b55282a62cb7c39d7c72d48fa8e1d2b11e4.tar.xz
libssh-ff515b55282a62cb7c39d7c72d48fa8e1d2b11e4.zip
gcrypt + SSH1 bug resolved
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@174 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/dh.c')
-rw-r--r--libssh/dh.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/libssh/dh.c b/libssh/dh.c
index bfbab9cd..35d130c2 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
}