Hi all.

At least in OpenSSL 1.0.1e, rand.h header file includes the Windows specific windows.h header and does so in such a way that it can cause conflicts with the rest of OpenSSL code.

windows.h defines some symbols like X509_NAME & X509_EXTENSIONS that conflict with OpenSSL types. ossl_typ.h has a workaround for this by #undef-ing such symbols in case they were already registered by a previous windows.h include. This, of course, assumes that the ossl_typ.h header needs to be included after the windows.h header.

OpenSSL's rand.h header on the other hand includes first the ossl_typ.h header and only then windows.h - causing symbol conflicts and messy compiler error messages in case the windows.h header file actually gets included here and not earlier.

Note that simply changing the order in which these two headers are included will fix this specific issue but the whole system is still open to the same sort of problems in case another OpenSSL header includes ossl_typ.h and only then does the rand.h header get included.

  I believe a better fix would be one of the following:

1. Add a compile-time error in case the windows.h header has not already been included prior to including rand.h (that is the only place in OpenSSL where that humongous header is included anyway) and have the user be explicitly in charge of including it prior to including any OpenSSL headers.

2. Remove the need for including the windows.h header from rand.h completely by simply explicitly declaring those few windows specific types used there. I believe it is just the UINT, WPARAM & LPARAM types used in RAND_event() - all simple types, and not really worth including the whole windows.h just for them...

  My personal preference is the solution #2.

  Hope this helps.

  Best regards,
    Jurko Gospodnetić
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]

Reply via email to