# M9.6 dev session protocol and TLS adapter (ADR-0082). Opt-in; never part of the # headless simulation. Mbed TLS comes only from the explicitly prepared, pinned source. include("${PROJECT_SOURCE_DIR}/tools/mbedtls-pin.cmake") set(mbedtls_source "${PROJECT_SOURCE_DIR}/build/external/mbedtls/mbedtls-${EVO_MBEDTLS_VERSION}") if(NOT EXISTS "${mbedtls_source}/evo-verified.sha256") message(FATAL_ERROR "Prepare Mbed TLS explicitly: cmake -P tools/prepare-mbedtls.cmake") endif() file(STRINGS "${mbedtls_source}/evo-verified.sha256" verified) if(NOT verified STREQUAL EVO_MBEDTLS_SHA256) message(FATAL_ERROR "Prepared Mbed TLS does not match the reviewed source pin") endif() enable_language(C) set(ENABLE_PROGRAMS OFF CACHE BOOL "" FORCE) set(ENABLE_TESTING OFF CACHE BOOL "" FORCE) set(GEN_FILES OFF CACHE BOOL "" FORCE) set(USE_STATIC_MBEDTLS_LIBRARY ON CACHE BOOL "" FORCE) set(USE_SHARED_MBEDTLS_LIBRARY OFF CACHE BOOL "" FORCE) set(USE_STATIC_TF_PSA_CRYPTO_LIBRARY ON CACHE BOOL "" FORCE) set(USE_SHARED_TF_PSA_CRYPTO_LIBRARY OFF CACHE BOOL "" FORCE) set(DISABLE_PACKAGE_CONFIG_AND_INSTALL ON CACHE BOOL "" FORCE) # Warnings-as-errors is policy for owned code. Upstream's own -Werror turns # compiler-version-specific diagnostics (GCC 13 -O3 maybe-uninitialized in # ssl_tls.c) into build failures of unmodified upstream sources. set(MBEDTLS_FATAL_WARNINGS OFF CACHE BOOL "" FORCE) set(TF_PSA_CRYPTO_FATAL_WARNINGS OFF CACHE BOOL "" FORCE) set(MBEDTLS_USER_CONFIG_FILE "${PROJECT_SOURCE_DIR}/third_party/mbedtls/evo_mbedtls_config.h" CACHE FILEPATH "Owned TLS 1.3-only restriction (ADR-0082)" FORCE) # Upstream code is not compiled with project warning policy or our sanitizer # instrumentation guarantees; only owned targets use evo_owned_target. add_subdirectory("${mbedtls_source}" "${PROJECT_BINARY_DIR}/mbedtls" EXCLUDE_FROM_ALL SYSTEM) # Dependency-free protocol: framing, envelopes, admission. No Mbed TLS types. add_library(evo_network_protocol STATIC src/network/protocol/codec.cpp src/network/protocol/admission.cpp src/network/protocol/session_control.cpp src/network/protocol/session_protocol.cpp src/network/protocol/intent_admission.cpp src/network/protocol/replication.cpp src/network/protocol/probe_motion.cpp) target_link_libraries(evo_network_protocol PUBLIC evo_client_views evo_client_controls) evo_owned_target(evo_network_protocol) # M10.6 client prediction and reconciliation of the probe marker (ADR-0094). add_library(evo_client_prediction STATIC src/client/prediction/motion_prediction.cpp src/client/prediction/interpolation.cpp) target_link_libraries(evo_client_prediction PUBLIC evo_network_protocol) evo_owned_target(evo_client_prediction) # Mbed TLS adapters: dev grants (HMAC-SHA256 via PSA) and the TLS 1.3 channel. # M10.3 session grants (ECDSA P-256 via PSA) share the adapter (ADR-0091). add_library(evo_network_tls STATIC src/network/tls/dev_grant.cpp src/network/tls/channel.cpp src/network/tls/dev_credentials.cpp src/network/tls/session_grant.cpp src/network/tls/handoff_ticket.cpp) target_link_libraries(evo_network_tls PUBLIC evo_network_protocol PRIVATE mbedtls) evo_owned_target(evo_network_tls) # M10.3 backend identity adapter: providers, account directory, grant issuer (library only). add_library(evo_identity STATIC src/identity/identity.cpp) target_link_libraries(evo_identity PUBLIC evo_network_tls) evo_owned_target(evo_identity) # M9.7 sessions: non-blocking TCP, the host-agnostic session server and the client. add_library(evo_network_session STATIC src/network/socket/tcp.cpp src/network/session/server.cpp src/network/session/client.cpp src/network/session/grant_ledger.cpp) target_link_libraries(evo_network_session PUBLIC evo_network_tls) if(WIN32) target_link_libraries(evo_network_session PRIVATE ws2_32) endif() evo_owned_target(evo_network_session) # Dev credential and grant tool (ADR-0083); generates throwaway-scale dev secrets only. add_executable(evo-dev-session apps/evo-dev-session/main.cpp) target_link_libraries(evo-dev-session PRIVATE evo_network_session) evo_owned_target(evo-dev-session) if(BUILD_TESTING) add_executable(evo-cellular-intent-protocol-tests tests/cellular_intent_protocol_tests.cpp) target_link_libraries(evo-cellular-intent-protocol-tests PRIVATE evo_network_protocol) evo_owned_target(evo-cellular-intent-protocol-tests) add_test(NAME cellular-session-protocol-v6-v7 COMMAND evo-cellular-intent-protocol-tests) set_tests_properties(cellular-session-protocol-v6-v7 PROPERTIES TIMEOUT 30 LABELS "network") add_executable(evo-cellular-intent-admission-tests tests/cellular_intent_admission_tests.cpp) target_link_libraries(evo-cellular-intent-admission-tests PRIVATE evo_network_protocol) evo_owned_target(evo-cellular-intent-admission-tests) add_test(NAME cellular-intent-admission COMMAND evo-cellular-intent-admission-tests) set_tests_properties(cellular-intent-admission PROPERTIES TIMEOUT 30 LABELS "network") add_executable(evo-network-tests tests/network_protocol.cpp tests/network_tls.cpp tests/network_session.cpp tests/network_control.cpp tests/network_replication.cpp tests/network_motion.cpp tests/network_interpolation.cpp tests/network_main.cpp) # The TLS tests generate throwaway dev certificates with Mbed TLS directly. target_link_libraries(evo-network-tests PRIVATE evo_network_session evo_identity evo_client_prediction mbedtls) evo_owned_target(evo-network-tests) add_test(NAME network COMMAND evo-network-tests) set_tests_properties(network PROPERTIES TIMEOUT 120 LABELS "network") # M10.9c (ADR-0097): the session protocol fuzz target, run as a seeded smoke test. add_executable(evo-session-fuzz-smoke tests/fuzz/session_fuzz.cpp tests/fuzz/session_fuzz_smoke.cpp) target_link_libraries(evo-session-fuzz-smoke PRIVATE evo_network_tls) evo_owned_target(evo-session-fuzz-smoke) add_test(NAME session-fuzz-smoke COMMAND evo-session-fuzz-smoke) set_tests_properties(session-fuzz-smoke PROPERTIES TIMEOUT 300 LABELS "network") endif() if(EVO_BUILD_FUZZER) # Coverage-guided codec fuzzing (Linux Clang; see the EVO_BUILD_FUZZER guard). add_executable(evo-dev-session-fuzz tests/fuzz/dev_session_fuzz.cpp src/network/protocol/codec.cpp) target_link_libraries(evo-dev-session-fuzz PRIVATE evo_client_views evo_client_controls) evo_owned_target(evo-dev-session-fuzz) target_compile_options(evo-dev-session-fuzz PRIVATE -fsanitize=fuzzer,address,undefined -fno-omit-frame-pointer) target_link_options(evo-dev-session-fuzz PRIVATE -fsanitize=fuzzer,address,undefined) # M10.9c: session protocol v4, grants, tickets and snapshot assembly (ADR-0097). # The code under test is compiled into the target so coverage instruments it. add_executable(evo-session-fuzz tests/fuzz/session_fuzz.cpp src/network/protocol/session_protocol.cpp src/network/protocol/replication.cpp src/network/protocol/probe_motion.cpp src/network/protocol/session_control.cpp src/network/tls/session_grant.cpp src/network/tls/handoff_ticket.cpp) target_link_libraries(evo-session-fuzz PRIVATE evo_client_views evo_client_controls mbedtls) evo_owned_target(evo-session-fuzz) target_compile_options(evo-session-fuzz PRIVATE -fsanitize=fuzzer,address,undefined -fno-omit-frame-pointer) target_link_options(evo-session-fuzz PRIVATE -fsanitize=fuzzer,address,undefined) endif()