Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openssl + wolfssl combo backend build broken #10321

Closed
marekr opened this issue Jan 19, 2023 · 11 comments
Closed

openssl + wolfssl combo backend build broken #10321

marekr opened this issue Jan 19, 2023 · 11 comments

Comments

@marekr
Copy link

marekr commented Jan 19, 2023

This commit made a change to curl_ntlm_core 5fd7cd7

It rearranged the includes in the curl_ntlm_core.c so that openssl headers are included before wolfssl if both backends are enabled. However, the curl_ntlm_core.h header was not updated and it still includes wolfssl before openssl.

The problem is curl_ntlm_core.h since updated, if you attempt to build, the source file will include openssl and the header will include wolfssl. Wolfssl's compat types immediately clash into openssl types

The result is

FAILED: lib/CMakeFiles/libcurl.dir/curl_ntlm_core.c.obj 
C:\PROGRA~1\MIB055~1\2022\COMMUN~1\VC\Tools\MSVC\1434~1.319\bin\Hostx64\x64\cl.exe   -DBUILDING_LIBCURL -DCURLDEBUG -DCURL_HIDDEN_SYMBOLS -DDEBUGBUILD -DHAVE_CONFIG_H -DOPENSSL_SUPPRESS_DEPRECATED -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE -D_UNICODE -Dlibcurl_EXPORTS -IE:\vcpkgup\buildtrees\curl\src\url-7_87_0-fe2580e2b4\include -IE:\vcpkgup\buildtrees\curl\x64-windows-dbg\lib\..\include -IE:\vcpkgup\buildtrees\curl\src\url-7_87_0-fe2580e2b4\lib\.. -IE:\vcpkgup\buildtrees\curl\src\url-7_87_0-fe2580e2b4\lib\..\include -IE:\vcpkgup\buildtrees\curl\x64-windows-dbg\lib\.. -IE:\vcpkgup\buildtrees\curl\src\url-7_87_0-fe2580e2b4\lib -IE:\vcpkgup\buildtrees\curl\x64-windows-dbg\lib -external:IE:\vcpkgup\installed\x64-windows\include -external:W0 /nologo /DWIN32 /D_WINDOWS /W4 /utf-8 /MP  /MP /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1  -MDd /showIncludes /Folib\CMakeFiles\libcurl.dir\curl_ntlm_core.c.obj /Fdlib\CMakeFiles\libcurl.dir\ /FS -c E:\vcpkgup\buildtrees\curl\src\url-7_87_0-fe2580e2b4\lib\curl_ntlm_core.c
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/compat_types.h(54): error C2371: 'EVP_MD': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(103): note: see declaration of 'EVP_MD'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/compat_types.h(55): error C2371: 'EVP_MD_CTX': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(104): note: see declaration of 'EVP_MD_CTX'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/compat_types.h(56): error C2371: 'EVP_CIPHER': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(101): note: see declaration of 'EVP_CIPHER'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/compat_types.h(57): error C2371: 'EVP_CIPHER_CTX': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(102): note: see declaration of 'EVP_CIPHER_CTX'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/compat_types.h(58): error C2371: 'ASN1_PCTX': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(70): note: see declaration of 'ASN1_PCTX'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/compat_types.h(59): error C2371: 'EVP_PKEY': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(107): note: see declaration of 'EVP_PKEY'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/compat_types.h(60): error C2371: 'PKCS8_PRIV_KEY_INFO': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(174): note: see declaration of 'PKCS8_PRIV_KEY_INFO'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/compat_types.h(62): error C2371: 'ENGINE': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(183): note: see declaration of 'ENGINE'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/compat_types.h(63): error C2371: 'EVP_PKEY_CTX': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(112): note: see declaration of 'EVP_PKEY_CTX'
E:\vcpkgup\installed\x64-windows\include\wolfssl/wolfcrypt/rsa.h(163): error C2059: syntax error: 'constant'
E:\vcpkgup\installed\x64-windows\include\wolfssl/wolfcrypt/rsa.h(223): error C2065: 'RSA_MAX_ID_LEN': undeclared identifier
E:\vcpkgup\installed\x64-windows\include\wolfssl/wolfcrypt/rsa.h(223): error C2057: expected constant expression
E:\vcpkgup\installed\x64-windows\include\wolfssl/wolfcrypt/rsa.h(224): error C2229: struct 'RsaKey' has an illegal zero-sized array
E:\vcpkgup\installed\x64-windows\include\wolfssl/wolfcrypt/rsa.h(225): error C2065: 'RSA_MAX_LABEL_LEN': undeclared identifier
E:\vcpkgup\installed\x64-windows\include\wolfssl/wolfcrypt/rsa.h(225): error C2057: expected constant expression
E:\vcpkgup\installed\x64-windows\include\wolfssl/wolfcrypt/rsa.h(226): error C2229: struct 'RsaKey' has an illegal zero-sized array
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/bn.h(164): error C2371: 'BIGNUM': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(87): note: see declaration of 'BIGNUM'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/bn.h(165): error C2371: 'BN_CTX': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(88): note: see declaration of 'BN_CTX'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/bn.h(166): error C2371: 'BN_GENCB': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(92): note: see declaration of 'BN_GENCB'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/rsa.h(102): error C2371: 'RSA': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(143): note: see declaration of 'RSA'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/rsa.h(103): error C2371: 'RSA_METHOD': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(144): note: see declaration of 'RSA_METHOD'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/hmac.h(70): error C2371: 'HMAC_CTX': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(132): note: see declaration of 'HMAC_CTX'
E:\vcpkgup\installed\x64-windows\include\wolfssl/wolfcrypt/asn.h(760): error C2059: syntax error: 'constant'
E:\vcpkgup\installed\x64-windows\include\wolfssl/ssl.h(2324): error C2365: 'OCSP_RESPONSE': redefinition; previous definition was 'typedef'
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(203): note: see declaration of 'OCSP_RESPONSE'
E:\vcpkgup\installed\x64-windows\include\wolfssl/ssl.h(2324): error C2086: '<unnamed-enum-OCSP_NOCERTS> OCSP_RESPONSE': redefinition
E:\vcpkgup\installed\x64-windows\include\wolfssl/ssl.h(2324): note: see declaration of 'OCSP_RESPONSE'
E:\vcpkgup\installed\x64-windows\include\wolfssl/ssl.h(2328): error C2365: 'ASN1_GENERALIZEDTIME': redefinition; previous definition was 'typedef'
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(57): note: see declaration of 'ASN1_GENERALIZEDTIME'
E:\vcpkgup\installed\x64-windows\include\wolfssl/ssl.h(2328): error C2086: '<unnamed-enum-OCSP_NOCERTS> ASN1_GENERALIZEDTIME': redefinition
E:\vcpkgup\installed\x64-windows\include\wolfssl/ssl.h(2328): note: see declaration of 'ASN1_GENERALIZEDTIME'
E:\vcpkgup\installed\x64-windows\include\wolfssl/ssl.h(2329): error C2059: syntax error: 'constant'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/crypto.h(32): error C2371: 'OPENSSL_INIT_SETTINGS': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(178): note: see declaration of 'OPENSSL_INIT_SETTINGS'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/crypto.h(39): error C2371: 'CRYPTO_EX_DATA': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(200): note: see declaration of 'CRYPTO_EX_DATA'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/conf.h(48): error C2371: 'CONF': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(177): note: see declaration of 'CONF'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/conf.h(49): error C2371: 'CONF_VALUE': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/conf.h(39): note: see declaration of 'CONF_VALUE'
E:\vcpkgup\installed\x64-windows\include\wolfssl/ssl.h(4997): error C2371: 'SSL_COMP_get_compression_methods': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/ssl.h(2242): note: see declaration of 'SSL_COMP_get_compression_methods'
E:\vcpkgup\installed\x64-windows\include\wolfssl/ssl.h(5007): error C2371: 'ERR_load_SSL_strings': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/sslerr_legacy.h(29): note: see declaration of 'ERR_load_SSL_strings'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/md5.h(61): error C2371: 'MD5_CTX': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/md5.h(46): note: see declaration of 'MD5_CTX'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/sha.h(70): error C2059: syntax error: 'constant'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/sha.h(73): error C2371: 'SHA_CTX': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/sha.h(47): note: see declaration of 'SHA_CTX'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/sha.h(156): error C2059: syntax error: 'constant'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/sha.h(159): error C2371: 'SHA256_CTX': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/sha.h(67): note: see declaration of 'SHA256_CTX'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/sha.h(197): error C2059: syntax error: 'constant'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/sha.h(228): error C2059: syntax error: 'constant'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/sha.h(231): error C2371: 'SHA512_CTX': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/sha.h(117): note: see declaration of 'SHA512_CTX'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/dsa.h(120): error C2371: 'DSA': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(138): note: see declaration of 'DSA'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ec.h(38): error C2365: 'POINT_CONVERSION_COMPRESSED': redefinition; previous definition was 'enumerator'
E:\vcpkgup\installed\x64-windows\include\openssl/ec.h(81): note: see declaration of 'POINT_CONVERSION_COMPRESSED'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ec.h(38): error C2086: 'POINT_CONVERSION_COMPRESSED': redefinition
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ec.h(38): note: see declaration of 'POINT_CONVERSION_COMPRESSED'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ec.h(39): error C2365: 'POINT_CONVERSION_UNCOMPRESSED': redefinition; previous definition was 'enumerator'
E:\vcpkgup\installed\x64-windows\include\openssl/ec.h(83): note: see declaration of 'POINT_CONVERSION_UNCOMPRESSED'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ec.h(39): error C2086: '<unnamed-enum-POINT_CONVERSION_COMPRESSED> POINT_CONVERSION_UNCOMPRESSED': redefinition
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ec.h(39): note: see declaration of 'POINT_CONVERSION_UNCOMPRESSED'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ec.h(44): error C2059: syntax error: 'constant'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ec.h(312): error C2371: 'EC_KEY': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(149): note: see declaration of 'EC_KEY'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ec.h(313): error C2371: 'EC_GROUP': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/ec.h(107): note: see declaration of 'EC_GROUP'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ec.h(314): error C2371: 'EC_METHOD': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/ec.h(105): note: see declaration of 'EC_METHOD'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ec.h(315): error C2371: 'EC_POINT': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/ec.h(108): note: see declaration of 'EC_POINT'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ec.h(316): error C2371: 'EC_builtin_curve': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/ec.h(521): note: see declaration of 'EC_builtin_curve'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/dh.h(83): error C2371: 'DH': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(134): note: see declaration of 'DH'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/evp.h(234): error C2059: syntax error: 'constant'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/evp.h(289): error C2059: syntax error: 'constant'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/evp.h(326): error C2059: syntax error: 'constant'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/evp.h(365): error C2059: syntax error: 'constant'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ecdsa.h(40): error C2371: 'ECDSA_SIG': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/ec.h(1304): note: see declaration of 'ECDSA_SIG'
E:\vcpkgup\installed\x64-windows\include\wolfssl/wolfcrypt/pkcs7.h(197): error C2371: 'PKCS7': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/pkcs7.h(216): note: see declaration of 'PKCS7'
E:\vcpkgup\installed\x64-windows\include\wolfssl/wolfcrypt/pkcs7.h(198): error C2371: 'PKCS7_SIGNED': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/pkcs7.h(138): note: see declaration of 'PKCS7_SIGNED'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(76): error C2371: 'SSL': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(184): note: see declaration of 'SSL'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(77): error C2371: 'SSL_SESSION': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/ssl.h(231): note: see declaration of 'SSL_SESSION'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(78): error C2371: 'SSL_METHOD': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/ssl.h(229): note: see declaration of 'SSL_METHOD'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(79): error C2371: 'SSL_CTX': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(185): note: see declaration of 'SSL_CTX'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(81): error C2371: 'X509': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(157): note: see declaration of 'X509'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(82): error C2371: 'X509_REQ': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/x509.h(280): note: see declaration of 'X509_REQ'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(83): error C2371: 'X509_NAME': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(162): note: see declaration of 'X509_NAME'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(84): error C2371: 'X509_INFO': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/x509.h(386): note: see declaration of 'X509_INFO'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(94): error C2371: 'BIO': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(86): note: see declaration of 'BIO'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(95): error C2371: 'BIO_METHOD': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/bio.h(296): note: see declaration of 'BIO_METHOD'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(96): error C2371: 'SSL_CIPHER': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/ssl.h(230): note: see declaration of 'SSL_CIPHER'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(97): error C2371: 'X509_LOOKUP': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(168): note: see declaration of 'X509_LOOKUP'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(98): error C2371: 'X509_LOOKUP_METHOD': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(169): note: see declaration of 'X509_LOOKUP_METHOD'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(99): error C2371: 'X509_CRL': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(159): note: see declaration of 'X509_CRL'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(100): error C2371: 'X509_EXTENSION': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/x509.h(222): note: see declaration of 'X509_EXTENSION'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(101): error C2371: 'X509_PUBKEY': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(163): note: see declaration of 'X509_PUBKEY'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(102): error C2371: 'X509_ALGOR': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(158): note: see declaration of 'X509_ALGOR'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(103): error C2371: 'ASN1_TIME': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(56): note: see declaration of 'ASN1_TIME'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(104): error C2371: 'ASN1_INTEGER': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(45): note: see declaration of 'ASN1_INTEGER'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(105): error C2371: 'ASN1_OBJECT': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(66): note: see declaration of 'ASN1_OBJECT'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(106): error C2371: 'ASN1_STRING': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(60): note: see declaration of 'ASN1_STRING'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(107): error C2371: 'ASN1_TYPE': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(65): note: see declaration of 'ASN1_TYPE'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(108): error C2371: 'X509_ATTRIBUTE': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/x509.h(251): note: see declaration of 'X509_ATTRIBUTE'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(109): error C2371: 'ASN1_BIT_STRING': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(47): note: see declaration of 'ASN1_BIT_STRING'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(111): error C2371: 'BUF_MEM': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(94): note: see declaration of 'BUF_MEM'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(114): error C2371: 'OBJ_NAME': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/objects.h(48): note: see declaration of 'OBJ_NAME'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(116): error C2371: 'DIST_POINT': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(196): note: see declaration of 'DIST_POINT'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(126): error C2371: 'COMP_METHOD': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(188): note: see declaration of 'COMP_METHOD'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(127): error C2371: 'SSL_COMP': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/ssl.h(234): note: see declaration of 'SSL_COMP'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(128): error C2371: 'X509_REVOKED': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(161): note: see declaration of 'X509_REVOKED'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(130): error C2371: 'X509_OBJECT': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(167): note: see declaration of 'X509_OBJECT'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(131): error C2371: 'X509_STORE': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(164): note: see declaration of 'X509_STORE'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(132): error C2371: 'X509_STORE_CTX': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(165): note: see declaration of 'X509_STORE_CTX'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(133): error C2371: 'X509_VERIFY_PARAM': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/types.h(170): note: see declaration of 'X509_VERIFY_PARAM'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(607): error C2371: 'X509_NAME_ENTRY': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/x509.h(190): note: see declaration of 'X509_NAME_ENTRY'
E:\vcpkgup\installed\x64-windows\include\wolfssl/openssl/ssl.h(1619): error C2371: 'SSL_CONF_CTX': redefinition; different basic types
E:\vcpkgup\installed\x64-windows\include\openssl/ssl.h(233): note: see declaration of 'SSL_CONF_CTX'

