summaryrefslogtreecommitdiff
path: root/src/libstrongswan/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/utils')
-rw-r--r--src/libstrongswan/utils/chunk.c8
-rw-r--r--src/libstrongswan/utils/compat/windows.h7
2 files changed, 14 insertions, 1 deletions
diff --git a/src/libstrongswan/utils/chunk.c b/src/libstrongswan/utils/chunk.c
index 2f824a259..0c50ab788 100644
--- a/src/libstrongswan/utils/chunk.c
+++ b/src/libstrongswan/utils/chunk.c
@@ -504,7 +504,13 @@ chunk_t chunk_from_hex(chunk_t hex, char *buf)
u_char *ptr;
bool odd = FALSE;
- /* subtract the number of optional ':' separation characters */
+ /* skip an optional 0x prefix */
+ if (hex.len > 1 && hex.ptr[1] == 'x' && hex.ptr[0] == '0')
+ {
+ hex = chunk_skip(hex, 2);
+ }
+
+ /* subtract the number of optional ':' separation characters */
len = hex.len;
ptr = hex.ptr;
for (i = 0; i < hex.len; i++)
diff --git a/src/libstrongswan/utils/compat/windows.h b/src/libstrongswan/utils/compat/windows.h
index f7e6207a5..68e1dca80 100644
--- a/src/libstrongswan/utils/compat/windows.h
+++ b/src/libstrongswan/utils/compat/windows.h
@@ -114,6 +114,13 @@ static inline char* strdup_windows(const char *src)
char* strndup(const char *s, size_t n);
/**
+ * From winsock2.h
+ */
+#ifndef IPPROTO_IPIP
+#define IPPROTO_IPIP IPPROTO_IPV4
+#endif
+
+/**
* Provided via ws2_32
*/
#ifndef InetNtop