Add "-rand" option to s_client and s_server.
This commit is contained in:
parent
a6ed5dd674
commit
52b621db88
@ -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," -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," command to see what is available\n");
|
||||||
BIO_printf(bio_err," -engine id - Initialise and use the specified engine\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;
|
int prexit = 0;
|
||||||
SSL_METHOD *meth=NULL;
|
SSL_METHOD *meth=NULL;
|
||||||
BIO *sbio;
|
BIO *sbio;
|
||||||
|
char *inrand=NULL;
|
||||||
char *engine_id=NULL;
|
char *engine_id=NULL;
|
||||||
ENGINE *e=NULL;
|
ENGINE *e=NULL;
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
@ -328,6 +330,11 @@ int MAIN(int argc, char **argv)
|
|||||||
if (--argc < 1) goto bad;
|
if (--argc < 1) goto bad;
|
||||||
engine_id = *(++argv);
|
engine_id = *(++argv);
|
||||||
}
|
}
|
||||||
|
else if (strcmp(*argv,"-rand") == 0)
|
||||||
|
{
|
||||||
|
if (--argc < 1) goto bad;
|
||||||
|
inrand= *(++argv);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,"unknown option %s\n",*argv);
|
BIO_printf(bio_err,"unknown option %s\n",*argv);
|
||||||
@ -344,7 +351,14 @@ bad:
|
|||||||
goto end;
|
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)
|
if (bio_c_out == NULL)
|
||||||
{
|
{
|
||||||
|
@ -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 /' 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," -WWW - Respond to a 'GET /<path> HTTP/1.0' with file ./<path>\n");
|
||||||
BIO_printf(bio_err," -engine id - Initialise and use the specified engine\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;
|
static int local_argc=0;
|
||||||
@ -417,6 +418,7 @@ int MAIN(int argc, char *argv[])
|
|||||||
int state=0;
|
int state=0;
|
||||||
SSL_METHOD *meth=NULL;
|
SSL_METHOD *meth=NULL;
|
||||||
ENGINE *e=NULL;
|
ENGINE *e=NULL;
|
||||||
|
char *inrand=NULL;
|
||||||
|
|
||||||
#if !defined(NO_SSL2) && !defined(NO_SSL3)
|
#if !defined(NO_SSL2) && !defined(NO_SSL3)
|
||||||
meth=SSLv23_server_method();
|
meth=SSLv23_server_method();
|
||||||
@ -575,6 +577,11 @@ int MAIN(int argc, char *argv[])
|
|||||||
if (--argc < 1) goto bad;
|
if (--argc < 1) goto bad;
|
||||||
engine_id= *(++argv);
|
engine_id= *(++argv);
|
||||||
}
|
}
|
||||||
|
else if (strcmp(*argv,"-rand") == 0)
|
||||||
|
{
|
||||||
|
if (--argc < 1) goto bad;
|
||||||
|
inrand= *(++argv);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,"unknown option %s\n",*argv);
|
BIO_printf(bio_err,"unknown option %s\n",*argv);
|
||||||
@ -591,7 +598,14 @@ bad:
|
|||||||
goto end;
|
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)
|
if (bio_s_out == NULL)
|
||||||
{
|
{
|
||||||
|
@ -33,6 +33,7 @@ B<openssl> B<s_client>
|
|||||||
[B<-bugs>]
|
[B<-bugs>]
|
||||||
[B<-cipher cipherlist>]
|
[B<-cipher cipherlist>]
|
||||||
[B<-engine id>]
|
[B<-engine id>]
|
||||||
|
[B<-rand file(s)>]
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=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
|
thus initialising it if needed. The engine will then be set as the default
|
||||||
for all available algorithms.
|
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<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
|
=back
|
||||||
|
|
||||||
=head1 CONNECTED COMMANDS
|
=head1 CONNECTED COMMANDS
|
||||||
|
@ -40,6 +40,7 @@ B<openssl> B<s_server>
|
|||||||
[B<-www>]
|
[B<-www>]
|
||||||
[B<-WWW>]
|
[B<-WWW>]
|
||||||
[B<-engine id>]
|
[B<-engine id>]
|
||||||
|
[B<-rand file(s)>]
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=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
|
thus initialising it if needed. The engine will then be set as the default
|
||||||
for all available algorithms.
|
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<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
|
=back
|
||||||
|
|
||||||
=head1 CONNECTED COMMANDS
|
=head1 CONNECTED COMMANDS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user