From 003360237f792e1d9adea5e4a49a37ddcedb4d36 Mon Sep 17 00:00:00 2001 From: David Garske Date: Mon, 7 Jan 2019 10:08:16 -0800 Subject: [PATCH] Fixes for building with `NO_WOLFSSL_SERVER`. Minor test.h cleanups. --- examples/benchmark/tls_bench.c | 14 +++++++++++--- wolfssl/test.h | 6 ++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/examples/benchmark/tls_bench.c b/examples/benchmark/tls_bench.c index 3a5fe7d67..500da37b7 100644 --- a/examples/benchmark/tls_bench.c +++ b/examples/benchmark/tls_bench.c @@ -169,9 +169,12 @@ static const char* kTestStr = "bag dolor terry richardson sapiente.\n"; #endif -#if !defined(NO_WOLFSSL_SERVER) && !defined(NO_DH) -/* dh2048 p */ +#if !defined(NO_DH) + #define MIN_DHKEY_BITS 1024 + +#if !defined(NO_WOLFSSL_SERVER) +/* dh2048 p */ static const unsigned char p[] = { 0xb0, 0xa1, 0x08, 0x06, 0x9c, 0x08, 0x13, 0xba, 0x59, 0x06, 0x3c, 0xbc, 0x30, @@ -201,7 +204,8 @@ static const unsigned char g[] = { 0x02, }; -#endif /* !NO_WOLFSSL_SERVER && !NO_DH */ +#endif /* !NO_WOLFSSL_SERVER */ +#endif /* !NO_DH */ #ifdef HAVE_PTHREAD typedef struct { @@ -1225,8 +1229,10 @@ int bench_tls(void* args) #ifdef HAVE_PTHREAD int doShutdown; #endif +#if !defined(NO_WOLFSSL_SERVER) || defined(HAVE_PTHREAD) int argLocalMem = 0; int listenFd = -1; +#endif if (args) ((func_args*)args)->return_code = -1; /* error state */ @@ -1379,7 +1385,9 @@ int bench_tls(void* args) info->runTimeSec = argRuntimeSec; info->showPeerInfo = argShowPeerInfo; info->showVerbose = argShowVerbose; + #ifndef NO_WOLFSSL_SERVER info->listenFd = listenFd; + #endif info->client.sockFd = -1; info->server.sockFd = -1; diff --git a/wolfssl/test.h b/wolfssl/test.h index adb321309..1c61f23af 100644 --- a/wolfssl/test.h +++ b/wolfssl/test.h @@ -271,7 +271,7 @@ #define dhParamFile "certs/dh2048.pem" #define cliEccKeyFile "certs/ecc-client-key.pem" #define cliEccCertFile "certs/client-ecc-cert.pem" -#define caEccCertFile "certs/ca-ecc-cert/pem" +#define caEccCertFile "certs/ca-ecc-cert.pem" #define crlPemDir "certs/crl" #define edCertFile "certs/ed25519/server-ed25519-cert.pem" #define edKeyFile "certs/ed25519/server-ed25519-priv.pem" @@ -564,7 +564,7 @@ static const char* client_showx509_msg[][5] = { /* lng_index is to specify the language for displaying message. */ /* 0:English, 1:Japanese */ -static WC_INLINE void ShowX509Ex(WOLFSSL_X509* x509, const char* hdr, +static WC_INLINE void ShowX509Ex(WOLFSSL_X509* x509, const char* hdr, int lng_index) { char* altName; @@ -1196,7 +1196,6 @@ static WC_INLINE unsigned int my_psk_client_cb(WOLFSSL* ssl, const char* hint, key[2] = 0x3c; key[3] = 0x4d; - return 4; /* length of key in octets or 0 for error */ } else { @@ -1232,7 +1231,6 @@ static WC_INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identit key[2] = 0x3c; key[3] = 0x4d; - return 4; /* length of key in octets or 0 for error */ } else {