This commit is contained in:
Kaleb Himes
2014-12-18 14:53:27 -07:00
parent e6a629118c
commit 7bab3a9564
3 changed files with 269 additions and 267 deletions

View File

@@ -90,6 +90,7 @@
#define CYASSL_TLSV1_2 WOLFSSL_TLSV1_2 #define CYASSL_TLSV1_2 WOLFSSL_TLSV1_2
#define CYASSL_SSLV3 WOLFSSL_SSLV3 #define CYASSL_SSLV3 WOLFSSL_SSLV3
#define MAX_CYASSL_FILE_SIZE MAX_WOLFSSL_FILE_SIZE #define MAX_CYASSL_FILE_SIZE MAX_WOLFSSL_FILE_SIZE
#define CYASSL_CRL WOLFSSL_CRL
#define CyaSSL_session_reused wolfSSL_session_reused #define CyaSSL_session_reused wolfSSL_session_reused
#define CyaSSL_get_version wolfSSL_get_version #define CyaSSL_get_version wolfSSL_get_version
#define CyaSSL_get_shutdown wolfSSL_get_shutdown #define CyaSSL_get_shutdown wolfSSL_get_shutdown
@@ -137,7 +138,10 @@
#define CYASSL_CHAIN_CA WOLFSSL_CHAIN_CA #define CYASSL_CHAIN_CA WOLFSSL_CHAIN_CA
#define CYASSL_CBIO_ERR_CONN_RST WOLFSSL_CBIO_ERR_CONN_RST #define CYASSL_CBIO_ERR_CONN_RST WOLFSSL_CBIO_ERR_CONN_RST
#define CYASSL_ALERT_HISTORY WOLFSSL_ALERT_HISTORY #define CYASSL_ALERT_HISTORY WOLFSSL_ALERT_HISTORY
#define CYASSL_SESSION_TIMEOUT WOLFSSL_SESSION_TIMEOUT
#define cyassl_chacha wolfssl_chacha #define cyassl_chacha wolfssl_chacha
#define cyassl_rc4 wolfssl_rc4
#define cyassl_aes wolfssl_aes
/* keys.c */ /* keys.c */
#define cyassl_triple_des wolfssl_triple_des #define cyassl_triple_des wolfssl_triple_des

View File

