Merge pull request #2738 from SparkiDev/cppcheck_fixes_3

Changes to clear issues raised by cppcheck
This commit is contained in:
Chris Conlon
2020-02-03 17:02:40 -07:00
committed by GitHub
63 changed files with 896 additions and 922 deletions

View File

@@ -315,8 +315,8 @@ static void EarlyData(WOLFSSL_CTX* ctx, WOLFSSL* ssl, const char* msg,
if (ret != msgSz) {
printf("SSL_write_early_data msg error %d, %s\n", err,
wolfSSL_ERR_error_string(err, buffer));
wolfSSL_free(ssl); ssl = NULL;
wolfSSL_CTX_free(ctx); ctx = NULL;
wolfSSL_free(ssl);
wolfSSL_CTX_free(ctx);
err_sys("SSL_write_early_data failed");
}
}
@@ -1393,9 +1393,9 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
unsigned char alpn_opt = 0;
char* cipherList = NULL;
int useDefCipherList = 0;
const char* verifyCert = caCertFile;
const char* ourCert = cliCertFile;
const char* ourKey = cliKeyFile;
const char* verifyCert;
const char* ourCert;
const char* ourKey;
int doSTARTTLS = 0;
char* starttlsProt = NULL;
@@ -1480,17 +1480,26 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
((func_args*)args)->return_code = -1; /* error state */
#ifdef NO_RSA
#ifndef NO_RSA
verifyCert = caCertFile;
ourCert = cliCertFile;
ourKey = cliKeyFile;
#else
#ifdef HAVE_ECC
verifyCert = (char*)caEccCertFile;
ourCert = (char*)cliEccCertFile;
ourKey = (char*)cliEccKeyFile;
verifyCert = caEccCertFile;
ourCert = cliEccCertFile;
ourKey = cliEccKeyFile;
#elif defined(HAVE_ED25519)
verifyCert = (char*)caEdCertFile;
ourCert = (char*)cliEdCertFile;
ourKey = (char*)cliEdKeyFile;
verifyCert = caEdCertFile;
ourCert = cliEdCertFile;
ourKey = cliEdKeyFile;
#else
verifyCert = NULL;
ourCert = NULL;
ourKey = NULL;
#endif
#endif
(void)resumeSz;
(void)session;
(void)flatSession;
@@ -1729,7 +1738,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
break;
}
}
if (throughput <= 0 || block <= 0) {
if (throughput == 0 || block <= 0) {
Usage();
XEXIT_T(MY_EX_USAGE);
}

View File

@@ -73,8 +73,10 @@ void echoclient_test(void* args)
int doDTLS = 0;
int doPSK = 0;
int sendSz;
#ifndef WOLFSSL_MDK_SHELL
int argc = 0;
char** argv = 0;
#endif
word16 port = yasslPort;
char buffer[CYASSL_MAX_ERROR_SZ];
@@ -83,7 +85,6 @@ void echoclient_test(void* args)
#ifndef WOLFSSL_MDK_SHELL
argc = ((func_args*)args)->argc;
argv = ((func_args*)args)->argv;
#endif
if (argc >= 2) {
fin = fopen(argv[1], "r");
@@ -93,6 +94,7 @@ void echoclient_test(void* args)
fout = fopen(argv[2], "w");
outCreated = 1;
}
#endif
if (!fin) err_sys("can't open input file");
if (!fout) err_sys("can't open output file");

View File

@@ -81,7 +81,7 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
int ret = 0;
int doDTLS = 0;
int doPSK = 0;
int doPSK;
int outCreated = 0;
int shutDown = 0;
int useAnyAddr = 0;
@@ -108,12 +108,11 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
doDTLS = 1;
#endif
#ifdef CYASSL_LEANPSK
doPSK = 1;
#endif
#if defined(NO_RSA) && !defined(HAVE_ECC) && !defined(HAVE_ED25519)
#if (defined(NO_RSA) && !defined(HAVE_ECC) && !defined(HAVE_ED25519)) || \
defined(CYASSL_LEANPSK)
doPSK = 1;
#else
doPSK = 0;
#endif
#if defined(NO_MAIN_DRIVER) && !defined(CYASSL_SNIFFER) && \

View File

@@ -936,9 +936,9 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
char* cipherList = NULL;
int useDefCipherList = 0;
int overrideDateErrors = 0;
const char* verifyCert = cliCertFile;
const char* ourCert = svrCertFile;
const char* ourKey = svrKeyFile;
const char* verifyCert;
const char* ourCert;
const char* ourKey;
const char* ourDhParam = dhParamFile;
tcp_ready* readySignal = NULL;
int argc = ((func_args*)args)->argc;
@@ -1018,15 +1018,23 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
((func_args*)args)->return_code = -1; /* error state */
#ifdef NO_RSA
#ifndef NO_RSA
verifyCert = cliCertFile;
ourCert = svrCertFile;
ourKey = svrKeyFile;
#else
#ifdef HAVE_ECC
verifyCert = (char*)cliEccCertFile;
ourCert = (char*)eccCertFile;
ourKey = (char*)eccKeyFile;
verifyCert = cliEccCertFile;
ourCert = eccCertFile;
ourKey = eccKeyFile;
#elif defined(HAVE_ED25519)
verifyCert = (char*)cliEdCertFile;
ourCert = (char*)edCertFile;
ourKey = (char*)edKeyFile;
verifyCert = cliEdCertFile;
ourCert = edCertFile;
ourKey = edKeyFile;
#else
verifyCert = NULL;
ourCert = NULL;
ourKey = NULL;
#endif
#endif
@@ -1314,7 +1322,7 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
break;
}
}
if (throughput <= 0 || block <= 0) {
if (throughput == 0 || block <= 0) {
Usage();
XEXIT_T(MY_EX_USAGE);
}