Files
ssw-mpc/tools/ci.sh
T
rong a00b32f2f5 feat(secure): 链路 AEAD 加密 + 熵源统一 + TEE seal 换成标准 ChaCha20-Poly1305
影响:跨机部署不再假设链路可被窃听(此前只有握手认证,分片与掩码差值明文传输);
TEE 密封格式从 v1 换到 v2,旧 blob 解不开但会明确失败而不是误解。

- nax-core 新增 aead / osrand:ChaCha20-Poly1305(复用 prg 的 core,RFC 8439 标准向量 + OpenSSL 交叉验证),OS 熵源拒绝时间戳降级
- nax-node 握手派生 c2s/s2c 双向会话密钥,帧走 AEAD;计数器严格对齐,重放与错向密钥均拒绝
- nax-tee 两处手拼 encrypt-then-MAC(optee/core、mock)收敛到 nax-core::aead:开销 44B→28B、版本进 AAD、删除已无用的 K_mac;重复的 HMAC/ct_eq 合并为 nax-core 单一实现
- nax-he 补 keygen_os(库函数不再 panic),确定性 keygen 保留给 golden 测试
- tools/ci.sh + .gitea/workflows/ci.yml:测试 / -Dwarnings / nax-core no_std 三条闸门
- bench_core:matmul、逐元素、AEAD、分片重建的可复现基准

设计取舍:帧加密自己实现而不引 crate —— nax-core 的依赖树必须为空才能编进 OP-TEE TA;
ChaCha20 复用 prg 里已有的 core,避免两套实现分叉。
2026-11-01 11:20:28 +08:00

46 lines
1.5 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
#
# 回归闸门:CI 与本地跑的是**同一份**,避免「CI 挂了、本地不知道怎么复现」。
#
# 守的三条就是 CLAUDE.md 里的铁律,不多不少:
# 1. 全量测试必须带 --features secure(不带会漏掉 36 条,其中曾有坏的)
# 2. 零 rustc 告警(-Dwarnings,warning 直接变 error)
# 3. nax-core 必须能 no_std 编译(TEE / armv7 那条路)
#
# 用法:tools/ci.sh 正常跑
# tools/ci.sh --fast 跳过测试,只编译(改完想快速确认能编过时用)
#
set -euo pipefail
cd "$(dirname "$0")/.."
FAST=0
for a in "$@"; do
case "$a" in
--fast) FAST=1 ;;
-h|--help) sed -n '2,12p' "$0"; exit 0 ;;
*) echo "不认识的参数: $a" >&2; exit 2 ;;
esac
done
step() { printf '\n\033[1m== %s ==\033[0m\n' "$1"; }
ok() { printf '\033[32m ok\033[0m\n'; }
if [ "$FAST" -eq 0 ]; then
step "1/3 全量测试(含 secure 特性)"
cargo test --workspace --features secure
ok
fi
step "2/3 零告警构建(所有目标)"
# -Dwarnings 同时作用于本地 crate 的 test / bench / example 目标,
# 所以「测试代码里有 unused」也会被拦下 —— 这正是想要的。
RUSTFLAGS="${RUSTFLAGS:+${RUSTFLAGS} }-Dwarnings" \
cargo build --workspace --all-targets --features secure
ok
step "3/3 nax-core no_std 守线"
cargo build -p nax-core --no-default-features
ok
printf '\n\033[32m\033[1m全部通过\033[0m\n'