Defines for UEFI environment under MSVC added
diff --git a/library/net.c b/library/net.c
index 2ab12df..be2785d 100644
--- a/library/net.c
+++ b/library/net.c
@@ -29,7 +29,8 @@
#include "polarssl/net.h"
-#if defined(_WIN32) || defined(_WIN32_WCE)
+#if (defined(_WIN32) || defined(_WIN32_WCE)) && !defined(EFIX64) && \
+ !defined(EFI32)
#include <winsock2.h>
#include <windows.h>
@@ -64,7 +65,8 @@
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || \
defined(__DragonflyBSD__)
#include <sys/endian.h>
-#elif defined(__APPLE__) || defined(HAVE_MACHINE_ENDIAN_H)
+#elif defined(__APPLE__) || defined(HAVE_MACHINE_ENDIAN_H) || \
+ defined(EFIX64) || defined(EFI32)
#include <machine/endian.h>
#elif defined(sun)
#include <sys/isa_defs.h>
@@ -83,7 +85,7 @@
#include <time.h>
#endif
-#ifdef _MSC_VER
+#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
#include <basetsd.h>
typedef UINT32 uint32_t;
#else
@@ -120,7 +122,9 @@
struct sockaddr_in server_addr;
struct hostent *server_host;
-#if defined(_WIN32) || defined(_WIN32_WCE)
+#if ( defined(_WIN32) || defined(_WIN32_WCE) ) && !defined(EFIX64) && \
+ !defined(EFI32)
+
WSADATA wsaData;
if( wsa_init_done == 0 )
@@ -131,8 +135,10 @@
wsa_init_done = 1;
}
#else
+#if !defined(EFIX64) && !defined(EFI32)
signal( SIGPIPE, SIG_IGN );
#endif
+#endif
if( ( server_host = gethostbyname( host ) ) == NULL )
return( POLARSSL_ERR_NET_UNKNOWN_HOST );
@@ -165,7 +171,8 @@
int n, c[4];
struct sockaddr_in server_addr;
-#if defined(_WIN32) || defined(_WIN32_WCE)
+#if ( defined(_WIN32) || defined(_WIN32_WCE) ) && !defined(EFIX64) && \
+ !defined(EFI32)
WSADATA wsaData;
if( wsa_init_done == 0 )
@@ -176,8 +183,10 @@
wsa_init_done = 1;
}
#else
+#if !defined(EFIX64) && !defined(EFI32)
signal( SIGPIPE, SIG_IGN );
#endif
+#endif
if( ( *fd = (int) socket( AF_INET, SOCK_STREAM, IPPROTO_IP ) ) < 0 )
return( POLARSSL_ERR_NET_SOCKET_FAILED );
@@ -228,7 +237,8 @@
*/
static int net_is_blocking( void )
{
-#if defined(_WIN32) || defined(_WIN32_WCE)
+#if ( defined(_WIN32) || defined(_WIN32_WCE) ) && !defined(EFIX64) && \
+ !defined(EFI32)
return( WSAGetLastError() == WSAEWOULDBLOCK );
#else
switch( errno )
@@ -282,7 +292,8 @@
*/
int net_set_block( int fd )
{
-#if defined(_WIN32) || defined(_WIN32_WCE)
+#if ( defined(_WIN32) || defined(_WIN32_WCE) ) && !defined(EFIX64) && \
+ !defined(EFI32)
u_long n = 0;
return( ioctlsocket( fd, FIONBIO, &n ) );
#else
@@ -292,7 +303,8 @@
int net_set_nonblock( int fd )
{
-#if defined(_WIN32) || defined(_WIN32_WCE)
+#if ( defined(_WIN32) || defined(_WIN32_WCE) ) && !defined(EFIX64) && \
+ !defined(EFI32)
u_long n = 1;
return( ioctlsocket( fd, FIONBIO, &n ) );
#else
@@ -317,7 +329,7 @@
* Read at most 'len' characters
*/
int net_recv( void *ctx, unsigned char *buf, size_t len )
-{
+{
int ret = read( *((int *) ctx), buf, len );
if( ret < 0 )
@@ -325,7 +337,8 @@
if( net_is_blocking() != 0 )
return( POLARSSL_ERR_NET_WANT_READ );
-#if defined(_WIN32) || defined(_WIN32_WCE)
+#if ( defined(_WIN32) || defined(_WIN32_WCE) ) && !defined(EFIX64) && \
+ !defined(EFI32)
if( WSAGetLastError() == WSAECONNRESET )
return( POLARSSL_ERR_NET_CONN_RESET );
#else
@@ -354,7 +367,8 @@
if( net_is_blocking() != 0 )
return( POLARSSL_ERR_NET_WANT_WRITE );
-#if defined(_WIN32) || defined(_WIN32_WCE)
+#if ( defined(_WIN32) || defined(_WIN32_WCE) ) && !defined(EFIX64) && \
+ !defined(EFI32)
if( WSAGetLastError() == WSAECONNRESET )
return( POLARSSL_ERR_NET_CONN_RESET );
#else