GHA/appveyor: add VS2019 job, merge two others, fix build fallout

- add VS2019 job, with Schannel + OpenSSL 1.0.2.
  First MultiSSL job here and add the last missing modern VS version.

- fix builds with mixed ALPN capabilities in MultiSSL unity builds.
  Caused by reusing `HAS_ALPN` between TLS modules without
  resetting it. Fix it by using unique names for each backend.

- merge a VS2010 job into a VS2012. With MultiSSL and x86 OpenSSL.

- make a job static.

- fix `Shared`/`Static` in a job name.

- add `Shared` to job names.

Closes #16231
This commit is contained in:
Viktor Szakats 2025-02-07 02:53:15 +01:00
parent 0b3afd133a
commit 0c933081fb
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
5 changed files with 46 additions and 43 deletions

View File

@ -28,16 +28,23 @@ set -eux; [ -n "${BASH:-}${ZSH_NAME:-}" ] && set -o pipefail
# build # build
case "${TARGET:-}" in
*Win32) openssl_suffix='-Win32';;
*) openssl_suffix='-Win64';;
esac
if [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2022' ]; then if [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2022' ]; then
openssl_root_win='C:/OpenSSL-v34-Win64' openssl_root_win="C:/OpenSSL-v34${openssl_suffix}"
elif [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2019' ]; then
openssl_root_win="C:/OpenSSL${openssl_suffix}"
else else
openssl_root_win='C:/OpenSSL-v111-Win64' openssl_root_win="C:/OpenSSL-v111${openssl_suffix}"
fi fi
openssl_root="$(cygpath "${openssl_root_win}")" openssl_root="$(cygpath "${openssl_root_win}")"
if [ "${BUILD_SYSTEM}" = 'CMake' ]; then if [ "${BUILD_SYSTEM}" = 'CMake' ]; then
options='' options=''
[[ "${TARGET:-}" = *'ARM64'* ]] && SKIP_RUN='ARM64 architecture' [[ "${TARGET}" = *'ARM64'* ]] && SKIP_RUN='ARM64 architecture'
[ -n "${TOOLSET:-}" ] && options+=" -T ${TOOLSET}" [ -n "${TOOLSET:-}" ] && options+=" -T ${TOOLSET}"
[ "${OPENSSL}" = 'ON' ] && options+=" -DOPENSSL_ROOT_DIR=${openssl_root_win}" [ "${OPENSSL}" = 'ON' ] && options+=" -DOPENSSL_ROOT_DIR=${openssl_root_win}"
[ -n "${CURLDEBUG:-}" ] && options+=" -DENABLE_CURLDEBUG=${CURLDEBUG}" [ -n "${CURLDEBUG:-}" ] && options+=" -DENABLE_CURLDEBUG=${CURLDEBUG}"
@ -45,7 +52,7 @@ if [ "${BUILD_SYSTEM}" = 'CMake' ]; then
[ "${PRJ_CFG}" = 'Release' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=' [ "${PRJ_CFG}" = 'Release' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE='
[[ "${PRJ_GEN}" = *'Visual Studio'* ]] && options+=' -DCMAKE_VS_GLOBALS=TrackFileAccess=false' [[ "${PRJ_GEN}" = *'Visual Studio'* ]] && options+=' -DCMAKE_VS_GLOBALS=TrackFileAccess=false'
# shellcheck disable=SC2086 # shellcheck disable=SC2086
cmake -B _bld "-G${PRJ_GEN}" ${TARGET:-} ${options} \ cmake -B _bld "-G${PRJ_GEN}" ${TARGET} ${options} \
"-DCURL_USE_OPENSSL=${OPENSSL}" \ "-DCURL_USE_OPENSSL=${OPENSSL}" \
"-DCURL_USE_SCHANNEL=${SCHANNEL}" \ "-DCURL_USE_SCHANNEL=${SCHANNEL}" \
"-DHTTP_ONLY=${HTTP_ONLY}" \ "-DHTTP_ONLY=${HTTP_ONLY}" \

View File

@ -63,16 +63,7 @@ environment:
ENABLE_UNICODE: 'OFF' ENABLE_UNICODE: 'OFF'
DEBUG: 'OFF' DEBUG: 'OFF'
CURLDEBUG: 'ON' CURLDEBUG: 'ON'
- job_name: 'CMake, VS2010, Release, x86, Schannel, Static, Build-tests' - job_name: 'CMake, VS2010, Debug, x64, Schannel, Shared, Build-tests & examples'
APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015'
BUILD_SYSTEM: CMake
PRJ_GEN: 'Visual Studio 10 2010'
TARGET: '-A Win32'
PRJ_CFG: Release
SCHANNEL: 'ON'
ENABLE_UNICODE: 'OFF'
SHARED: 'ON'
- job_name: 'CMake, VS2010, Debug, x64, Schannel, Static, Build-tests & examples'
APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015'
BUILD_SYSTEM: CMake BUILD_SYSTEM: CMake
PRJ_GEN: 'Visual Studio 10 2010' PRJ_GEN: 'Visual Studio 10 2010'
@ -82,17 +73,17 @@ environment:
ENABLE_UNICODE: 'OFF' ENABLE_UNICODE: 'OFF'
SHARED: 'ON' SHARED: 'ON'
EXAMPLES: 'ON' EXAMPLES: 'ON'
- job_name: 'CMake, VS2012, Debug, x64, OpenSSL 1.1.1, Build-tests' - job_name: 'CMake, VS2012, Release, x86, OpenSSL 1.1.1 + Schannel, Shared, Build-tests'
APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015'
BUILD_SYSTEM: CMake BUILD_SYSTEM: CMake
PRJ_GEN: 'Visual Studio 11 2012' PRJ_GEN: 'Visual Studio 11 2012'
TARGET: '-A x64' TARGET: '-A Win32'
PRJ_CFG: Debug PRJ_CFG: Release
OPENSSL: 'ON' OPENSSL: 'ON'
SCHANNEL: 'OFF' SCHANNEL: 'ON'
ENABLE_UNICODE: 'OFF' ENABLE_UNICODE: 'OFF'
SHARED: 'ON' SHARED: 'ON'
- job_name: 'CMake, VS2013, Debug, x64, OpenSSL 1.1.1, Build-only' - job_name: 'CMake, VS2013, Debug, x64, OpenSSL 1.1.1, Shared, Build-only'
APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015'
BUILD_SYSTEM: CMake BUILD_SYSTEM: CMake
PRJ_GEN: 'Visual Studio 12 2013' PRJ_GEN: 'Visual Studio 12 2013'
@ -103,7 +94,7 @@ environment:
ENABLE_UNICODE: 'OFF' ENABLE_UNICODE: 'OFF'
SHARED: 'ON' SHARED: 'ON'
TFLAGS: 'skipall' TFLAGS: 'skipall'
- job_name: 'CMake, VS2015, Debug, x64, OpenSSL 1.1.1, Build-only' - job_name: 'CMake, VS2015, Debug, x64, OpenSSL 1.1.1, Static, Build-only'
APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015'
BUILD_SYSTEM: CMake BUILD_SYSTEM: CMake
PRJ_GEN: 'Visual Studio 14 2015' PRJ_GEN: 'Visual Studio 14 2015'
@ -112,9 +103,8 @@ environment:
OPENSSL: 'ON' OPENSSL: 'ON'
SCHANNEL: 'OFF' SCHANNEL: 'OFF'
ENABLE_UNICODE: 'OFF' ENABLE_UNICODE: 'OFF'
SHARED: 'ON'
TFLAGS: 'skipall' TFLAGS: 'skipall'
- job_name: 'CMake, VS2017, Debug, x64, OpenSSL 1.1.1, Build-only' - job_name: 'CMake, VS2017, Debug, x64, OpenSSL 1.1.1, Shared, Build-only'
APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2017' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2017'
BUILD_SYSTEM: CMake BUILD_SYSTEM: CMake
PRJ_GEN: 'Visual Studio 15 2017' PRJ_GEN: 'Visual Studio 15 2017'
@ -125,6 +115,16 @@ environment:
ENABLE_UNICODE: 'OFF' ENABLE_UNICODE: 'OFF'
SHARED: 'ON' SHARED: 'ON'
TFLAGS: 'skipall' TFLAGS: 'skipall'
- job_name: 'CMake, VS2019, Debug, x64, OpenSSL 1.0.2 + Schannel, Shared, Build-tests'
APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2019'
BUILD_SYSTEM: CMake
PRJ_GEN: 'Visual Studio 16 2019'
TARGET: '-A x64'
PRJ_CFG: Debug
OPENSSL: 'ON'
SCHANNEL: 'ON'
ENABLE_UNICODE: 'OFF'
SHARED: 'ON'
- job_name: 'CMake, VS2022, Debug, x64, Schannel, Static, Unicode, Build-tests & examples, clang-cl' - job_name: 'CMake, VS2022, Debug, x64, Schannel, Static, Unicode, Build-tests & examples, clang-cl'
APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022'
BUILD_SYSTEM: CMake BUILD_SYSTEM: CMake

View File

@ -79,11 +79,8 @@
#include "memdebug.h" #include "memdebug.h"
/* ALPN for http2 */ /* ALPN for http2 */
#ifdef USE_HTTP2 #if defined(USE_HTTP2) && defined(MBEDTLS_SSL_ALPN)
# undef HAS_ALPN # define HAS_ALPN_MBEDTLS
# ifdef MBEDTLS_SSL_ALPN
# define HAS_ALPN
# endif
#endif #endif
struct mbed_ssl_backend_data { struct mbed_ssl_backend_data {
@ -97,7 +94,7 @@ struct mbed_ssl_backend_data {
#endif #endif
mbedtls_pk_context pk; mbedtls_pk_context pk;
mbedtls_ssl_config config; mbedtls_ssl_config config;
#ifdef HAS_ALPN #ifdef HAS_ALPN_MBEDTLS
const char *protocols[3]; const char *protocols[3];
#endif #endif
int *ciphersuites; int *ciphersuites;
@ -931,7 +928,7 @@ mbed_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
#ifdef HAS_ALPN #ifdef HAS_ALPN_MBEDTLS
if(connssl->alpn) { if(connssl->alpn) {
struct alpn_proto_buf proto; struct alpn_proto_buf proto;
size_t i; size_t i;
@ -1109,7 +1106,7 @@ pinnedpubkey_error:
} }
} }
#ifdef HAS_ALPN #ifdef HAS_ALPN_MBEDTLS
if(connssl->alpn) { if(connssl->alpn) {
const char *proto = mbedtls_ssl_get_alpn_protocol(&backend->ssl); const char *proto = mbedtls_ssl_get_alpn_protocol(&backend->ssl);

View File

@ -2871,10 +2871,9 @@ static void ossl_trace(int direction, int ssl_ver, int content_type,
/* ====================================================== */ /* ====================================================== */
/* Check for OpenSSL 1.0.2 which has ALPN support. */ /* Check for OpenSSL 1.0.2 which has ALPN support. */
#undef HAS_ALPN
#if OPENSSL_VERSION_NUMBER >= 0x10002000L \ #if OPENSSL_VERSION_NUMBER >= 0x10002000L \
&& !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_TLSEXT)
# define HAS_ALPN 1 # define HAS_ALPN_OPENSSL
#endif #endif
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) /* 1.1.0 */ #if (OPENSSL_VERSION_NUMBER >= 0x10100000L) /* 1.1.0 */
@ -3854,7 +3853,7 @@ CURLcode Curl_ossl_ctx_init(struct ossl_ctx *octx,
#endif #endif
if(alpn && alpn_len) { if(alpn && alpn_len) {
#ifdef HAS_ALPN #ifdef HAS_ALPN_OPENSSL
if(SSL_CTX_set_alpn_protos(octx->ssl_ctx, alpn, (int)alpn_len)) { if(SSL_CTX_set_alpn_protos(octx->ssl_ctx, alpn, (int)alpn_len)) {
failf(data, "Error setting ALPN"); failf(data, "Error setting ALPN");
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
@ -4192,7 +4191,7 @@ static CURLcode ossl_connect_step1(struct Curl_cfilter *cf,
DEBUGASSERT(ssl_connect_1 == connssl->connecting_state); DEBUGASSERT(ssl_connect_1 == connssl->connecting_state);
DEBUGASSERT(octx); DEBUGASSERT(octx);
memset(&proto, 0, sizeof(proto)); memset(&proto, 0, sizeof(proto));
#ifdef HAS_ALPN #ifdef HAS_ALPN_OPENSSL
if(connssl->alpn) { if(connssl->alpn) {
result = Curl_alpn_to_proto_buf(&proto, connssl->alpn); result = Curl_alpn_to_proto_buf(&proto, connssl->alpn);
if(result) { if(result) {
@ -4229,7 +4228,7 @@ static CURLcode ossl_connect_step1(struct Curl_cfilter *cf,
SSL_set_bio(octx->ssl, bio, bio); SSL_set_bio(octx->ssl, bio, bio);
#endif #endif
#ifdef HAS_ALPN #ifdef HAS_ALPN_OPENSSL
if(connssl->alpn) { if(connssl->alpn) {
Curl_alpn_to_proto_str(&proto, connssl->alpn); Curl_alpn_to_proto_str(&proto, connssl->alpn);
infof(data, VTLS_INFOF_ALPN_OFFER_1STR, proto.data); infof(data, VTLS_INFOF_ALPN_OFFER_1STR, proto.data);
@ -4541,7 +4540,7 @@ static CURLcode ossl_connect_step2(struct Curl_cfilter *cf,
# endif /* !OPENSSL_IS_BORINGSSL && !OPENSSL_IS_AWSLC */ # endif /* !OPENSSL_IS_BORINGSSL && !OPENSSL_IS_AWSLC */
#endif /* USE_ECH_OPENSSL */ #endif /* USE_ECH_OPENSSL */
#ifdef HAS_ALPN #ifdef HAS_ALPN_OPENSSL
/* Sets data and len to negotiated protocol, len is 0 if no protocol was /* Sets data and len to negotiated protocol, len is 0 if no protocol was
* negotiated * negotiated
*/ */

View File

@ -77,7 +77,7 @@
https://technet.microsoft.com/en-us/library/hh831771%28v=ws.11%29.aspx https://technet.microsoft.com/en-us/library/hh831771%28v=ws.11%29.aspx
*/ */
#if defined(_MSC_VER) && (_MSC_VER >= 1800) && !defined(_USING_V110_SDK71_) #if defined(_MSC_VER) && (_MSC_VER >= 1800) && !defined(_USING_V110_SDK71_)
# define HAS_ALPN 1 # define HAS_ALPN_SCHANNEL
#endif #endif
#ifndef BCRYPT_CHACHA20_POLY1305_ALGORITHM #ifndef BCRYPT_CHACHA20_POLY1305_ALGORITHM
@ -888,7 +888,7 @@ schannel_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
SecBufferDesc outbuf_desc; SecBufferDesc outbuf_desc;
SecBuffer inbuf; SecBuffer inbuf;
SecBufferDesc inbuf_desc; SecBufferDesc inbuf_desc;
#ifdef HAS_ALPN #ifdef HAS_ALPN_SCHANNEL
unsigned char alpn_buffer[128]; unsigned char alpn_buffer[128];
#endif #endif
SECURITY_STATUS sspi_status = SEC_E_OK; SECURITY_STATUS sspi_status = SEC_E_OK;
@ -908,7 +908,7 @@ schannel_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
"connect to some servers due to lack of SNI, algorithms, etc."); "connect to some servers due to lack of SNI, algorithms, etc.");
} }
#ifdef HAS_ALPN #ifdef HAS_ALPN_SCHANNEL
/* ALPN is only supported on Windows 8.1 / Server 2012 R2 and above. /* ALPN is only supported on Windows 8.1 / Server 2012 R2 and above.
Also it does not seem to be supported for WINE, see curl bug #983. */ Also it does not seem to be supported for WINE, see curl bug #983. */
backend->use_alpn = connssl->alpn && backend->use_alpn = connssl->alpn &&
@ -991,7 +991,7 @@ schannel_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
infof(data, "schannel: using IP address, SNI is not supported by OS."); infof(data, "schannel: using IP address, SNI is not supported by OS.");
} }
#ifdef HAS_ALPN #ifdef HAS_ALPN_SCHANNEL
if(backend->use_alpn) { if(backend->use_alpn) {
int cur = 0; int cur = 0;
int list_start_index = 0; int list_start_index = 0;
@ -1039,7 +1039,7 @@ schannel_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
InitSecBuffer(&inbuf, SECBUFFER_EMPTY, NULL, 0); InitSecBuffer(&inbuf, SECBUFFER_EMPTY, NULL, 0);
InitSecBufferDesc(&inbuf_desc, &inbuf, 1); InitSecBufferDesc(&inbuf_desc, &inbuf, 1);
} }
#else /* HAS_ALPN */ #else /* HAS_ALPN_SCHANNEL */
InitSecBuffer(&inbuf, SECBUFFER_EMPTY, NULL, 0); InitSecBuffer(&inbuf, SECBUFFER_EMPTY, NULL, 0);
InitSecBufferDesc(&inbuf_desc, &inbuf, 1); InitSecBufferDesc(&inbuf_desc, &inbuf, 1);
#endif #endif
@ -1533,7 +1533,7 @@ schannel_connect_step3(struct Curl_cfilter *cf, struct Curl_easy *data)
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
SECURITY_STATUS sspi_status = SEC_E_OK; SECURITY_STATUS sspi_status = SEC_E_OK;
CERT_CONTEXT *ccert_context = NULL; CERT_CONTEXT *ccert_context = NULL;
#ifdef HAS_ALPN #ifdef HAS_ALPN_SCHANNEL
SecPkgContext_ApplicationProtocol alpn_result; SecPkgContext_ApplicationProtocol alpn_result;
#endif #endif
@ -1562,7 +1562,7 @@ schannel_connect_step3(struct Curl_cfilter *cf, struct Curl_easy *data)
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
#ifdef HAS_ALPN #ifdef HAS_ALPN_SCHANNEL
if(backend->use_alpn) { if(backend->use_alpn) {
sspi_status = sspi_status =
Curl_pSecFn->QueryContextAttributes(&backend->ctxt->ctxt_handle, Curl_pSecFn->QueryContextAttributes(&backend->ctxt->ctxt_handle,