4fae20f56d
Bug 7: MAC2 buffer size
- Changed from fixed 1024-byte buffer to dynamic allocation
- Uses malloc/free for packets up to WG_MAX_PACKET_SIZE
Documentation:
- Added comments about WG_TYPE constants sharing values (intentional)
- Added note about platform-specific RNG for embedded systems
- system_rng() uses POSIX /dev/urandom - replace for u-boot/ESP32
Known limitations:
- chain_key initialization uses simplified version (peer_public_key directly)
Full handshake would use HASH("Noise_IKpsk2_25519...")
- For test phase, simplified version is acceptable
Test results: 29 passed, 3 failed (unchanged)
81 lines
2.0 KiB
CMake
81 lines
2.0 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
|
project(se050_wireguard C)
|
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
|
|
# Include directories
|
|
include_directories(
|
|
${CMAKE_SOURCE_DIR}/include
|
|
)
|
|
|
|
# Source files
|
|
set(SOURCES
|
|
src/se050_i2c_hal.c
|
|
src/se050_session.c
|
|
src/se050_keystore.c
|
|
src/se050_rng.c
|
|
src/se050_x25519.c
|
|
src/se050_x25519_sw.c
|
|
src/se050_chacha20_poly1305.c
|
|
src/se050_blake2s.c
|
|
src/se050_hmac_blake2s.c
|
|
src/se050_hkdf_blake2s.c
|
|
src/se050_tai64n.c
|
|
src/se050_scp03.c
|
|
src/se050_scp03_keys.c
|
|
src/se050_wireguard_proto.c
|
|
src/se050_tai64n_hw.c
|
|
src/se050_wireguard.c
|
|
src/se050_wireguard_se050_rng.c
|
|
src/se050_rng_seed.c
|
|
)
|
|
|
|
# Create library
|
|
add_library(se050_wireguard STATIC ${SOURCES})
|
|
|
|
# Linux-specific flags
|
|
if(UNIX AND NOT APPLE)
|
|
# OpenSSL for SCP03 encryption
|
|
find_package(OpenSSL REQUIRED)
|
|
target_link_libraries(se050_wireguard OpenSSL::SSL OpenSSL::Crypto)
|
|
endif()
|
|
|
|
# Enable testing
|
|
option(BUILD_TESTS "Build test suite" ON)
|
|
if(BUILD_TESTS)
|
|
enable_testing()
|
|
|
|
# SCP03 tests
|
|
add_executable(test_scp03 tests/test_scp03.c)
|
|
target_link_libraries(test_scp03 se050_wireguard)
|
|
|
|
if(UNIX AND NOT APPLE)
|
|
target_link_libraries(test_scp03 OpenSSL::SSL OpenSSL::Crypto)
|
|
endif()
|
|
|
|
add_test(NAME SCP03Tests COMMAND test_scp03)
|
|
|
|
# SCP03 Hardware tests with AN12436 default keys
|
|
add_executable(test_scp03_hardware tests/test_scp03_hardware.c)
|
|
target_link_libraries(test_scp03_hardware se050_wireguard)
|
|
|
|
if(UNIX AND NOT APPLE)
|
|
target_link_libraries(test_scp03_hardware OpenSSL::SSL OpenSSL::Crypto)
|
|
endif()
|
|
|
|
add_test(NAME SCP03HardwareTests COMMAND test_scp03_hardware)
|
|
endif()
|
|
|
|
# Install headers
|
|
install(FILES include/se050_wireguard.h
|
|
DESTINATION include)
|
|
|
|
# Install library
|
|
install(TARGETS se050_wireguard
|
|
ARCHIVE DESTINATION lib)
|
|
|
|
# Note: For embedded platforms (ESP32, u-boot), replace system_rng() with
|
|
# platform-specific RNG (e.g., get_random_bytes() for ESP32)
|
|
# See se050_wireguard.c for details.
|