Commit f1f5ee17 authored by Andy Polyakov's avatar Andy Polyakov
Browse files

include/openssl: don't include <windows.h> in public headers.



If application uses any of Windows-specific interfaces, make it
application developer's respondibility to include <windows.h>.
Rationale is that <windows.h> is quite "toxic" and is sensitive
to inclusion order (most notably in relation to <winsock2.h>).
It's only natural to give complete control to the application developer.

Reviewed-by: default avatarRich Salz <rsalz@openssl.org>
Reviewed-by: default avatarMatt Caswell <matt@openssl.org>
parent ab6a591c
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -11,9 +11,6 @@
#include "../async_locl.h"

#ifdef ASYNC_NULL
# include <openssl/ct.h>
# include <openssl/x509v3.h>

int ASYNC_is_capable(void)
{
    return 0;
@@ -22,6 +19,5 @@ int ASYNC_is_capable(void)
void async_local_cleanup(void)
{
}

#endif
+4 −0
Original line number Diff line number Diff line
@@ -16,6 +16,10 @@
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif

#if defined(_WIN32)
# include <windows.h>
#endif

#include <internal/async.h>
#include <openssl/crypto.h>

+4 −0
Original line number Diff line number Diff line
@@ -7,6 +7,10 @@
 * https://www.openssl.org/source/license.html
 */

#if defined(_WIN32)
# include <windows.h>
#endif

#include <openssl/crypto.h>

#if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) && defined(OPENSSL_SYS_WINDOWS)
+9 −0
Original line number Diff line number Diff line
@@ -112,6 +112,15 @@ ASYNC_WAIT_CTX_set_wait_fd, ASYNC_WAIT_CTX_get_fd, ASYNC_WAIT_CTX_get_all_fds,
ASYNC_WAIT_CTX_get_changed_fds and ASYNC_WAIT_CTX_clear_fd all return 1 on
success or 0 on error.

=head1 NOTES

On Windows platforms the openssl/async.h header is dependent on some
of the types customarily made available by including windows.h. The
application developer is likely to require control over when the latter
is included, commonly as one of the first included headers. Therefore
it is defined as an application developer's responsibility to include
windows.h prior to async.h.

=head1 SEE ALSO

L<crypto(3)>, L<ASYNC_start_job(3)>
+12 −0
Original line number Diff line number Diff line
@@ -161,10 +161,22 @@ ASYNC_get_wait_ctx() returns a pointer to the ASYNC_WAIT_CTX for the job.
ASYNC_is_capable() returns 1 if the current platform is async capable or 0
otherwise.

=head1 NOTES

On Windows platforms the openssl/async.h header is dependent on some
of the types customarily made available by including windows.h. The
application developer is likely to require control over when the latter
is included, commonly as one of the first included headers. Therefore
it is defined as an application developer's responsibility to include
windows.h prior to async.h.

=head1 EXAMPLE

The following example demonstrates how to use most of the core async APIs:

 #ifdef _WIN32
 # include <windows.h>
 #endif
 #include <stdio.h>
 #include <unistd.h>
 #include <openssl/async.h>
Loading