== Build Environment

  • MSVC 2022
  • VCPKG build system (I am attempting to update the vcpkg upstream)
@jay
Copy link
Member

jay commented Jan 19, 2023

Ref: microsoft/vcpkg#24348
Ref: #8864
Ref: #9314

Basically, to summarize, it looks like @elms had put wolfssl first and @vszakats had put openssl first. I think if wolfSSL can use the same paths as OpenSSL includes (@elms mentioned this in his PR) then we would want to check wolfSSL first, otherwise our OpenSSL section could include wolfSSL includes? If I understand this right. @vszakats do you remember the reason for the change to put OpenSSL first?

@marekr
Copy link
Author

marekr commented Jan 19, 2023

Also fyi, if I fix the issue in curl_ntlm_core by reordering the includes, another issue appears in \lib\vtls\wolfssl.c with a header conflict.

This second conflict is caused by dafdb20

It introduced vtls_int.h, this header includes all the backend headers outright. openssl.h is first, it includes the openssl/ssl.h header which includes all the openssl types. wolfssl.c then includes vtls_int.h before the wolfssl headers and the result is the same compiler barf

@vszakats
Copy link
Member

vszakats commented Jan 19, 2023

Can't remember what was the exact error without this patch. But, is it really possible to use both wolfSSL and OpenSSL at the same time? In my tests this didn't seem to be the case, and they were conflicting. One (main) reason is that wolfSSL is supported by curl via its OpenSSL compatibility interface, sharing most (but not all) interface code.

