Skip to content

boringssl: fix more coexist cases with Schannel/WinCrypt#21136

Closed
vszakats wants to merge 1 commit intocurl:masterfrom
vszakats:bssl-schan-coexist-cont
Closed

boringssl: fix more coexist cases with Schannel/WinCrypt#21136
vszakats wants to merge 1 commit intocurl:masterfrom
vszakats:bssl-schan-coexist-cont

Conversation

@vszakats
Copy link
Copy Markdown
Member

@vszakats vszakats commented Mar 28, 2026

By moving the coexist workaround from vtls/openssl.c to vtls/openssl.h.
This way it also applies to vtls.c (and possibly other sources including
vtls/openssl.h), which may need it in unity builds before BoringSSL
header openssl/ssl.h pulling in the conflicting symbols and causing
conflicts otherwise.

Seen with build config:

-DCURL_USE_SCHANNEL=ON -DCURL_USE_OPENSSL=ON
-DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=30

Fixing:

In file included from _cm-win-boringssl/lib/CMakeFiles/libcurl_object.dir/Unity/unity_5_c.c:7:
In file included from lib/vtls/vtls.c:54:
In file included from lib/vtls/openssl.h:33:
In file included from /path/to/boringssl/_x64-win-ucrt/usr/include/openssl/opensslv.h:18:
In file included from /path/to/boringssl/_x64-win-ucrt/usr/include/openssl/crypto.h:18:
/path/to/boringssl/_x64-win-ucrt/usr/include/openssl/base.h:293:29: error: expected ')'
  293 | typedef struct X509_name_st X509_NAME;
      |                             ^
/path/to/llvm-mingw/x86_64-w64-mingw32/include/wincrypt.h:1515:29: note: expanded from macro 'X509_NAME'
 1515 | #define X509_NAME ((LPCSTR) 7)
      |                             ^
[...]

Ref: 2a92c39 #20567

By moving the coexist workaround from vtls/openssl.c to vtls/openssl.h.
This way it also applies to vtls.c (and possibly other sources including
`vtls/openssl.h`), which may need it before including BoringSSL header
`openssl/ssl.h` pulling in the conflicting symbols and causing conflicts
otherwise.

Example build:
```
-DCURL_USE_SCHANNEL=ON -DCURL_USE_OPENSSL=ON
-DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=30
```

Fixing:
```
In file included from _cm-win-boringssl/lib/CMakeFiles/libcurl_object.dir/Unity/unity_5_c.c:7:
In file included from lib/vtls/vtls.c:54:
In file included from lib/vtls/openssl.h:33:
In file included from /path/to/boringssl/_x64-win-ucrt/usr/include/openssl/opensslv.h:18:
In file included from /path/to/boringssl/_x64-win-ucrt/usr/include/openssl/crypto.h:18:
/path/to/boringssl/_x64-win-ucrt/usr/include/openssl/base.h:293:29: error: expected ')'
  293 | typedef struct X509_name_st X509_NAME;
      |                             ^
/path/to/llvm-mingw/x86_64-w64-mingw32/include/wincrypt.h:1515:29: note: expanded from macro 'X509_NAME'
 1515 | #define X509_NAME ((LPCSTR) 7)
      |                             ^
```

Ref: 2a92c39 curl#20567
@vszakats vszakats added build TLS Windows Windows-specific labels Mar 28, 2026
@vszakats vszakats closed this in f0f0a7f Mar 28, 2026
@vszakats vszakats deleted the bssl-schan-coexist-cont branch March 28, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build TLS Windows Windows-specific

Development

Successfully merging this pull request may close these issues.

1 participant