Skip to content

Upstream PRs 1160, 1193, 1169, 1190, 1192, 1194, 1196, 1195, 1170, 1172, 1200, 1199, 1203, 1201, 1206, 1078, 1209, 979, 1212, 1218, 1217, 1221, 1222 #249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 71 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
ac71020
group: Save a normalize_to_zero in gej_add_ge
real-or-random Feb 4, 2022
e089eec
group: Further simply gej_add_ge
real-or-random Feb 4, 2022
e862c4a
Makefile: add -I$(top_srcdir)/src to CPPFLAGS for precomputed
whitslack Nov 22, 2022
e03ef86
Make all non-API functions (except main) static
sipa Jan 9, 2023
4f1a54e
Move valgrind CPPFLAGS into SECP_CONFIG_DEFINES
sipa Dec 7, 2022
0db05a7
Abstract interactions with valgrind behind new checkmem.h
sipa Dec 6, 2022
8dc6407
Add compile-time error to valgrind_ctime_test
sipa Dec 6, 2022
8e11f89
Add support for msan integration to checkmem.h
sipa Dec 6, 2022
6eed6c1
Update error messages to suggest msan as well
sipa Dec 6, 2022
5048be1
Rename valgrind_ctime_test -> ctime_tests
sipa Dec 6, 2022
1897406
Make ctime tests building configurable
sipa Dec 7, 2022
5e2e6fc
Run ctime test in Linux MSan CI job
sipa Dec 6, 2022
74b026f
Add runtime checking for DECLASSIFY flag
sipa Dec 20, 2022
0f088ec
Rename CTIMETEST -> CTIMETESTS
sipa Dec 20, 2022
88e8072
Merge bitcoin-core/secp256k1#1160: Makefile: add `-I$(top_srcdir)/{in…
real-or-random Jan 12, 2023
d4a6b58
Add `noverify_tests` to `.gitignore`
hebasto Jan 13, 2023
4934aa7
Switch to exhaustive groups with small B coefficient
sipa Jan 10, 2023
ce60785
Introduce SECP256K1_B macro for curve b coefficient
sipa Jan 10, 2023
ff8edf8
Merge bitcoin-core/secp256k1#1193: Add `noverify_tests` to `.gitignore`
real-or-random Jan 14, 2023
f29a327
Merge bitcoin-core/secp256k1#1169: Add support for msan instead of va…
real-or-random Jan 16, 2023
a7a7bfa
Merge bitcoin-core/secp256k1#1190: Make all non-API functions (except…
real-or-random Jan 16, 2023
a01a7d8
Merge bitcoin-core/secp256k1#1192: Switch to exhaustive groups with s…
real-or-random Jan 16, 2023
d6ff738
Ensure safety of ctz_debruijn implementation.
roconnor-blockstream Jan 17, 2023
8f51229
ctime_tests: improve output when CHECKMEM_RUNNING is not defined
jonasnick Jan 18, 2023
b1579cf
Merge bitcoin-core/secp256k1#1194: Ensure safety of ctz_debruijn impl…
real-or-random Jan 18, 2023
4b6df5e
contexts: Forbid cloning/destroying secp256k1_context_static
real-or-random Dec 7, 2022
61841fc
contexts: Forbid randomizing secp256k1_context_static
real-or-random Dec 7, 2022
613626f
Drop no longer used `SECP_TEST_{LIBS,INCLUDE}` variables
hebasto Jan 19, 2023
2cd4e3c
Drop no longer used `SECP_{LIBS,INCLUDE}` variables
hebasto Jan 19, 2023
e39d954
tests: Add CHECK_ILLEGAL(_VOID) macros and use in static ctx tests
real-or-random Jan 17, 2023
ad7433b
Merge bitcoin-core/secp256k1#1196: Drop no longer used variables from…
sipa Jan 19, 2023
233822d
Merge bitcoin-core/secp256k1#1195: ctime_tests: improve output when C…
sipa Jan 19, 2023
5fbff5d
Merge bitcoin-core/secp256k1#1170: contexts: Forbid destroying, cloni…
sipa Jan 19, 2023
620ba3d
benchmarks: fix bench_scalar_split
jonasnick Dec 9, 2022
7f49aa7
ci: add test job with -DVERIFY
jonasnick Dec 9, 2022
eb6beba
scalar: restrict split_lambda args, improve doc and VERIFY_CHECKs
jonasnick Jan 4, 2023
2b77240
Merge bitcoin-core/secp256k1#1172: benchmarks: fix bench_scalar_split
sipa Jan 19, 2023
0ecf318
ci: Use remote pull/merge ref instead of local git merge
real-or-random Jan 27, 2023
c241586
ci: Don't fetch git history
real-or-random Jan 27, 2023
9b7d186
Drop no longer used Autoheader macros
hebasto Jan 28, 2023
1bff200
Merge bitcoin-core/secp256k1#1200: Drop no longer used Autoheader macros
sipa Jan 30, 2023
e1817a6
Merge bitcoin-core/secp256k1#1199: ci: Minor improvements inspired by…
real-or-random Jan 30, 2023
9b60e31
ci: Do not set git's `user.{email,name}` config options
hebasto Jan 30, 2023
ef39721
Do not link `bench` and `ctime_tests` to `COMMON_LIB`
hebasto Jan 30, 2023
5596ec5
Merge bitcoin-core/secp256k1#1203: Do not link `bench` and `ctime_tes…
real-or-random Jan 31, 2023
8ebe5c5
Merge bitcoin-core/secp256k1#1201: ci: Do not set git's `user.{email,…
real-or-random Jan 31, 2023
8c7e0fc
build: Add -Wreserved-identifier supported by clang
real-or-random Feb 2, 2023
1cca7c1
Merge bitcoin-core/secp256k1#1206: build: Add -Wreserved-identifier s…
real-or-random Feb 3, 2023
914276e
build: Add SECP256K1_API_VAR to fix importing variables from DLLs
real-or-random Jan 28, 2023
739c53b
examples: Extend sig examples by call that uses static context
real-or-random Feb 6, 2023
9a5a611
build: Suppress stupid MSVC linker warning
real-or-random Feb 6, 2023
e433034
ci: Shutdown wineserver whenever CI script exits
real-or-random Jan 28, 2023
1b21aa5
Merge bitcoin-core/secp256k1#1078: group: Save a normalize_to_zero in…
sipa Feb 14, 2023
cbd2555
Merge bitcoin-core/secp256k1#1209: build: Add SECP256K1_API_VAR to fi…
real-or-random Feb 21, 2023
5fffb2c
Make secp256k1_i128_check_pow2 support -(2^n)
sipa Dec 10, 2022
04c6c1b
Make secp256k1_modinv64_det_check_pow2 support abs val
sipa Dec 10, 2022
1de2a01
Native jacobi symbol algorithm
sipa Sep 11, 2021
6be0103
Add secp256k1_fe_is_square_var function
sipa Jan 4, 2023
ce3cfc7
doc: Describe Jacobi calculation in safegcd_implementation.md
robot-dreams Nov 10, 2021
09b1d46
Merge bitcoin-core/secp256k1#979: Native jacobi symbol algorithm
real-or-random Mar 1, 2023
5660c13
prevent optimization in algorithms
Harshil-Jani Feb 17, 2023
b081f7e
Add secp256k1_fe_add_int function
sipa Mar 1, 2023
5757318
Merge bitcoin-core/secp256k1#1212: Prevent dead-store elimination whe…
real-or-random Mar 2, 2023
2ef1c9b
Update overflow check
roconnor-blockstream Mar 6, 2023
8962fc9
Merge bitcoin-core/secp256k1#1218: Update overflow check
real-or-random Mar 7, 2023
d232112
Update Changelog
real-or-random Mar 7, 2023
9d1b458
Merge bitcoin-core/secp256k1#1217: Add secp256k1_fe_add_int function
jonasnick Mar 7, 2023
5d8f53e
Remove redudent checks.
roconnor-blockstream Mar 7, 2023
eb8749f
Merge bitcoin-core/secp256k1#1221: Update Changelog
real-or-random Mar 8, 2023
6048e6c
Merge bitcoin-core/secp256k1#1222: Remove redundant checks.
real-or-random Mar 8, 2023
0d540ec
Merge commits '88e80722 ff8edf89 f29a3270 a7a7bfaf a01a7d86 b1579cf5 …
jonasnick Jul 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
env:
### cirrus config
CIRRUS_CLONE_DEPTH: 1
### compiler options
HOST:
WRAPPER_CMD:
Expand Down Expand Up @@ -29,7 +31,7 @@ env:
SECP256K1_TEST_ITERS:
BENCH: yes
SECP256K1_BENCH_ITERS: 2
CTIMETEST: yes
CTIMETESTS: yes
# Compile and run the tests
EXAMPLES: yes