It would be nice to sort out inconsistencies when picking one over the other, but building against both at the same time I don't think is possible. It means a viable fix is to deselect one of them at build time.

UPDATE: The likely reason I had changed the order, is the comment at the top of curl_ntlm_core.c which specifies the expected priority order, USE_OPENSSL being the first on the list. I think the order should be synced with this also in curl_ntlm_core.h. [ Back then, after finding out these two are conflicting, I did sort this out at the build level, and may have skipped bumping into the header issue in further tests. ]

UPDATE 2: When I added this priority list in 2017 (6f86022), wolfSSL support wasn't present yet. When wolfSSL support was added later on, the list wasn't updated, so it's still missing from it. I'd be also nice to add it there, right below USE_OPENSSL.

Patch proposal moved here: #10322

@marekr
Copy link
Author

marekr commented Jan 19, 2023

Can't remember what was the exact error without this patch. But, is it really possible to use both wolfSSL and OpenSSL at the same time?

I just checked and curl 7.84.0 builds with both backends just fine

@vszakats
Copy link
Member

vszakats commented Jan 19, 2023

Do you mean that curl -V would display both OpenSSL and wolfSSL at the same time? Or do you mean the build finishes successfully (with one of the TLS backends appearing in curl -V)?

@marekr
Copy link
Author

