[Spice-devel] [spice-common 3/3] ssl_verify: Move wincrypt.h related #ifdef closer to the include

Christophe Fergeau cfergeau at redhat.com
Mon Jan 26 04:18:26 PST 2015


Both wincrypt.h and openssl try to define X509_NAME. The wincrypt.h one
is not useful for us, so we currently #undef it if this was set.
However, it's done very late, right before including x509v3.h which
defines the X509_NAME type. Any header included in between may try to
 #include x509v3.h so it's better to undefine X509_NAME right after
including wincrypt.h.
---
 common/ssl_verify.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/common/ssl_verify.h b/common/ssl_verify.h
index e4a0406..e32ca54 100644
--- a/common/ssl_verify.h
+++ b/common/ssl_verify.h
@@ -22,6 +22,10 @@
 #if defined(WIN32)
 #include <windows.h>
 #include <wincrypt.h>
+#ifdef X509_NAME
+/* wincrypt.h has already a different define... */
+#undef X509_NAME
+#endif
 #endif
 
 #include <openssl/rsa.h>
@@ -29,10 +33,6 @@
 #include <openssl/x509.h>
 #include <openssl/ssl.h>
 #include <openssl/err.h>
-#ifdef X509_NAME
-/* wincrypt.h has already a different define... */
-#undef X509_NAME
-#endif
 #include <openssl/x509v3.h>
 
 #include <spice/macros.h>
-- 
2.1.0



More information about the Spice-devel mailing list