Merge pull request #2597 from ejohnstown/octeon-global

Sync OCTEON Sniffer
This commit is contained in:
toddouska
2019-11-18 17:06:30 -08:00
committed by GitHub
3 changed files with 11 additions and 19 deletions

View File

@ -3903,6 +3903,7 @@ AC_ARG_WITH([cavium-v],
# Cavium Octeon # Cavium Octeon
OCTEON_ROOT="" OCTEON_ROOT=""
: ${OCTEON_OBJ="obj-octeon2"} : ${OCTEON_OBJ="obj-octeon2"}
: ${OCTEON_HOST="standalone"}
AC_ARG_WITH([octeon-sync], AC_ARG_WITH([octeon-sync],
[AS_HELP_STRING([--with-octeon-sync=PATH],[PATH to Cavium Octeon SDK dir (sync)])], [AS_HELP_STRING([--with-octeon-sync=PATH],[PATH to Cavium Octeon SDK dir (sync)])],
@ -3917,8 +3918,9 @@ AC_ARG_WITH([octeon-sync],
fi fi
AM_CFLAGS="$AM_CFLAGS -DHAVE_CAVIUM_OCTEON_SYNC" AM_CFLAGS="$AM_CFLAGS -DHAVE_CAVIUM_OCTEON_SYNC"
AM_CFLAGS="$AM_CFLAGS -DOCTEON_MODEL=$OCTEON_MODEL -DCVMX_BUILD_FOR_LINUX_HOST" AM_CFLAGS="$AM_CFLAGS -DOCTEON_MODEL=$OCTEON_MODEL"
AM_CFLAGS="$AM_CFLAGS -I$OCTEON_ROOT/executive" AM_CFLAGS="$AM_CFLAGS -I$OCTEON_ROOT/executive"
AS_CASE([$OCTEON_HOST],['linux'],[AM_CFLAGS="$AM_CFLAGS -DCVMX_BUILD_FOR_LINUX_HOST"])
#-I$OCTEON_ROOT/target/include #-I$OCTEON_ROOT/target/include
AM_LDFLAGS="$AM_LDFLAGS -lrt -Xlinker -T -Xlinker $OCTEON_ROOT/executive/cvmx-shared-linux.ld" AM_LDFLAGS="$AM_LDFLAGS -lrt -Xlinker -T -Xlinker $OCTEON_ROOT/executive/cvmx-shared-linux.ld"

View File

@ -487,7 +487,7 @@ static void UpdateMissedDataSessions(void)
#ifdef WOLF_CRYPTO_CB #ifdef WOLF_CRYPTO_CB
static int CryptoDeviceId = INVALID_DEVID; static WOLFSSL_GLOBAL int CryptoDeviceId = INVALID_DEVID;
#endif #endif
@ -1434,7 +1434,7 @@ static int LoadKeyFile(byte** keyBuf, word32* keyBufSz,
#ifdef WOLFSSL_SNIFFER_WATCH #ifdef WOLFSSL_SNIFFER_WATCH
static int CreateWatchSnifferServer(char* error, int devId) static int CreateWatchSnifferServer(char* error)
{ {
SnifferServer* sniffer; SnifferServer* sniffer;
@ -1453,7 +1453,7 @@ static int CreateWatchSnifferServer(char* error, int devId)
} }
#ifdef WOLF_CRYPTO_CB #ifdef WOLF_CRYPTO_CB
if (CryptoDeviceId != INVALID_DEVID) if (CryptoDeviceId != INVALID_DEVID)
wolfSSL_CTX_SetDevId(sniffer->ctx, devId); wolfSSL_CTX_SetDevId(sniffer->ctx, CryptoDeviceId);
#endif #endif
ServerList = sniffer; ServerList = sniffer;
@ -3753,7 +3753,7 @@ static int CheckPreRecord(IpInfo* ipInfo, TcpInfo* tcpInfo,
word32 i, offset, headerSz, qty, remainder; word32 i, offset, headerSz, qty, remainder;
Trace(CHAIN_INPUT_STR); Trace(CHAIN_INPUT_STR);
headerSz = (word64)*sslFrame - (word64)chain[0].iov_base; headerSz = (word32)*sslFrame - (word32)chain[0].iov_base;
remainder = *sslBytes; remainder = *sslBytes;
if ( (*sslBytes + length) > ssl->buffers.inputBuffer.bufferSize) { if ( (*sslBytes + length) > ssl->buffers.inputBuffer.bufferSize) {
@ -4506,15 +4506,16 @@ int ssl_ReadResetStatistics(SSLStats* stats)
int ssl_SetWatchKeyCallback_ex(SSLWatchCb cb, int devId, char* error) int ssl_SetWatchKeyCallback_ex(SSLWatchCb cb, int devId, char* error)
{ {
(void)devId;
WatchCb = cb; WatchCb = cb;
return CreateWatchSnifferServer(error, devId); return CreateWatchSnifferServer(error);
} }
int ssl_SetWatchKeyCallback(SSLWatchCb cb, char* error) int ssl_SetWatchKeyCallback(SSLWatchCb cb, char* error)
{ {
WatchCb = cb; WatchCb = cb;
return CreateWatchSnifferServer(error, INVALID_DEVID); return CreateWatchSnifferServer(error);
} }

View File

@ -725,7 +725,7 @@ 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 #ifdef HAVE_CAVIUM_OCTEON_SYNC
/* By default, the OCTEON's global variables are all thread local. This /* By default, the OCTEON's global variables are all thread local. This
* tag allows them to be shared between threads. */ * tag allows them to be shared between threads. */
#include "cvmx-platform.h" #include "cvmx-platform.h"
@ -734,17 +734,6 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
#define WOLFSSL_GLOBAL #define WOLFSSL_GLOBAL
#endif #endif
#ifdef HAVE_NITROX_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_GLOBAL CVMX_SHARED
#else
#define WOLFSSL_GLOBAL
#endif
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif #endif