marekr commented Jan 19, 2023

Do you mean that curl -V would display both OpenSSL and wolfSSL at the same time? Or do you mean the build finishes successfully (with one of the TLS backends appearing in curl -V)?

PS E:\vcpkgup\installed\x64-windows\tools\curl> ./curl -V
curl 7.84.0-DEV (Windows) libcurl/7.84.0-DEV wolfSSL/5.5.0 (OpenSSL/3.0.7) (Schannel) zlib/1.2.11
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS HSTS IPv6 Kerberos Largefile libz MultiSSL NTLM SPNEGO SSL SSPI threadsafe UnixSockets

Yes, also schannel for bonus points

@vszakats
Copy link
Member

vszakats commented Jan 19, 2023

Thanks! I've made my tests with HTTP/3 enabled, which may change the situation (e.g. due to ngtcp2 supporting one or the other TLS backend). I'll make some tests without HTTP/3.

@marekr
Copy link
Author

marekr commented Jan 19, 2023

Thanks! I've made my tests with HTTP/3 enabled, which may change the situation (e.g. due to ngtcp2 supporting one or the other TLS backend). I'll make some tests without HTTP/3.

In the meantime, did you have a chance to test the patch above?

Your patch does fix the build in curl_ntlm_core however if you see my other comment #10321 (comment)

