From 520ea911f6de2c04d3d71e02fa8a1cb227a06e0e Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Wed, 24 Oct 2012 14:17:01 +0000
Subject: [PATCH] - Fixed to support 4096 bit DHM params as well
---
programs/pkey/dh_client.c | 6 +++---
programs/pkey/dh_server.c | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/programs/pkey/dh_client.c b/programs/pkey/dh_client.c
index 381050782..db9283a08 100644
--- a/programs/pkey/dh_client.c
+++ b/programs/pkey/dh_client.c
@@ -68,7 +68,7 @@ int main( int argc, char *argv[] )
int server_fd = -1;
unsigned char *p, *end;
- unsigned char buf[1024];
+ unsigned char buf[2048];
unsigned char hash[20];
char *pers = "dh_client";
@@ -179,7 +179,7 @@ int main( int argc, char *argv[] )
goto exit;
}
- if( dhm.len < 64 || dhm.len > 256 )
+ if( dhm.len < 64 || dhm.len > 512 )
{
ret = 1;
printf( " failed\n ! Invalid DHM modulus size\n\n" );
@@ -218,7 +218,7 @@ int main( int argc, char *argv[] )
fflush( stdout );
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 )
{
printf( " failed\n ! dhm_make_public returned %d\n\n", ret );
diff --git a/programs/pkey/dh_server.c b/programs/pkey/dh_server.c
index d7133f7c7..8babef29d 100644
--- a/programs/pkey/dh_server.c
+++ b/programs/pkey/dh_server.c
@@ -68,7 +68,7 @@ int main( int argc, char *argv[] )
int listen_fd = -1;
int client_fd = -1;
- unsigned char buf[1024];
+ unsigned char buf[2048];
unsigned char hash[20];
unsigned char buf2[2];
char *pers = "dh_server";
@@ -181,7 +181,7 @@ int main( int argc, char *argv[] )
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 )
{
printf( " failed\n ! dhm_make_params returned %d\n\n", ret );