mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 02:37:28 +02:00
1
IDE/WIN/user_settings.h
Executable file → Normal file
1
IDE/WIN/user_settings.h
Executable file → Normal file
@ -25,6 +25,7 @@
|
||||
#else
|
||||
/* Enables blinding mode, to prevent timing attacks */
|
||||
#define WC_RSA_BLINDING
|
||||
#define NO_MULTIBYTE_PRINT
|
||||
|
||||
#if defined(WOLFSSL_LIB)
|
||||
/* The lib */
|
||||
|
@ -447,18 +447,18 @@ static int SocketRecv(int sockFd, char* buf, int sz)
|
||||
int recvd = (int)recv(sockFd, buf, sz, 0);
|
||||
if (recvd == -1) {
|
||||
switch (errno) {
|
||||
#if EAGAIN != EWOULDBLOCK
|
||||
#if EAGAIN != SOCKET_EWOULDBLOCK
|
||||
case EAGAIN: /* EAGAIN == EWOULDBLOCK on some systems, but not others */
|
||||
#endif
|
||||
case EWOULDBLOCK:
|
||||
case SOCKET_EWOULDBLOCK:
|
||||
return WOLFSSL_CBIO_ERR_WANT_READ;
|
||||
case ECONNRESET:
|
||||
case SOCKET_ECONNRESET:
|
||||
return WOLFSSL_CBIO_ERR_CONN_RST;
|
||||
case EINTR:
|
||||
case SOCKET_EINTR:
|
||||
return WOLFSSL_CBIO_ERR_ISR;
|
||||
case ECONNREFUSED: /* DTLS case */
|
||||
case SOCKET_ECONNREFUSED: /* DTLS case */
|
||||
return WOLFSSL_CBIO_ERR_WANT_READ;
|
||||
case ECONNABORTED:
|
||||
case SOCKET_ECONNABORTED:
|
||||
return WOLFSSL_CBIO_ERR_CONN_CLOSE;
|
||||
default:
|
||||
return WOLFSSL_CBIO_ERR_GENERAL;
|
||||
@ -475,16 +475,16 @@ static int SocketSend(int sockFd, char* buf, int sz)
|
||||
int sent = (int)send(sockFd, buf, sz, 0);
|
||||
if (sent == -1) {
|
||||
switch (errno) {
|
||||
#if EAGAIN != EWOULDBLOCK
|
||||
#if EAGAIN != SOCKET_EWOULDBLOCK
|
||||
case EAGAIN: /* EAGAIN == EWOULDBLOCK on some systems, but not others */
|
||||
#endif
|
||||
case EWOULDBLOCK:
|
||||
case SOCKET_EWOULDBLOCK:
|
||||
return WOLFSSL_CBIO_ERR_WANT_READ;
|
||||
case ECONNRESET:
|
||||
case SOCKET_ECONNRESET:
|
||||
return WOLFSSL_CBIO_ERR_CONN_RST;
|
||||
case EINTR:
|
||||
case SOCKET_EINTR:
|
||||
return WOLFSSL_CBIO_ERR_ISR;
|
||||
case EPIPE:
|
||||
case SOCKET_EPIPE:
|
||||
return WOLFSSL_CBIO_ERR_CONN_CLOSE;
|
||||
default:
|
||||
return WOLFSSL_CBIO_ERR_GENERAL;
|
||||
@ -873,7 +873,11 @@ static void* client_thread(void* args)
|
||||
static int SetupSocketAndListen(int* listenFd, word32 port)
|
||||
{
|
||||
struct sockaddr_in servAddr;
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
char optval = 1;
|
||||
#else
|
||||
int optval = 1;
|
||||
#endif
|
||||
|
||||
/* Setup server address */
|
||||
XMEMSET(&servAddr, 0, sizeof(servAddr));
|
||||
@ -890,7 +894,8 @@ static int SetupSocketAndListen(int* listenFd, word32 port)
|
||||
}
|
||||
|
||||
/* allow reuse */
|
||||
if (setsockopt(*listenFd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) == -1) {
|
||||
if (setsockopt(*listenFd, SOL_SOCKET, SO_REUSEADDR,
|
||||
&optval, sizeof(optval)) == -1) {
|
||||
printf("setsockopt SO_REUSEADDR failed\n");
|
||||
return -1;
|
||||
}
|
||||
@ -923,7 +928,7 @@ static int SocketWaitClient(info_t* info)
|
||||
socklen_t size = sizeof(clientAddr);
|
||||
|
||||
if ((connd = accept(info->listenFd, (struct sockaddr*)&clientAddr, &size)) == -1) {
|
||||
if (errno == EWOULDBLOCK)
|
||||
if (errno == SOCKET_EWOULDBLOCK)
|
||||
return -2;
|
||||
printf("ERROR: failed to accept the connection\n");
|
||||
return -1;
|
||||
|
@ -631,7 +631,11 @@ static int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
wolfSSL_free(ssl); ssl = NULL;
|
||||
CloseSocket(sockfd);
|
||||
|
||||
#if !defined(__MINGW32__)
|
||||
printf("wolfSSL Client Benchmark %zu bytes\n"
|
||||
#else
|
||||
printf("wolfSSL Client Benchmark %d bytes\n"
|
||||
#endif
|
||||
"\tConnect %8.3f ms\n"
|
||||
"\tTX %8.3f ms (%8.3f MBps)\n"
|
||||
"\tRX %8.3f ms (%8.3f MBps)\n",
|
||||
|
@ -417,7 +417,11 @@ int ServerEchoData(SSL* ssl, int clientfd, int echoData, int block,
|
||||
free(buffer);
|
||||
|
||||
if (throughput) {
|
||||
#if !defined(__MINGW32__)
|
||||
printf("wolfSSL Server Benchmark %zu bytes\n"
|
||||
#else
|
||||
printf("wolfSSL Server Benchmark %d bytes\n"
|
||||
#endif
|
||||
"\tRX %8.3f ms (%8.3f MBps)\n"
|
||||
"\tTX %8.3f ms (%8.3f MBps)\n",
|
||||
throughput,
|
||||
|
@ -483,7 +483,9 @@
|
||||
#else
|
||||
/* 4996 warning to use MS extensions e.g., _sprintf_s
|
||||
instead of _snprintf */
|
||||
#if !defined(__MINGW32__)
|
||||
#pragma warning(disable: 4996)
|
||||
#endif
|
||||
static WC_INLINE
|
||||
int xsnprintf(char *buffer, size_t bufsize,
|
||||
const char *format, ...) {
|
||||
@ -500,7 +502,9 @@
|
||||
}
|
||||
#define XSNPRINTF xsnprintf
|
||||
#endif /* (_MSC_VER >= 1900) */
|
||||
#endif /* _MSC_VER || __CYGWIN__ || __MINGW32__ */
|
||||
#else
|
||||
#define XSNPRINTF snprintf
|
||||
#endif /* _MSC_VER */
|
||||
#endif /* USE_WINDOWS_API */
|
||||
|
||||
#if defined(WOLFSSL_CERT_EXT) || defined(OPENSSL_EXTRA) \
|
||||
|
Reference in New Issue
Block a user