forked from wolfSSL/wolfssl
Fixes for building with IPV6. Added new WOLFSSL_IPV6 define to indicate IPV6 support. Fix to not include connect() and socket() calls unless HAVE_HTTP_CLIENT, HAVE_OCSP or HAVE_CRL_IO defined. Typo fixes.
This commit is contained in:
@ -326,7 +326,7 @@ AC_ARG_ENABLE([ipv6],
|
|||||||
|
|
||||||
if test "$ENABLED_IPV6" = "yes"
|
if test "$ENABLED_IPV6" = "yes"
|
||||||
then
|
then
|
||||||
AM_CFLAGS="$AM_CFLAGS -DTEST_IPV6"
|
AM_CFLAGS="$AM_CFLAGS -DTEST_IPV6 -DWOLFSSL_IPV6"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AM_CONDITIONAL([BUILD_IPV6], [test "x$ENABLED_IPV6" = "xyes"])
|
AM_CONDITIONAL([BUILD_IPV6], [test "x$ENABLED_IPV6" = "xyes"])
|
||||||
@ -3340,7 +3340,7 @@ echo "#endif /* WOLFSSL_OPTIONS_H */" >> $OPTION_FILE
|
|||||||
echo "" >> $OPTION_FILE
|
echo "" >> $OPTION_FILE
|
||||||
echo
|
echo
|
||||||
|
|
||||||
#backwards compatability for those who have included options or version
|
#backwards compatibility for those who have included options or version
|
||||||
touch cyassl/options.h
|
touch cyassl/options.h
|
||||||
echo "/* cyassl options.h" > cyassl/options.h
|
echo "/* cyassl options.h" > cyassl/options.h
|
||||||
echo " * generated from wolfssl/options.h" >> cyassl/options.h
|
echo " * generated from wolfssl/options.h" >> cyassl/options.h
|
||||||
|
55
src/io.c
55
src/io.c
@ -50,6 +50,7 @@ Possible IO enable options:
|
|||||||
* USE_WOLFSSL_IO: Enables the wolfSSL IO functions default: off
|
* USE_WOLFSSL_IO: Enables the wolfSSL IO functions default: off
|
||||||
* HAVE_HTTP_CLIENT: Enables HTTP client API's default: off
|
* HAVE_HTTP_CLIENT: Enables HTTP client API's default: off
|
||||||
(unless HAVE_OCSP or HAVE_CRL_IO defined)
|
(unless HAVE_OCSP or HAVE_CRL_IO defined)
|
||||||
|
* HAVE_IO_TIMEOUT: Enables support for connect timeout default: off
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -421,12 +422,14 @@ int EmbedGenerateCookie(WOLFSSL* ssl, byte *buf, int sz, void *ctx)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WOLFSSL_IP6:
|
case WOLFSSL_IP6:
|
||||||
|
#ifdef WOLFSSL_IPV6
|
||||||
if (XINET_NTOP(*fam, &(((SOCKADDR_IN6*)&peer)->sin6_addr),
|
if (XINET_NTOP(*fam, &(((SOCKADDR_IN6*)&peer)->sin6_addr),
|
||||||
ip, *ipSz) == NULL) {
|
ip, *ipSz) == NULL) {
|
||||||
WOLFSSL_MSG("XINET_NTOP error");
|
WOLFSSL_MSG("XINET_NTOP error");
|
||||||
return SOCKET_ERROR_E;
|
return SOCKET_ERROR_E;
|
||||||
}
|
}
|
||||||
*port = XNTOHS(((SOCKADDR_IN6*)&peer)->sin6_port);
|
*port = XNTOHS(((SOCKADDR_IN6*)&peer)->sin6_port);
|
||||||
|
#endif /* WOLFSSL_IPV6 */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -473,6 +476,7 @@ int EmbedGenerateCookie(WOLFSSL* ssl, byte *buf, int sz, void *ctx)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WOLFSSL_IP6:
|
case WOLFSSL_IP6:
|
||||||
|
#ifdef WOLFSSL_IPV6
|
||||||
if (XINET_PTON(addr.ss_family, ip,
|
if (XINET_PTON(addr.ss_family, ip,
|
||||||
&(((SOCKADDR_IN6*)&addr)->sin6_addr)) <= 0) {
|
&(((SOCKADDR_IN6*)&addr)->sin6_addr)) <= 0) {
|
||||||
WOLFSSL_MSG("XINET_PTON error");
|
WOLFSSL_MSG("XINET_PTON error");
|
||||||
@ -486,6 +490,7 @@ int EmbedGenerateCookie(WOLFSSL* ssl, byte *buf, int sz, void *ctx)
|
|||||||
WOLFSSL_MSG("Import DTLS peer info error");
|
WOLFSSL_MSG("Import DTLS peer info error");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif /* WOLFSSL_IPV6 */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -498,10 +503,32 @@ int EmbedGenerateCookie(WOLFSSL* ssl, byte *buf, int sz, void *ctx)
|
|||||||
#endif /* WOLFSSL_SESSION_EXPORT */
|
#endif /* WOLFSSL_SESSION_EXPORT */
|
||||||
#endif /* WOLFSSL_DTLS */
|
#endif /* WOLFSSL_DTLS */
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
return recvd;
|
||||||
|
}
|
||||||
|
|
||||||
|
int wolfIO_Send(SOCKET_T sd, char *buf, int sz, int wrFlags)
|
||||||
|
{
|
||||||
|
int sent;
|
||||||
|
int len = sz;
|
||||||
|
|
||||||
|
sent = (int)SEND_FUNCTION(sd, &buf[sz - len], len, wrFlags);
|
||||||
|
sent = TranslateReturnCode(sent, sd);
|
||||||
|
|
||||||
|
return sent;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* USE_WOLFSSL_IO */
|
#endif /* USE_WOLFSSL_IO */
|
||||||
|
|
||||||
|
|
||||||
#if defined(USE_WOLFSSL_IO)
|
#ifdef HAVE_HTTP_CLIENT
|
||||||
|
|
||||||
#ifndef HAVE_IO_TIMEOUT
|
#ifndef HAVE_IO_TIMEOUT
|
||||||
#define io_timeout_sec 0
|
#define io_timeout_sec 0
|
||||||
@ -704,32 +731,6 @@ int wolfIO_TcpConnect(SOCKET_T* sockfd, const char* ip, word16 port, int to_sec)
|
|||||||
#endif /* HAVE_SOCKADDR */
|
#endif /* HAVE_SOCKADDR */
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
return recvd;
|
|
||||||
}
|
|
||||||
|
|
||||||
int wolfIO_Send(SOCKET_T sd, char *buf, int sz, int wrFlags)
|
|
||||||
{
|
|
||||||
int sent;
|
|
||||||
int len = sz;
|
|
||||||
|
|
||||||
sent = (int)SEND_FUNCTION(sd, &buf[sz - len], len, wrFlags);
|
|
||||||
sent = TranslateReturnCode(sent, sd);
|
|
||||||
|
|
||||||
return sent;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* USE_WOLFSSL_IO */
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(HAVE_HTTP_CLIENT)
|
|
||||||
|
|
||||||
#ifndef HTTP_SCRATCH_BUFFER_SIZE
|
#ifndef HTTP_SCRATCH_BUFFER_SIZE
|
||||||
#define HTTP_SCRATCH_BUFFER_SIZE 512
|
#define HTTP_SCRATCH_BUFFER_SIZE 512
|
||||||
#endif
|
#endif
|
||||||
|
@ -249,7 +249,7 @@
|
|||||||
typedef struct sockaddr SOCKADDR;
|
typedef struct sockaddr SOCKADDR;
|
||||||
typedef struct sockaddr_storage SOCKADDR_S;
|
typedef struct sockaddr_storage SOCKADDR_S;
|
||||||
typedef struct sockaddr_in SOCKADDR_IN;
|
typedef struct sockaddr_in SOCKADDR_IN;
|
||||||
#ifdef TEST_IPV6
|
#ifdef WOLFSSL_IPV6
|
||||||
typedef struct sockaddr_in6 SOCKADDR_IN6;
|
typedef struct sockaddr_in6 SOCKADDR_IN6;
|
||||||
#endif
|
#endif
|
||||||
typedef struct hostent HOSTENT;
|
typedef struct hostent HOSTENT;
|
||||||
|
@ -1497,6 +1497,11 @@ static char *fgets(char *buff, int sz, FILE *fp)
|
|||||||
#error old TLS requires MD5 and SHA
|
#error old TLS requires MD5 and SHA
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* for backwards compatibility */
|
||||||
|
#if defined(TEST_IPV6) && !defined(WOLFSSL_IPV6)
|
||||||
|
#define WOLFSSL_IPV6
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Place any other flags or defines here */
|
/* Place any other flags or defines here */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user