|
50 | 50 | #endif |
51 | 51 | #endif |
52 | 52 |
|
| 53 | +/* CE Not always reliably detected. Define our own _WIN32_WCE as needed. */ |
| 54 | +#if defined(_WIN32_WCE) || defined(WINCE) || defined(PocketPC) |
| 55 | + #if !defined(_WIN32_WCE) |
| 56 | + #define _WIN32_WCE |
| 57 | + #endif |
| 58 | +#endif |
53 | 59 | #if defined(USE_WOLFSSL_IO) || defined(WOLFSSL_USER_IO) || \ |
54 | 60 | defined(HAVE_HTTP_CLIENT) |
55 | 61 | #ifdef HAVE_LIBZ |
@@ -578,34 +584,40 @@ WOLFSSL_API int wolfIO_RecvFrom(SOCKET_T sd, WOLFSSL_BIO_ADDR *addr, char *buf, |
578 | 584 | #endif |
579 | 585 | #endif /* WOLFSSL_NO_SOCK */ |
580 | 586 |
|
581 | | -WOLFSSL_API int wolfSSL_BioSend(WOLFSSL* ssl, char *buf, int sz, void *ctx); |
582 | | -WOLFSSL_API int wolfSSL_BioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx); |
| 587 | +#ifdef PocketPC |
| 588 | + #define WOLFSSL_CALL __stdcall |
| 589 | +#else |
| 590 | + #define WOLFSSL_CALL |
| 591 | +#endif |
| 592 | + |
| 593 | +WOLFSSL_API int WOLFSSL_CALL wolfSSL_BioSend(WOLFSSL* ssl, char *buf, int sz, void *ctx); |
| 594 | +WOLFSSL_API int WOLFSSL_CALL wolfSSL_BioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx); |
583 | 595 | #ifndef OPENSSL_COEXIST |
584 | 596 | /* Preserve API previously exposed */ |
585 | 597 | #define BioSend wolfSSL_BioSend |
586 | 598 | #define BioReceive wolfSSL_BioReceive |
587 | 599 | #endif |
588 | 600 |
|
589 | | -WOLFSSL_LOCAL int SslBioSend(WOLFSSL* ssl, char *buf, int sz, void *ctx); |
| 601 | +WOLFSSL_LOCAL int WOLFSSL_CALL SslBioSend(WOLFSSL* ssl, char *buf, int sz, void *ctx); |
590 | 602 | #if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) |
591 | 603 | WOLFSSL_LOCAL int BioReceiveInternal(WOLFSSL_BIO* biord, WOLFSSL_BIO* biowr, |
592 | 604 | char* buf, int sz); |
593 | 605 | #endif |
594 | | -WOLFSSL_LOCAL int SslBioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx); |
| 606 | +WOLFSSL_LOCAL int WOLFSSL_CALL SslBioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx); |
595 | 607 | #if defined(USE_WOLFSSL_IO) |
596 | 608 | /* default IO callbacks */ |
597 | | - WOLFSSL_API int EmbedReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx); |
598 | | - WOLFSSL_API int EmbedSend(WOLFSSL* ssl, char* buf, int sz, void* ctx); |
| 609 | + WOLFSSL_API int WOLFSSL_CALL EmbedReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx); |
| 610 | + WOLFSSL_API int WOLFSSL_CALL EmbedSend(WOLFSSL* ssl, char* buf, int sz, void* ctx); |
599 | 611 |
|
600 | 612 | #ifdef WOLFSSL_DTLS |
601 | 613 | #ifdef NUCLEUS_PLUS_2_3 |
602 | 614 | #define SELECT_FUNCTION nucyassl_select |
603 | 615 | WOLFSSL_LOCAL int nucyassl_select(INT sd, UINT32 timeout); |
604 | 616 | #endif |
605 | | - WOLFSSL_API int EmbedReceiveFrom(WOLFSSL *ssl, char *buf, int sz, |
| 617 | + WOLFSSL_API int WOLFSSL_CALL EmbedReceiveFrom(WOLFSSL *ssl, char *buf, int sz, |
606 | 618 | void *ctx); |
607 | | - WOLFSSL_API int EmbedSendTo(WOLFSSL* ssl, char *buf, int sz, void *ctx); |
608 | | - WOLFSSL_API int EmbedGenerateCookie(WOLFSSL* ssl, byte *buf, int sz, |
| 619 | + WOLFSSL_API int WOLFSSL_CALL EmbedSendTo(WOLFSSL* ssl, char *buf, int sz, void *ctx); |
| 620 | + WOLFSSL_API int WOLFSSL_CALL EmbedGenerateCookie(WOLFSSL* ssl, byte *buf, int sz, |
609 | 621 | void *ctx); |
610 | 622 | #ifdef WOLFSSL_MULTICAST |
611 | 623 | WOLFSSL_API int EmbedReceiveFromMcast(WOLFSSL *ssl, char *buf, |
@@ -663,8 +675,8 @@ typedef int (*WolfSSLGenericIORecvCb)(char *buf, int sz, void *ctx); |
663 | 675 |
|
664 | 676 |
|
665 | 677 | /* I/O callbacks */ |
666 | | -typedef int (*CallbackIORecv)(WOLFSSL *ssl, char *buf, int sz, void *ctx); |
667 | | -typedef int (*CallbackIOSend)(WOLFSSL *ssl, char *buf, int sz, void *ctx); |
| 678 | +typedef int (WOLFSSL_CALL *CallbackIORecv)(WOLFSSL *ssl, char *buf, int sz, void *ctx); |
| 679 | +typedef int (WOLFSSL_CALL *CallbackIOSend)(WOLFSSL *ssl, char *buf, int sz, void *ctx); |
668 | 680 | WOLFSSL_API void wolfSSL_CTX_SetIORecv(WOLFSSL_CTX *ctx, CallbackIORecv CBIORecv); |
669 | 681 | WOLFSSL_API void wolfSSL_CTX_SetIOSend(WOLFSSL_CTX *ctx, CallbackIOSend CBIOSend); |
670 | 682 | WOLFSSL_API void wolfSSL_SSLSetIORecv(WOLFSSL *ssl, CallbackIORecv CBIORecv); |
@@ -917,10 +929,17 @@ WOLFSSL_API void wolfSSL_SetIOWriteFlags(WOLFSSL* ssl, int flags); |
917 | 929 | #define XINET_PTON(a,b,c) *(unsigned *)(c) = inet_addr((b)) |
918 | 930 | #endif |
919 | 931 | #elif defined(USE_WINDOWS_API) /* Windows-friendly definition */ |
920 | | - #if defined(__MINGW64__) && !defined(UNICODE) |
| 932 | + #if defined(UNICODE) |
| 933 | + /* Use Win API Pointer to a constant wide-character string */ |
| 934 | + #define XINET_PTON(a,b,c) InetPton((a),(PCWSTR)(b),(c)) |
| 935 | + #elif defined(__MINGW64__) && !defined(UNICODE) |
921 | 936 | #define XINET_PTON(a,b,c) InetPton((a),(b),(c)) |
922 | 937 | #else |
923 | | - #define XINET_PTON(a,b,c) InetPton((a),(PCWSTR)(b),(c)) |
| 938 | + #if (defined(_MSC_VER) && (_MSC_VER >= 1600)) || defined(_WIN32_WCE) |
| 939 | + #define XINET_PTON(a,b,c) InetPton((a),(PCWSTR)(b),(c)) |
| 940 | + #else |
| 941 | + #define XINET_PTON(a,b,c) InetPton((a),(PCSTR)(b),(c)) |
| 942 | + #endif |
924 | 943 | #endif |
925 | 944 | #else |
926 | 945 | #define XINET_PTON(a,b,c) inet_pton((a),(b),(c)) |
|
0 commit comments