summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorLutz Jänicke <jaenicke@openssl.org>2001-02-15 10:35:29 +0000
committerLutz Jänicke <jaenicke@openssl.org>2001-02-15 10:35:29 +0000
commit0dbfc1da4ab0235e114eb301f14da18e8fe81c8e (patch)
treef5b86c1a3461d49868aca8d9e610def4985471a6 /apps
parentf9450406332365856423d10289e8f0dbe1fd87f0 (diff)
Add '-rand' option to s_server and s_client.
Diffstat (limited to 'apps')
-rw-r--r--apps/s_client.c16
-rw-r--r--apps/s_server.c16
2 files changed, 30 insertions, 2 deletions
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 /<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)
{