Expand All @@ -46,8 +48,8 @@ cat_logs_snippet: &CAT_LOGS
- cat noverify_tests.log || true
cat_exhaustive_tests_log_script:
- cat exhaustive_tests.log || true
cat_valgrind_ctime_test_log_script:
- cat valgrind_ctime_test.log || true
cat_ctime_tests_log_script:
- cat ctime_tests.log || true
cat_bench_log_script:
- cat bench.log || true
cat_config_log_script:
Expand All @@ -60,10 +62,8 @@ cat_logs_snippet: &CAT_LOGS
merge_base_script_snippet: &MERGE_BASE
merge_base_script:
- if [ "$CIRRUS_PR" = "" ]; then exit 0; fi
- git fetch $CIRRUS_REPO_CLONE_URL $CIRRUS_BASE_BRANCH
- git config --global user.email "ci@ci.ci"
- git config --global user.name "ci"
- git merge FETCH_HEAD # Merge base to detect silent merge conflicts
- git fetch --depth=1 $CIRRUS_REPO_CLONE_URL "pull/${CIRRUS_PR}/merge"
- git checkout FETCH_HEAD # Use merged changes to detect silent merge conflicts

linux_container_snippet: &LINUX_CONTAINER
container:
Expand All @@ -87,9 +87,10 @@ task:
- env: {WIDEMUL: int128, ECDH: yes, SCHNORRSIG: yes, EXPERIMENTAL: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes, BPPP: yes}
- env: {WIDEMUL: int128, ASM: x86_64}
- env: { RECOVERY: yes, SCHNORRSIG: yes, EXPERIMENTAL: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes, BPPP: yes}
- env: {BUILD: distcheck, WITH_VALGRIND: no, CTIMETEST: no, BENCH: no}
- env: {CTIMETESTS: no, RECOVERY: yes, ECDH: yes, SCHNORRSIG: yes, EXPERIMENTAL: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes, BPPP: yes, CPPFLAGS: -DVERIFY}
- env: {BUILD: distcheck, WITH_VALGRIND: no, CTIMETESTS: no, BENCH: no}
- env: {CPPFLAGS: -DDETERMINISTIC}
- env: {CFLAGS: -O0, CTIMETEST: no}
- env: {CFLAGS: -O0, CTIMETESTS: no}
- env: { ECMULTGENPRECISION: 2, ECMULTWINDOW: 2 }
- env: { ECMULTGENPRECISION: 8, ECMULTWINDOW: 4 }
matrix:
Expand Down Expand Up @@ -144,7 +145,7 @@ task:
env:
ASM: no
WITH_VALGRIND: no
CTIMETEST: no
CTIMETESTS: no
matrix:
- env:
CC: gcc
Expand Down Expand Up @@ -177,7 +178,7 @@ task:
MUSIG: yes
ECDSAADAPTOR: yes
BPPP: yes
CTIMETEST: no
CTIMETESTS: no
<< : *MERGE_BASE
test_script:
# https://sourceware.org/bugzilla/show_bug.cgi?id=27008
Expand All @@ -196,7 +197,7 @@ task:
ECDH: yes
RECOVERY: yes
SCHNORRSIG: yes
CTIMETEST: no
CTIMETESTS: no
matrix:
- env: {}
- env: {EXPERIMENTAL: yes, ASM: arm}
Expand All @@ -216,7 +217,7 @@ task:
ECDH: yes
RECOVERY: yes
SCHNORRSIG: yes
CTIMETEST: no
CTIMETESTS: no
<< : *MERGE_BASE
test_script:
- ./ci/cirrus.sh
Expand All @@ -233,7 +234,7 @@ task:
ECDH: yes
RECOVERY: yes
SCHNORRSIG: yes
CTIMETEST: no
CTIMETESTS: no
<< : *MERGE_BASE
test_script:
- ./ci/cirrus.sh
Expand All @@ -247,7 +248,7 @@ task:
ECDH: yes
RECOVERY: yes
SCHNORRSIG: yes
CTIMETEST: no
CTIMETESTS: no
matrix:
- name: "x86_64 (mingw32-w64): Windows (Debian stable, Wine)"
env:
Expand Down Expand Up @@ -277,7 +278,7 @@ task:
MUSIG: yes
ECDSAADAPTOR: yes
BPPP: yes
CTIMETEST: no
CTIMETESTS: no
# Use a MinGW-w64 host to tell ./configure we're building for Windows.
# This will detect some MinGW-w64 tools but then make will need only
# the MSVC tools CC, AR and NM as specified below.
Expand All @@ -288,7 +289,7 @@ task:
# Set non-essential options that affect the CLI messages here.
# (They depend on the user's taste, so we don't want to set them automatically in configure.ac.)
CFLAGS: -nologo -diagnostics:caret
LDFLAGS: -XCClinker -nologo -XCClinker -diagnostics:caret
LDFLAGS: -Xlinker -Xlinker -Xlinker -nologo
matrix:
- name: "x86_64 (MSVC): Windows (Debian stable, Wine)"
- name: "x86_64 (MSVC): Windows (Debian stable, Wine, int128_struct)"
Expand Down Expand Up @@ -325,7 +326,7 @@ task:
MUSIG: yes
ECDSAADAPTOR: yes
BPPP: yes
CTIMETEST: no
CTIMETESTS: no
matrix:
- name: "Valgrind (memcheck)"
container:
Expand Down Expand Up @@ -378,10 +379,11 @@ task:
MUSIG: yes
ECDSAADAPTOR: yes
BPPP: yes
CTIMETEST: no
CTIMETESTS: yes
CC: clang
SECP256K1_TEST_ITERS: 32
ASM: no
WITH_VALGRIND: no
container:
memory: 2G
matrix:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ bench_generator
bench_rangeproof
bench_internal
bench_whitelist
noverify_tests
tests
example_musig
exhaustive_tests
precompute_ecmult_gen
precompute_ecmult
valgrind_ctime_test
ctime_tests
ecdh_example
ecdsa_example
schnorr_example
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

