Add '-rand' option to s_server and s_client.

This commit is contained in:
Lutz Jänicke 2001-02-15 10:35:29 +00:00
parent f945040633
commit 0dbfc1da4a
5 changed files with 51 additions and 2 deletions

View file

@ -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

View 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)
{

View 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)
{

View 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

View 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