- Fixed to support 4096 bit DHM params as well

This commit is contained in:
Paul Bakker 2012-10-24 14:17:01 +00:00
parent 98fe5eaf47
commit 520ea911f6
2 changed files with 5 additions and 5 deletions

View file

@ -68,7 +68,7 @@ int main( int argc, char *argv[] )
int server_fd = -1; int server_fd = -1;
unsigned char *p, *end; unsigned char *p, *end;
unsigned char buf[1024]; unsigned char buf[2048];
unsigned char hash[20]; unsigned char hash[20];
char *pers = "dh_client"; char *pers = "dh_client";
@ -179,7 +179,7 @@ int main( int argc, char *argv[] )
goto exit; goto exit;
} }
if( dhm.len < 64 || dhm.len > 256 ) if( dhm.len < 64 || dhm.len > 512 )
{ {
ret = 1; ret = 1;
printf( " failed\n ! Invalid DHM modulus size\n\n" ); printf( " failed\n ! Invalid DHM modulus size\n\n" );
@ -218,7 +218,7 @@ int main( int argc, char *argv[] )
fflush( stdout ); fflush( stdout );
n = dhm.len; n = dhm.len;
if( ( ret = dhm_make_public( &dhm, 256, buf, n, if( ( ret = dhm_make_public( &dhm, dhm.len, buf, n,
ctr_drbg_random, &ctr_drbg ) ) != 0 ) ctr_drbg_random, &ctr_drbg ) ) != 0 )
{ {
printf( " failed\n ! dhm_make_public returned %d\n\n", ret ); printf( " failed\n ! dhm_make_public returned %d\n\n", ret );

View file

@ -68,7 +68,7 @@ int main( int argc, char *argv[] )
int listen_fd = -1; int listen_fd = -1;
int client_fd = -1; int client_fd = -1;
unsigned char buf[1024]; unsigned char buf[2048];
unsigned char hash[20]; unsigned char hash[20];
unsigned char buf2[2]; unsigned char buf2[2];
char *pers = "dh_server"; char *pers = "dh_server";
@ -181,7 +181,7 @@ int main( int argc, char *argv[] )
memset( buf, 0, sizeof( buf ) ); memset( buf, 0, sizeof( buf ) );
if( ( ret = dhm_make_params( &dhm, 256, buf, &n, if( ( ret = dhm_make_params( &dhm, mpi_size( &dhm.P ), buf, &n,
ctr_drbg_random, &ctr_drbg ) ) != 0 ) ctr_drbg_random, &ctr_drbg ) ) != 0 )
{ {
printf( " failed\n ! dhm_make_params returned %d\n\n", ret ); printf( " failed\n ! dhm_make_params returned %d\n\n", ret );