#### Added
- Usage examples: Added a recommended method for securely clearing sensitive data, e.g., secret keys, from memory.
- Tests: Added a new test binary `noverify_tests`. This binary runs the tests without some additional checks present in the ordinary `tests` binary and is thereby closer to production binaries. The `noverify_tests` binary is automatically run as part of the `make check` target.

#### Fixed
- Fixed declarations of API variables for MSVC (`__declspec(dllimport)`). This fixes MSVC builds of programs which link against a libsecp256k1 DLL dynamically and use API variables (and not only API functions). Unfortunately, the MSVC linker now will emit warning `LNK4217` when trying to link against libsecp256k1 statically. Pass `/ignore:4217` to the linker to suppress this warning.

#### Changed
- Forbade cloning or destroying `secp256k1_context_static`. Create a new context instead of cloning the static context. (If this change breaks your code, your code is probably wrong.)
- Forbade randomizing (copies of) `secp256k1_context_static`. Randomizing a copy of `secp256k1_context_static` did not have any effect and did not provide defense-in-depth protection against side-channel attacks. Create a new context if you want to benefit from randomization.

#### Removed
- Removed the configuration header `src/libsecp256k1-config.h`. We recommend passing flags to `./configure` to set configuration options (see `./configure --help`). If you cannot or do not want to use `./configure`, pass configuration flags such as `-DSECP256K1_ENABLE_MODULE_SCHNORRSIG` manually to the compiler (see the file `configure.ac` for supported flags).

