curl / curl

A command line tool and library for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS and WSS. libcurl offers a myriad of powerful features
https://curl.se/
Other
35.87k stars 6.42k forks source link

openssl + wolfssl combo backend build broken #10321

Closed marekr closed 1 year ago

marekr commented 1 year ago

This commit made a change to curl_ntlm_core https://github.com/curl/curl/commit/5fd7cd7302d3ea265661822b5eea200f97005133

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

jay commented 1 year ago

Ref: https://github.com/microsoft/vcpkg/pull/24348 Ref: https://github.com/curl/curl/pull/8864 Ref: https://github.com/curl/curl/pull/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 commented 1 year ago

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 https://github.com/curl/curl/commit/dafdb20a26d0c890e83dea61a104b75408481ebd

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 commented 1 year ago

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 (6f86022df26243cc8a035fe8b4c89033b6a04bc0), 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: https://github.com/curl/curl/pull/10322

marekr commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 https://github.com/curl/curl/issues/10321#issuecomment-1396462823

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 commented 1 year ago

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

vszakats commented 1 year ago

Yep, got it! The dafdb20a26d0c890e83dea61a104b75408481ebd 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).

bagder commented 1 year ago

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