release: restore ZUPT and harden source-only 5.2.2

This commit is contained in:
Cristian Cezar Moisés 2026-08-31 14:14:36 -03:00
commit ff99770bd0
205 changed files with 19627 additions and 13215 deletions

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright (c) 2025-2026 Cristian Cezar Moisés
#
# dudect-style constant-time verification of zupt_ct_memeq (v3.5.0).
# dudect-style timing regression measurement for zupt_ct_memeq (v3.5.0).
# Builds at -O2 (the shipped optimisation level — so this tests the code
# as users run it, including that the volatile accumulator survives the
# optimiser) and runs the Welch t-test harness.
@ -15,7 +15,6 @@
# passing vacuously.
set -u
SDK_DIR="${ZUPTSDK_DIR:-vendor/zuptsdk}"
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "i686" ]; then
SHANI="-msha -mssse3 -msse4.1"
@ -24,19 +23,14 @@ else
fi
TMP=$(mktemp -d)
# This test uses only native CT primitives (zupt_ct_memeq, ML-KEM CT compare);
# the libzuptsdk linkage is vestigial. Link it only when the vendored library
# is present (WITH_SDK builds); source-only builds compile+run without it.
SDK_LINK=""
if ls "$SDK_DIR"/libzuptsdk.so* >/dev/null 2>&1; then
SDK_LINK="-L$SDK_DIR -lzuptsdk -Wl,-rpath,$(cd "$SDK_DIR" && pwd)"
fi
if gcc -Iinclude -Isrc -I"$SDK_DIR/include" -Wall -Wextra -Werror $SHANI -O2 -std=c11 \
# This test uses only native CT primitives; it deliberately has no optional
# SDK linkage so the baseline source build is the exact path under test.
if "${CC:-cc}" -Iinclude -Isrc -Wall -Wextra -Werror $SHANI -O2 -std=c11 \
tests/test_ct_timing.c \
src/zupt_crypto.c src/zupt_sha256.c src/zupt_sha256_shani.c src/zupt_aes256.c \
src/zupt_xxh.c src/zupt_keccak.c src/zupt_x25519.c src/zupt_mlkem.c \
src/zupt_cpuid.c src/zupt_mlock.c \
$SDK_LINK -lm \
-lm \
-o "$TMP/t" 2>"$TMP/cc.log"; then
"$TMP/t"; rc=$?
else
@ -48,8 +42,8 @@ rm -rf "$TMP"
# Source-routing guard: the security-critical compares must use the single
# audited zupt_ct_memeq primitive, not a reintroduced inline byte-OR loop.
# This is what makes the 32-byte timing proof transfer to the ML-KEM
# 1088-byte decaps compare (same function, length-independent).
# This confirms that the measured primitive is also used by the ML-KEM
# 1088-byte decapsulation comparison; it is not a formal timing proof.
echo ""
echo " -- source routing (audited primitive) --"
ROUTE_OK=0