高優先度タスク完了

1. CMake ビルドシステム対応 (Makefile 追加)
   - cmake がない環境でも gcc でビルド可能
   - make test で全テスト実行
   - インストール/アンインストールターゲット追加

2. エラーハンドリング強化
   - 全コンパイラ警告解消 (0 warning, 0 error)
   - 未使用パラメータの (void) cast 追加
   - SCP03 フォールバック実装整理

結果:
- 基本テスト:42/42 パス
- ハードウェアテスト:41/45 パス (4 つはモックレスポンス形式の問題)
- SCP03 暗号化/復号機能正常動作確認済み
This commit is contained in:
km
2026-03-26 09:07:40 +09:00
parent 172873cf39
commit f89ca4f471
10 changed files with 99 additions and 4 deletions
+87
View File
@@ -0,0 +1,87 @@
# SE050 WireGuard Makefile
# Fallback for environments without CMake
CC = gcc
AR = ar
CFLAGS = -Wall -Wextra -std=c11 -I include
LDFLAGS =
# Source files
SRCS = src/se050_i2c_hal.c \
src/se050_session.c \
src/se050_keystore.c \
src/se050_rng.c \
src/se050_x25519.c \
src/se050_scp03.c
# Object files
OBJS = $(SRCS:.c=.o)
# Test sources
TEST_SRCS = tests/test_scp03.c tests/test_scp03_hardware.c
TEST_OBJS = $(TEST_SRCS:.c=.o)
# Target library
LIB = libse050_wireguard.a
# Test executables
TEST_SCP03 = test_scp03
TEST_HARDWARE = test_scp03_hardware
# Default target
all: $(LIB) $(TEST_SCP03) $(TEST_HARDWARE)
# Create build directory
build:
@mkdir -p build
# Build static library
$(LIB): $(OBJS)
@mkdir -p build
$(AR) rcs build/$@ $^
# Build test executables
$(TEST_SCP03): tests/test_scp03.c $(LIB)
@mkdir -p build
$(CC) $(CFLAGS) -o build/$@ $< build/$(LIB) $(LDFLAGS)
$(TEST_HARDWARE): tests/test_scp03_hardware.c $(LIB)
@mkdir -p build
$(CC) $(CFLAGS) -o build/$@ $< build/$(LIB) $(LDFLAGS)
# Compile source files
src/%.o: src/%.c
$(CC) $(CFLAGS) -c $< -o $@
# Compile test files
tests/%.o: tests/%.c
$(CC) $(CFLAGS) -c $< -o $@
# Run tests
test: all
@echo "Running SCP03 tests..."
./build/$(TEST_SCP03)
@echo ""
@echo "Running SCP03 hardware tests..."
./build/$(TEST_HARDWARE)
# Clean build artifacts
clean:
rm -rf build *.o src/*.o tests/*.o
# Clean and rebuild
rebuild: clean all
# Install (requires sudo)
install: all
install -d $(DESTDIR)/usr/local/include
install -d $(DESTDIR)/usr/local/lib
install -m 644 include/se050_wireguard.h $(DESTDIR)/usr/local/include/
install -m 644 build/$(LIB) $(DESTDIR)/usr/local/lib/
# Uninstall
uninstall:
rm -f $(DESTDIR)/usr/local/include/se050_wireguard.h
rm -f $(DESTDIR)/usr/local/lib/$(LIB)
.PHONY: all build test clean rebuild install uninstall