Improvements to tls_bench tool in wolfSSL lib for embedded use.

This commit is contained in:
David Garske
2019-11-15 12:09:19 -08:00
parent 961f9c4ecc
commit 0c2c4fd91b

View File

@@ -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, ':');