there is a second breakage by a more recent commit in november. I poked it but it seems more problematic to fix since vtls_int.h also carries necessary types/functions for the backend headers now after that referenced commit.

@vszakats
Copy link
Member

Testing with 7.87.0, with the above patch, I bumped into the dafdb20 issue.
If that sorted, the next issue will be ngtcp2.

@vszakats
Copy link
Member

vszakats commented Jan 19, 2023

Yep, got it! The dafdb20 issue wasn't present (nor was HTTP/3 supported by wolfSSL) at the time, but there were further issues down the line with HTTP/3 enabled, according to my notes both at compile and link time. So, mixing these two may or may not be possible depending on other features enabled. With wolfSSL now also supporting HTTP/3, there are some more combinations since.

I can unlock this combo in lib/Makefile.mk (patch above updated, and converted to #10322) and in curl-for-win, but checking all valid and invalid combinations seems a little bit too complex at this point. Not to mention CMake and autotools builds (CMake doesn't support wolfSSL with HTTP/3 yet).

vszakats added a commit to curl/curl-for-win that referenced this issue Jan 19, 2023
Caveat: This is broken in multiple ways depending on curl version,
options enabled and build tool.

With HTTP/3 enabled, these two backends never worked together and
as of 7.87.0, there are multiple compile-time issues even without
HTTP/3.

Also `lib/Makefile.mk` will need a patch to allow this combination.

Ref: curl/curl#10321
vszakats added a commit to vszakats/curl that referenced this issue Jan 19, 2023
1. Add USE_WOLFSSL to the priority list in `lib/curl_ntlm_core.c`

2. Fix `lib/curl_ntlm_core.h` to respect backend priority, bringing
   this in sync with the above list and `lib/curl_ntlm_core.c` itself.

3. Allow enabling both wolfSSL and OpenSSL at the same time in
   `lib/Makefile.mk`. Update the logic to select the crypto-specific
   lib for ngtcp2.

Ref: curl#10321

Closes #xxxxx
vszakats added a commit to vszakats/curl that referenced this issue Jan 19, 2023
1. Add USE_WOLFSSL to the priority list in `lib/curl_ntlm_core.c`

2. Fix `lib/curl_ntlm_core.h` to respect backend priority, bringing
   this in sync with the above list and `lib/curl_ntlm_core.c` itself.

3. Allow enabling both wolfSSL and OpenSSL at the same time in
   `lib/Makefile.mk`. Update the logic to select the crypto-specific
   lib for ngtcp2.

Ref: curl#10321

Closes curl#10322
@vszakats vszakats added TLS and removed Windows Windows-specific labels Jan 19, 2023
@bagder
Copy link
Member

bagder commented Jan 28, 2023

I would be okay with documenting that wolfSSL and OpenSSL cannot be used together in a curl build.

bagder added a commit that referenced this issue Jan 31, 2023
And document how OpenSSL forks and wolfSSL cannot be used at the same
time.

Reported-by: Mark Roszko
Fixes #10321
@bagder bagder closed this as completed in 886861b Feb 1, 2023
vszakats added a commit that referenced this issue Feb 1, 2023
1. Add `USE_WOLFSSL` to the TLS backend priority list in
   `lib/curl_ntlm_core.c`.

2. Fix `lib/curl_ntlm_core.h` to respect TLS backend priority, bringing
   it in sync with the above list and `lib/curl_ntlm_core.c` itself.

   Reported-by: Mark Roszko
   Ref: #10321

3. Allow enabling both wolfSSL and OpenSSL at the same time in
   `lib/Makefile.mk` bringing this in line with cmake/autotools builds.
   Update logic to select the crypto-specific lib for `ngtcp2`, which
   supports a single TLS backend at the same time.

Closes #10322
bch pushed a commit to bch/curl that referenced this issue Jul 19, 2023
And document how OpenSSL forks and wolfSSL cannot be used at the same
time.

Reported-by: Mark Roszko
Fixes curl#10321
Closes curl#10382
bch pushed a commit to bch/curl that referenced this issue Jul 19, 2023
1. Add `USE_WOLFSSL` to the TLS backend priority list in
   `lib/curl_ntlm_core.c`.

2. Fix `lib/curl_ntlm_core.h` to respect TLS backend priority, bringing
   it in sync with the above list and `lib/curl_ntlm_core.c` itself.

   Reported-by: Mark Roszko
   Ref: curl#10321

3. Allow enabling both wolfSSL and OpenSSL at the same time in
   `lib/Makefile.mk` bringing this in line with cmake/autotools builds.
   Update logic to select the crypto-specific lib for `ngtcp2`, which
   supports a single TLS backend at the same time.

Closes curl#10322
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

4 participants