Add '-rand' option to s_server and s_client.
authorLutz Jänicke <jaenicke@openssl.org>
Thu, 15 Feb 2001 10:35:29 +0000 (10:35 +0000)
committerLutz Jänicke <jaenicke@openssl.org>
Thu, 15 Feb 2001 10:35:29 +0000 (10:35 +0000)
CHANGES
apps/s_client.c
apps/s_server.c
doc/apps/s_client.pod
doc/apps/s_server.pod

diff --git a/CHANGES b/CHANGES
index 5d6cd7e2385e8509459d6ec60f8b595a525d5fd7..0e89e594060b3001726bc68c55efade3970ce12b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
   *) 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
index c93531718a4eeb8d2cf8a01b314934d117309ee1..323358836c09f8e301ff551f3d4e8522fb00aea1 100644 (file)
@@ -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)
                {
index b5932832569a693eb6db6e883d33226ea8214eb9..7f5af98c139f1b9d904dece5df9da8e9cf419061 100644 (file)
@@ -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 /<path> HTTP/1.0' with file ./<path>\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)
                {
index 2f8037531996023379ee76e036278c47f99bf0d3..f596ec71fc7a45b83e98e5e91b0aab9f12941553 100644 (file)
@@ -32,6 +32,7 @@ B<openssl> B<s_client>
 [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<ciphers>
 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<RAND_egd(3)|RAND_egd(3)>).
+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
index 0f29c361d90b2841c3829fc7b1a833dc2f499816..bc599dc41ca4b901228a87fcf806865efcf0a065 100644 (file)
@@ -39,6 +39,7 @@ B<openssl> B<s_client>
 [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<RAND_egd(3)|RAND_egd(3)>).
+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