Run a non-blocking TLS 1.3 session server inside evo-server's loop: environment views come from the region's own field/terrain stores with an explicitly empty organism presentation; admitted intentions ride the next synthetic input (content unchanged) and return a durable no-effect outcome from the host's final acknowledgement, or not_committed when dropped. Sessions are bound to their connection, epochs close stale sessions, and connections have bounded output, input rate and deadlines. SessionClient and evo-client --connect consume one single-use grant per Hello (refusals before admission keep it), reset to a fresh baseline on every session, keep stale views visible and report in-flight intentions as unknown after loss. evo-dev-session generates dev credentials, grant bundles and runs a restart probe. The dev deployment gains a drill-time, loopback-only listener with an optional Secret, enforced by the policy check, and tools/ops/session-drill.sh. Protocol v1 gains IntentOutcome and the capacity close reason before any deployment. ADR-0083 records the maintainer-confirmed decisions; M8-dev/stage remains not passed and no cluster change was made. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
72 lines
4.1 KiB
CMake
72 lines
4.1 KiB
CMake
# 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)
|
|
target_link_libraries(evo_network_protocol PUBLIC evo_client_views evo_client_controls)
|
|
evo_owned_target(evo_network_protocol)
|
|
# Mbed TLS adapters: dev grants (HMAC-SHA256 via PSA) and the TLS 1.3 channel.
|
|
add_library(evo_network_tls STATIC src/network/tls/dev_grant.cpp src/network/tls/channel.cpp
|
|
src/network/tls/dev_credentials.cpp)
|
|
target_link_libraries(evo_network_tls PUBLIC evo_network_protocol PRIVATE mbedtls)
|
|
evo_owned_target(evo_network_tls)
|
|
# 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)
|
|
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-network-tests tests/network_protocol.cpp tests/network_tls.cpp
|
|
tests/network_session.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 mbedtls)
|
|
evo_owned_target(evo-network-tests)
|
|
add_test(NAME network COMMAND evo-network-tests)
|
|
set_tests_properties(network PROPERTIES TIMEOUT 120 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)
|
|
endif()
|