Feature: Add on-demand TLS transport with hot-switch to the Android client
Reuse the Linux OpenSSL TlsChannel implementation (platform guard widened to __linux__); the trust anchor lives in the app-private filesDir, injected via TlsSetAnchorDir in nativeInit before the connection thread starts. COMMAND_TLS_ENABLE/DISABLE save/remove the anchor, hot-reload and reconnect only when the transport actually changes, so the master menu takes effect within seconds without restarting the app. Login reports RES_TLS, refreshed before each re-login. The reconnect flag is consumed before the drop check and cleared before reconnecting so a switch racing a disconnect cannot cause an extra reconnect/login cycle. Cross-compile OpenSSL 3.5.0 per ABI with build_openssl_android.sh (NDK clang + MSYS2 perl/make), integrated into build_android_libs.ps1 (-OpenSslOnly). Static libs and per-ABI headers are tracked like the existing libzstd/libsign prebuilts; --exclude-libs keeps OpenSSL symbols private to libyama.so, isolated from the Java-layer Conscrypt. Co-Authored-By: Qoder <noreply@qoder.com>
This commit is contained in:
1 parent
36618b0ad0
commit
51747dc0ea
586 files changed
+183905
-35
No files matched your search
@@ -23,6 +23,7 @@ add_compile_options(-include "${CMAKE_CURRENT_SOURCE_DIR}/android_compat.h")
|
||||
set(CORE_SOURCES
|
||||
${YAMA_ROOT}/client/Buffer.cpp
|
||||
${YAMA_ROOT}/client/IOCPClient.cpp
|
||||
${YAMA_ROOT}/client/TlsChannelLinux.cpp # 单向 TLS(OpenSSL),Linux/Android 共用
|
||||
${YAMA_ROOT}/client/sign_shim_unix.cpp
|
||||
${YAMA_ROOT}/common/logger.cpp
|
||||
${YAMA_ROOT}/common/ikcp.c
|
||||
@@ -44,8 +45,22 @@ target_link_libraries(yama PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/lib/${ANDROID_ABI}/libzstd.a"
|
||||
)
|
||||
|
||||
# ---- OpenSSL(单向 TLS,client/TlsChannelLinux.cpp)----
|
||||
# 静态库与头文件由 build_android_libs.ps1 按 ABI 产出。opensslconf.h 各架构不同,故头文件
|
||||
# 也按 ABI 存放(lib/<ABI>/include)。libssl 依赖 libcrypto,链接顺序 ssl 在前。
|
||||
target_include_directories(yama PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/lib/${ANDROID_ABI}/include"
|
||||
)
|
||||
target_link_libraries(yama PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/lib/${ANDROID_ABI}/libssl.a"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/lib/${ANDROID_ABI}/libcrypto.a"
|
||||
)
|
||||
# 不把静态库(OpenSSL/sign/zstd)的符号导出到 libyama.so 之外,与 Java 层 Conscrypt 隔离;
|
||||
# JNI 入口来自目标文件(非归档),不受影响,仍正常导出。
|
||||
target_link_options(yama PRIVATE "-Wl,--exclude-libs,ALL")
|
||||
|
||||
# ---- Android 系统库 ----
|
||||
target_link_libraries(yama PRIVATE android log)
|
||||
target_link_libraries(yama PRIVATE android log dl)
|
||||
|
||||
# ---- 编译选项 ----
|
||||
target_compile_options(yama PRIVATE
|
||||
|
||||
Reference in new issue
Block a user