wolfSSL Global

1. Renamed the global variable tag to WOLFSSL_GLOBAL.
2. Tagged several more global variables with WOLFSSL_GLOBAL.
This commit is contained in:
John Safranek
2019-07-17 15:21:09 -07:00
parent bbc208ad33
commit 4292936efc
4 changed files with 27 additions and 27 deletions

View File

@@ -325,8 +325,8 @@ static int QSH_FreeAll(WOLFSSL* ssl)
#ifdef HAVE_NTRU
static WC_RNG* rng;
static wolfSSL_Mutex* rngMutex;
static WOLFSSL_GLOBAL WC_RNG* rng;
static WOLFSSL_GLOBAL wolfSSL_Mutex* rngMutex;
static word32 GetEntropy(unsigned char* out, word32 num_bytes)
{

View File

@@ -129,8 +129,8 @@ BOOL APIENTRY DllMain( HMODULE hModule,
#endif /* _WIN32 */
static WOLFSSL_SHARED int TraceOn = 0; /* Trace is off by default */
static WOLFSSL_SHARED FILE* TraceFile = 0;
static WOLFSSL_GLOBAL int TraceOn = 0; /* Trace is off by default */
static WOLFSSL_GLOBAL FILE* TraceFile = 0;
/* windows uses .rc table for this */
@@ -404,37 +404,37 @@ typedef struct SnifferSession {
/* Sniffer Server List and mutex */
static WOLFSSL_SHARED SnifferServer* ServerList = 0;
static WOLFSSL_SHARED wolfSSL_Mutex ServerListMutex;
static WOLFSSL_GLOBAL SnifferServer* ServerList = 0;
static WOLFSSL_GLOBAL wolfSSL_Mutex ServerListMutex;
/* Session Hash Table, mutex, and count */
static WOLFSSL_SHARED SnifferSession* SessionTable[HASH_SIZE];
static WOLFSSL_SHARED wolfSSL_Mutex SessionMutex;
static WOLFSSL_SHARED int SessionCount = 0;
static WOLFSSL_GLOBAL SnifferSession* SessionTable[HASH_SIZE];
static WOLFSSL_GLOBAL wolfSSL_Mutex SessionMutex;
static WOLFSSL_GLOBAL int SessionCount = 0;
/* Recovery of missed data switches and stats */
static WOLFSSL_SHARED wolfSSL_Mutex RecoveryMutex; /* for stats */
static WOLFSSL_SHARED int RecoveryEnabled = 0; /* global switch */
static WOLFSSL_SHARED int MaxRecoveryMemory = -1;
static WOLFSSL_GLOBAL wolfSSL_Mutex RecoveryMutex; /* for stats */
static WOLFSSL_GLOBAL int RecoveryEnabled = 0; /* global switch */
static WOLFSSL_GLOBAL int MaxRecoveryMemory = -1;
/* per session max recovery memory */
static WOLFSSL_SHARED word32 MissedDataSessions = 0;
static WOLFSSL_GLOBAL word32 MissedDataSessions = 0;
/* # of sessions with missed data */
/* Connection Info Callback */
static WOLFSSL_SHARED SSLConnCb ConnectionCb;
static WOLFSSL_SHARED void* ConnectionCbCtx = NULL;
static WOLFSSL_GLOBAL SSLConnCb ConnectionCb;
static WOLFSSL_GLOBAL void* ConnectionCbCtx = NULL;
#ifdef WOLFSSL_SNIFFER_STATS
/* Sessions Statistics */
static WOLFSSL_SHARED SSLStats SnifferStats;
static WOLFSSL_SHARED wolfSSL_Mutex StatsMutex;
static WOLFSSL_GLOBAL SSLStats SnifferStats;
static WOLFSSL_GLOBAL wolfSSL_Mutex StatsMutex;
#endif
#ifdef WOLFSSL_SNIFFER_WATCH
/* Watch Key Callback */
static WOLFSSL_SHARED SSLWatchCb WatchCb;
static WOLFSSL_SHARED void* WatchCbCtx = NULL;
static WOLFSSL_GLOBAL SSLWatchCb WatchCb;
static WOLFSSL_GLOBAL void* WatchCbCtx = NULL;
#endif

View File

@@ -292,8 +292,8 @@ int wolfSSL_send_session(WOLFSSL* ssl)
/* prevent multiple mutex initializations */
static volatile int initRefCount = 0;
static wolfSSL_Mutex count_mutex; /* init ref count mutex */
static volatile WOLFSSL_GLOBAL int initRefCount = 0;
static WOLFSSL_GLOBAL wolfSSL_Mutex count_mutex; /* init ref count mutex */
/* Create a new WOLFSSL_CTX struct and return the pointer to created struct.
WOLFSSL_METHOD pointer passed in is given to ctx to manage.
@@ -4658,13 +4658,13 @@ int AddCA(WOLFSSL_CERT_MANAGER* cm, DerBuffer** pDer, int type, int verify)
WOLFSSL_SESSION Sessions[SESSIONS_PER_ROW];
} SessionRow;
static WOLFSSL_SHARED SessionRow SessionCache[SESSION_ROWS];
static WOLFSSL_GLOBAL SessionRow SessionCache[SESSION_ROWS];
#if defined(WOLFSSL_SESSION_STATS) && defined(WOLFSSL_PEAK_SESSIONS)
static WOLFSSL_SHARED word32 PeakSessions;
static WOLFSSL_GLOBAL word32 PeakSessions;
#endif
static WOLFSSL_SHARED wolfSSL_Mutex session_mutex; /* SessionCache mutex */
static WOLFSSL_GLOBAL wolfSSL_Mutex session_mutex; /* SessionCache mutex */
#ifndef NO_CLIENT_CACHE
@@ -4679,7 +4679,7 @@ int AddCA(WOLFSSL_CERT_MANAGER* cm, DerBuffer** pDer, int type, int verify)
ClientSession Clients[SESSIONS_PER_ROW];
} ClientRow;
static WOLFSSL_SHARED ClientRow ClientCache[SESSION_ROWS];
static WOLFSSL_GLOBAL ClientRow ClientCache[SESSION_ROWS];
/* Client Cache */
/* uses session mutex */
#endif /* NO_CLIENT_CACHE */

View File

@@ -724,9 +724,9 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
/* 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
#define WOLFSSL_GLOBAL CVMX_SHARED
#else
#define WOLFSSL_SHARED
#define WOLFSSL_GLOBAL
#endif