Fix mingw-w64 build issues on windows.
This commit is contained in:
parent
b99f5e5041
commit
87113cc88d
@ -8123,8 +8123,9 @@ AX_HARDEN_CC_COMPILER_FLAGS
|
||||
|
||||
case $host_os in
|
||||
mingw*)
|
||||
# if mingw then link to ws2_32 for sockets
|
||||
# if mingw then link to ws2_32 for sockets, and crypt32
|
||||
LDFLAGS="$LDFLAGS -lws2_32"
|
||||
LIB_ADD="$LIB_ADD -lcrypt32"
|
||||
if test "$enable_shared" = "yes"
|
||||
then
|
||||
AC_DEFINE([WOLFSSL_DLL], [1], [Use __declspec(dllexport) when building library])
|
||||
|
@ -2144,7 +2144,7 @@ int wolfSSL_BIO_flush(WOLFSSL_BIO* bio)
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
|
||||
b->num = sfd;
|
||||
b->num = (int) sfd;
|
||||
b->shutdown = BIO_CLOSE;
|
||||
return WOLFSSL_SUCCESS;
|
||||
}
|
||||
@ -2173,7 +2173,7 @@ int wolfSSL_BIO_flush(WOLFSSL_BIO* bio)
|
||||
WOLFSSL_ENTER("wolfIO_TcpBind error");
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
b->num = sfd;
|
||||
b->num = (int) sfd;
|
||||
b->shutdown = BIO_CLOSE;
|
||||
}
|
||||
else {
|
||||
|
11
src/ssl.c
11
src/ssl.c
@ -165,9 +165,14 @@
|
||||
#ifdef WOLFSSL_SYS_CA_CERTS
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <Wincrypt.h>
|
||||
#pragma comment(lib, "crypt32")
|
||||
#include <windows.h>
|
||||
#include <Wincrypt.h>
|
||||
|
||||
/* mingw gcc does not support pragma comment, and the
|
||||
* linking with crypt32 is handled in configure.ac */
|
||||
#if !defined(__MINGW32__) && !defined(__MINGW64__)
|
||||
#pragma comment(lib, "crypt32")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) && defined(HAVE_SECURITY_SECTRUSTSETTINGS_H)
|
||||
|
14
src/wolfio.c
14
src/wolfio.c
@ -837,7 +837,7 @@ int wolfIO_Recv(SOCKET_T sd, char *buf, int sz, int rdFlags)
|
||||
int recvd;
|
||||
|
||||
recvd = (int)RECV_FUNCTION(sd, buf, sz, rdFlags);
|
||||
recvd = TranslateReturnCode(recvd, sd);
|
||||
recvd = TranslateReturnCode(recvd, (int) sd);
|
||||
|
||||
return recvd;
|
||||
}
|
||||
@ -847,7 +847,7 @@ int wolfIO_Send(SOCKET_T sd, char *buf, int sz, int wrFlags)
|
||||
int sent;
|
||||
|
||||
sent = (int)SEND_FUNCTION(sd, buf, sz, wrFlags);
|
||||
sent = TranslateReturnCode(sent, sd);
|
||||
sent = TranslateReturnCode(sent, (int) sd);
|
||||
|
||||
return sent;
|
||||
}
|
||||
@ -1142,6 +1142,7 @@ int wolfIO_TcpConnect(SOCKET_T* sockfd, const char* ip, word16 port, int to_sec)
|
||||
#endif
|
||||
{
|
||||
WOLFSSL_MSG("bad socket fd, out of fds?");
|
||||
*sockfd = SOCKET_INVALID;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1206,7 +1207,12 @@ int wolfIO_TcpBind(SOCKET_T* sockfd, word16 port)
|
||||
sin->sin_port = XHTONS(port);
|
||||
*sockfd = (SOCKET_T)socket(AF_INET, SOCK_STREAM, 0);
|
||||
|
||||
if (*sockfd < 0) {
|
||||
#ifdef USE_WINDOWS_API
|
||||
if (*sockfd == SOCKET_INVALID)
|
||||
#else
|
||||
if (*sockfd <= SOCKET_INVALID)
|
||||
#endif
|
||||
{
|
||||
WOLFSSL_MSG("socket failed");
|
||||
*sockfd = SOCKET_INVALID;
|
||||
return -1;
|
||||
@ -1794,7 +1800,7 @@ int EmbedOcspLookup(void* ctx, const char* url, int urlSz,
|
||||
WOLFSSL_MSG("OCSP ocsp request failed");
|
||||
}
|
||||
else {
|
||||
ret = wolfIO_HttpProcessResponseOcsp(sfd, ocspRespBuf, httpBuf,
|
||||
ret = wolfIO_HttpProcessResponseOcsp((int) sfd, ocspRespBuf, httpBuf,
|
||||
HTTP_SCRATCH_BUFFER_SIZE, ctx);
|
||||
}
|
||||
if (sfd != SOCKET_INVALID)
|
||||
|
@ -36310,8 +36310,8 @@ static int test_wolfSSL_set_options(void)
|
||||
WOLFSSL_OP_NO_COMPRESSION) == WOLFSSL_OP_NO_COMPRESSION);
|
||||
|
||||
#ifdef OPENSSL_EXTRA
|
||||
AssertNull((wolfSSL_clear_options(ssl, WOLFSSL_OP_NO_COMPRESSION) &
|
||||
WOLFSSL_OP_NO_COMPRESSION));
|
||||
AssertFalse((wolfSSL_clear_options(ssl, WOLFSSL_OP_NO_COMPRESSION) &
|
||||
WOLFSSL_OP_NO_COMPRESSION));
|
||||
#endif
|
||||
|
||||
#ifdef OPENSSL_EXTRA
|
||||
|
@ -451,7 +451,12 @@ void wait_tcp_ready(func_args* args)
|
||||
(void)tx_mutex_put(&args->signal->mutex);
|
||||
#elif defined(USE_WINDOWS_API)
|
||||
/* Give peer a moment to get running */
|
||||
_sleep(500);
|
||||
#if defined(__MINGW32__) || defined(__MINGW64__)
|
||||
Sleep(500);
|
||||
#else
|
||||
_sleep(500);
|
||||
#endif
|
||||
(void)args;
|
||||
#else
|
||||
(void)args;
|
||||
#endif
|
||||
|
@ -358,7 +358,11 @@
|
||||
#endif
|
||||
|
||||
#ifdef USE_WINDOWS_API
|
||||
typedef unsigned int SOCKET_T;
|
||||
#if defined(__MINGW64__)
|
||||
typedef size_t SOCKET_T;
|
||||
#else
|
||||
typedef unsigned int SOCKET_T;
|
||||
#endif
|
||||
#ifndef SOCKET_INVALID
|
||||
#define SOCKET_INVALID INVALID_SOCKET
|
||||
#endif
|
||||
@ -745,7 +749,11 @@ WOLFSSL_API void wolfSSL_SetIOWriteFlags(WOLFSSL* ssl, int flags);
|
||||
#define XINET_PTON(a,b,c) inet_pton((a),(b),(c))
|
||||
#ifdef USE_WINDOWS_API /* Windows-friendly definition */
|
||||
#undef XINET_PTON
|
||||
#define XINET_PTON(a,b,c) InetPton((a),(PCWSTR)(b),(c))
|
||||
#if defined(__MINGW64__) && !defined(UNICODE)
|
||||
#define XINET_PTON(a,b,c) InetPton((a),(b),(c))
|
||||
#else
|
||||
#define XINET_PTON(a,b,c) InetPton((a),(PCWSTR)(b),(c))
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user