mirror of
https://github.com/openssl/openssl.git
synced 2025-01-18 13:44:20 +08:00
Move types.h #undefs for wincrypt.h compatibility
+ Always undef the symbols that may have been #define-d by wincrypt.h after the first inclusion of types.h to avoid errors from wincrypt.h symbols being used to compile OpenSSL code + Also need to remove #pragma once for this approach to work + Define WINCRYPT_USE_SYMBOL_PREFIX to enable wincrypt symbol prefix at some point in future Fixes #9981 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/18131)
This commit is contained in:
parent
128d1c3c0a
commit
3c58d44749
@ -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
|
||||
|
@ -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;
|
||||
|
42
test/build_wincrypt_test.c
Normal file
42
test/build_wincrypt_test.c
Normal file
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user