## [0.2.0] - 2022-12-12

#### Added
Expand Down
54 changes: 27 additions & 27 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ noinst_HEADERS += src/modinv64_impl.h
noinst_HEADERS += src/precomputed_ecmult.h
noinst_HEADERS += src/precomputed_ecmult_gen.h
noinst_HEADERS += src/assumptions.h
noinst_HEADERS += src/checkmem.h
noinst_HEADERS += src/util.h
noinst_HEADERS += src/int128.h
noinst_HEADERS += src/int128_impl.h
Expand All @@ -70,12 +71,14 @@ noinst_HEADERS += contrib/lax_der_parsing.h
noinst_HEADERS += contrib/lax_der_parsing.c
noinst_HEADERS += contrib/lax_der_privatekey_parsing.h
noinst_HEADERS += contrib/lax_der_privatekey_parsing.c
noinst_HEADERS += examples/random.h
noinst_HEADERS += examples/examples_util.h

PRECOMPUTED_LIB = libsecp256k1_precomputed.la
noinst_LTLIBRARIES = $(PRECOMPUTED_LIB)
libsecp256k1_precomputed_la_SOURCES = src/precomputed_ecmult.c src/precomputed_ecmult_gen.c
libsecp256k1_precomputed_la_CPPFLAGS = $(SECP_INCLUDES) $(SECP_CONFIG_DEFINES)
# We need `-I$(top_srcdir)/src` in VPATH builds if libsecp256k1_precomputed_la_SOURCES have been recreated in the build tree.
# This helps users and packagers who insist on recreating the precomputed files (e.g., Gentoo).
libsecp256k1_precomputed_la_CPPFLAGS = -I$(top_srcdir)/src $(SECP_CONFIG_DEFINES)

