Files
ssw 60b6fa6f7b vault: 设备绑定密钥 + 密封存储(宿主 16 用例 / QEMU VAULT_ALL_OK / 签名验收通过)
- src/vault-core: no_std 密码学核心(HKDF 派生、AES-256-GCM、两条水位线防回滚)
- src/ta-vault / src/ca-vault: TA 薄壳与 selftest 客户端
- build/p1_vault_qemu.sh: QEMU 全链,判据 VAULT_ALL_OK
- build/p2_ta_keys_qemu.sh: TA 公钥编进 tee.bin,默认密钥签的被拒
- build/gen_ta_keys.sh: 自建签名密钥
- docs/07-VAULT-TA.md: 设计 + 已验证/未验证清单
- CLAUDE.md 雷区 11-16:user_ta_header、嵌套 workspace、ARCH=arm、SIGPIPE、TA_PUBLIC_KEY、heredoc 变量
2026-10-28 14:37:04 +08:00

65 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
# 沙箱内第一段:装依赖 + 并行拉源码 + 装 Rust 工具链
set -x
export DEBIAN_FRONTEND=noninteractive
export RUSTUP_HOME=/opt/rustup
export CARGO_HOME=/opt/cargo
export PATH=/opt/cargo/bin:$PATH
apt-get update -qq
apt-get install -y -qq --no-install-recommends \
bc cpio device-tree-compiler xxd rsync \
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross \
qemu-system-arm qemu-system-data qemu-utils u-boot-tools \
python3-cryptography python3-pyelftools \
libssl-dev uuid-dev libgnutls28-dev swig python3-dev libncurses-dev \
kmod expect gawk net-tools
echo "APT_RC=$?"
cd /root || exit 1
clone() {
local url=$1 dir=$2 ref=$3
for i in 1 2 3; do
git -c http.version=HTTP/1.1 clone -q --depth 1 ${ref:+--branch $ref} "$url" "$dir" && { echo "OK $dir"; return 0; }
git -c http.version=HTTP/1.1 clone -q --depth 1 ${ref:+--branch $ref} "https://ghfast.top/$url" "$dir" && { echo "OK(mirror) $dir"; return 0; }
rm -rf "$dir"; sleep 3
done
echo "CLONE_FAIL $dir"
}
clone https://github.com/OP-TEE/optee_os.git optee_os 4.11.0 &
clone https://github.com/OP-TEE/optee_client.git optee_client 4.11.0 &
clone https://github.com/apache/incubator-teaclave-trustzone-sdk.git teaclave-sdk "" &
clone https://github.com/u-boot/u-boot.git u-boot v2024.10 &
clone https://github.com/ARM-software/arm-trusted-firmware.git trusted-firmware-a v2.11.0 &
(
for u in https://mirrors.tuna.tsinghua.edu.cn/kernel/v6.x/linux-6.6.60.tar.xz \
https://mirrors.ustc.edu.cn/kernel/v6.x/linux-6.6.60.tar.xz \
https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.6.60.tar.xz ; do
echo "try $u"
curl -sSL --max-time 900 -o linux.tar.xz "$u" && break
done
tar xf linux.tar.xz && mv linux-6.6.60 linux && rm -f linux.tar.xz && echo "OK linux"
) &
# Rust:官方站从沙箱不可达,走 USTC 镜像
(
mkdir -p /opt/rustup
curl -sSL --max-time 300 -o /tmp/rustup-init \
https://mirrors.ustc.edu.cn/rust-static/rustup/dist/x86_64-unknown-linux-gnu/rustup-init
chmod +x /tmp/rustup-init
/tmp/rustup-init -y --no-modify-path --default-toolchain none
export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup
rustup toolchain install nightly-2026-08-05 --profile minimal -c rust-src \
-t arm-unknown-linux-gnueabihf -t aarch64-unknown-linux-gnu
echo "OK rust $(/opt/cargo/bin/rustc --version)"
) &
wait
echo "=== 源码盘点 ==="
ls -d optee_os optee_client teaclave-sdk u-boot trusted-firmware-a linux 2>/dev/null
echo "=== STAGE1_DONE ==="