feat: port GIP protocol and auth stack

Port the GIP protocol and authentication layers from medusalix/xone
into the C++ stack:

- crypto: SHA-256/HMAC (CommonCrypto), RSA PKCS#1 (Security.framework),
  and a self-contained P-256 ECDH validated against OpenSSL vectors
- auth: v1 (RSA) and v2 (ECDH) handshake state machine
- gip: header/varint/chunk handling and packet dispatch, with the kernel
  device model replaced by transport + client_listener interfaces

Adds test_crypto, test_auth, and test_gip suites.

Co-Authored-By: deepseek (deepseek/deepseek-v4-pro-0813): ported crypto, auth, and GIP
This commit is contained in:
portersky
2026-08-17 15:04:44 +02:00
parent 95e958a7e8
commit 2d4366f454
13 changed files with 3217 additions and 14 deletions
+5 -1
View File
@@ -6,7 +6,7 @@ if(NOT CMAKE_GENERATOR MATCHES "^(Ninja|Xcode)$")
endif()
cmake_minimum_required(VERSION 3.21)
project(xone_macos VERSION 0.1.0 LANGUAGES CXX Swift)
project(xone_macos VERSION 0.1.1 LANGUAGES CXX Swift)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
@@ -35,11 +35,15 @@ target_compile_definitions(xone_usb PRIVATE ${BASE_DEFINITIONS})
# Auth + crypto (AES-CCMP key setup, ECDH, RSA — port from auth/)
add_library(xone_auth STATIC
"src/auth/crypto.cpp"
"src/auth/auth.cpp"
)
target_include_directories(xone_auth PUBLIC "${CMAKE_SOURCE_DIR}/include")
target_compile_features(xone_auth PRIVATE cxx_std_23)
target_compile_options(xone_auth PRIVATE ${BASE_OPTIONS})
target_compile_definitions(xone_auth PRIVATE ${BASE_DEFINITIONS})
find_library(XONE_SECURITY Security)
find_library(XONE_COREFOUNDATION CoreFoundation)
target_link_libraries(xone_auth PUBLIC "${XONE_SECURITY}" "${XONE_COREFOUNDATION}")
# MT76 chip protocol (firmware load, EFUSE, radio init, beacons)
add_library(xone_mt76 STATIC