if USE_EXTERNAL_ASM
COMMON_LIB = libsecp256k1_common.la
Expand All @@ -94,42 +97,32 @@ endif
endif

libsecp256k1_la_SOURCES = src/secp256k1.c
libsecp256k1_la_CPPFLAGS = $(SECP_INCLUDES) $(SECP_CONFIG_DEFINES)
libsecp256k1_la_LIBADD = $(SECP_LIBS) $(COMMON_LIB) $(PRECOMPUTED_LIB)
libsecp256k1_la_CPPFLAGS = $(SECP_CONFIG_DEFINES)
libsecp256k1_la_LIBADD = $(COMMON_LIB) $(PRECOMPUTED_LIB)
libsecp256k1_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_CURRENT):$(LIB_VERSION_REVISION):$(LIB_VERSION_AGE)

if VALGRIND_ENABLED
libsecp256k1_la_CPPFLAGS += -DVALGRIND
endif

noinst_PROGRAMS =
if USE_BENCHMARK
noinst_PROGRAMS += bench bench_internal bench_ecmult
bench_SOURCES = src/bench.c
bench_LDADD = libsecp256k1.la $(SECP_LIBS) $(SECP_TEST_LIBS) $(COMMON_LIB)
bench_LDADD = libsecp256k1.la
bench_CPPFLAGS = $(SECP_CONFIG_DEFINES)
bench_internal_SOURCES = src/bench_internal.c
bench_internal_LDADD = $(SECP_LIBS) $(COMMON_LIB) $(PRECOMPUTED_LIB)
bench_internal_CPPFLAGS = $(SECP_INCLUDES) $(SECP_CONFIG_DEFINES)
bench_internal_LDADD = $(COMMON_LIB) $(PRECOMPUTED_LIB)
bench_internal_CPPFLAGS = $(SECP_CONFIG_DEFINES)
bench_ecmult_SOURCES = src/bench_ecmult.c
bench_ecmult_LDADD = $(SECP_LIBS) $(COMMON_LIB) $(PRECOMPUTED_LIB)
bench_ecmult_CPPFLAGS = $(SECP_INCLUDES) $(SECP_CONFIG_DEFINES)
bench_ecmult_LDADD = $(COMMON_LIB) $(PRECOMPUTED_LIB)
bench_ecmult_CPPFLAGS = $(SECP_CONFIG_DEFINES)
endif

TESTS =
if USE_TESTS
TESTS += noverify_tests
noinst_PROGRAMS += noverify_tests
noverify_tests_SOURCES = src/tests.c
noverify_tests_CPPFLAGS = $(SECP_INCLUDES) $(SECP_TEST_INCLUDES) $(SECP_CONFIG_DEFINES)
noverify_tests_LDADD = $(SECP_LIBS) $(SECP_TEST_LIBS) $(COMMON_LIB) $(PRECOMPUTED_LIB)
noverify_tests_CPPFLAGS = $(SECP_CONFIG_DEFINES)
noverify_tests_LDADD = $(COMMON_LIB) $(PRECOMPUTED_LIB)
noverify_tests_LDFLAGS = -static
if VALGRIND_ENABLED
noverify_tests_CPPFLAGS += -DVALGRIND
noinst_PROGRAMS += valgrind_ctime_test
valgrind_ctime_test_SOURCES = src/valgrind_ctime_test.c
valgrind_ctime_test_LDADD = libsecp256k1.la $(SECP_LIBS) $(COMMON_LIB)
endif
if !ENABLE_COVERAGE
TESTS += tests
noinst_PROGRAMS += tests
Expand All @@ -140,15 +133,22 @@ tests_LDFLAGS = $(noverify_tests_LDFLAGS)
endif
endif

if USE_CTIME_TESTS
noinst_PROGRAMS += ctime_tests
ctime_tests_SOURCES = src/ctime_tests.c
ctime_tests_LDADD = libsecp256k1.la
ctime_tests_CPPFLAGS = $(SECP_CONFIG_DEFINES)
endif

