summaryrefslogtreecommitdiff
path: root/src/usr.bin/openssl/s_time.c
diff options
context:
space:
mode:
authorcheloha <>2018-09-17 15:37:35 +0000
committercheloha <>2018-09-17 15:37:35 +0000
commite6a459dcbefb4cbc837bce30f21261bd6350200a (patch)
tree3264cf76244348a724e934c8c7f05d561f332b03 /src/usr.bin/openssl/s_time.c
parent6ae7e36ac660812622367c922c684b97052bae6d (diff)
downloadopenbsd-e6a459dcbefb4cbc837bce30f21261bd6350200a.tar.gz
openbsd-e6a459dcbefb4cbc837bce30f21261bd6350200a.tar.bz2
openbsd-e6a459dcbefb4cbc837bce30f21261bd6350200a.zip
Move tally mark printing out of the main benchmark loop; ok tb@
Diffstat (limited to 'src/usr.bin/openssl/s_time.c')
-rw-r--r--src/usr.bin/openssl/s_time.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/usr.bin/openssl/s_time.c b/src/usr.bin/openssl/s_time.c
index 793e50e4be..1506ca356a 100644
--- a/src/usr.bin/openssl/s_time.c
+++ b/src/usr.bin/openssl/s_time.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s_time.c,v 1.31 2018/08/28 14:30:48 cheloha Exp $ */ 1/* $OpenBSD: s_time.c,v 1.32 2018/09/17 15:37:35 cheloha Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -92,6 +92,7 @@ extern int verify_depth;
92static void s_time_usage(void); 92static void s_time_usage(void);
93static int run_test(SSL *); 93static int run_test(SSL *);
94static int benchmark(int); 94static int benchmark(int);
95static void print_tally_mark(SSL *);
95 96
96static SSL_CTX *tm_ctx = NULL; 97static SSL_CTX *tm_ctx = NULL;
97static const SSL_METHOD *s_time_meth = NULL; 98static const SSL_METHOD *s_time_meth = NULL;
@@ -393,6 +394,24 @@ run_test(SSL *scon)
393 return 1; 394 return 1;
394} 395}
395 396
397static void
398print_tally_mark(SSL *scon)
399{
400 int ver;
401
402 if (SSL_session_reused(scon))
403 ver = 'r';
404 else {
405 ver = SSL_version(scon);
406 if (ver == TLS1_VERSION)
407 ver = 't';
408 else
409 ver = '*';
410 }
411 fputc(ver, stdout);
412 fflush(stdout);
413}
414
396static int 415static int
397benchmark(int reuse_session) 416benchmark(int reuse_session)
398{ 417{
@@ -400,7 +419,6 @@ benchmark(int reuse_session)
400 int nConn = 0; 419 int nConn = 0;
401 SSL *scon = NULL; 420 SSL *scon = NULL;
402 int ret = 1; 421 int ret = 1;
403 int ver;
404 422
405 if (reuse_session) { 423 if (reuse_session) {
406 /* Get an SSL object so we can reuse the session id */ 424 /* Get an SSL object so we can reuse the session id */
@@ -429,18 +447,7 @@ benchmark(int reuse_session)
429 if (!run_test(scon)) 447 if (!run_test(scon))
430 goto end; 448 goto end;
431 nConn += 1; 449 nConn += 1;
432 if (SSL_session_reused(scon)) 450 print_tally_mark(scon);
433 ver = 'r';
434 else {
435 ver = SSL_version(scon);
436 if (ver == TLS1_VERSION)
437 ver = 't';
438 else
439 ver = '*';
440 }
441 fputc(ver, stdout);
442 fflush(stdout);
443
444 if (!reuse_session) { 451 if (!reuse_session) {
445 SSL_free(scon); 452 SSL_free(scon);
446 scon = NULL; 453 scon = NULL;