diff options
author | Lutz Jänicke <jaenicke@openssl.org> | 2001-02-15 10:22:07 +0000 |
---|---|---|
committer | Lutz Jänicke <jaenicke@openssl.org> | 2001-02-15 10:22:07 +0000 |
commit | 52b621db88e28c12290b94b0f730204f424b44a0 (patch) | |
tree | f2ff6f6b354c6a0f9e627d0b083ba714aa01eae9 /apps | |
parent | a6ed5dd6748cdba9fe7a832e51e0dc1e5d3b7bb4 (diff) |
Add "-rand" option to s_client and s_server.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/s_client.c | 16 | ||||
-rw-r--r-- | apps/s_server.c | 16 |
2 files changed, 30 insertions, 2 deletions
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 /<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," -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) { |