gcrypt + SSH1 bug resolved
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@174 7dcaeef0-15fb-0310-b436-a5af3365683c
Этот коммит содержится в:
родитель
507ea1e90f
Коммит
ff515b5528
15
libssh/dh.c
15
libssh/dh.c
@ -67,22 +67,19 @@ static bignum g;
|
|||||||
static bignum p;
|
static bignum p;
|
||||||
static int ssh_crypto_inited=0;
|
static int ssh_crypto_inited=0;
|
||||||
|
|
||||||
/* maybe it might be enhanced .... */
|
|
||||||
/* XXX Do it. */
|
|
||||||
int ssh_get_random(void *where, int len, int strong){
|
int ssh_get_random(void *where, int len, int strong){
|
||||||
if(strong){
|
|
||||||
#ifdef HAVE_LIBGCRYPT
|
#ifdef HAVE_LIBGCRYPT
|
||||||
gcry_randomize(where,len,GCRY_VERY_STRONG_RANDOM);
|
// not using GCRY_VERY_STRONG_RANDOM which is a bit overkill
|
||||||
return 1;
|
gcry_randomize(where,len,GCRY_STRONG_RANDOM);
|
||||||
} else {
|
return 1;
|
||||||
gcry_randomize(where,len,GCRY_STRONG_RANDOM);
|
|
||||||
return 1;
|
|
||||||
#elif defined HAVE_LIBCRYPTO
|
#elif defined HAVE_LIBCRYPTO
|
||||||
|
if(strong){
|
||||||
return RAND_bytes(where,len);
|
return RAND_bytes(where,len);
|
||||||
} else {
|
} else {
|
||||||
return RAND_pseudo_bytes(where,len);
|
return RAND_pseudo_bytes(where,len);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -497,6 +497,7 @@ int ssh_get_kex1(SSH_SESSION *session){
|
|||||||
}
|
}
|
||||||
session->current_crypto=session->next_crypto;
|
session->current_crypto=session->next_crypto;
|
||||||
session->next_crypto=NULL;
|
session->next_crypto=NULL;
|
||||||
|
ssh_log(session,SSH_LOG_PROTOCOL,"Waiting for a SSH_SMSG_SUCCESS");
|
||||||
if(packet_wait(session,SSH_SMSG_SUCCESS,1)){
|
if(packet_wait(session,SSH_SMSG_SUCCESS,1)){
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
snprintf(buffer,sizeof(buffer),"Key exchange failed : %s",ssh_get_error(session));
|
snprintf(buffer,sizeof(buffer),"Key exchange failed : %s",ssh_get_error(session));
|
||||||
|
@ -69,7 +69,7 @@ PUBLIC_KEY *publickey_make_dss(SSH_SESSION *session, BUFFER *buffer){
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_LIBGCRYPT
|
#ifdef HAVE_LIBGCRYPT
|
||||||
gcry_sexp_build(&key->dsa_pub,session,"(public-key(dsa(p %b)(q %b)(g %b)(y %b)))",string_len(p),p->string,string_len(q),q->string,string_len(g),g->string,string_len(pubkey),pubkey->string);
|
gcry_sexp_build(&key->dsa_pub,NULL,"(public-key(dsa(p %b)(q %b)(g %b)(y %b)))",string_len(p),p->string,string_len(q),q->string,string_len(g),g->string,string_len(pubkey),pubkey->string);
|
||||||
#elif defined HAVE_LIBCRYPTO
|
#elif defined HAVE_LIBCRYPTO
|
||||||
key->dsa_pub=DSA_new();
|
key->dsa_pub=DSA_new();
|
||||||
key->dsa_pub->p=make_string_bn(p);
|
key->dsa_pub->p=make_string_bn(p);
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#else
|
#else
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user