[openssl-dev] [openssl.org #4010] [PATCH] Fix #include order in rand.h for Windows

Kim Gräsman via RT rt at openssl.org
Tue Aug 18 14:16:24 UTC 2015


Hi all,

When using OpenSSL on Windows, we've seen compiler errors when we
#include <openssl/engine.h> after <openssl/x509.h> and then attempting
to use X509_NAME in our code.

This is because engine.h pulls in rand.h, which in turn includes
windows.h. The Windows headers introduce conflicting #defines for
X509_NAME (among other names). Most of the OpenSSL headers counteract
this by #undef-ing the conflicting names. However, rand.h includes
windows.h *after* ossl_types.h, so Windows re-#defines the symbols and
wins again.

The attached patch switches include order around so that ossl_types.h
is included after windows.h, and thereby fixing the namespace up
again.

I've built on Windows and Linux and everything still appears to work.

Please let me know if this is applicable to mainline OpenSSL.

Thanks,
- Kim

-------------- next part --------------
A non-text attachment was scrubbed...
Name: rand.h-include-order-windows.patch
Type: application/octet-stream
Size: 879 bytes
Desc: not available
URL: <http://mta.openssl.org/pipermail/openssl-dev/attachments/20150818/430298a1/attachment.obj>
-------------- next part --------------
_______________________________________________
openssl-bugs-mod mailing list
openssl-bugs-mod at openssl.org
https://mta.openssl.org/mailman/listinfo/openssl-bugs-mod


More information about the openssl-dev mailing list