diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index 87e3dac7ff..9fe12bba20 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -29,39 +29,6 @@ #if defined(USE_QUICHE) || defined(USE_OPENSSL) -#ifdef USE_WIN32_CRYPTO -#include -/* If is included directly, or indirectly via , - * , , or something else, does this: - * #define X509_NAME ((LPCSTR)7) - * - * In BoringSSL/AWC-LC's there is: - * typedef struct X509_name_st X509_NAME; - * etc. - * - * The redefined symbols break these OpenSSL headers when included after - * . - * The workaround is to undefine those defines here (and only here). - * - * For unity builds it may need to be repeated elsewhere too, e.g. in ldap.c, - * to apply to other sources using OpenSSL includes. Each compilation unit - * needs undefine them between the first include and the first - * OpenSSL include. - * - * OpenSSL does this in and , but it - * also does the #undef by including . <3.1.0 only does - * it on the first include. - * - * LibreSSL automatically undefines these symbols before using them. - */ -#undef X509_NAME -#undef X509_EXTENSIONS -#undef PKCS7_ISSUER_AND_SERIAL -#undef PKCS7_SIGNER_INFO -#undef OCSP_REQUEST -#undef OCSP_RESPONSE -#endif - #include "urldata.h" #include "curl_trc.h" #include "httpsrr.h" diff --git a/lib/vtls/openssl.h b/lib/vtls/openssl.h index 4bac2388f6..44153ba4bf 100644 --- a/lib/vtls/openssl.h +++ b/lib/vtls/openssl.h @@ -26,6 +26,40 @@ #include "curl_setup.h" #ifdef USE_OPENSSL + +#ifdef USE_WIN32_CRYPTO +#include +/* If is included directly, or indirectly via , + * , , or something else, does this: + * #define X509_NAME ((LPCSTR)7) + * + * In BoringSSL/AWC-LC's there is: + * typedef struct X509_name_st X509_NAME; + * etc. + * + * The redefined symbols break these OpenSSL headers when included after + * . + * The workaround is to undefine those defines here (and only here). + * + * For unity builds it may need to be repeated elsewhere too, e.g. in ldap.c, + * to apply to other sources using OpenSSL includes. Each compilation unit + * needs undefine them between the first include and the first + * OpenSSL include. + * + * OpenSSL does this in and , but it + * also does the #undef by including . <3.1.0 only does + * it on the first include. + * + * LibreSSL automatically undefines these symbols before using them. + */ +#undef X509_NAME +#undef X509_EXTENSIONS +#undef PKCS7_ISSUER_AND_SERIAL +#undef PKCS7_SIGNER_INFO +#undef OCSP_REQUEST +#undef OCSP_RESPONSE +#endif /* USE_WIN32_CRYPTO */ + /* * This header should only be needed to get included by vtls.c, openssl.c * and ngtcp2.c