Merge "Add patches/clang.patch to fix two minor Clang compiler errors."
diff --git a/crypto/bio/bss_dgram.c b/crypto/bio/bss_dgram.c
index 1b1e4be..3c66dd1 100644
--- a/crypto/bio/bss_dgram.c
+++ b/crypto/bio/bss_dgram.c
@@ -447,7 +447,7 @@
 	bio_dgram_data *data = NULL;
 #if defined(IP_MTU_DISCOVER) || defined(IP_MTU)
 	long sockopt_val = 0;
-	unsigned int sockopt_len = 0;
+	socklen_t sockopt_len = 0;
 #endif
 #ifdef OPENSSL_SYS_LINUX
 	socklen_t addr_len;
diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c
index 766ea8c..50fd492 100644
--- a/crypto/cryptlib.c
+++ b/crypto/cryptlib.c
@@ -504,7 +504,7 @@
 	CRYPTO_THREADID_set_numeric(id, (unsigned long)find_thread(NULL));
 #else
 	/* For everything else, default to using the address of 'errno' */
-	CRYPTO_THREADID_set_pointer(id, &errno);
+	CRYPTO_THREADID_set_pointer(id, (void*)&errno);
 #endif
 	}
 
diff --git a/openssl.config b/openssl.config
index bbe6ad5..4baf198 100644
--- a/openssl.config
+++ b/openssl.config
@@ -203,6 +203,7 @@
 sha1_armv4_large.patch \
 mips_private.patch \
 channelid.patch \
+clang.patch \
 "
 
 OPENSSL_PATCHES_progs_SOURCES="\
@@ -257,3 +258,8 @@
 ssl/t1_lib.c \
 ssl/tls1.h \
 "
+
+OPENSSL_PATCHES_clang_SOURCES="\
+crypto/bio/bss_dgram.c \
+crypto/cryptlib.c \
+"
diff --git a/patches/README b/patches/README
index 7fc0cc2..d47199f 100644
--- a/patches/README
+++ b/patches/README
@@ -30,3 +30,7 @@
 
 Implements TLS Channel ID support as both a client and a server.
 See http://tools.ietf.org/html/draft-balfanz-tls-channelid-00.
+
+clang.patch
+
+Fixes two minor compilation errors when building with the Clang compiler.
diff --git a/patches/clang.patch b/patches/clang.patch
new file mode 100644
index 0000000..285945e
--- /dev/null
+++ b/patches/clang.patch
@@ -0,0 +1,26 @@
+diff --git a/openssl/crypto/bio/bss_dgram.c b/openssl/crypto/bio/bss_dgram.c
+index 71ebe98..a6d882b 100644
+--- a/crypto/bio/bss_dgram.c
++++ b/crypto/bio/bss_dgram.c
+@@ -378,7 +378,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
+ 	bio_dgram_data *data = NULL;
+ #if defined(IP_MTU_DISCOVER) || defined(IP_MTU)
+ 	long sockopt_val = 0;
+-	unsigned int sockopt_len = 0;
++	socklen_t sockopt_len = 0;
+ #endif
+ #ifdef OPENSSL_SYS_LINUX
+ 	socklen_t addr_len;
+diff --git a/openssl/crypto/cryptlib.c b/openssl/crypto/cryptlib.c
+index 387a987..5dfeec7 100644
+--- a/crypto/cryptlib.c
++++ b/crypto/cryptlib.c
+@@ -500,7 +500,7 @@ void CRYPTO_THREADID_current(CRYPTO_THREADID *id)
+ 	CRYPTO_THREADID_set_numeric(id, (unsigned long)find_thread(NULL));
+ #else
+ 	/* For everything else, default to using the address of 'errno' */
+-	CRYPTO_THREADID_set_pointer(id, &errno);
++	CRYPTO_THREADID_set_pointer(id, (void*)&errno);
+ #endif
+ 	}
+