From 0c2c4fd91bc570e7430492244ef8782d05aa9b99 Mon Sep 17 00:00:00 2001 From: David Garske Date: Fri, 15 Nov 2019 12:09:19 -0800 Subject: [PATCH] Improvements to tls_bench tool in wolfSSL lib for embedded use. --- examples/benchmark/tls_bench.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/examples/benchmark/tls_bench.c b/examples/benchmark/tls_bench.c index 6d1de164c..9075b1c88 100644 --- a/examples/benchmark/tls_bench.c +++ b/examples/benchmark/tls_bench.c @@ -81,12 +81,36 @@ bench_tls(args); #define BENCH_DEFAULT_HOST "localhost" #define BENCH_DEFAULT_PORT 11112 #define NUM_THREAD_PAIRS 1 /* Thread pairs of server/client */ -#define BENCH_RUNTIME_SEC 1 -#define MEM_BUFFER_SZ ((16 * 1024) + 38 + 32) /* Must be large enough to handle max packet size plus max TLS header MAX_MSG_EXTRA */ -#define TEST_PACKET_SIZE (16 * 1024) /* TLS packet size */ -#define TEST_MAX_SIZE (16 * 1024) /* Total bytes to benchmark */ +#ifndef BENCH_RUNTIME_SEC + #ifdef BENCH_EMBEDDED + #define BENCH_RUNTIME_SEC 15 + #else + #define BENCH_RUNTIME_SEC 1 + #endif +#endif +/* TLS packet size */ +#ifndef TEST_PACKET_SIZE + #ifdef BENCH_EMBEDDED + #define TEST_PACKET_SIZE (2 * 1024) + #else + #define TEST_PACKET_SIZE (16 * 1024) + #endif +#endif +/* Total bytes to benchmark per connection */ +#ifndef TEST_MAX_SIZE + #ifdef BENCH_EMBEDDED + #define TEST_MAX_SIZE (16 * 1024) + #else + #define TEST_MAX_SIZE (128 * 1024) + #endif +#endif + +/* In memory transfer buffer maximum size */ +/* Must be large enough to handle max TLS packet size plus max TLS header MAX_MSG_EXTRA */ +#define MEM_BUFFER_SZ (TEST_PACKET_SIZE + 38 + 32) #define SHOW_VERBOSE 0 /* Default output is tab delimited format */ +/* shutdown message - nice signal to server, we are done */ static const char* kShutdown = "shutdown"; #if (!defined(NO_WOLFSSL_CLIENT) || !defined(NO_WOLFSSL_SERVER)) && \ @@ -1411,6 +1435,8 @@ int bench_tls(void* args) } #endif + printf("Running TLS Benchmarks...\n"); + /* parse by : */ while ((cipher != NULL) && (cipher[0] != '\0')) { next_cipher = strchr(cipher, ':');