2020-05-02 21:58:42 +03:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
2022-11-08 09:47:31 +00:00
|
|
|
set -eux
|
2020-05-02 21:58:42 +03:00
|
|
|
|
2020-12-22 16:42:08 +01:00
|
|
|
export LC_ALL=C
|
|
|
|
|
|
2023-07-01 10:47:40 +02:00
|
|
|
# Print commit and relevant CI environment to allow reproducing the job outside of CI.
|
|
|
|
|
git show --no-patch
|
2022-11-02 14:45:13 +00:00
|
|
|
print_environment() {
|
|
|
|
|
# Turn off -x because it messes up the output
|
|
|
|
|
set +x
|
|
|
|
|
# There are many ways to print variable names and their content. This one
|
|
|
|
|
# does not rely on bash.
|
2022-11-08 09:47:31 +00:00
|
|
|
for var in WERROR_CFLAGS MAKEFLAGS BUILD \
|
2021-12-29 15:09:52 -05:00
|
|
|
ECMULTWINDOW ECMULTGENKB ASM WIDEMUL WITH_VALGRIND EXTRAFLAGS \
|
2026-02-13 13:08:00 +02:00
|
|
|
EXPERIMENTAL ECDH RECOVERY EXTRAKEYS SCHNORRSIG MUSIG SCHNORRSIG_HALFAGG ELLSWIFT \
|
2026-03-03 15:00:11 +00:00
|
|
|
ECDSA_S2C GENERATOR RANGEPROOF SURJECTIONPROOF WHITELIST ECDSAADAPTOR BPPP \
|
build: wire prefractal into CI and the README feature list
The prefractal module landed on main in parallel with the branches that
established the current module conventions, so it never picked up the
integration points every other experimental module has. 01379624 covered
the CMake experimental gate and EXTRA_DIST; these two are what remained.
The CI gap is the more consequential of the pair. ci/ci.sh had no
PREFRACTAL plumbing at all, so no CI job has ever passed
--enable-module-prefractal -- the flag was reachable only by configuring
by hand, and the module has been built and tested exclusively outside CI
since it landed.
- ci/ci.sh: PREFRACTAL joins FROST, CHILLDKG and ICEBERG in the
reproduction header's variable list, and configure gains
--enable-module-prefractal="$PREFRACTAL" after the iceberg line.
Unlike 2473c768 there is no bench-step counterpart: prefractal ships
neither a bench binary nor an example program, so the BENCH block
needs nothing.
- .github/workflows/ci.yml: a PREFRACTAL: 'no' default alongside the
other module defaults, then PREFRACTAL: 'yes' in the 21 places that
already enable FROST (11 inline matrix entries and 10 job-level env
blocks). The default is not cosmetic -- ci.sh runs under set -eux, so
an undefined PREFRACTAL would abort every job at the configure step,
including the ones that build no modules at all.
FROST-enabled jobs are the right target because enabling prefractal
implies frost (configure.ac:539, mirrored in src/CMakeLists.txt:90):
adding PREFRACTAL to a job that sets FROST: 'no' would silently turn
frost on and change what that job covers. Every job that already builds
frost also enables musig, schnorrsig, extrakeys and experimental, which
is the remainder of prefractal's dependency chain, so no job needed any
other variable adjusted.
This is a slightly wider set than CHILLDKG and ICEBERG cover. The
x86_64-debian matrix entry at line 117 sets FROST: 'yes' without
CHILLDKG or ICEBERG, and 2473c768 deliberately left it alone; it gets
PREFRACTAL here, on the rule above. The consequence is that no job now
builds frost without prefractal. If that standalone-frost combination is
worth preserving, that one entry is the place to drop it.
README.md gains the doc/prefractal.md link beside the frost, chilldkg
and iceberg entries. This is the exact inverse of the bug 42f827a7
fixed: there the documents were linked from README.md but missing from
EXTRA_DIST, so the tarball's README pointed at files it did not carry.
Here doc/prefractal.md has been in EXTRA_DIST since 01379624 but nothing
referenced it, so it shipped unreferenced. All four module documents
this fork adds are now both linked and distributed.
Verified with ./autogen.sh, ./configure --enable-experimental
--enable-module-prefractal and make -j: all exit 0 with no warnings, and
the configure summary shows the implication chain resolving, with
prefractal = yes pulling in frost = yes and musig = yes. nm confirms
run_prefractal_api_test is linked into ./tests, and the suite passes.
make dist succeeds and the tarball carries doc/prefractal.md next to
doc/iceberg.md, src/modules/frost/frost.md and
src/modules/chilldkg/chilldkg.md. ci/ci.sh passes sh -n.
Verified programmatically for the workflow, as in 2473c768: the YAML
parses, 33 effective job contexts set FROST: 'yes', all 33 of them now
also set PREFRACTAL: 'yes', every one has MUSIG, SCHNORRSIG, EXTRAKEYS
and EXPERIMENTAL set to 'yes', and no context sets PREFRACTAL without
FROST.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-04 03:28:22 +02:00
|
|
|
FROST CHILLDKG ICEBERG PREFRACTAL SECP256K1_TEST_ITERS BENCH SECP256K1_BENCH_ITERS CTIMETESTS SYMBOL_CHECK \
|
2022-11-02 14:45:13 +00:00
|
|
|
EXAMPLES \
|
2022-11-08 09:47:31 +00:00
|
|
|
HOST WRAPPER_CMD \
|
2024-03-19 17:17:13 +01:00
|
|
|
CC CFLAGS CPPFLAGS AR NM \
|
|
|
|
|
UBSAN_OPTIONS ASAN_OPTIONS LSAN_OPTIONS
|
2022-11-02 14:45:13 +00:00
|
|
|
do
|
2022-11-08 09:47:31 +00:00
|
|
|
eval "isset=\${$var+x}"
|
|
|
|
|
if [ -n "$isset" ]; then
|
|
|
|
|
eval "val=\${$var}"
|
|
|
|
|
# shellcheck disable=SC2154
|
|
|
|
|
printf '%s="%s" ' "$var" "$val"
|
|
|
|
|
fi
|
2022-11-02 14:45:13 +00:00
|
|
|
done
|
|
|
|
|
echo "$0"
|
|
|
|
|
set -x
|
|
|
|
|
}
|
|
|
|
|
print_environment
|
|
|
|
|
|
2020-12-22 16:42:08 +01:00
|
|
|
env >> test_env.log
|
|
|
|
|
|
2023-08-16 14:39:58 +01:00
|
|
|
# If gcc is requested, assert that it's in fact gcc (and not some symlinked Apple clang).
|
|
|
|
|
case "${CC:-undefined}" in
|
|
|
|
|
*gcc*)
|
|
|
|
|
$CC -v 2>&1 | grep -q "gcc version" || exit 1;
|
2022-03-16 14:33:37 +01:00
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
|
2022-11-08 09:47:31 +00:00
|
|
|
if [ -n "${CC+x}" ]; then
|
2022-11-02 14:21:04 +00:00
|
|
|
# The MSVC compiler "cl" doesn't understand "-v"
|
|
|
|
|
$CC -v || true
|
|
|
|
|
fi
|
|
|
|
|
if [ "$WITH_VALGRIND" = "yes" ]; then
|
|
|
|
|
valgrind --version
|
|
|
|
|
fi
|
|
|
|
|
if [ -n "$WRAPPER_CMD" ]; then
|
|
|
|
|
$WRAPPER_CMD --version
|
|
|
|
|
fi
|
2020-12-22 16:42:08 +01:00
|
|
|
|
|
|
|
|
./autogen.sh
|
2020-05-02 21:58:42 +03:00
|
|
|
|
|
|
|
|
./configure \
|
2020-09-25 20:06:36 -07:00
|
|
|
--enable-experimental="$EXPERIMENTAL" \
|
2020-10-11 16:04:58 -07:00
|
|
|
--with-test-override-wide-multiply="$WIDEMUL" --with-asm="$ASM" \
|
2021-12-15 14:10:46 +01:00
|
|
|
--with-ecmult-window="$ECMULTWINDOW" \
|
2021-12-29 15:09:52 -05:00
|
|
|
--with-ecmult-gen-kb="$ECMULTGENKB" \
|
2019-01-03 13:45:36 -05:00
|
|
|
--enable-module-ecdh="$ECDH" --enable-module-recovery="$RECOVERY" \
|
2022-11-04 16:21:25 -04:00
|
|
|
--enable-module-ellswift="$ELLSWIFT" \
|
2024-07-22 07:36:22 +00:00
|
|
|
--enable-module-extrakeys="$EXTRAKEYS" \
|
2020-12-05 23:18:54 +00:00
|
|
|
--enable-module-ecdsa-s2c="$ECDSA_S2C" \
|
2023-02-06 13:53:02 -08:00
|
|
|
--enable-module-bppp="$BPPP" \
|
2026-03-03 15:00:11 +00:00
|
|
|
--enable-module-rangeproof="$RANGEPROOF" --enable-module-surjectionproof="$SURJECTIONPROOF" --enable-module-whitelist="$WHITELIST" --enable-module-generator="$GENERATOR" \
|
2026-02-13 11:36:52 +02:00
|
|
|
--enable-module-schnorrsig="$SCHNORRSIG" --enable-module-ecdsa-adaptor="$ECDSAADAPTOR" \
|
2024-01-06 19:31:18 +00:00
|
|
|
--enable-module-musig="$MUSIG" \
|
2023-11-26 16:44:23 +01:00
|
|
|
--enable-module-schnorrsig-halfagg="$SCHNORRSIG_HALFAGG" \
|
2026-08-31 00:05:16 +02:00
|
|
|
--enable-module-frost="$FROST" \
|
chilldkg: CI wiring, ctime_tests coverage, declassify fixes
CI:
- ci/ci.sh: new CHILLDKG environment variable, passed to configure as
--enable-module-chilldkg (mirroring FROST).
- .github/workflows/ci.yml: default CHILLDKG: 'no' and CHILLDKG: 'yes'
in every job that enables FROST, except the x86_64 matrix entry that
deliberately builds without the ecdh module (chilldkg requires
schnorrsig + ecdh; the configure-time dependency error would fire
there). YAML validity and per-job dependency presence checked
programmatically.
ctime_tests:
- src/ctime_tests.c: run a full ChillDKG session (n = 2, t = 2) through
the public API under the memory checker: hostpubkey_gen, params_hash,
participant_step1, coordinator_step1, participant_step2,
coordinator_finalize, participant_finalize, participant_recover and
recovery_ack_sign. Host secret keys, session randomness, aux
randomness and the resulting secret shares are undefined (secret);
all protocol messages, the certificate, threshold public key, public
shares, recovery data, ack signature and the secret-free state1
objects are defined (public). state2 stays secret (contains the
secret share).
Constant-time fixes found by running the new block under
MemorySanitizer (valgrind unavailable locally; MSan build via clang +
CMake). All are missing declassifications of secret-derived but public
(or public-outcome) values, following the frost module's
secp256k1_declassify pattern with justification comments; no real
constant-time bugs were found:
- hostpubkey_gen: declassify the computed host public key before
serialization (public output).
- participant_step1: declassify the zero-randomness check result (only
reveals "the RNG returned 32 zero bytes", which aborts the session).
- encpedpop participant_step1: declassify the pubnonce point before
serialization (public, part of pmsg1).
- chilldkg_schnorrsig_sign: declassify the signer public key before
normalization/parity branch, and declassify the return value (a
failure only reveals a zero derived nonce, negligible probability).
- vss_commit: declassify the VSS commitments before serialization
(public, part of pmsg1).
- vss_verify_secshare: declassify secshare*G before the infinity/eq
checks (equals the public pubshare in honest runs; the discrete log
is not revealed).
- simplpedpop_participant_investigate (proactive audit; not reached by
ctime_tests): declassify the secshare-sum comparison result (the
public fault code reveals it anyway).
Verified: MSan ctime_tests exits 0; autotools make check 10/10 (the
local tree is configured without --enable-ctime-tests because neither
valgrind nor an MSan-instrumented gcc build is available; CI runs
ctime_tests under valgrind as before); CMake ctest 428/428;
./tests --target=chilldkg and ./chilldkg_example pass.
2026-08-31 10:25:14 +02:00
|
|
|
--enable-module-chilldkg="$CHILLDKG" \
|
2026-08-31 12:25:55 +02:00
|
|
|
--enable-module-iceberg="$ICEBERG" \
|
build: wire prefractal into CI and the README feature list
The prefractal module landed on main in parallel with the branches that
established the current module conventions, so it never picked up the
integration points every other experimental module has. 01379624 covered
the CMake experimental gate and EXTRA_DIST; these two are what remained.
The CI gap is the more consequential of the pair. ci/ci.sh had no
PREFRACTAL plumbing at all, so no CI job has ever passed
--enable-module-prefractal -- the flag was reachable only by configuring
by hand, and the module has been built and tested exclusively outside CI
since it landed.
- ci/ci.sh: PREFRACTAL joins FROST, CHILLDKG and ICEBERG in the
reproduction header's variable list, and configure gains
--enable-module-prefractal="$PREFRACTAL" after the iceberg line.
Unlike 2473c768 there is no bench-step counterpart: prefractal ships
neither a bench binary nor an example program, so the BENCH block
needs nothing.
- .github/workflows/ci.yml: a PREFRACTAL: 'no' default alongside the
other module defaults, then PREFRACTAL: 'yes' in the 21 places that
already enable FROST (11 inline matrix entries and 10 job-level env
blocks). The default is not cosmetic -- ci.sh runs under set -eux, so
an undefined PREFRACTAL would abort every job at the configure step,
including the ones that build no modules at all.
FROST-enabled jobs are the right target because enabling prefractal
implies frost (configure.ac:539, mirrored in src/CMakeLists.txt:90):
adding PREFRACTAL to a job that sets FROST: 'no' would silently turn
frost on and change what that job covers. Every job that already builds
frost also enables musig, schnorrsig, extrakeys and experimental, which
is the remainder of prefractal's dependency chain, so no job needed any
other variable adjusted.
This is a slightly wider set than CHILLDKG and ICEBERG cover. The
x86_64-debian matrix entry at line 117 sets FROST: 'yes' without
CHILLDKG or ICEBERG, and 2473c768 deliberately left it alone; it gets
PREFRACTAL here, on the rule above. The consequence is that no job now
builds frost without prefractal. If that standalone-frost combination is
worth preserving, that one entry is the place to drop it.
README.md gains the doc/prefractal.md link beside the frost, chilldkg
and iceberg entries. This is the exact inverse of the bug 42f827a7
fixed: there the documents were linked from README.md but missing from
EXTRA_DIST, so the tarball's README pointed at files it did not carry.
Here doc/prefractal.md has been in EXTRA_DIST since 01379624 but nothing
referenced it, so it shipped unreferenced. All four module documents
this fork adds are now both linked and distributed.
Verified with ./autogen.sh, ./configure --enable-experimental
--enable-module-prefractal and make -j: all exit 0 with no warnings, and
the configure summary shows the implication chain resolving, with
prefractal = yes pulling in frost = yes and musig = yes. nm confirms
run_prefractal_api_test is linked into ./tests, and the suite passes.
make dist succeeds and the tarball carries doc/prefractal.md next to
doc/iceberg.md, src/modules/frost/frost.md and
src/modules/chilldkg/chilldkg.md. ci/ci.sh passes sh -n.
Verified programmatically for the workflow, as in 2473c768: the YAML
parses, 33 effective job contexts set FROST: 'yes', all 33 of them now
also set PREFRACTAL: 'yes', every one has MUSIG, SCHNORRSIG, EXTRAKEYS
and EXPERIMENTAL set to 'yes', and no context sets PREFRACTAL without
FROST.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-04 03:28:22 +02:00
|
|
|
--enable-module-prefractal="$PREFRACTAL" \
|
2020-04-30 14:34:24 +03:00
|
|
|
--enable-examples="$EXAMPLES" \
|
2022-12-20 12:28:48 -05:00
|
|
|
--enable-ctime-tests="$CTIMETESTS" \
|
2020-09-21 07:47:40 +00:00
|
|
|
--with-valgrind="$WITH_VALGRIND" \
|
2020-07-29 08:50:42 +02:00
|
|
|
--host="$HOST" $EXTRAFLAGS
|
2020-05-02 21:58:42 +03:00
|
|
|
|
2021-03-03 01:21:18 +01:00
|
|
|
# We have set "-j<n>" in MAKEFLAGS.
|
2023-11-07 12:05:57 +00:00
|
|
|
build_exit_code=0
|
|
|
|
|
make > make.log 2>&1 || build_exit_code=$?
|
|
|
|
|
cat make.log
|
|
|
|
|
if [ $build_exit_code -ne 0 ]; then
|
|
|
|
|
case "${CC:-undefined}" in
|
|
|
|
|
*snapshot*)
|
|
|
|
|
# Ignore internal compiler errors in gcc-snapshot and clang-snapshot
|
|
|
|
|
grep -e "internal compiler error:" -e "PLEASE submit a bug report" make.log
|
2025-03-13 11:56:07 +01:00
|
|
|
exit $?
|
2023-11-07 12:05:57 +00:00
|
|
|
;;
|
|
|
|
|
*)
|
2025-03-13 11:56:07 +01:00
|
|
|
exit 1
|
2023-11-07 12:05:57 +00:00
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
fi
|
2021-02-26 17:36:34 +01:00
|
|
|
|
|
|
|
|
# Print information about binaries so that we can see that the architecture is correct
|
2021-04-17 10:57:16 -07:00
|
|
|
file *tests* || true
|
2021-10-17 12:08:06 -04:00
|
|
|
file bench* || true
|
2021-02-26 17:36:34 +01:00
|
|
|
file .libs/* || true
|
|
|
|
|
|
2025-03-10 11:22:38 +00:00
|
|
|
if [ "$SYMBOL_CHECK" = "yes" ]
|
|
|
|
|
then
|
|
|
|
|
python3 --version
|
|
|
|
|
case "$HOST" in
|
|
|
|
|
*mingw*)
|
|
|
|
|
ls -l .libs
|
2025-07-21 16:35:16 +02:00
|
|
|
python3 ./tools/symbol-check.py .libs/libsecp256k1-*.dll
|
2025-03-10 11:22:38 +00:00
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
python3 ./tools/symbol-check.py .libs/libsecp256k1.so
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
fi
|
|
|
|
|
|
2021-05-17 17:19:01 +02:00
|
|
|
# This tells `make check` to wrap test invocations.
|
|
|
|
|
export LOG_COMPILER="$WRAPPER_CMD"
|
2020-12-22 16:42:08 +01:00
|
|
|
|
2021-05-17 17:19:01 +02:00
|
|
|
make "$BUILD"
|
2020-12-22 16:42:08 +01:00
|
|
|
|
2022-12-06 18:53:51 -05:00
|
|
|
# Using the local `libtool` because on macOS the system's libtool has nothing to do with GNU libtool
|
|
|
|
|
EXEC='./libtool --mode=execute'
|
|
|
|
|
if [ -n "$WRAPPER_CMD" ]
|
|
|
|
|
then
|
|
|
|
|
EXEC="$EXEC $WRAPPER_CMD"
|
|
|
|
|
fi
|
|
|
|
|
|
2020-07-30 11:18:07 +03:00
|
|
|
if [ "$BENCH" = "yes" ]
|
2020-05-02 21:58:42 +03:00
|
|
|
then
|
|
|
|
|
{
|
|
|
|
|
$EXEC ./bench_ecmult
|
|
|
|
|
$EXEC ./bench_internal
|
2021-10-17 12:08:06 -04:00
|
|
|
$EXEC ./bench
|
2023-02-06 13:53:02 -08:00
|
|
|
if [ "$BPPP" = "yes" ]
|
2023-01-20 13:41:01 +00:00
|
|
|
then
|
2023-02-06 13:53:02 -08:00
|
|
|
$EXEC ./bench_bppp
|
2023-01-20 13:41:01 +00:00
|
|
|
fi
|
2026-08-31 12:25:55 +02:00
|
|
|
if [ "$ICEBERG" = "yes" ]
|
|
|
|
|
then
|
|
|
|
|
$EXEC ./bench_iceberg
|
|
|
|
|
fi
|
2020-05-02 21:58:42 +03:00
|
|
|
} >> bench.log 2>&1
|
|
|
|
|
fi
|
2021-11-13 15:52:44 +01:00
|
|
|
|
2022-12-20 12:28:48 -05:00
|
|
|
if [ "$CTIMETESTS" = "yes" ]
|
2020-05-02 21:58:42 +03:00
|
|
|
then
|
2022-12-06 18:53:51 -05:00
|
|
|
if [ "$WITH_VALGRIND" = "yes" ]; then
|
|
|
|
|
./libtool --mode=execute valgrind --error-exitcode=42 ./ctime_tests > ctime_tests.log 2>&1
|
|
|
|
|
else
|
|
|
|
|
$EXEC ./ctime_tests > ctime_tests.log 2>&1
|
|
|
|
|
fi
|
2020-05-02 21:58:42 +03:00
|
|
|
fi
|
2021-11-13 15:52:44 +01:00
|
|
|
|
|
|
|
|
# Rebuild precomputed files (if not cross-compiling).
|
|
|
|
|
if [ -z "$HOST" ]
|
|
|
|
|
then
|
2023-03-21 22:10:59 -07:00
|
|
|
make clean-precomp clean-testvectors
|
|
|
|
|
make precomp testvectors
|
2021-11-13 15:52:44 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Check that no repo files have been modified by the build.
|
|
|
|
|
# (This fails for example if the precomp files need to be updated in the repo.)
|
|
|
|
|
git diff --exit-code
|