From 6edcd41c0ac72189af1741d96f1ab947f7545f44 Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Tue, 29 Oct 2013 15:22:54 +0100
Subject: [PATCH] Addition conditions for UEFI environment under MSVC
---
library/cipher.c | 3 ++-
library/debug.c | 6 ++++--
library/error.c | 3 ++-
library/md.c | 5 +++--
library/oid.c | 3 ++-
library/ssl_ciphersuites.c | 3 ++-
library/ssl_tls.c | 3 ++-
library/x509.c | 3 ++-
library/x509_create.c | 3 ++-
library/x509_crl.c | 3 ++-
library/x509_crt.c | 3 ++-
library/x509_csr.c | 3 ++-
12 files changed, 27 insertions(+), 14 deletions(-)
diff --git a/library/cipher.c b/library/cipher.c
index 277811a70..f0a770aba 100644
--- a/library/cipher.c
+++ b/library/cipher.c
@@ -44,7 +44,8 @@
#define POLARSSL_CIPHER_MODE_STREAM
#endif
-#if defined(_MSC_VER) && !defined strcasecmp
+#if defined(_MSC_VER) && !defined strcasecmp && !defined(EFIX64) && \
+ !defined(EFI32)
#define strcasecmp _stricmp
#endif
diff --git a/library/debug.c b/library/debug.c
index fb0ec719c..371cbf95c 100644
--- a/library/debug.c
+++ b/library/debug.c
@@ -36,13 +36,15 @@
#include
#endif
-#if defined(_MSC_VER) && !defined snprintf
+#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
+#if !defined snprintf
#define snprintf _snprintf
#endif
-#if defined(_MSC_VER) && !defined vsnprintf
+#if !defined vsnprintf
#define vsnprintf _vsnprintf
#endif
+#endif /* _MSC_VER */
char *debug_fmt( const char *format, ... )
{
diff --git a/library/error.c b/library/error.c
index 3f4bc9337..9d76f194c 100644
--- a/library/error.c
+++ b/library/error.c
@@ -160,7 +160,8 @@
#include
-#if defined(_MSC_VER) && !defined snprintf
+#if defined(_MSC_VER) && !defined snprintf && !defined(EFIX64) && \
+ !defined(EFI32)
#define snprintf _snprintf
#endif
diff --git a/library/md.c b/library/md.c
index 073f9322a..af6675661 100644
--- a/library/md.c
+++ b/library/md.c
@@ -36,8 +36,9 @@
#include
-#if defined(_MSC_VER) && !defined strcasecmp
-#define snprintf _stricmp
+#if defined(_MSC_VER) && !defined strcasecmp && !defined(EFIX64) && \
+ !defined(EFI32)
+#define strcasecmp _stricmp
#endif
static const int supported_digests[] = {
diff --git a/library/oid.c b/library/oid.c
index f0f43d813..b0b551dea 100644
--- a/library/oid.c
+++ b/library/oid.c
@@ -542,7 +542,8 @@ FN_OID_TYPED_FROM_ASN1(oid_pkcs12_pbe_alg_t, pkcs12_pbe_alg, oid_pkcs12_pbe_alg)
FN_OID_GET_ATTR2(oid_get_pkcs12_pbe_alg, oid_pkcs12_pbe_alg_t, pkcs12_pbe_alg, md_type_t, md_alg, cipher_type_t, cipher_alg);
#endif /* POLARSSL_PKCS12_C */
-#if defined(_MSC_VER) && !defined snprintf
+#if defined(_MSC_VER) && !defined snprintf && !defined(EFIX64) && \
+ !defined(EFI32)
#include
#if !defined vsnprintf
diff --git a/library/ssl_ciphersuites.c b/library/ssl_ciphersuites.c
index e1a86269c..615e96715 100644
--- a/library/ssl_ciphersuites.c
+++ b/library/ssl_ciphersuites.c
@@ -34,7 +34,8 @@
#include
-#if defined(_MSC_VER) && !defined strcasecmp
+#if defined(_MSC_VER) && !defined strcasecmp && !defined(EFIX64) && \
+ !defined(EFI32)
#define strcasecmp _stricmp
#endif
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index c86e774ff..b8bc18831 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -47,7 +47,8 @@
#include
-#if defined(_MSC_VER) && !defined strcasecmp
+#if defined(_MSC_VER) && !defined strcasecmp && !defined(EFIX64) && \
+ !defined(EFI32)
#define strcasecmp _stricmp
#endif
diff --git a/library/x509.c b/library/x509.c
index 27040b93a..2ba1e8618 100644
--- a/library/x509.c
+++ b/library/x509.c
@@ -429,7 +429,8 @@ int x509_load_file( const char *path, unsigned char **buf, size_t *n )
}
#endif /* POLARSSL_FS_IO */
-#if defined(_MSC_VER) && !defined snprintf
+#if defined(_MSC_VER) && !defined snprintf && !defined(EFIX64) && \
+ !defined(EFI32)
#include
#if !defined vsnprintf
diff --git a/library/x509_create.c b/library/x509_create.c
index 1cb88c7b9..fdf2a7246 100644
--- a/library/x509_create.c
+++ b/library/x509_create.c
@@ -31,7 +31,8 @@
#include "polarssl/asn1write.h"
#include "polarssl/oid.h"
-#if defined(_MSC_VER) && !defined strncasecmp
+#if defined(_MSC_VER) && !defined strncasecmp && !defined(EFIX64) && \
+ !defined(EFI32)
#define strncasecmp _strnicmp
#endif
diff --git a/library/x509_crl.c b/library/x509_crl.c
index 90ceabd67..60a54f2e7 100644
--- a/library/x509_crl.c
+++ b/library/x509_crl.c
@@ -545,7 +545,8 @@ int x509_crl_parse_file( x509_crl *chain, const char *path )
}
#endif /* POLARSSL_FS_IO */
-#if defined(_MSC_VER) && !defined snprintf
+#if defined(_MSC_VER) && !defined snprintf && !defined(EFIX64) && \
+ !defined(EFI32)
#include
#if !defined vsnprintf
diff --git a/library/x509_crt.c b/library/x509_crt.c
index 9470132ba..6a127b267 100644
--- a/library/x509_crt.c
+++ b/library/x509_crt.c
@@ -1039,7 +1039,8 @@ int x509_crt_parse_path( x509_crt *chain, const char *path )
}
#endif /* POLARSSL_FS_IO */
-#if defined(_MSC_VER) && !defined snprintf
+#if defined(_MSC_VER) && !defined snprintf && !defined(EFIX64) && \
+ !defined(EFI32)
#include
#if !defined vsnprintf
diff --git a/library/x509_csr.c b/library/x509_csr.c
index 4dec9b934..c0c7679c0 100644
--- a/library/x509_csr.c
+++ b/library/x509_csr.c
@@ -302,7 +302,8 @@ int x509_csr_parse_file( x509_csr *csr, const char *path )
}
#endif /* POLARSSL_FS_IO */
-#if defined(_MSC_VER) && !defined snprintf
+#if defined(_MSC_VER) && !defined snprintf && !defined(EFIX64) && \
+ !defined(EFI32)
#include
#if !defined vsnprintf