From 26a2688f0ebb1bc692a81a9318793e4eb22085d9 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Tue, 30 Dec 2014 13:05:24 -0700 Subject: [PATCH] debuging test script --- cyassl/ssl.h | 12 ++---------- wolfssl/wolfcrypt/error-crypt.h | 3 ++- wolfssl/wolfcrypt/types.h | 27 +++++++++++++++++++++++++-- wolfssl/wolfcrypt/visibility.h | 7 +++++++ wolfssl/wolfcrypt/wc_port.h | 9 ++++++++- 5 files changed, 44 insertions(+), 14 deletions(-) diff --git a/cyassl/ssl.h b/cyassl/ssl.h index bea0bdbcc..1be120509 100644 --- a/cyassl/ssl.h +++ b/cyassl/ssl.h @@ -84,10 +84,6 @@ #define CYASSL_THREAD WOLFSSL_THREAD #endif -#ifndef CYASSL_MAX_ERROR_SZ - #define CYASSL_MAX_ERROR_SZ WOLFSSL_MAX_ERROR_SZ -#endif - /* src/ssl.c */ #define CYASSL_CRL WOLFSSL_CRL #define CYASSL_SSLV3 WOLFSSL_SSLV3 @@ -364,12 +360,8 @@ #define CYASSL_SMALL_STACK #endif -/* change visibility to be compatible with CyaSSL visibility */ -#ifndef HAVE_FIPS - /* Do Nothing */ -#else - #undef WOLFSSL_API - #define WOLFSSL_API CYASSL_API +#if !defined(CYASSL_MAX_ERROR_SZ) && !defined(HAVE_FIPS) + #define CYASSL_MAX_ERROR_SZ WOLFSSL_MAX_ERROR_SZ #endif /* wrapper around macros until they are changed in cyassl code * needs investigation in regards to macros in fips */ diff --git a/wolfssl/wolfcrypt/error-crypt.h b/wolfssl/wolfcrypt/error-crypt.h index 49ba8ae21..8f342cbf8 100644 --- a/wolfssl/wolfcrypt/error-crypt.h +++ b/wolfssl/wolfcrypt/error-crypt.h @@ -23,9 +23,10 @@ #ifndef WOLF_CRYPT_ERROR_H #define WOLF_CRYPT_ERROR_H +#include + /* compatibility and fips @wc_fips */ #ifndef HAVE_FIPS -#include #define CTaoCryptErrorString wc_CryptErrorString #define CTaoCryptGetErrorString wc_CryptGetErrorString diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index 60252d666..6da094c2d 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -25,9 +25,34 @@ #ifndef WOLF_CRYPT_TYPES_H #define WOLF_CRYPT_TYPES_H + #include + #include + /* for fips compatiblity @wc_fips */ #ifdef HAVE_FIPS #include + /* set old macros since this is often called for visibility also */ + #ifndef WOLFSSL_API + #define WOLFSSL_API CYASSL_API + #endif + #ifndef WOLFSSL_LOCAL + #define WOLFSSL_LOCAL CYASSL_LOCAL + #endif + #define WOLFSSL_MAX_ERROR_SZ CYASSL_MAX_ERROR_SZ + +/* memory macros */ + /* when using fips map wolfSSL to CyaSSL*/ + #define wolfSSL_Malloc_cb CyaSSL_Malloc_cb + #define wolfSSL_Free_cb CyaSSL_Free_cb + #define wolfSSL_Realloc_cb CyaSSL_Realloc_cb + #define wolfSSL_SetAllocators CyaSSL_SetAllocators + + /* Public in case user app wants to use XMALLOC/XFREE */ + #define wolfSSL_Malloc CyaSSL_Malloc + #define wolfSSL_Free CyaSSL_Free + #define wolfSSL_Realloc CyaSSL_Realloc + + #else /* set old macros since this is often called for visibility also */ #ifndef CYASSL_API @@ -37,8 +62,6 @@ #define CYASSL_LOCAL WOLFSSL_LOCAL #endif - #include - #include #ifdef __cplusplus extern "C" { diff --git a/wolfssl/wolfcrypt/visibility.h b/wolfssl/wolfcrypt/visibility.h index 40d993688..dbd91d1e5 100644 --- a/wolfssl/wolfcrypt/visibility.h +++ b/wolfssl/wolfcrypt/visibility.h @@ -24,6 +24,12 @@ #ifndef WOLF_CRYPT_VISIBILITY_H #define WOLF_CRYPT_VISIBILITY_H +/* fips compatibility @wc_fips */ +#ifdef HAVE_FIPS + #include + #define WOLFSSL_API CYASSL_API + #define WOLFSSL_LOCAL CYASSL_LOCAL +#else /* WOLFSSL_API is used for the public API symbols. It either imports or exports (or does nothing for static builds) @@ -64,5 +70,6 @@ #endif /* BUILDING_WOLFSSL */ +#endif /* HAVE_FIPS */ #endif /* WOLF_CRYPT_VISIBILITY_H */ diff --git a/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfcrypt/wc_port.h index e64a161a2..45d763c7c 100644 --- a/wolfssl/wolfcrypt/wc_port.h +++ b/wolfssl/wolfcrypt/wc_port.h @@ -20,9 +20,15 @@ */ -#if !defined(WOLF_CRYPT_PORT_H) //&& CTAO_CRYPT_PORT_H) +#ifndef WOLF_CRYPT_PORT_H #define WOLF_CRYPT_PORT_H +/* fips compatibility @wc_fips */ +#ifdef HAVE_FIPS + #include +#define wolfSSL_Mutex CyaSSL_Mutex + +#else #ifdef __cplusplus extern "C" { @@ -196,5 +202,6 @@ WOLFSSL_LOCAL int UnLockMutex(wolfSSL_Mutex*); } /* extern "C" */ #endif +#endif /* HAVE_FIPS */ #endif /* WOLF_CRYPT_PORT_H */