1. Added a tag for global variables in environments where they aren't

shared across threads by default.
2. Set the Trace file and flag up with the shared flag.
This commit is contained in:
John Safranek
2019-07-11 17:28:21 -05:00
parent 743a6ab829
commit 87a8447f0d
3 changed files with 21 additions and 7 deletions

View File

@ -129,8 +129,8 @@ BOOL APIENTRY DllMain( HMODULE hModule,
#endif /* _WIN32 */ #endif /* _WIN32 */
static int TraceOn = 0; /* Trace is off by default */ static WOLFSSL_SHARED int TraceOn = 0; /* Trace is off by default */
static FILE* TraceFile = 0; static WOLFSSL_SHARED FILE* TraceFile = 0;
/* windows uses .rc table for this */ /* windows uses .rc table for this */
@ -4077,12 +4077,15 @@ int ssl_FreeZeroDecodeBuffer(byte** data, int sz, char* error)
int ssl_Trace(const char* traceFile, char* error) int ssl_Trace(const char* traceFile, char* error)
{ {
if (traceFile) { if (traceFile) {
TraceFile = fopen(traceFile, "a"); /* Don't try to reopen the file */
if (!TraceFile) { if (TraceFile == NULL) {
SetError(BAD_TRACE_FILE_STR, error, NULL, 0); TraceFile = fopen(traceFile, "a");
return -1; if (!TraceFile) {
SetError(BAD_TRACE_FILE_STR, error, NULL, 0);
return -1;
}
TraceOn = 1;
} }
TraceOn = 1;
} }
else else
TraceOn = 0; TraceOn = 0;

View File

@ -18548,6 +18548,7 @@ static void test_wc_PemToDer(void)
if (cert_buf) if (cert_buf)
free(cert_buf); free(cert_buf);
printf(resultFmt, passed);
#endif #endif
} }
@ -18564,6 +18565,7 @@ static void test_wc_AllocDer(void)
AssertIntEQ(ret, 0); AssertIntEQ(ret, 0);
AssertNotNull(pDer); AssertNotNull(pDer);
wc_FreeDer(&pDer); wc_FreeDer(&pDer);
printf(resultFmt, passed);
#endif #endif
} }

View File

@ -720,6 +720,15 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
will use dynamic buffer if not big enough */ will use dynamic buffer if not big enough */
#endif #endif
#ifdef HAVE_CAVIUM_OCTEON
/* By default, the OCTEON's global variables are all thread local. This
* tag allows them to be shared between threads. */
#include "cvmx-platform.h"
#define WOLFSSL_SHARED CVMX_SHARED
#else
#define WOLFSSL_SHARED
#endif
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */