Handle endianness in x509_inet_pton_ipv6()

Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
diff --git a/library/x509_crt.c b/library/x509_crt.c
index 7def3e9..64016a5 100644
--- a/library/x509_crt.c
+++ b/library/x509_crt.c
@@ -2579,7 +2579,7 @@
             ;
         }
         if (j != 0) {
-            addr[i++] = (x << 8) | (x >> 8);     /* htons(x) */
+            addr[i++] = MBEDTLS_IS_BIG_ENDIAN ? x : (x << 8) | (x >> 8);
             if (*v == '\0') {
                 break;
             } else if (*v == '.' && (i != 0 || dc != -1) && (i < 7) &&