summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorraja-ashok <rashok.svks@gmail.com>2019-09-19 16:07:21 +0530
committerMatt Caswell <matt@openssl.org>2019-09-23 08:16:15 +0100
commit7757a90e263da73542f9b12c4061af81812367bf (patch)
treefa876acdbbef99f3704aa507d5bf5a2259a885a7 /apps
parent320408382046db015c9a9cc04ae91c2bcd0e5c4c (diff)
Add TLS version options to s_time
Reviewed-by: Paul Yang <kaishen.yy@antfin.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9947)
Diffstat (limited to 'apps')
-rw-r--r--apps/s_time.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/apps/s_time.c b/apps/s_time.c
index 39e3d4bb48..f6dbfa0462 100644
--- a/apps/s_time.c
+++ b/apps/s_time.c
@@ -47,7 +47,7 @@ typedef enum OPTION_choice {
OPT_CONNECT, OPT_CIPHER, OPT_CIPHERSUITES, OPT_CERT, OPT_NAMEOPT, OPT_KEY,
OPT_CAPATH, OPT_CAFILE, OPT_NOCAPATH, OPT_NOCAFILE, OPT_NEW, OPT_REUSE,
OPT_BUGS, OPT_VERIFY, OPT_TIME, OPT_SSL3,
- OPT_WWW
+ OPT_WWW, OPT_TLS1, OPT_TLS1_1, OPT_TLS1_2, OPT_TLS1_3
} OPTION_CHOICE;
const OPTIONS s_time_options[] = {
@@ -76,6 +76,18 @@ const OPTIONS s_time_options[] = {
#ifndef OPENSSL_NO_SSL3
{"ssl3", OPT_SSL3, '-', "Just use SSLv3"},
#endif
+#ifndef OPENSSL_NO_TLS1
+ {"tls1", OPT_TLS1, '-', "Just use TLSv1.0"},
+#endif
+#ifndef OPENSSL_NO_TLS1_1
+ {"tls1_1", OPT_TLS1_1, '-', "Just use TLSv1.1"},
+#endif
+#ifndef OPENSSL_NO_TLS1_2
+ {"tls1_2", OPT_TLS1_2, '-', "Just use TLSv1.2"},
+#endif
+#ifndef OPENSSL_NO_TLS1_3
+ {"tls1_3", OPT_TLS1_3, '-', "Just use TLSv1.3"},
+#endif
{NULL}
};
@@ -101,7 +113,7 @@ int s_time_main(int argc, char **argv)
int maxtime = SECONDS, nConn = 0, perform = 3, ret = 1, i, st_bugs = 0;
long bytes_read = 0, finishtime = 0;
OPTION_CHOICE o;
- int max_version = 0, ver, buf_len;
+ int min_version = 0, max_version = 0, ver, buf_len;
size_t buf_size;
meth = TLS_client_method();
@@ -177,8 +189,25 @@ int s_time_main(int argc, char **argv)
}
break;
case OPT_SSL3:
+ min_version = SSL3_VERSION;
max_version = SSL3_VERSION;
break;
+ case OPT_TLS1:
+ min_version = TLS1_VERSION;
+ max_version = TLS1_VERSION;
+ break;
+ case OPT_TLS1_1:
+ min_version = TLS1_1_VERSION;
+ max_version = TLS1_1_VERSION;
+ break;
+ case OPT_TLS1_2:
+ min_version = TLS1_2_VERSION;
+ max_version = TLS1_2_VERSION;
+ break;
+ case OPT_TLS1_3:
+ min_version = TLS1_3_VERSION;
+ max_version = TLS1_3_VERSION;
+ break;
}
}
argc = opt_num_rest();
@@ -193,6 +222,8 @@ int s_time_main(int argc, char **argv)
SSL_CTX_set_mode(ctx, SSL_MODE_AUTO_RETRY);
SSL_CTX_set_quiet_shutdown(ctx, 1);
+ if (SSL_CTX_set_min_proto_version(ctx, min_version) == 0)
+ goto end;
if (SSL_CTX_set_max_proto_version(ctx, max_version) == 0)
goto end;