Refactor HAVE_PTHREAD and _POSIX_THREADS (#6536)

* HAVE_PTHREAD gate in test.h
* add config.h and settings.h to test.h
* added config.h and settings.h to other test.h in wolfcrypt/test
* settings #ifdef _POSIX_THREADS HAVE_PTHREAD
* cyassl settings _POSIX_THREADS HAVE_PTHREAD
* undo cyassl _POSIX_THREADS HAVE_PTHREAD
* move settings.h #include in both test.h
* add !defined(SINGLE_THREADED) logic
* refactor  HAVE_PTHREAD, _POSIX_THREADS
This commit is contained in:
gojimmypi
2023-06-26 07:32:20 -07:00
committed by GitHub
parent 18032cdc40
commit 6b240fa41a
12 changed files with 85 additions and 46 deletions

View File

@@ -66,9 +66,18 @@ Or
#endif #endif
/* PTHREAD requires server and client enabled */ /* PTHREAD requires server and client enabled */
#if defined(HAVE_PTHREAD) && (defined(NO_WOLFSSL_CLIENT) || defined(NO_WOLFSSL_SERVER)) #if defined(NO_WOLFSSL_CLIENT) || defined(NO_WOLFSSL_SERVER)
#if defined(HAVE_PTHREAD)
#ifdef __GNUC__ /* GCC compiler */
#pragma message "PTHREAD requires server and client enabled."
#elif defined(_MSC_VER) /* Microsoft Visual C++ compiler */
#pragma message("PTHREAD requires server and client enabled.")
#else
#warning "PTHREAD requires server and client enabled."
#endif
#undef HAVE_PTHREAD #undef HAVE_PTHREAD
#endif #endif
#endif
#ifdef HAVE_PTHREAD #ifdef HAVE_PTHREAD
#include <pthread.h> #include <pthread.h>

View File

@@ -1740,7 +1740,7 @@ static int client_srtp_test(WOLFSSL *ssl, func_args *args)
size_t srtp_secret_length; size_t srtp_secret_length;
byte *srtp_secret, *p; byte *srtp_secret, *p;
int ret; int ret;
#if !defined(SINGLE_THREADED) && defined(_POSIX_THREADS) #ifdef HAVE_PTHREAD
srtp_test_helper *srtp_helper = args->srtp_helper; srtp_test_helper *srtp_helper = args->srtp_helper;
byte *other_secret = NULL; byte *other_secret = NULL;
size_t other_size = 0; size_t other_size = 0;
@@ -1774,7 +1774,7 @@ static int client_srtp_test(WOLFSSL *ssl, func_args *args)
printf("%02X", *p); printf("%02X", *p);
printf("\n"); printf("\n");
#if !defined(SINGLE_THREADED) && defined(_POSIX_THREADS) #ifdef HAVE_PTHREAD
if (srtp_helper != NULL) { if (srtp_helper != NULL) {
srtp_helper_get_ekm(srtp_helper, &other_secret, &other_size); srtp_helper_get_ekm(srtp_helper, &other_secret, &other_size);
@@ -1790,7 +1790,7 @@ static int client_srtp_test(WOLFSSL *ssl, func_args *args)
/* we are delegated from server to free this buffer */ /* we are delegated from server to free this buffer */
XFREE(other_secret, NULL, DYNAMIC_TYPE_TMP_BUFFER); XFREE(other_secret, NULL, DYNAMIC_TYPE_TMP_BUFFER);
} }
#endif #endif /* HAVE_PTHREAD */
XFREE(srtp_secret, NULL, DYNAMIC_TYPE_TMP_BUFFER); XFREE(srtp_secret, NULL, DYNAMIC_TYPE_TMP_BUFFER);
@@ -4546,7 +4546,7 @@ exit:
StartTCP(); StartTCP();
#if defined(WOLFSSL_SRTP) && !defined(SINGLE_THREADED) && defined(_POSIX_THREADS) #if defined(WOLFSSL_SRTP) && defined(HAVE_PTHREAD)
args.srtp_helper = NULL; args.srtp_helper = NULL;
#endif #endif
args.argc = argc; args.argc = argc;

View File

@@ -67,7 +67,7 @@
static void SignalReady(void* args, word16 port) static void SignalReady(void* args, word16 port)
{ {
#if defined(_POSIX_THREADS) && defined(NO_MAIN_DRIVER) && !defined(__MINGW32__) #if defined(NO_MAIN_DRIVER) && defined(HAVE_PTHREAD)
/* signal ready to tcp_accept */ /* signal ready to tcp_accept */
func_args* server_args = (func_args*)args; func_args* server_args = (func_args*)args;
tcp_ready* ready = server_args->signal; tcp_ready* ready = server_args->signal;
@@ -76,7 +76,7 @@ static void SignalReady(void* args, word16 port)
ready->port = port; ready->port = port;
PTHREAD_CHECK_RET(pthread_cond_signal(&ready->cond)); PTHREAD_CHECK_RET(pthread_cond_signal(&ready->cond));
PTHREAD_CHECK_RET(pthread_mutex_unlock(&ready->mutex)); PTHREAD_CHECK_RET(pthread_mutex_unlock(&ready->mutex));
#endif #endif /* NO_MAIN_DRIVER && HAVE_PTHREAD */
(void)args; (void)args;
(void)port; (void)port;
} }

View File

@@ -1319,7 +1319,7 @@ static int server_srtp_test(WOLFSSL *ssl, func_args *args)
size_t srtp_secret_length; size_t srtp_secret_length;
byte *srtp_secret, *p; byte *srtp_secret, *p;
int ret; int ret;
#if !defined(SINGLE_THREADED) && defined(_POSIX_THREADS) #ifdef HAVE_PTHREAD
srtp_test_helper *srtp_helper = args->srtp_helper; srtp_test_helper *srtp_helper = args->srtp_helper;
#else #else
(void)args; (void)args;
@@ -1351,7 +1351,7 @@ static int server_srtp_test(WOLFSSL *ssl, func_args *args)
printf("%02X", *p); printf("%02X", *p);
printf("\n"); printf("\n");
#if !defined(SINGLE_THREADED) && defined(_POSIX_THREADS) #ifdef HAVE_PTHREAD
if (srtp_helper != NULL) { if (srtp_helper != NULL) {
srtp_helper_set_ekm(srtp_helper, srtp_secret, srtp_secret_length); srtp_helper_set_ekm(srtp_helper, srtp_secret, srtp_secret_length);
@@ -1359,7 +1359,7 @@ static int server_srtp_test(WOLFSSL *ssl, func_args *args)
correctness */ correctness */
return 0; return 0;
} }
#endif /* _POSIX_THREADS */ #endif /* HAVE_PTHREAD */
XFREE(srtp_secret, NULL, DYNAMIC_TYPE_TMP_BUFFER); XFREE(srtp_secret, NULL, DYNAMIC_TYPE_TMP_BUFFER);
return 0; return 0;
@@ -3807,7 +3807,7 @@ exit:
args.argv = argv; args.argv = argv;
args.signal = &ready; args.signal = &ready;
args.return_code = 0; args.return_code = 0;
#if defined(WOLFSSL_SRTP) && !defined(SINGLE_THREADED) && defined(_POSIX_THREADS) #if defined(WOLFSSL_SRTP) && defined(HAVE_PTHREAD)
args.srtp_helper = NULL; args.srtp_helper = NULL;
#endif #endif
InitTcpReady(&ready); InitTcpReady(&ready);

View File

@@ -329,7 +329,7 @@ static int execute_test_case(int svr_argc, char** svr_argv,
int reqClientCert; int reqClientCert;
#endif #endif
#if defined(WOLFSSL_SRTP) && !defined(SINGLE_THREADED) && defined(_POSIX_THREADS) #if defined(WOLFSSL_SRTP) && defined(HAVE_PTHREAD)
srtp_test_helper srtp_helper; srtp_test_helper srtp_helper;
#endif #endif
/* Is Valid Cipher and Version Checks */ /* Is Valid Cipher and Version Checks */
@@ -460,7 +460,7 @@ static int execute_test_case(int svr_argc, char** svr_argv,
InitTcpReady(&ready); InitTcpReady(&ready);
#if defined(WOLFSSL_SRTP) && !defined(SINGLE_THREADED) && defined(_POSIX_THREADS) #if defined(WOLFSSL_SRTP) && defined(HAVE_PTHREAD)
srtp_helper_init(&srtp_helper); srtp_helper_init(&srtp_helper);
cliArgs.srtp_helper = &srtp_helper; cliArgs.srtp_helper = &srtp_helper;
svrArgs.srtp_helper = &srtp_helper; svrArgs.srtp_helper = &srtp_helper;
@@ -580,7 +580,7 @@ static int execute_test_case(int svr_argc, char** svr_argv,
#endif #endif
FreeTcpReady(&ready); FreeTcpReady(&ready);
#if defined (WOLFSSL_SRTP) &&!defined(SINGLE_THREADED) && defined(_POSIX_THREADS) #if defined (WOLFSSL_SRTP) && defined(HAVE_PTHREAD)
srtp_helper_free(&srtp_helper); srtp_helper_free(&srtp_helper);
#endif #endif

View File

@@ -275,9 +275,7 @@ exit:
void wait_tcp_ready(func_args* args) void wait_tcp_ready(func_args* args)
{ {
#ifdef SINGLE_THREADED #ifdef HAVE_PTHREAD
(void)args;
#elif defined(_POSIX_THREADS) && !defined(__MINGW32__)
PTHREAD_CHECK_RET(pthread_mutex_lock(&args->signal->mutex)); PTHREAD_CHECK_RET(pthread_mutex_lock(&args->signal->mutex));
if (!args->signal->ready) if (!args->signal->ready)
@@ -287,6 +285,7 @@ void wait_tcp_ready(func_args* args)
PTHREAD_CHECK_RET(pthread_mutex_unlock(&args->signal->mutex)); PTHREAD_CHECK_RET(pthread_mutex_unlock(&args->signal->mutex));
#else #else
/* no threading wait or single threaded */
(void)args; (void)args;
#endif #endif
} }
@@ -294,11 +293,11 @@ void wait_tcp_ready(func_args* args)
void start_thread(THREAD_FUNC fun, func_args* args, THREAD_TYPE* thread) void start_thread(THREAD_FUNC fun, func_args* args, THREAD_TYPE* thread)
{ {
#ifdef SINGLE_THREADED #if defined(SINGLE_THREADED)
(void)fun; (void)fun;
(void)args; (void)args;
(void)thread; (void)thread;
#elif defined(_POSIX_THREADS) && !defined(__MINGW32__) #elif defined(HAVE_PTHREAD)
PTHREAD_CHECK_RET(pthread_create(thread, 0, fun, args)); PTHREAD_CHECK_RET(pthread_create(thread, 0, fun, args));
return; return;
#elif defined (WOLFSSL_TIRTOS) #elif defined (WOLFSSL_TIRTOS)
@@ -313,6 +312,7 @@ void start_thread(THREAD_FUNC fun, func_args* args, THREAD_TYPE* thread)
} }
Task_yield(); Task_yield();
#else #else
/* custom / external thread type */
*thread = (THREAD_TYPE)_beginthreadex(0, 0, fun, args, 0, 0); *thread = (THREAD_TYPE)_beginthreadex(0, 0, fun, args, 0, 0);
#endif #endif
} }
@@ -320,9 +320,9 @@ void start_thread(THREAD_FUNC fun, func_args* args, THREAD_TYPE* thread)
void join_thread(THREAD_TYPE thread) void join_thread(THREAD_TYPE thread)
{ {
#ifdef SINGLE_THREADED #if defined(SINGLE_THREADED)
(void)thread; (void)thread;
#elif defined(_POSIX_THREADS) && !defined(__MINGW32__) #elif defined(HAVE_PTHREAD)
PTHREAD_CHECK_RET(pthread_join(thread, 0)); PTHREAD_CHECK_RET(pthread_join(thread, 0));
#elif defined (WOLFSSL_TIRTOS) #elif defined (WOLFSSL_TIRTOS)
while(1) { while(1) {

View File

@@ -431,7 +431,7 @@ static void simple_test(func_args* args)
*/ */
void wait_tcp_ready(func_args* args) void wait_tcp_ready(func_args* args)
{ {
#if defined(_POSIX_THREADS) && !defined(__MINGW32__) #if defined(HAVE_PTHREAD)
PTHREAD_CHECK_RET(pthread_mutex_lock(&args->signal->mutex)); PTHREAD_CHECK_RET(pthread_mutex_lock(&args->signal->mutex));
if (!args->signal->ready) if (!args->signal->ready)
@@ -459,7 +459,7 @@ void wait_tcp_ready(func_args* args)
(void)args; (void)args;
#else #else
(void)args; (void)args;
#endif #endif /* thread checks */
} }
@@ -471,7 +471,7 @@ void wait_tcp_ready(func_args* args)
*/ */
void start_thread(THREAD_FUNC fun, func_args* args, THREAD_TYPE* thread) void start_thread(THREAD_FUNC fun, func_args* args, THREAD_TYPE* thread)
{ {
#if defined(_POSIX_THREADS) && !defined(__MINGW32__) #if defined(HAVE_PTHREAD)
PTHREAD_CHECK_RET(pthread_create(thread, 0, fun, args)); PTHREAD_CHECK_RET(pthread_create(thread, 0, fun, args));
return; return;
#elif defined(WOLFSSL_TIRTOS) #elif defined(WOLFSSL_TIRTOS)
@@ -527,10 +527,11 @@ void start_thread(THREAD_FUNC fun, func_args* args, THREAD_TYPE* thread)
{ {
printf("Ethernet Bypass Application: failed to create idle thread!\n"); printf("Ethernet Bypass Application: failed to create idle thread!\n");
} }
/* end if NETOS */
#else #else
/* custom / external thread type */
*thread = (THREAD_TYPE)_beginthreadex(0, 0, fun, args, 0, 0); *thread = (THREAD_TYPE)_beginthreadex(0, 0, fun, args, 0, 0);
#endif #endif /* thread types */
} }
@@ -540,7 +541,7 @@ void start_thread(THREAD_FUNC fun, func_args* args, THREAD_TYPE* thread)
*/ */
void join_thread(THREAD_TYPE thread) void join_thread(THREAD_TYPE thread)
{ {
#if defined(_POSIX_THREADS) && !defined(__MINGW32__) #if defined(HAVE_PTHREAD)
PTHREAD_CHECK_RET(pthread_join(thread, 0)); PTHREAD_CHECK_RET(pthread_join(thread, 0));
#elif defined(WOLFSSL_TIRTOS) #elif defined(WOLFSSL_TIRTOS)
while(1) { while(1) {

View File

@@ -874,8 +874,7 @@ static WC_INLINE word64 Entropy_TimeHiRes(void)
return now.tv_nsec; return now.tv_nsec;
} }
#elif !defined(SINGLE_THREADED) && defined(_POSIX_THREADS) && \ #elif defined(HAVE_PTHREAD)
!defined(__MINGW32__)
/* Start and stop thread that counts as a proxy for time counter. */ /* Start and stop thread that counts as a proxy for time counter. */
#define ENTROPY_MEMUSE_THREADED #define ENTROPY_MEMUSE_THREADED
@@ -983,7 +982,7 @@ static void Entropy_StopThread(void)
entropy_thread_started = 0; entropy_thread_started = 0;
} }
} }
/* end if defined(HAVE_PTHREAD) */
#else #else
#error "No high precision time available for MemUse Entropy." #error "No high precision time available for MemUse Entropy."

View File

@@ -35,6 +35,11 @@
typedef sword32 wc_test_ret_t; typedef sword32 wc_test_ret_t;
#endif #endif
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <wolfssl/wolfcrypt/settings.h>
#ifdef HAVE_STACK_SIZE #ifdef HAVE_STACK_SIZE
THREAD_RETURN WOLFSSL_THREAD wolfcrypt_test(void* args); THREAD_RETURN WOLFSSL_THREAD wolfcrypt_test(void* args);
#else #else

View File

@@ -28,6 +28,11 @@
#ifndef wolfSSL_TEST_H #ifndef wolfSSL_TEST_H
#define wolfSSL_TEST_H #define wolfSSL_TEST_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <wolfssl/wolfcrypt/settings.h>
#ifdef FUSION_RTOS #ifdef FUSION_RTOS
#include <fclstdio.h> #include <fclstdio.h>
#include <fclstdlib.h> #include <fclstdlib.h>
@@ -182,7 +187,9 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/socket.h> #include <sys/socket.h>
#ifdef HAVE_PTHREAD
#include <pthread.h> #include <pthread.h>
#endif
#include <fcntl.h> #include <fcntl.h>
#ifdef TEST_IPV6 #ifdef TEST_IPV6
#include <netdb.h> #include <netdb.h>
@@ -529,7 +536,7 @@ typedef struct tcp_ready {
word16 ready; /* predicate */ word16 ready; /* predicate */
word16 port; word16 port;
char* srfName; /* server ready file name */ char* srfName; /* server ready file name */
#if defined(_POSIX_THREADS) && !defined(__MINGW32__) #ifdef HAVE_PTHREAD
pthread_mutex_t mutex; pthread_mutex_t mutex;
pthread_cond_t cond; pthread_cond_t cond;
#endif #endif
@@ -543,12 +550,13 @@ static WC_INLINE void InitTcpReady(tcp_ready* ready)
ready->ready = 0; ready->ready = 0;
ready->port = 0; ready->port = 0;
ready->srfName = NULL; ready->srfName = NULL;
#ifdef SINGLE_THREADED #if defined(HAVE_PTHREAD)
#elif defined(_POSIX_THREADS) && !defined(__MINGW32__)
PTHREAD_CHECK_RET(pthread_mutex_init(&ready->mutex, 0)); PTHREAD_CHECK_RET(pthread_mutex_init(&ready->mutex, 0));
PTHREAD_CHECK_RET(pthread_cond_init(&ready->cond, 0)); PTHREAD_CHECK_RET(pthread_cond_init(&ready->cond, 0));
#elif defined(NETOS) #elif defined(NETOS)
tx_mutex_create(&ready->mutex, "wolfSSL Lock", TX_INHERIT); tx_mutex_create(&ready->mutex, "wolfSSL Lock", TX_INHERIT);
#else
/* no threading init or single threaded */
#endif #endif
} }
@@ -558,9 +566,7 @@ static WC_INLINE void InitTcpReady(tcp_ready* ready)
static WC_INLINE void FreeTcpReady(tcp_ready* ready) static WC_INLINE void FreeTcpReady(tcp_ready* ready)
{ {
#ifdef SINGLE_THREADED #if defined(HAVE_PTHREAD)
(void)ready;
#elif defined(_POSIX_THREADS) && !defined(__MINGW32__)
PTHREAD_CHECK_RET(pthread_mutex_destroy(&ready->mutex)); PTHREAD_CHECK_RET(pthread_mutex_destroy(&ready->mutex));
PTHREAD_CHECK_RET(pthread_cond_destroy(&ready->cond)); PTHREAD_CHECK_RET(pthread_cond_destroy(&ready->cond));
#elif defined(NETOS) #elif defined(NETOS)
@@ -599,14 +605,14 @@ typedef struct callback_functions {
unsigned char doUdp:1; unsigned char doUdp:1;
} callback_functions; } callback_functions;
#if defined(WOLFSSL_SRTP) && !defined(SINGLE_THREADED) && defined(_POSIX_THREADS) #if defined(WOLFSSL_SRTP) && defined(HAVE_PTHREAD)
typedef struct srtp_test_helper { typedef struct srtp_test_helper {
pthread_mutex_t mutex; pthread_mutex_t mutex;
pthread_cond_t cond; pthread_cond_t cond;
uint8_t* server_srtp_ekm; uint8_t* server_srtp_ekm;
size_t server_srtp_ekm_size; size_t server_srtp_ekm_size;
} srtp_test_helper; } srtp_test_helper;
#endif #endif /* WOLFSSL_SRTP HAVE_PTHREAD */
typedef struct func_args { typedef struct func_args {
int argc; int argc;
@@ -614,7 +620,7 @@ typedef struct func_args {
int return_code; int return_code;
tcp_ready* signal; tcp_ready* signal;
callback_functions *callbacks; callback_functions *callbacks;
#if defined(WOLFSSL_SRTP) && !defined(SINGLE_THREADED) && defined(_POSIX_THREADS) #if defined(WOLFSSL_SRTP) && defined(HAVE_PTHREAD)
srtp_test_helper* srtp_helper; srtp_test_helper* srtp_helper;
#endif #endif
} func_args; } func_args;
@@ -655,7 +661,7 @@ static const word16 wolfSSLPort = 11111;
extern int myoptind; extern int myoptind;
extern char* myoptarg; extern char* myoptarg;
#if defined(WOLFSSL_SRTP) && !defined(SINGLE_THREADED) && defined(_POSIX_THREADS) #if defined(WOLFSSL_SRTP) && defined(HAVE_PTHREAD)
static WC_INLINE void srtp_helper_init(srtp_test_helper *srtp) static WC_INLINE void srtp_helper_init(srtp_test_helper *srtp)
{ {
@@ -2201,7 +2207,7 @@ static WC_INLINE void udp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd,
#endif #endif
if (args != NULL && args->signal != NULL) { if (args != NULL && args->signal != NULL) {
#if defined(_POSIX_THREADS) && !defined(__MINGW32__) #if defined(HAVE_PTHREAD)
/* signal ready to accept data */ /* signal ready to accept data */
tcp_ready* ready = args->signal; tcp_ready* ready = args->signal;
PTHREAD_CHECK_RET(pthread_mutex_lock(&ready->mutex)); PTHREAD_CHECK_RET(pthread_mutex_lock(&ready->mutex));
@@ -2248,7 +2254,7 @@ static WC_INLINE void tcp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd,
if(do_listen) { if(do_listen) {
tcp_listen(sockfd, &port, useAnyAddr, udp, sctp); tcp_listen(sockfd, &port, useAnyAddr, udp, sctp);
#if defined(_POSIX_THREADS) && defined(NO_MAIN_DRIVER) && !defined(__MINGW32__) #if defined(NO_MAIN_DRIVER) && defined(HAVE_PTHREAD)
/* signal ready to tcp_accept */ /* signal ready to tcp_accept */
if (args) if (args)
ready = args->signal; ready = args->signal;

View File

@@ -275,6 +275,23 @@
#include <wolfssl/wolfcrypt/visibility.h> #include <wolfssl/wolfcrypt/visibility.h>
/* AFTER user_settings.h is loaded,
** determine if POSIX multi-threaded: HAVE_PTHREAD */
#if defined(SINGLE_THREADED) || defined(__MINGW32__)
/* Never HAVE_PTHREAD in single thread, or non-POSIX mode.
** Reminder: MING32 is win32 threads, not POSIX threads */
#undef HAVE_PTHREAD
#else
#ifdef _POSIX_THREADS
/* HAVE_PTHREAD == POSIX threads capable and enabled. */
#undef HAVE_PTHREAD
#define HAVE_PTHREAD 1
#else
/* Not manually disabled, but POSIX threads not found. */
#undef HAVE_PTHREAD
#endif
#endif
#define WOLFSSL_MAKE_FIPS_VERSION(major, minor) (((major) * 256) + (minor)) #define WOLFSSL_MAKE_FIPS_VERSION(major, minor) (((major) * 256) + (minor))
#if !defined(HAVE_FIPS) #if !defined(HAVE_FIPS)
#define WOLFSSL_FIPS_VERSION_CODE WOLFSSL_MAKE_FIPS_VERSION(0,0) #define WOLFSSL_FIPS_VERSION_CODE WOLFSSL_MAKE_FIPS_VERSION(0,0)

View File

@@ -31,6 +31,9 @@ decouple library dependencies with standard string, memory and so on.
#ifndef WOLF_CRYPT_TYPES_H #ifndef WOLF_CRYPT_TYPES_H
#define WOLF_CRYPT_TYPES_H #define WOLF_CRYPT_TYPES_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <wolfssl/wolfcrypt/settings.h> #include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/wolfcrypt/wc_port.h> #include <wolfssl/wolfcrypt/wc_port.h>
@@ -1351,8 +1354,7 @@ typedef struct w64wrapper {
typedef unsigned int THREAD_RETURN; typedef unsigned int THREAD_RETURN;
typedef size_t THREAD_TYPE; typedef size_t THREAD_TYPE;
#define WOLFSSL_THREAD #define WOLFSSL_THREAD
#elif (defined(_POSIX_THREADS) || defined(HAVE_PTHREAD)) && \ #elif defined(HAVE_PTHREAD)
!defined(__MINGW32__)
typedef void* THREAD_RETURN; typedef void* THREAD_RETURN;
typedef pthread_t THREAD_TYPE; typedef pthread_t THREAD_TYPE;
#define WOLFSSL_THREAD #define WOLFSSL_THREAD