- Improved portability with Microsoft Visual C
diff --git a/library/cipher.c b/library/cipher.c
index 697ff54..ee3cd45 100644
--- a/library/cipher.c
+++ b/library/cipher.c
@@ -37,6 +37,10 @@
 #include <string.h>
 #include <stdlib.h>
 
+#if defined _MSC_VER && !defined strcasecmp
+#define strcasecmp _stricmp
+#endif
+
 static const int supported_ciphers[] = {
 
 #if defined(POLARSSL_AES_C)
diff --git a/library/havege.c b/library/havege.c
index d3981d9..499fe4f 100644
--- a/library/havege.c
+++ b/library/havege.c
@@ -30,13 +30,13 @@
  *  Contact: seznec(at)irisa_dot_fr - orocheco(at)irisa_dot_fr
  */
 
-#include <string.h>
-#include <time.h>
-
 #include "polarssl/config.h"
 
 #if defined(POLARSSL_HAVEGE_C)
 
+#include <string.h>
+#include <time.h>
+
 #include "polarssl/havege.h"
 #include "polarssl/timing.h"
 
diff --git a/library/md.c b/library/md.c
index 6348271..62c3e45 100644
--- a/library/md.c
+++ b/library/md.c
@@ -37,6 +37,10 @@
 #include <string.h>
 #include <stdlib.h>
 
+#if defined _MSC_VER && !defined strcasecmp
+#define strcasecmp _stricmp
+#endif
+
 static const int supported_digests[] = {
 
 #if defined(POLARSSL_MD2_C)
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index ea374ed..3875e99 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -46,6 +46,10 @@
 #include <stdlib.h>
 #include <time.h>
 
+#if defined _MSC_VER && !defined strcasecmp
+#define strcasecmp _stricmp
+#endif
+
 /*
  * Key material generation
  */