From: Margaret Wasserman Date: Wed, 9 Jan 2013 13:53:11 +0000 (-0500) Subject: Generate DH paramters using a randomly generated public key. X-Git-Tag: 1.0~71 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=trust_router.git;a=commitdiff_plain;h=9d91a8f919bcb23a2618751c51fde7551af46152 Generate DH paramters using a randomly generated public key. --- diff --git a/common/dh_test/dh_test.c b/common/dh_test/dh_test.c index eabe984..4122669 100644 --- a/common/dh_test/dh_test.c +++ b/common/dh_test/dh_test.c @@ -37,19 +37,19 @@ #include -char tmp_key1[32] = - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x19, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; - -char tmp_key2[32] = - {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04}; - -int tmp_len = 32; +// char tmp_key1[32] = +// {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, +// 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, +// 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, +// 0x19, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; +// +// char tmp_key2[32] = +// {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +// 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, +// 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, +// 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04}; +// +// int tmp_len = 32; int main (int argc, const char *argv[]) @@ -63,7 +63,7 @@ int main (int argc, /* TBD -- Generate random private keys */ /* Generate initial DH params on the client side */ - if (NULL == (c_dh = tr_create_dh_params(tmp_key1, tmp_len))) { + if (NULL == (c_dh = tr_create_dh_params(NULL, 0))) { printf("Error: Can't create client DH params, exiting.\n"); exit(1); } @@ -75,7 +75,7 @@ int main (int argc, /*** Would now send DH params and client's public key to the server ***/ /* Generate DH params on the server side */ - if (NULL == (s_dh = tr_create_matching_dh(tmp_key2, tmp_len, c_dh))) { + if (NULL == (s_dh = tr_create_matching_dh(NULL, 0, c_dh))) { printf("Error: Can't create server server DH params, exiting.\n"); exit(1); }