Files
aevolution/cmake/Quic.cmake
T
dingoandClaude Opus 5.5 3c421cd0cf
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 2m28s
Foundation / checks (network) (push) Successful in 8m16s
Foundation / checks (client) (push) Successful in 12m14s
Foundation / checks (tsan) (push) Successful in 7m50s
Foundation / checks (checks) (push) Successful in 31m45s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 25m13s
Select and pin the M10.2 QUIC transport (msquic with OpenSSL)
ADR-0090 records the maintainer's selection of msquic 2.6.2 with OpenSSL 3.5.9 LTS
built from pinned, checksum-verified sources on Windows and Linux (plus the
xdp-for-windows headers msquic needs on Windows), the trust, threading and
channel model, and the known gap that OpenSSL's verifier also trusts its default
paths. Adds the opt-in quic preset, explicit preparation, and a loopback smoke
test (datagram, stream, untrusted CA and wrong name refused) passing on MSVC and
GCC. windows-check picks up newly installed Perl/NASM and pins cl.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 15:07:16 -04:00

56 lines
2.8 KiB
CMake

# M10.2 QUIC transport (ADR-0090): pinned msquic 2.6.2 with its OpenSSL TLS provider
# (OpenSSL 3.5.9 LTS, TLS 1.3 only, built static inside the msquic shared library).
# Explicit preparation only: cmake -P tools/prepare-msquic.cmake. Windows builds need a
# native Perl (Strawberry Perl) and NASM for OpenSSL, plus nmake from the MSVC shell.
include_guard(GLOBAL)
include("${PROJECT_SOURCE_DIR}/tools/msquic-pin.cmake")
set(msquic_source "${PROJECT_SOURCE_DIR}/build/external/msquic/msquic-${EVO_MSQUIC_VERSION}")
if(NOT EXISTS "${msquic_source}/evo-verified.sha256")
message(FATAL_ERROR "Prepare msquic explicitly: cmake -P tools/prepare-msquic.cmake")
endif()
file(STRINGS "${msquic_source}/evo-verified.sha256" verified_msquic)
if(NOT verified_msquic STREQUAL "${EVO_MSQUIC_SHA256} ${EVO_OPENSSL_SHA256} ${EVO_XDP_SHA256}")
message(FATAL_ERROR "Prepared msquic/OpenSSL do not match the reviewed pins")
endif()
if(WIN32)
find_program(EVO_NATIVE_PERL perl)
find_program(EVO_NASM nasm)
if(NOT EVO_NATIVE_PERL OR NOT EVO_NASM)
message(FATAL_ERROR "msquic's OpenSSL build needs a native Perl (Strawberry Perl) and NASM on PATH")
endif()
endif()
enable_language(C)
foreach(setting IN ITEMS "QUIC_TLS_LIB=openssl" "QUIC_BUILD_SHARED=ON" "QUIC_BUILD_TEST=OFF"
"QUIC_BUILD_TOOLS=OFF" "QUIC_BUILD_PERF=OFF" "QUIC_ENABLE_LOGGING=OFF" "QUIC_EMBED_GIT_HASH=OFF"
"QUIC_SOURCE_LINK=OFF" "QUIC_USE_EXTERNAL_OPENSSL=OFF" "QUIC_CODE_CHECK=OFF")
string(REPLACE "=" ";" pair "${setting}")
list(GET pair 0 name)
list(GET pair 1 value)
set(${name} "${value}" CACHE STRING "Pinned by AEvolution (ADR-0090)" FORCE)
endforeach()
add_subdirectory("${msquic_source}" "${PROJECT_BINARY_DIR}/msquic" EXCLUDE_FROM_ALL SYSTEM)
# Upstream compiles itself with warnings as errors (and MSVC /analyze). As for Mbed TLS,
# compiler-version-specific diagnostics must not fail unmodified upstream sources
# (MSVC 19.44 /analyze reports C28020 in crypto_tls.c); owned code keeps its policy.
if(MSVC)
target_compile_options(warnings INTERFACE /WX-)
else()
target_compile_options(warnings INTERFACE -Wno-error)
endif()
# Consumer target: the public C API header and the shared library.
add_library(evo_msquic INTERFACE)
target_include_directories(evo_msquic SYSTEM INTERFACE "${msquic_source}/src/inc")
target_link_libraries(evo_msquic INTERFACE msquic)
if(WIN32)
# msquic.h's inline address helpers (QuicAddrFromString) call Rtl* functions in ntdll.
target_link_libraries(evo_msquic INTERFACE ntdll)
endif()
# The shared library must sit next to Windows executables that load it.
function(evo_msquic_runtime target)
if(WIN32)
add_custom_command(TARGET ${target} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$<TARGET_FILE:msquic>" "$<TARGET_FILE_DIR:${target}>"
VERBATIM)
endif()
endfunction()