if USE_EXHAUSTIVE_TESTS
noinst_PROGRAMS += exhaustive_tests
exhaustive_tests_SOURCES = src/tests_exhaustive.c
exhaustive_tests_CPPFLAGS = $(SECP_INCLUDES) $(SECP_CONFIG_DEFINES)
exhaustive_tests_CPPFLAGS = $(SECP_CONFIG_DEFINES)
if !ENABLE_COVERAGE
exhaustive_tests_CPPFLAGS += -DVERIFY
endif
# Note: do not include $(PRECOMPUTED_LIB) in exhaustive_tests (it uses runtime-generated tables).
exhaustive_tests_LDADD = $(SECP_LIBS) $(COMMON_LIB)
exhaustive_tests_LDADD = $(COMMON_LIB)
exhaustive_tests_LDFLAGS = -static
TESTS += exhaustive_tests
endif
Expand Down Expand Up @@ -203,12 +203,12 @@ EXTRA_PROGRAMS = precompute_ecmult precompute_ecmult_gen
CLEANFILES = $(EXTRA_PROGRAMS)

precompute_ecmult_SOURCES = src/precompute_ecmult.c
precompute_ecmult_CPPFLAGS = $(SECP_INCLUDES) $(SECP_CONFIG_DEFINES)
precompute_ecmult_LDADD = $(SECP_LIBS) $(COMMON_LIB)
precompute_ecmult_CPPFLAGS = $(SECP_CONFIG_DEFINES)
precompute_ecmult_LDADD = $(COMMON_LIB)

precompute_ecmult_gen_SOURCES = src/precompute_ecmult_gen.c
precompute_ecmult_gen_CPPFLAGS = $(SECP_INCLUDES) $(SECP_CONFIG_DEFINES)
precompute_ecmult_gen_LDADD = $(SECP_LIBS) $(COMMON_LIB)
precompute_ecmult_gen_CPPFLAGS = $(SECP_CONFIG_DEFINES)
precompute_ecmult_gen_LDADD = $(COMMON_LIB)

# See Automake manual, Section "Errors with distclean".
# We don't list any dependencies for the prebuilt files here because
Expand Down
29 changes: 17 additions & 12 deletions ci/cirrus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ print_environment() {
ECMULTWINDOW ECMULTGENPRECISION ASM WIDEMUL WITH_VALGRIND EXTRAFLAGS \
EXPERIMENTAL ECDH RECOVERY SCHNORRSIG \
ECDSA_S2C GENERATOR RANGEPROOF WHITELIST MUSIG ECDSAADAPTOR BPPP \
SECP256K1_TEST_ITERS BENCH SECP256K1_BENCH_ITERS CTIMETEST\
SECP256K1_TEST_ITERS BENCH SECP256K1_BENCH_ITERS CTIMETESTS\
EXAMPLES \
HOST WRAPPER_CMD \
CC CFLAGS CPPFLAGS AR NM
Expand All @@ -35,6 +35,8 @@ print_environment
# This speeds up jobs with many invocations of wine (e.g., ./configure with MSVC) tremendously.
case "$WRAPPER_CMD" in
*wine*)
# Make sure to shutdown wineserver whenever we exit.
trap "wineserver -k || true" EXIT INT HUP
# This is apparently only reliable when we run a dummy command such as "hh.exe" afterwards.
wineserver -p && wine hh.exe
;;
Expand Down Expand Up @@ -67,6 +69,7 @@ fi
--enable-module-schnorrsig="$SCHNORRSIG" --enable-module-musig="$MUSIG" --enable-module-ecdsa-adaptor="$ECDSAADAPTOR" \
--enable-module-schnorrsig="$SCHNORRSIG" \
--enable-examples="$EXAMPLES" \
--enable-ctime-tests="$CTIMETESTS" \
--with-valgrind="$WITH_VALGRIND" \
--host="$HOST" $EXTRAFLAGS

Expand All @@ -83,14 +86,15 @@ export LOG_COMPILER="$WRAPPER_CMD"

make "$BUILD"

# 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

if [ "$BENCH" = "yes" ]
then
# 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
{
$EXEC ./bench_ecmult
$EXEC ./bench_internal
Expand All @@ -102,9 +106,13 @@ then
} >> bench.log 2>&1
fi

if [ "$CTIMETEST" = "yes" ]
if [ "$CTIMETESTS" = "yes" ]
then
./libtool --mode=execute valgrind --error-exitcode=42 ./valgrind_ctime_test > valgrind_ctime_test.log 2>&1
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
fi

# Rebuild precomputed files (if not cross-compiling).
Expand All @@ -114,9 +122,6 @@ then
make precomp
fi

# Shutdown wineserver again
wineserver -k || true

# 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
Loading