diff options
-rw-r--r-- | include/openssl/types.h | 23 | ||||
-rw-r--r-- | test/build.info | 6 | ||||
-rw-r--r-- | test/build_wincrypt_test.c | 42 |
3 files changed, 60 insertions, 11 deletions
diff --git a/include/openssl/types.h b/include/openssl/types.h index de9f166524..c28028681f 100644 --- a/include/openssl/types.h +++ b/include/openssl/types.h @@ -7,9 +7,21 @@ * https://www.openssl.org/source/license.html */ +/* + * Unfortunate workaround to avoid symbol conflict with wincrypt.h + * See https://github.com/openssl/openssl/issues/9981 + */ +#ifdef _WIN32 +# define WINCRYPT_USE_SYMBOL_PREFIX +# undef X509_NAME +# undef X509_EXTENSIONS +# undef PKCS7_SIGNER_INFO +# undef OCSP_REQUEST +# undef OCSP_RESPONSE +#endif + #ifndef OPENSSL_TYPES_H # define OPENSSL_TYPES_H -# pragma once # include <limits.h> @@ -70,15 +82,6 @@ typedef struct ASN1_ITEM_st ASN1_ITEM; typedef struct asn1_pctx_st ASN1_PCTX; typedef struct asn1_sctx_st ASN1_SCTX; -# ifdef _WIN32 -# undef X509_NAME -# undef X509_EXTENSIONS -# undef PKCS7_ISSUER_AND_SERIAL -# undef PKCS7_SIGNER_INFO -# undef OCSP_REQUEST -# undef OCSP_RESPONSE -# endif - # ifdef BIGNUM # undef BIGNUM # endif diff --git a/test/build.info b/test/build.info index a6dffe280e..fd72890539 100644 --- a/test/build.info +++ b/test/build.info @@ -58,7 +58,7 @@ IF[{- !$disabled{tests} -}] recordlentest drbgtest rand_status_test sslbuffertest \ time_offset_test pemtest ssl_cert_table_internal_test ciphername_test \ http_test servername_test ocspapitest fatalerrtest tls13ccstest \ - sysdefaulttest errtest ssl_ctx_test \ + sysdefaulttest errtest ssl_ctx_test build_wincrypt_test \ context_internal_test aesgcmtest params_test evp_pkey_dparams_test \ keymgmt_internal_test hexstr_test provider_status_test defltfips_test \ bio_readbuffer_test user_property_test pkcs7_test upcallstest \ @@ -930,6 +930,10 @@ ENDIF INCLUDE[ssl_ctx_test]=../include ../apps/include DEPEND[ssl_ctx_test]=../libcrypto ../libssl libtestutil.a + SOURCE[build_wincrypt_test]=build_wincrypt_test.c + INCLUDE[build_wincrypt_test]=../include + DEPEND[build_wincrypt_test]=../libssl ../libcrypto + {- use File::Spec::Functions; use File::Basename; diff --git a/test/build_wincrypt_test.c b/test/build_wincrypt_test.c new file mode 100644 index 0000000000..5bd75e6a43 --- /dev/null +++ b/test/build_wincrypt_test.c @@ -0,0 +1,42 @@ +/* + * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* + * Simple buildtest to check for symbol collisions between wincrypt and + * OpenSSL headers + */ + +#include <openssl/types.h> + +#ifdef _WIN32 +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include <windows.h> +# include <wincrypt.h> +# ifndef X509_NAME +# ifndef PEDANTIC +# warning "wincrypt.h no longer defining X509_NAME before OpenSSL headers" +# endif +# endif +#endif + +#include <openssl/opensslconf.h> +#ifndef OPENSSL_NO_STDIO +# include <stdio.h> +#endif + +#include <openssl/evp.h> +#include <openssl/x509.h> +#include <openssl/x509v3.h> + +int main(void) +{ + return 0; +} |