From 0dbfc1da4ab0235e114eb301f14da18e8fe81c8e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lutz=20J=C3=A4nicke?= Date: Thu, 15 Feb 2001 10:35:29 +0000 Subject: [PATCH] Add '-rand' option to s_server and s_client. --- CHANGES | 3 +++ apps/s_client.c | 16 +++++++++++++++- apps/s_server.c | 16 +++++++++++++++- doc/apps/s_client.pod | 9 +++++++++ doc/apps/s_server.pod | 9 +++++++++ 5 files changed, 51 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 5d6cd7e238..0e89e59406 100644 --- a/CHANGES +++ b/CHANGES @@ -151,6 +151,9 @@ *) Added several new manual pages for SSL_* function. [Lutz Jaenicke] + *) Add "-rand" option also to s_client and s_server. + [Lutz Jaenicke] + Changes between 0.9.5a and 0.9.6 [24 Sep 2000] *) In ssl23_get_client_hello, generate an error message when faced diff --git a/apps/s_client.c b/apps/s_client.c index c93531718a..323358836c 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -152,6 +152,7 @@ static void sc_usage(void) BIO_printf(bio_err," -bugs - Switch on all SSL implementation bug workarounds\n"); BIO_printf(bio_err," -cipher - preferred cipher to use, use the 'openssl ciphers'\n"); BIO_printf(bio_err," command to see what is available\n"); + BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); } @@ -179,6 +180,7 @@ int MAIN(int argc, char **argv) int prexit = 0; SSL_METHOD *meth=NULL; BIO *sbio; + char *inrand=NULL; #ifdef WINDOWS struct timeval tv; #endif @@ -316,6 +318,11 @@ int MAIN(int argc, char **argv) else if (strcmp(*argv,"-nbio") == 0) { c_nbio=1; } #endif + else if (strcmp(*argv,"-rand") == 0) + { + if (--argc < 1) goto bad; + inrand= *(++argv); + } else { BIO_printf(bio_err,"unknown option %s\n",*argv); @@ -332,7 +339,14 @@ bad: goto end; } - app_RAND_load_file(NULL, bio_err, 0); + if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL + && !RAND_status()) + { + BIO_printf(bio_err,"warning, not much extra random data, consider using the -rand option\n"); + } + if (inrand != NULL) + BIO_printf(bio_err,"%ld semi-random bytes loaded\n", + app_RAND_load_files(inrand)); if (bio_c_out == NULL) { diff --git a/apps/s_server.c b/apps/s_server.c index b593283256..7f5af98c13 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -242,6 +242,7 @@ static void sv_usage(void) BIO_printf(bio_err," -bugs - Turn on SSL bug compatibility\n"); BIO_printf(bio_err," -www - Respond to a 'GET /' with a status page\n"); BIO_printf(bio_err," -WWW - Respond to a 'GET / HTTP/1.0' with file ./\n"); + BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); } static int local_argc=0; @@ -411,6 +412,7 @@ int MAIN(int argc, char *argv[]) int no_tmp_rsa=0,no_dhe=0,nocert=0; int state=0; SSL_METHOD *meth=NULL; + char *inrand=NULL; #ifndef NO_DH DH *dh=NULL; #endif @@ -565,6 +567,11 @@ int MAIN(int argc, char *argv[]) else if (strcmp(*argv,"-tls1") == 0) { meth=TLSv1_server_method(); } #endif + else if (strcmp(*argv,"-rand") == 0) + { + if (--argc < 1) goto bad; + inrand= *(++argv); + } else { BIO_printf(bio_err,"unknown option %s\n",*argv); @@ -581,7 +588,14 @@ bad: goto end; } - app_RAND_load_file(NULL, bio_err, 0); + if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL + && !RAND_status()) + { + BIO_printf(bio_err,"warning, not much extra random data, consider using the -rand option\n"); + } + if (inrand != NULL) + BIO_printf(bio_err,"%ld semi-random bytes loaded\n", + app_RAND_load_files(inrand)); if (bio_s_out == NULL) { diff --git a/doc/apps/s_client.pod b/doc/apps/s_client.pod index 2f80375319..f596ec71fc 100644 --- a/doc/apps/s_client.pod +++ b/doc/apps/s_client.pod @@ -32,6 +32,7 @@ B B [B<-no_tls1>] [B<-bugs>] [B<-cipher cipherlist>] +[B<-rand file(s)>] =head1 DESCRIPTION @@ -156,6 +157,14 @@ the server determines which cipher suite is used it should take the first supported cipher in the list sent by the client. See the B command for more information. +=item B<-rand file(s)> + +a file or files containing random data used to seed the random number +generator, or an EGD socket (see L). +Multiple files can be specified separated by a OS-dependent character. +The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for +all others. + =back =head1 CONNECTED COMMANDS diff --git a/doc/apps/s_server.pod b/doc/apps/s_server.pod index 0f29c361d9..bc599dc41c 100644 --- a/doc/apps/s_server.pod +++ b/doc/apps/s_server.pod @@ -39,6 +39,7 @@ B B [B<-hack>] [B<-www>] [B<-WWW>] +[B<-rand file(s)>] =head1 DESCRIPTION @@ -186,6 +187,14 @@ emulates a simple web server. Pages will be resolved relative to the current directory, for example if the URL https://myhost/page.html is requested the file ./page.html will be loaded. +=item B<-rand file(s)> + +a file or files containing random data used to seed the random number +generator, or an EGD socket (see L). +Multiple files can be specified separated by a OS-dependent character. +The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for +all others. + =back =head1 CONNECTED COMMANDS -- 2.25.1