From: Lutz Jänicke Date: Thu, 15 Feb 2001 10:22:07 +0000 (+0000) Subject: Add "-rand" option to s_client and s_server. X-Git-Tag: OpenSSL_0_9_6a-beta1~32^2~19 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=52b621db88e28c12290b94b0f730204f424b44a0;p=oweals%2Fopenssl.git Add "-rand" option to s_client and s_server. --- diff --git a/apps/s_client.c b/apps/s_client.c index 2e71b42890..a129a49416 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -155,6 +155,7 @@ static void sc_usage(void) 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," -engine id - Initialise and use the specified engine\n"); + BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); } @@ -182,6 +183,7 @@ int MAIN(int argc, char **argv) int prexit = 0; SSL_METHOD *meth=NULL; BIO *sbio; + char *inrand=NULL; char *engine_id=NULL; ENGINE *e=NULL; #ifdef WINDOWS @@ -328,6 +330,11 @@ int MAIN(int argc, char **argv) if (--argc < 1) goto bad; engine_id = *(++argv); } + else if (strcmp(*argv,"-rand") == 0) + { + if (--argc < 1) goto bad; + inrand= *(++argv); + } else { BIO_printf(bio_err,"unknown option %s\n",*argv); @@ -344,7 +351,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 1a9ce281c3..86d2ca70c4 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -247,6 +247,7 @@ static void sv_usage(void) 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," -engine id - Initialise and use the specified engine\n"); + BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); } static int local_argc=0; @@ -417,6 +418,7 @@ int MAIN(int argc, char *argv[]) int state=0; SSL_METHOD *meth=NULL; ENGINE *e=NULL; + char *inrand=NULL; #if !defined(NO_SSL2) && !defined(NO_SSL3) meth=SSLv23_server_method(); @@ -575,6 +577,11 @@ int MAIN(int argc, char *argv[]) if (--argc < 1) goto bad; engine_id= *(++argv); } + else if (strcmp(*argv,"-rand") == 0) + { + if (--argc < 1) goto bad; + inrand= *(++argv); + } else { BIO_printf(bio_err,"unknown option %s\n",*argv); @@ -591,7 +598,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 9df1c07fb7..8d2939a9da 100644 --- a/doc/apps/s_client.pod +++ b/doc/apps/s_client.pod @@ -33,6 +33,7 @@ B B [B<-bugs>] [B<-cipher cipherlist>] [B<-engine id>] +[B<-rand file(s)>] =head1 DESCRIPTION @@ -164,6 +165,14 @@ to attempt to obtain a functional reference to the specified engine, thus initialising it if needed. The engine will then be set as the default for all available algorithms. +=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 fcb52226dd..c59aed5c8e 100644 --- a/doc/apps/s_server.pod +++ b/doc/apps/s_server.pod @@ -40,6 +40,7 @@ B B [B<-www>] [B<-WWW>] [B<-engine id>] +[B<-rand file(s)>] =head1 DESCRIPTION @@ -194,6 +195,14 @@ to attempt to obtain a functional reference to the specified engine, thus initialising it if needed. The engine will then be set as the default for all available algorithms. +=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