- Fixed include location of endian.h and name clash on Apples (found by Martin van Hensbergen)

This commit is contained in:
Paul Bakker 2009-07-27 21:09:47 +00:00
parent 2a1fadffd7
commit b3bb6c0c66
2 changed files with 8 additions and 3 deletions

View file

@ -19,6 +19,8 @@ Changes
Bug fixes Bug fixes
* Fixed include location of endian.h on FreeBSD (found by * Fixed include location of endian.h on FreeBSD (found by
Gabriel) Gabriel)
* Fixed include location of endian.h and name clash on
Apples (found by Martin van Hensbergen)
* Fixed HMAC-MD2 by modifying md2_starts(), so that the * Fixed HMAC-MD2 by modifying md2_starts(), so that the
required HMAC ipad and opad variables are not cleared. required HMAC ipad and opad variables are not cleared.
(found by code coverage tests) (found by code coverage tests)

View file

@ -55,8 +55,11 @@ static int wsa_init_done = 0;
#include <fcntl.h> #include <fcntl.h>
#include <netdb.h> #include <netdb.h>
#include <errno.h> #include <errno.h>
#if defined(__FreeBSD__) #if defined(__FreeBSD__)
#include <sys/endian.h> #include <sys/endian.h>
#elif defined(__APPLE__)
#include <machine/endian.h>
#else #else
#include <endian.h> #include <endian.h>
#endif #endif
@ -74,13 +77,13 @@ static int wsa_init_done = 0;
* to help determine endianess. * to help determine endianess.
*/ */
#if defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && __BYTE_ORDER == __BIG_ENDIAN #if defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && __BYTE_ORDER == __BIG_ENDIAN
#define HTONS(n) (n) #define POLARSSL_HTONS(n) (n)
#else #else
#define HTONS(n) (((((unsigned short)(n) & 0xFF)) << 8) | (((unsigned short)(n) & 0xFF00) >> 8)) #define POLARSSL_HTONS(n) (((((unsigned short)(n) & 0xFF)) << 8) | (((unsigned short)(n) & 0xFF00) >> 8))
#endif #endif
unsigned short net_htons(unsigned short n); unsigned short net_htons(unsigned short n);
#define net_htons(n) HTONS(n) #define net_htons(n) POLARSSL_HTONS(n)
/* /*
* Initiate a TCP connection with host:port * Initiate a TCP connection with host:port