Skip to content

Commit

Permalink
More fixes for building x86 in Visual Studio for non-windows OS. Foll…
Browse files Browse the repository at this point in the history
…owup to PR wolfSSL#7884. Expands the `WOLFSSL_NOT_WINDOWS_API` improvement for intrinsics and word sizes. Fixes ZD 18465
  • Loading branch information
dgarske committed Oct 22, 2024
1 parent 846ef15 commit beea2e1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
3 changes: 2 additions & 1 deletion wolfcrypt/src/wc_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -3604,7 +3604,8 @@ time_t stm32_hal_time(time_t *t1)

#endif /* !NO_ASN_TIME */

#if !defined(WOLFSSL_LEANPSK) && !defined(STRING_USER)
#if (!defined(WOLFSSL_LEANPSK) && !defined(STRING_USER)) || \
defined(USE_WOLF_STRNSTR)
char* mystrnstr(const char* s1, const char* s2, unsigned int n)
{
unsigned int s2_len = (unsigned int)XSTRLEN(s2);
Expand Down
2 changes: 1 addition & 1 deletion wolfssl/wolfcrypt/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ WOLFSSL_API void wolfSSL_SetLoggingPrefix(const char* prefix);
WOLFSSL_API void WOLFSSL_MSG_EX(const char* fmt, ...);
#define HAVE_WOLFSSL_MSG_EX
#else
#define WOLFSSL_MSG_EX(...) WC_DO_NOTHING
#define WOLFSSL_MSG_EX() WC_DO_NOTHING
#endif
WOLFSSL_API void WOLFSSL_MSG(const char* msg);
#ifdef WOLFSSL_DEBUG_CODEPOINTS
Expand Down
7 changes: 0 additions & 7 deletions wolfssl/wolfcrypt/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -1358,13 +1358,6 @@
#define NO_SESSION_CACHE
#endif

/* Micrium will use Visual Studio for compilation but not the Win32 API */
#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) && \
!defined(FREERTOS_TCP) && !defined(EBSNET) && !defined(WOLFSSL_EROAD) && \
!defined(WOLFSSL_UTASKER) && !defined(INTIME_RTOS)
#define USE_WINDOWS_API
#endif

#if defined(WOLFSSL_uITRON4)

#define XMALLOC_USER
Expand Down
7 changes: 4 additions & 3 deletions wolfssl/wolfcrypt/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ decouple library dependencies with standard string, memory and so on.
#endif
#endif

#if defined(_MSC_VER) || defined(__BCPLUSPLUS__)
#if (defined(_MSC_VER) && !defined(WOLFSSL_NOT_WINDOWS_API)) || \
defined(__BCPLUSPLUS__)
#define WORD64_AVAILABLE
#define W64LIT(x) x##ui64
#define SW64LIT(x) x##i64
Expand Down Expand Up @@ -379,8 +380,8 @@ typedef struct w64wrapper {
#endif

/* set up rotate style */
#if (defined(_MSC_VER) || defined(__BCPLUSPLUS__)) && \
!defined(WOLFSSL_SGX) && !defined(INTIME_RTOS)
#if ((defined(_MSC_VER) && !defined(WOLFSSL_NOT_WINDOWS_API)) || \
defined(__BCPLUSPLUS__)) && !defined(WOLFSSL_SGX) && !defined(INTIME_RTOS)
#define INTEL_INTRINSICS
#define FAST_ROTATE
#elif defined(__MWERKS__) && TARGET_CPU_PPC
Expand Down
7 changes: 4 additions & 3 deletions wolfssl/wolfcrypt/wc_port.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef WOLFSSL_SGX
#if !defined(WOLFSSL_SGX) && !defined(WOLFSSL_NOT_WINDOWS_API)
#if defined(_WIN32_WCE) || defined(WIN32_LEAN_AND_MEAN)
/* On WinCE winsock2.h must be included before windows.h */
#include <winsock2.h>
Expand Down Expand Up @@ -346,7 +346,7 @@
#define WOLFSSL_ATOMIC_OPS
#endif /* WOLFSSL_HAVE_ATOMIC_H */
#endif
#elif defined(_MSC_VER)
#elif defined(_MSC_VER) && !defined(WOLFSSL_NOT_WINDOWS_API)
/* Use MSVC compiler intrinsics for atomic ops */
#ifdef _WIN32_WCE
#include <armintr.h>
Expand Down Expand Up @@ -1273,7 +1273,8 @@ WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Cleanup(void);
#endif /* !NO_ASN_TIME */


#ifndef WOLFSSL_LEANPSK
#if (!defined(WOLFSSL_LEANPSK) && !defined(STRING_USER)) || \
defined(USE_WOLF_STRNSTR)
char* mystrnstr(const char* s1, const char* s2, unsigned int n);
#endif

Expand Down

0 comments on commit beea2e1

Please sign in to comment.