Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -13262,9 +13262,17 @@ static int MatchIPv6(const char* pattern, int patternLen,
XMEMSET(&addr2, 0, sizeof(addr2));

/* Try parsing both as IPv6 */
#ifdef FREESCALE_MQX
if (XINET_PTON(WOLFSSL_IP6, patBuf, &addr1, sizeof(addr1)) != RTCS_OK)
#else
if (XINET_PTON(WOLFSSL_IP6, patBuf, &addr1) != 1)
#endif
return 0;
#ifdef FREESCALE_MQX
if (XINET_PTON(WOLFSSL_IP6, strBuf, &addr2, sizeof(addr2)) != RTCS_OK)
#else
if (XINET_PTON(WOLFSSL_IP6, strBuf, &addr2) != 1)
#endif
Comment thread
josepho0918 marked this conversation as resolved.
return 0;

/* Compare raw address bytes */
Expand Down
11 changes: 7 additions & 4 deletions src/sniffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1824,7 +1824,7 @@ static int SetNamedPrivateKey(const char* name, const char* address, int port,
if (serverIp.ip4 == XINADDR_NONE) {
#ifdef FUSION_RTOS
if (XINET_PTON(AF_INET6, address, serverIp.ip6,
sizeof(serverIp.ip4)) == 1)
sizeof(serverIp.ip6)) == 1)
#elif defined(FREESCALE_MQX)
if (XINET_PTON(AF_INET6, address, serverIp.ip6,
sizeof(serverIp.ip6)) == RTCS_OK)
Expand Down Expand Up @@ -7658,7 +7658,10 @@ static int addKeyLogSnifferServerHelper(const char* address,
if (serverIp.ip4 == XINADDR_NONE) {
#ifdef FUSION_RTOS
if (XINET_PTON(AF_INET6, address, serverIp.ip6,
sizeof(serverIp.ip4)) == 1)
sizeof(serverIp.ip6)) == 1)
#elif defined(FREESCALE_MQX)
if (XINET_PTON(AF_INET6, address, serverIp.ip6,
sizeof(serverIp.ip6)) == RTCS_OK)
#else
if (XINET_PTON(AF_INET6, address, serverIp.ip6) == 1)
#endif
Expand Down Expand Up @@ -7783,7 +7786,7 @@ int ssl_RemoveSession(const char* clientIp, int clientPort,
if (clientAddr.ip4 == XINADDR_NONE) {
#ifdef FUSION_RTOS
if (XINET_PTON(AF_INET6, clientIp, clientAddr.ip6,
sizeof(clientAddr.ip4)) == 1)
sizeof(clientAddr.ip6)) == 1)
#elif defined(FREESCALE_MQX)
if (XINET_PTON(AF_INET6, clientIp, clientAddr.ip6,
sizeof(clientAddr.ip6)) == RTCS_OK)
Expand All @@ -7805,7 +7808,7 @@ int ssl_RemoveSession(const char* clientIp, int clientPort,
if (serverAddr.ip4 == XINADDR_NONE) {
#ifdef FUSION_RTOS
if (XINET_PTON(AF_INET6, serverIp, serverAddr.ip6,
sizeof(serverAddr.ip4)) == 1)
sizeof(serverAddr.ip6)) == 1)
#elif defined(FREESCALE_MQX)
if (XINET_PTON(AF_INET6, clientIp, clientAddr.ip6,
Comment thread
josepho0918 marked this conversation as resolved.
Outdated
sizeof(clientAddr.ip6)) == RTCS_OK)
Comment thread
josepho0918 marked this conversation as resolved.
Outdated
Expand Down
18 changes: 18 additions & 0 deletions src/x509.c
Original file line number Diff line number Diff line change
Expand Up @@ -3085,15 +3085,25 @@ int wolfSSL_X509_add_altname(WOLFSSL_X509* x509, const char* name, int type)
int ptonRet;

/* Check if this is an ip4 address */
#ifdef FREESCALE_MQX
ptonRet = XINET_PTON(WOLFSSL_IP4, name, ip4, sizeof(ip4));
if (ptonRet == RTCS_OK) {
#else
ptonRet = XINET_PTON(WOLFSSL_IP4, name, ip4);
if (ptonRet == 1) {
#endif
return wolfSSL_X509_add_altname_ex(x509, (const char*)ip4, 4,
type);
}

/* Check for ip6 */
#ifdef FREESCALE_MQX
ptonRet = XINET_PTON(WOLFSSL_IP6, name, ip6, sizeof(ip6));
if (ptonRet == RTCS_OK) {
#else
ptonRet = XINET_PTON(WOLFSSL_IP6, name, ip6);
if (ptonRet == 1) {
#endif
return wolfSSL_X509_add_altname_ex(x509, (const char*)ip6, 16,
type);
}
Expand Down Expand Up @@ -5521,12 +5531,20 @@ static int MatchIpName(const char* name, int nameSz, WOLFSSL_GENERAL_NAME* gn)
/* IPv4 constraint 8 bytes (IP + mask),
* IPv6 constraint 32 bytes (IP + mask) */
if (constraintLen == 8) {
#ifdef FREESCALE_MQX
if (XINET_PTON(WOLFSSL_IP4, ipStr, ipBytes, sizeof(ipBytes)) == RTCS_OK) {
#else
if (XINET_PTON(WOLFSSL_IP4, ipStr, ipBytes) == 1) {
#endif
ipLen = 4;
}
}
else if (constraintLen == 32) {
#ifdef FREESCALE_MQX
if (XINET_PTON(WOLFSSL_IP6, ipStr, ipBytes, sizeof(ipBytes)) == RTCS_OK) {
#else
if (XINET_PTON(WOLFSSL_IP6, ipStr, ipBytes) == 1) {
#endif
ipLen = 16;
}
}
Expand Down
Loading