@@ -19,312 +19,310 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <cyassl/ctaocrypt/types.h>
#if !defined(WOLF_CRYPT_TYPES_H) && !defined(CTAO_CRYPT_TYPES_H) // #if !defined(WOLF_CRYPT_TYPES_H) && !defined(CTAO_CRYPT_TYPES_H)
#elif defined(CTAO_CRYPT_TYPES_H) // #define WOLF_CRYPT_TYPES_H
/* do nothing */
#else
#define WOLF_CRYPT_TYPES_H
#include <wolfssl/wolfcrypt/settings.h> // #include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/wolfcrypt/wc_port.h> // #include <wolfssl/wolfcrypt/wc_port.h>
#ifdef __cplusplus // #ifdef __cplusplus
extern "C" { // extern "C" {
#endif // #endif
#if defined(WORDS_BIGENDIAN) // #if defined(WORDS_BIGENDIAN)
#define BIG_ENDIAN_ORDER // #define BIG_ENDIAN_ORDER
#endif // #endif
#ifndef BIG_ENDIAN_ORDER // #ifndef BIG_ENDIAN_ORDER
#define LITTLE_ENDIAN_ORDER // #define LITTLE_ENDIAN_ORDER
#endif // #endif
#ifndef WOLFSSL_TYPES // #ifndef WOLFSSL_TYPES
#ifndef byte // #ifndef byte
typedef unsigned char byte; // typedef unsigned char byte;
#endif // #endif
typedef unsigned short word16; // typedef unsigned short word16;
typedef unsigned int word32; // typedef unsigned int word32;
#endif // #endif
/* try to set SIZEOF_LONG or LONG_LONG if user didn't */ // /* try to set SIZEOF_LONG or LONG_LONG if user didn't */
#if !defined(_MSC_VER) && !defined(__BCPLUSPLUS__) // #if !defined(_MSC_VER) && !defined(__BCPLUSPLUS__)
#if !defined(SIZEOF_LONG_LONG) && !defined(SIZEOF_LONG) // #if !defined(SIZEOF_LONG_LONG) && !defined(SIZEOF_LONG)
#if (defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) \ // #if (defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) \
|| defined(__mips64) || defined(__x86_64__)) // || defined(__mips64) || defined(__x86_64__))
/* long should be 64bit */ // /* long should be 64bit */
#define SIZEOF_LONG 8 // #define SIZEOF_LONG 8
#elif defined(__i386__) || defined(__CORTEX_M3__) // #elif defined(__i386__) || defined(__CORTEX_M3__)
/* long long should be 64bit */ // /* long long should be 64bit */
#define SIZEOF_LONG_LONG 8 // #define SIZEOF_LONG_LONG 8
#endif // #endif
#endif // #endif
#endif // #endif
#if defined(_MSC_VER) || defined(__BCPLUSPLUS__) // #if defined(_MSC_VER) || defined(__BCPLUSPLUS__)
#define WORD64_AVAILABLE // #define WORD64_AVAILABLE
#define W64LIT(x) x##ui64 // #define W64LIT(x) x##ui64
typedef unsigned __int64 word64; // typedef unsigned __int64 word64;
#elif defined(SIZEOF_LONG) && SIZEOF_LONG == 8 // #elif defined(SIZEOF_LONG) && SIZEOF_LONG == 8
#define WORD64_AVAILABLE // #define WORD64_AVAILABLE
#define W64LIT(x) x##LL // #define W64LIT(x) x##LL
typedef unsigned long word64; // typedef unsigned long word64;
#elif defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG == 8 // #elif defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG == 8
#define WORD64_AVAILABLE // #define WORD64_AVAILABLE
#define W64LIT(x) x##LL // #define W64LIT(x) x##LL
typedef unsigned long long word64; // typedef unsigned long long word64;
#elif defined(__SIZEOF_LONG_LONG__) && __SIZEOF_LONG_LONG__ == 8 // #elif defined(__SIZEOF_LONG_LONG__) && __SIZEOF_LONG_LONG__ == 8
#define WORD64_AVAILABLE // #define WORD64_AVAILABLE
#define W64LIT(x) x##LL // #define W64LIT(x) x##LL
typedef unsigned long long word64; // typedef unsigned long long word64;
#else // #else
#define MP_16BIT /* for mp_int, mp_word needs to be twice as big as // #define MP_16BIT /* for mp_int, mp_word needs to be twice as big as
mp_digit, no 64 bit type so make mp_digit 16 bit */ // mp_digit, no 64 bit type so make mp_digit 16 bit */
#endif // #endif
/* These platforms have 64-bit CPU registers. */ // /* These platforms have 64-bit CPU registers. */
#if (defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || \ // #if (defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || \
defined(__mips64) || defined(__x86_64__) || defined(_M_X64)) // defined(__mips64) || defined(__x86_64__) || defined(_M_X64))
typedef word64 wolfssl_word; // typedef word64 wolfssl_word;
#else // #else
typedef word32 wolfssl_word; // typedef word32 wolfssl_word;
#ifdef WORD64_AVAILABLE // #ifdef WORD64_AVAILABLE
#define WOLFCRYPT_SLOW_WORD64 // #define WOLFCRYPT_SLOW_WORD64
#endif // #endif
#endif // #endif
enum { // enum {
WOLFSSL_WORD_SIZE = sizeof(wolfssl_word), // WOLFSSL_WORD_SIZE = sizeof(wolfssl_word),
WOLFSSL_BIT_SIZE = 8, // WOLFSSL_BIT_SIZE = 8,
WOLFSSL_WORD_BITS = WOLFSSL_WORD_SIZE * WOLFSSL_BIT_SIZE // WOLFSSL_WORD_BITS = WOLFSSL_WORD_SIZE * WOLFSSL_BIT_SIZE
}; // };
#define WOLFSSL_MAX_16BIT 0xffffU // #define WOLFSSL_MAX_16BIT 0xffffU
/* use inlining if compiler allows */ // /* use inlining if compiler allows */
#ifndef INLINE // #ifndef INLINE
#ifndef NO_INLINE // #ifndef NO_INLINE
#ifdef _MSC_VER // #ifdef _MSC_VER
#define INLINE __inline // #define INLINE __inline
#elif defined(__GNUC__) // #elif defined(__GNUC__)
#define INLINE inline // #define INLINE inline
#elif defined(__IAR_SYSTEMS_ICC__) // #elif defined(__IAR_SYSTEMS_ICC__)
#define INLINE inline // #define INLINE inline
#elif defined(THREADX) // #elif defined(THREADX)
#define INLINE _Inline // #define INLINE _Inline
#else // #else
#define INLINE // #define INLINE
#endif // #endif
#else // #else
#define INLINE // #define INLINE
#endif // #endif
#endif // #endif
/* set up rotate style */ // /* set up rotate style */
#if defined(_MSC_VER) || defined(__BCPLUSPLUS__) // #if defined(_MSC_VER) || defined(__BCPLUSPLUS__)
#define INTEL_INTRINSICS // #define INTEL_INTRINSICS
#define FAST_ROTATE // #define FAST_ROTATE
#elif defined(__MWERKS__) && TARGET_CPU_PPC // #elif defined(__MWERKS__) && TARGET_CPU_PPC
#define PPC_INTRINSICS // #define PPC_INTRINSICS
#define FAST_ROTATE // #define FAST_ROTATE
#elif defined(__GNUC__) && defined(__i386__) // #elif defined(__GNUC__) && defined(__i386__)
/* GCC does peephole optimizations which should result in using rotate // /* GCC does peephole optimizations which should result in using rotate
instructions */ // instructions */
#define FAST_ROTATE // #define FAST_ROTATE
#endif // #endif
/* set up thread local storage if available */ // /* set up thread local storage if available */
#ifdef HAVE_THREAD_LS // #ifdef HAVE_THREAD_LS
#if defined(_MSC_VER) // #if defined(_MSC_VER)
#define THREAD_LS_T __declspec(thread) // #define THREAD_LS_T __declspec(thread)
#else // #else
#define THREAD_LS_T __thread // #define THREAD_LS_T __thread
#endif // #endif
#else // #else
#define THREAD_LS_T // #define THREAD_LS_T
#endif // #endif
/* Micrium will use Visual Studio for compilation but not the Win32 API */ // /* Micrium will use Visual Studio for compilation but not the Win32 API */
#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) \ // #if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) \
&& !defined(EBSNET) // && !defined(EBSNET)
#define USE_WINDOWS_API // #define USE_WINDOWS_API
#endif // #endif
/* idea to add global alloc override by Moisés Guimarães */ // /* idea to add global alloc override by Moisés Guimarães */
/* default to libc stuff */ // /* default to libc stuff */
/* XREALLOC is used once in normal math lib, not in fast math lib */ // /* XREALLOC is used once in normal math lib, not in fast math lib */
/* XFREE on some embeded systems doesn't like free(0) so test */ // /* XFREE on some embeded systems doesn't like free(0) so test */
#if defined(XMALLOC_USER) // #if defined(XMALLOC_USER)
/* prototypes for user heap override functions */ // /* prototypes for user heap override functions */
#include <stddef.h> /* for size_t */ // #include <stddef.h> /* for size_t */
extern void *XMALLOC(size_t n, void* heap, int type); // extern void *XMALLOC(size_t n, void* heap, int type);
extern void *XREALLOC(void *p, size_t n, void* heap, int type); // extern void *XREALLOC(void *p, size_t n, void* heap, int type);
extern void XFREE(void *p, void* heap, int type); // extern void XFREE(void *p, void* heap, int type);
#elif defined(NO_WOLFSSL_MEMORY) // #elif defined(NO_WOLFSSL_MEMORY)
/* just use plain C stdlib stuff if desired */ // /* just use plain C stdlib stuff if desired */
#include <stdlib.h> // #include <stdlib.h>
#define XMALLOC(s, h, t) ((void)h, (void)t, malloc((s))) // #define XMALLOC(s, h, t) ((void)h, (void)t, malloc((s)))
#define XFREE(p, h, t) {void* xp = (p); if((xp)) free((xp));} // #define XFREE(p, h, t) {void* xp = (p); if((xp)) free((xp));}
#define XREALLOC(p, n, h, t) realloc((p), (n)) // #define XREALLOC(p, n, h, t) realloc((p), (n))
#elif !defined(MICRIUM_MALLOC) && !defined(EBSNET) \ // #elif !defined(MICRIUM_MALLOC) && !defined(EBSNET) \
&& !defined(WOLFSSL_SAFERTOS) && !defined(FREESCALE_MQX) \ // && !defined(WOLFSSL_SAFERTOS) && !defined(FREESCALE_MQX) \
&& !defined(WOLFSSL_LEANPSK) // && !defined(WOLFSSL_LEANPSK)
/* default C runtime, can install different routines at runtime via cbs */ // /* default C runtime, can install different routines at runtime via cbs */
#include <wolfssl/wolfcrypt/memory.h> // #include <wolfssl/wolfcrypt/memory.h>
#define XMALLOC(s, h, t) ((void)h, (void)t, wolfSSL_Malloc((s))) // #define XMALLOC(s, h, t) ((void)h, (void)t, wolfSSL_Malloc((s)))
#define XFREE(p, h, t) {void* xp = (p); if((xp)) wolfSSL_Free((xp));} // #define XFREE(p, h, t) {void* xp = (p); if((xp)) wolfSSL_Free((xp));}
#define XREALLOC(p, n, h, t) wolfSSL_Realloc((p), (n)) // #define XREALLOC(p, n, h, t) wolfSSL_Realloc((p), (n))
#endif // #endif
#ifndef STRING_USER // #ifndef STRING_USER
#include <string.h> // #include <string.h>
char* mystrnstr(const char* s1, const char* s2, unsigned int n); // char* mystrnstr(const char* s1, const char* s2, unsigned int n);
#define XMEMCPY(d,s,l) memcpy((d),(s),(l)) // #define XMEMCPY(d,s,l) memcpy((d),(s),(l))
#define XMEMSET(b,c,l) memset((b),(c),(l)) // #define XMEMSET(b,c,l) memset((b),(c),(l))
#define XMEMCMP(s1,s2,n) memcmp((s1),(s2),(n)) // #define XMEMCMP(s1,s2,n) memcmp((s1),(s2),(n))
#define XMEMMOVE(d,s,l) memmove((d),(s),(l)) // #define XMEMMOVE(d,s,l) memmove((d),(s),(l))
#define XSTRLEN(s1) strlen((s1)) // #define XSTRLEN(s1) strlen((s1))
#define XSTRNCPY(s1,s2,n) strncpy((s1),(s2),(n)) // #define XSTRNCPY(s1,s2,n) strncpy((s1),(s2),(n))
/* strstr, strncmp, and strncat only used by wolfSSL proper, not required for // /* strstr, strncmp, and strncat only used by wolfSSL proper, not required for
CTaoCrypt only */ // CTaoCrypt only */
#define XSTRSTR(s1,s2) strstr((s1),(s2)) // #define XSTRSTR(s1,s2) strstr((s1),(s2))
#define XSTRNSTR(s1,s2,n) mystrnstr((s1),(s2),(n)) // #define XSTRNSTR(s1,s2,n) mystrnstr((s1),(s2),(n))
#define XSTRNCMP(s1,s2,n) strncmp((s1),(s2),(n)) // #define XSTRNCMP(s1,s2,n) strncmp((s1),(s2),(n))
#define XSTRNCAT(s1,s2,n) strncat((s1),(s2),(n)) // #define XSTRNCAT(s1,s2,n) strncat((s1),(s2),(n))
#ifndef USE_WINDOWS_API // #ifndef USE_WINDOWS_API
#define XSTRNCASECMP(s1,s2,n) strncasecmp((s1),(s2),(n)) // #define XSTRNCASECMP(s1,s2,n) strncasecmp((s1),(s2),(n))
#define XSNPRINTF snprintf // #define XSNPRINTF snprintf
#else // #else
#define XSTRNCASECMP(s1,s2,n) _strnicmp((s1),(s2),(n)) // #define XSTRNCASECMP(s1,s2,n) _strnicmp((s1),(s2),(n))
#define XSNPRINTF _snprintf // #define XSNPRINTF _snprintf
#endif // #endif
#endif // #endif
#ifndef CTYPE_USER // #ifndef CTYPE_USER
#include <ctype.h> // #include <ctype.h>
#if defined(HAVE_ECC) || defined(HAVE_OCSP) // #if defined(HAVE_ECC) || defined(HAVE_OCSP)
#define XTOUPPER(c) toupper((c)) // #define XTOUPPER(c) toupper((c))
#define XISALPHA(c) isalpha((c)) // #define XISALPHA(c) isalpha((c))
#endif // #endif
/* needed by wolfSSL_check_domain_name() */ // /* needed by wolfSSL_check_domain_name() */
#ifdef __CYGWIN__ // #ifdef __CYGWIN__
/* Cygwin uses a macro version of tolower() by default, use the // /* Cygwin uses a macro version of tolower() by default, use the
* function version. */ // * function version. */
#undef tolower // #undef tolower
#endif // #endif
#define XTOLOWER(c) tolower((c)) // #define XTOLOWER(c) tolower((c))
#endif // #endif
/* memory allocation types for user hints */ // /* memory allocation types for user hints */
enum { // enum {
DYNAMIC_TYPE_CA = 1, // DYNAMIC_TYPE_CA = 1,
DYNAMIC_TYPE_CERT = 2, // DYNAMIC_TYPE_CERT = 2,
DYNAMIC_TYPE_KEY = 3, // DYNAMIC_TYPE_KEY = 3,
DYNAMIC_TYPE_FILE = 4, // DYNAMIC_TYPE_FILE = 4,
DYNAMIC_TYPE_SUBJECT_CN = 5, // DYNAMIC_TYPE_SUBJECT_CN = 5,
DYNAMIC_TYPE_PUBLIC_KEY = 6, // DYNAMIC_TYPE_PUBLIC_KEY = 6,
DYNAMIC_TYPE_SIGNER = 7, // DYNAMIC_TYPE_SIGNER = 7,
DYNAMIC_TYPE_NONE = 8, // DYNAMIC_TYPE_NONE = 8,
DYNAMIC_TYPE_BIGINT = 9, // DYNAMIC_TYPE_BIGINT = 9,
DYNAMIC_TYPE_RSA = 10, // DYNAMIC_TYPE_RSA = 10,
DYNAMIC_TYPE_METHOD = 11, // DYNAMIC_TYPE_METHOD = 11,
DYNAMIC_TYPE_OUT_BUFFER = 12, // DYNAMIC_TYPE_OUT_BUFFER = 12,
DYNAMIC_TYPE_IN_BUFFER = 13, // DYNAMIC_TYPE_IN_BUFFER = 13,
DYNAMIC_TYPE_INFO = 14, // DYNAMIC_TYPE_INFO = 14,
DYNAMIC_TYPE_DH = 15, // DYNAMIC_TYPE_DH = 15,
DYNAMIC_TYPE_DOMAIN = 16, // DYNAMIC_TYPE_DOMAIN = 16,
DYNAMIC_TYPE_SSL = 17, // DYNAMIC_TYPE_SSL = 17,
DYNAMIC_TYPE_CTX = 18, // DYNAMIC_TYPE_CTX = 18,
DYNAMIC_TYPE_WRITEV = 19, // DYNAMIC_TYPE_WRITEV = 19,
DYNAMIC_TYPE_OPENSSL = 20, // DYNAMIC_TYPE_OPENSSL = 20,
DYNAMIC_TYPE_DSA = 21, // DYNAMIC_TYPE_DSA = 21,
DYNAMIC_TYPE_CRL = 22, // DYNAMIC_TYPE_CRL = 22,
DYNAMIC_TYPE_REVOKED = 23, // DYNAMIC_TYPE_REVOKED = 23,
DYNAMIC_TYPE_CRL_ENTRY = 24, // DYNAMIC_TYPE_CRL_ENTRY = 24,
DYNAMIC_TYPE_CERT_MANAGER = 25, // DYNAMIC_TYPE_CERT_MANAGER = 25,
DYNAMIC_TYPE_CRL_MONITOR = 26, // DYNAMIC_TYPE_CRL_MONITOR = 26,
DYNAMIC_TYPE_OCSP_STATUS = 27, // DYNAMIC_TYPE_OCSP_STATUS = 27,
DYNAMIC_TYPE_OCSP_ENTRY = 28, // DYNAMIC_TYPE_OCSP_ENTRY = 28,
DYNAMIC_TYPE_ALTNAME = 29, // DYNAMIC_TYPE_ALTNAME = 29,
DYNAMIC_TYPE_SUITES = 30, // DYNAMIC_TYPE_SUITES = 30,
DYNAMIC_TYPE_CIPHER = 31, // DYNAMIC_TYPE_CIPHER = 31,
DYNAMIC_TYPE_RNG = 32, // DYNAMIC_TYPE_RNG = 32,
DYNAMIC_TYPE_ARRAYS = 33, // DYNAMIC_TYPE_ARRAYS = 33,
DYNAMIC_TYPE_DTLS_POOL = 34, // DYNAMIC_TYPE_DTLS_POOL = 34,
DYNAMIC_TYPE_SOCKADDR = 35, // DYNAMIC_TYPE_SOCKADDR = 35,
DYNAMIC_TYPE_LIBZ = 36, // DYNAMIC_TYPE_LIBZ = 36,
DYNAMIC_TYPE_ECC = 37, // DYNAMIC_TYPE_ECC = 37,
DYNAMIC_TYPE_TMP_BUFFER = 38, // DYNAMIC_TYPE_TMP_BUFFER = 38,
DYNAMIC_TYPE_DTLS_MSG = 39, // DYNAMIC_TYPE_DTLS_MSG = 39,
DYNAMIC_TYPE_CAVIUM_TMP = 40, // DYNAMIC_TYPE_CAVIUM_TMP = 40,
DYNAMIC_TYPE_CAVIUM_RSA = 41, // DYNAMIC_TYPE_CAVIUM_RSA = 41,
DYNAMIC_TYPE_X509 = 42, // DYNAMIC_TYPE_X509 = 42,
DYNAMIC_TYPE_TLSX = 43, // DYNAMIC_TYPE_TLSX = 43,
DYNAMIC_TYPE_OCSP = 44, // DYNAMIC_TYPE_OCSP = 44,
DYNAMIC_TYPE_SIGNATURE = 45 // DYNAMIC_TYPE_SIGNATURE = 45
}; // };
/* max error buffer string size */ // /* max error buffer string size */
enum { // enum {
WOLFSSL_MAX_ERROR_SZ = 80 // WOLFSSL_MAX_ERROR_SZ = 80
}; // };
/* stack protection */ // /* stack protection */
enum { // enum {
MIN_STACK_BUFFER = 8 // MIN_STACK_BUFFER = 8
}; // };
/* settings detection for compile vs runtime math incombatibilities */ // /* settings detection for compile vs runtime math incombatibilities */
enum { // enum {
#if !defined(USE_FAST_MATH) && !defined(SIZEOF_LONG) && !defined(SIZEOF_LONG_LONG) // #if !defined(USE_FAST_MATH) && !defined(SIZEOF_LONG) && !defined(SIZEOF_LONG_LONG)
CTC_SETTINGS = 0x0 // CTC_SETTINGS = 0x0
#elif !defined(USE_FAST_MATH) && defined(SIZEOF_LONG) && (SIZEOF_LONG == 8) // #elif !defined(USE_FAST_MATH) && defined(SIZEOF_LONG) && (SIZEOF_LONG == 8)
CTC_SETTINGS = 0x1 // CTC_SETTINGS = 0x1
#elif !defined(USE_FAST_MATH) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 8) // #elif !defined(USE_FAST_MATH) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 8)
CTC_SETTINGS = 0x2 // CTC_SETTINGS = 0x2
#elif !defined(USE_FAST_MATH) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 4) // #elif !defined(USE_FAST_MATH) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 4)
CTC_SETTINGS = 0x4 // CTC_SETTINGS = 0x4
#elif defined(USE_FAST_MATH) && !defined(SIZEOF_LONG) && !defined(SIZEOF_LONG_LONG) // #elif defined(USE_FAST_MATH) && !defined(SIZEOF_LONG) && !defined(SIZEOF_LONG_LONG)
CTC_SETTINGS = 0x8 // CTC_SETTINGS = 0x8
#elif defined(USE_FAST_MATH) && defined(SIZEOF_LONG) && (SIZEOF_LONG == 8) // #elif defined(USE_FAST_MATH) && defined(SIZEOF_LONG) && (SIZEOF_LONG == 8)
CTC_SETTINGS = 0x10 // CTC_SETTINGS = 0x10
#elif defined(USE_FAST_MATH) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 8) // #elif defined(USE_FAST_MATH) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 8)
CTC_SETTINGS = 0x20 // CTC_SETTINGS = 0x20
#elif defined(USE_FAST_MATH) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 4) // #elif defined(USE_FAST_MATH) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 4)
CTC_SETTINGS = 0x40 // CTC_SETTINGS = 0x40
#else // #else
#error "bad math long / long long settings" // #error "bad math long / long long settings"
#endif // #endif
}; // };
WOLFSSL_API word32 CheckRunTimeSettings(void); // WOLFSSL_API word32 CheckRunTimeSettings(void);
/* If user uses RSA, DH, DSA, or ECC math lib directly then fast math and long // /* If user uses RSA, DH, DSA, or ECC math lib directly then fast math and long
types need to match at compile time and run time, CheckCtcSettings will // types need to match at compile time and run time, CheckCtcSettings will
return 1 if a match otherwise 0 */ // return 1 if a match otherwise 0 */
#define CheckCtcSettings() (CTC_SETTINGS == CheckRunTimeSettings()) // #define CheckCtcSettings() (CTC_SETTINGS == CheckRunTimeSettings())
#ifdef __cplusplus // #ifdef __cplusplus
} /* extern "C" */ // } /* extern "C" */
#endif // #endif
#endif /* WOLF_CRYPT_TYPES_H */ // #endif /* WOLF_CRYPT_TYPES_H */