deps: add -no_rand_screen to openssl s_client
In openssl s_client on Windows, RAND_screen() is invoked to initialize random state but it takes several seconds in each connection. This added -no_rand_screen to openssl s_client on Windows to skip RAND_screen() and gets a better performance in the unit test of test-tls-server-verify. Do not enable this except to use in the unit test. Fixes: https://github.com/nodejs/io.js/issues/1461 PR-URL: https://github.com/nodejs/io.js/pull/1836 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
parent
4cf323d23d
commit
0ee497f0b4
14
deps/openssl/openssl/apps/app_rand.c
vendored
14
deps/openssl/openssl/apps/app_rand.c
vendored
@ -124,10 +124,16 @@ int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn)
|
|||||||
char buffer[200];
|
char buffer[200];
|
||||||
|
|
||||||
#ifdef OPENSSL_SYS_WINDOWS
|
#ifdef OPENSSL_SYS_WINDOWS
|
||||||
BIO_printf(bio_e, "Loading 'screen' into random state -");
|
/*
|
||||||
BIO_flush(bio_e);
|
* allocate 2 to dont_warn not to use RAND_screen() via
|
||||||
RAND_screen();
|
* -no_rand_screen option in s_client
|
||||||
BIO_printf(bio_e, " done\n");
|
*/
|
||||||
|
if (dont_warn != 2) {
|
||||||
|
BIO_printf(bio_e, "Loading 'screen' into random state -");
|
||||||
|
BIO_flush(bio_e);
|
||||||
|
RAND_screen();
|
||||||
|
BIO_printf(bio_e, " done\n");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
|
11
deps/openssl/openssl/apps/s_client.c
vendored
11
deps/openssl/openssl/apps/s_client.c
vendored
@ -236,6 +236,7 @@ static BIO *bio_c_msg = NULL;
|
|||||||
static int c_quiet = 0;
|
static int c_quiet = 0;
|
||||||
static int c_ign_eof = 0;
|
static int c_ign_eof = 0;
|
||||||
static int c_brief = 0;
|
static int c_brief = 0;
|
||||||
|
static int c_no_rand_screen = 0;
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_PSK
|
#ifndef OPENSSL_NO_PSK
|
||||||
/* Default PSK identity and key */
|
/* Default PSK identity and key */
|
||||||
@ -446,6 +447,10 @@ static void sc_usage(void)
|
|||||||
" -keymatexport label - Export keying material using label\n");
|
" -keymatexport label - Export keying material using label\n");
|
||||||
BIO_printf(bio_err,
|
BIO_printf(bio_err,
|
||||||
" -keymatexportlen len - Export len bytes of keying material (default 20)\n");
|
" -keymatexportlen len - Export len bytes of keying material (default 20)\n");
|
||||||
|
#ifdef OPENSSL_SYS_WINDOWS
|
||||||
|
BIO_printf(bio_err,
|
||||||
|
" -no_rand_screen - Do not use RAND_screen() to initialize random state\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_TLSEXT
|
#ifndef OPENSSL_NO_TLSEXT
|
||||||
@ -1125,6 +1130,10 @@ int MAIN(int argc, char **argv)
|
|||||||
keymatexportlen = atoi(*(++argv));
|
keymatexportlen = atoi(*(++argv));
|
||||||
if (keymatexportlen == 0)
|
if (keymatexportlen == 0)
|
||||||
goto bad;
|
goto bad;
|
||||||
|
#ifdef OPENSSL_SYS_WINDOWS
|
||||||
|
} else if (strcmp(*argv, "-no_rand_screen") == 0) {
|
||||||
|
c_no_rand_screen = 1;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
BIO_printf(bio_err, "unknown option %s\n", *argv);
|
BIO_printf(bio_err, "unknown option %s\n", *argv);
|
||||||
badop = 1;
|
badop = 1;
|
||||||
@ -1230,7 +1239,7 @@ int MAIN(int argc, char **argv)
|
|||||||
if (!load_excert(&exc, bio_err))
|
if (!load_excert(&exc, bio_err))
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL
|
if (!app_RAND_load_file(NULL, bio_err, ++c_no_rand_screen) && inrand == NULL
|
||||||
&& !RAND_status()) {
|
&& !RAND_status()) {
|
||||||
BIO_printf(bio_err,
|
BIO_printf(bio_err,
|
||||||
"warning, not much extra random data, consider using the -rand option\n");
|
"warning, not much extra random data, consider using the -rand option\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user