Skip to content

Commit d009572

Browse files
authored
Merge pull request #1024 from apoelstra/2021-07--secp-update
Update libsecp-zkp to 90580edcc98350c9df9bebee58d2f9616d801849
2 parents 0bc24d9 + f1bf371 commit d009572

File tree

124 files changed

+9983
-2737
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+9983
-2737
lines changed

ci/test/00_setup_env_native_nowallet.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
export LC_ALL=C.UTF-8
88

99
export CONTAINER_NAME=ci_native_nowallet
10-
export DOCKER_NAME_TAG=ubuntu:16.04 # Use xenial to have one config run the tests in python3.5, see doc/dependencies.md
11-
export PACKAGES="python3-zmq clang-3.8 llvm-3.8" # Use clang-3.8 to test C++11 compatibility, see doc/dependencies.md
10+
export DOCKER_NAME_TAG=ubuntu:18.04 # Use bionic to have one config run the tests in python3.6, see doc/dependencies.md
11+
export PACKAGES="python3-zmq clang-5.0 llvm-5.0" # Use clang-5 to test C++17 compatibility, see doc/dependencies.md
1212
export DEP_OPTS="NO_WALLET=1"
1313
export GOAL="install"
14-
export BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports CC=clang-3.8 CXX=clang++-3.8 --with-boost-process"
14+
export BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports CC=clang-5.0 CXX=clang++-5.0 --with-boost-process"

src/pubkey.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ bool XOnlyPubKey::VerifySchnorr(const uint256& msg, Span<const unsigned char> si
178178
assert(sigbytes.size() == 64);
179179
secp256k1_xonly_pubkey pubkey;
180180
if (!secp256k1_xonly_pubkey_parse(secp256k1_context_verify, &pubkey, m_keydata.data())) return false;
181-
return secp256k1_schnorrsig_verify(secp256k1_context_verify, sigbytes.data(), msg.begin(), &pubkey);
181+
return secp256k1_schnorrsig_verify(secp256k1_context_verify, sigbytes.data(), msg.begin(), 32, &pubkey);
182182
}
183183

184184
bool XOnlyPubKey::CheckPayToContract(const XOnlyPubKey& base, const uint256& hash, bool parity) const

src/secp256k1/.cirrus.yml

Lines changed: 368 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,368 @@
1+
env:
2+
### compiler options
3+
HOST:
4+
# Specific warnings can be disabled with -Wno-error=foo.
5+
# -pedantic-errors is not equivalent to -Werror=pedantic and thus not implied by -Werror according to the GCC manual.
6+
WERROR_CFLAGS: -Werror -pedantic-errors
7+
MAKEFLAGS: -j2
8+
BUILD: check
9+
### secp256k1 config
10+
STATICPRECOMPUTATION: yes
11+
ECMULTGENPRECISION: auto
12+
ASM: no
13+
WIDEMUL: auto
14+
WITH_VALGRIND: yes
15+
EXTRAFLAGS:
16+
### secp256k1 modules
17+
ECDH: no
18+
RECOVERY: no
19+
SCHNORRSIG: no
20+
ECDSA_S2C: no
21+
GENERATOR: no
22+
RANGEPROOF: no
23+
WHITELIST: no
24+
MUSIG: no
25+
ECDSAADAPTOR: no
26+
### test options
27+
TEST_ITERS:
28+
BENCH: yes
29+
BENCH_ITERS: 2
30+
CTIMETEST: yes
31+
32+
cat_logs_snippet: &CAT_LOGS
33+
always:
34+
cat_tests_log_script:
35+
- cat tests.log || true
36+
cat_exhaustive_tests_log_script:
37+
- cat exhaustive_tests.log || true
38+
cat_valgrind_ctime_test_log_script:
39+
- cat valgrind_ctime_test.log || true
40+
cat_bench_log_script:
41+
- cat bench.log || true
42+
on_failure:
43+
cat_config_log_script:
44+
- cat config.log || true
45+
cat_test_env_script:
46+
- cat test_env.log || true
47+
cat_ci_env_script:
48+
- env
49+
50+
merge_base_script_snippet: &MERGE_BASE
51+
merge_base_script:
52+
- if [ "$CIRRUS_PR" = "" ]; then exit 0; fi
53+
- git fetch $CIRRUS_REPO_CLONE_URL $CIRRUS_BASE_BRANCH
54+
- git config --global user.email "[email protected]"
55+
- git config --global user.name "ci"
56+
- git merge FETCH_HEAD # Merge base to detect silent merge conflicts
57+
58+
task:
59+
name: "x86_64: Linux (Debian stable)"
60+
container:
61+
dockerfile: ci/linux-debian.Dockerfile
62+
# Reduce number of CPUs to be able to do more builds in parallel.
63+
cpu: 1
64+
# More than enough for our scripts.
65+
memory: 1G
66+
matrix: &ENV_MATRIX
67+
- env: {WIDEMUL: int64, RECOVERY: yes}
68+
- env: {WIDEMUL: int64, ECDH: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes}
69+
- env: {WIDEMUL: int128}
70+
- env: {WIDEMUL: int128, RECOVERY: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes}
71+
- env: {WIDEMUL: int128, ECDH: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes}
72+
- env: {WIDEMUL: int128, ASM: x86_64}
73+
- env: { RECOVERY: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes}
74+
- env: { STATICPRECOMPUTATION: no}
75+
- env: {BUILD: distcheck, WITH_VALGRIND: no, CTIMETEST: no, BENCH: no}
76+
- env: {CPPFLAGS: -DDETERMINISTIC}
77+
- env: {CFLAGS: -O0, CTIMETEST: no}
78+
- env: { ECMULTGENPRECISION: 2 }
79+
- env: { ECMULTGENPRECISION: 8 }
80+
matrix:
81+
- env:
82+
CC: gcc
83+
- env:
84+
CC: clang
85+
<< : *MERGE_BASE
86+
test_script:
87+
- ./ci/cirrus.sh
88+
<< : *CAT_LOGS
89+
90+
task:
91+
name: "i686: Linux (Debian stable)"
92+
container:
93+
dockerfile: ci/linux-debian.Dockerfile
94+
cpu: 1
95+
memory: 1G
96+
env:
97+
HOST: i686-linux-gnu
98+
ECDH: yes
99+
RECOVERY: yes
100+
EXPERIMENTAL: yes
101+
SCHNORRSIG: yes
102+
ECDSA_S2C: yes
103+
RANGEPROOF: yes
104+
WHITELIST: yes
105+
GENERATOR: yes
106+
MUSIG: yes
107+
ECDSAADAPTOR: yes
108+
matrix:
109+
- env:
110+
CC: i686-linux-gnu-gcc
111+
- env:
112+
CC: clang --target=i686-pc-linux-gnu -isystem /usr/i686-linux-gnu/include
113+
<< : *MERGE_BASE
114+
test_script:
115+
- ./ci/cirrus.sh
116+
<< : *CAT_LOGS
117+
118+
task:
119+
name: "x86_64: macOS Catalina"
120+
macos_instance:
121+
image: catalina-base
122+
# As of d4ca81f48e tasks with valgrind enabled take about 60 minutes
123+
timeout_in: 90m
124+
env:
125+
HOMEBREW_NO_AUTO_UPDATE: 1
126+
HOMEBREW_NO_INSTALL_CLEANUP: 1
127+
# Cirrus gives us a fixed number of 12 virtual CPUs. Not that we even have that many jobs at the moment...
128+
MAKEFLAGS: -j13
129+
matrix:
130+
<< : *ENV_MATRIX
131+
matrix:
132+
- env:
133+
CC: gcc-9
134+
- env:
135+
CC: clang
136+
# Update Command Line Tools
137+
# Uncomment this if the Command Line Tools on the CirrusCI macOS image are too old to brew valgrind.
138+
# See https://apple.stackexchange.com/a/195963 for the implementation.
139+
## update_clt_script:
140+
## - system_profiler SPSoftwareDataType
141+
## - touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
142+
## - |-
143+
## PROD=$(softwareupdate -l | grep "*.*Command Line" | tail -n 1 | awk -F"*" '{print $2}' | sed -e 's/^ *//' | sed 's/Label: //g' | tr -d '\n')
144+
## # For debugging
145+
## - softwareupdate -l && echo "PROD: $PROD"
146+
## - softwareupdate -i "$PROD" --verbose
147+
## - rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
148+
##
149+
brew_valgrind_pre_script:
150+
- brew config
151+
- brew tap --shallow LouisBrunner/valgrind
152+
# Fetch valgrind source but don't build it yet.
153+
- brew fetch --HEAD LouisBrunner/valgrind/valgrind
154+
brew_valgrind_cache:
155+
# This is $(brew --cellar valgrind) but command substition does not work here.
156+
folder: /usr/local/Cellar/valgrind
157+
# Rebuild cache if ...
158+
fingerprint_script:
159+
# ... macOS version changes:
160+
- sw_vers
161+
# ... brew changes:
162+
- brew config
163+
# ... valgrind changes:
164+
- git -C "$(brew --cache)/valgrind--git" rev-parse HEAD
165+
populate_script:
166+
# If there's no hit in the cache, build and install valgrind.
167+
- brew install --HEAD LouisBrunner/valgrind/valgrind
168+
brew_valgrind_post_script:
169+
# If we have restored valgrind from the cache, tell brew to create symlink to the PATH.
170+
# If we haven't restored from cached (and just run brew install), this is a no-op.
171+
- brew link valgrind
172+
brew_script:
173+
- brew install automake libtool gcc@9
174+
<< : *MERGE_BASE
175+
test_script:
176+
- ./ci/cirrus.sh
177+
<< : *CAT_LOGS
178+
179+
task:
180+
name: "s390x (big-endian): Linux (Debian stable, QEMU)"
181+
container:
182+
dockerfile: ci/linux-debian.Dockerfile
183+
cpu: 1
184+
memory: 1G
185+
env:
186+
WRAPPER_CMD: qemu-s390x
187+
TEST_ITERS: 16
188+
HOST: s390x-linux-gnu
189+
WITH_VALGRIND: no
190+
ECDH: yes
191+
RECOVERY: yes
192+
EXPERIMENTAL: yes
193+
SCHNORRSIG: yes
194+
ECDSA_S2C: yes
195+
RANGEPROOF: yes
196+
WHITELIST: yes
197+
GENERATOR: yes
198+
MUSIG: yes
199+
ECDSAADAPTOR: yes
200+
CTIMETEST: no
201+
<< : *MERGE_BASE
202+
test_script:
203+
# https://sourceware.org/bugzilla/show_bug.cgi?id=27008
204+
- rm /etc/ld.so.cache
205+
- ./ci/cirrus.sh
206+
<< : *CAT_LOGS
207+
208+
task:
209+
name: "ARM32: Linux (Debian stable, QEMU)"
210+
container:
211+
dockerfile: ci/linux-debian.Dockerfile
212+
cpu: 1
213+
memory: 1G
214+
env:
215+
WRAPPER_CMD: qemu-arm
216+
TEST_ITERS: 16
217+
HOST: arm-linux-gnueabihf
218+
WITH_VALGRIND: no
219+
ECDH: yes
220+
RECOVERY: yes
221+
EXPERIMENTAL: yes
222+
SCHNORRSIG: yes
223+
CTIMETEST: no
224+
matrix:
225+
- env: {}
226+
- env: {ASM: arm}
227+
<< : *MERGE_BASE
228+
test_script:
229+
- ./ci/cirrus.sh
230+
<< : *CAT_LOGS
231+
232+
task:
233+
name: "ARM64: Linux (Debian stable, QEMU)"
234+
container:
235+
dockerfile: ci/linux-debian.Dockerfile
236+
cpu: 1
237+
memory: 1G
238+
env:
239+
WRAPPER_CMD: qemu-aarch64
240+
TEST_ITERS: 16
241+
HOST: aarch64-linux-gnu
242+
WITH_VALGRIND: no
243+
ECDH: yes
244+
RECOVERY: yes
245+
EXPERIMENTAL: yes
246+
SCHNORRSIG: yes
247+
CTIMETEST: no
248+
<< : *MERGE_BASE
249+
test_script:
250+
- ./ci/cirrus.sh
251+
<< : *CAT_LOGS
252+
253+
task:
254+
name: "ppc64le: Linux (Debian stable, QEMU)"
255+
container:
256+
dockerfile: ci/linux-debian.Dockerfile
257+
cpu: 1
258+
memory: 1G
259+
env:
260+
WRAPPER_CMD: qemu-ppc64le
261+
TEST_ITERS: 16
262+
HOST: powerpc64le-linux-gnu
263+
WITH_VALGRIND: no
264+
ECDH: yes
265+
RECOVERY: yes
266+
EXPERIMENTAL: yes
267+
SCHNORRSIG: yes
268+
CTIMETEST: no
269+
<< : *MERGE_BASE
270+
test_script:
271+
- ./ci/cirrus.sh
272+
<< : *CAT_LOGS
273+
274+
task:
275+
name: "x86_64 (mingw32-w64): Windows (Debian stable, Wine)"
276+
container:
277+
dockerfile: ci/linux-debian.Dockerfile
278+
cpu: 1
279+
memory: 1G
280+
env:
281+
WRAPPER_CMD: wine64-stable
282+
TEST_ITERS: 16
283+
HOST: x86_64-w64-mingw32
284+
WITH_VALGRIND: no
285+
ECDH: yes
286+
RECOVERY: yes
287+
EXPERIMENTAL: yes
288+
SCHNORRSIG: yes
289+
CTIMETEST: no
290+
<< : *MERGE_BASE
291+
test_script:
292+
- ./ci/cirrus.sh
293+
<< : *CAT_LOGS
294+
295+
# Sanitizers
296+
task:
297+
timeout_in: 120m
298+
container:
299+
dockerfile: ci/linux-debian.Dockerfile
300+
cpu: 1
301+
memory: 2G
302+
env:
303+
ECDH: yes
304+
RECOVERY: yes
305+
EXPERIMENTAL: yes
306+
SCHNORRSIG: yes
307+
ECDSA_S2C: yes
308+
RANGEPROOF: yes
309+
WHITELIST: yes
310+
GENERATOR: yes
311+
MUSIG: yes
312+
ECDSAADAPTOR: yes
313+
CTIMETEST: no
314+
EXTRAFLAGS: "--disable-openssl-tests"
315+
matrix:
316+
- name: "Valgrind (memcheck)"
317+
env:
318+
# The `--error-exitcode` is required to make the test fail if valgrind found errors, otherwise it'll return 0 (https://www.valgrind.org/docs/manual/manual-core.html)
319+
WRAPPER_CMD: "valgrind --error-exitcode=42"
320+
TEST_ITERS: 8
321+
- name: "UBSan, ASan, LSan"
322+
env:
323+
CFLAGS: "-fsanitize=undefined,address"
324+
CFLAGS_FOR_BUILD: "-fsanitize=undefined,address"
325+
UBSAN_OPTIONS: "print_stacktrace=1:halt_on_error=1"
326+
ASAN_OPTIONS: "strict_string_checks=1:detect_stack_use_after_return=1:detect_leaks=1"
327+
LSAN_OPTIONS: "use_unaligned=1"
328+
TEST_ITERS: 32
329+
# Try to cover many configurations with just a tiny matrix.
330+
matrix:
331+
- env:
332+
ASM: auto
333+
STATICPRECOMPUTATION: yes
334+
- env:
335+
ASM: no
336+
STATICPRECOMPUTATION: no
337+
ECMULTGENPRECISION: 2
338+
matrix:
339+
- env:
340+
CC: clang
341+
- env:
342+
HOST: i686-linux-gnu
343+
CC: i686-linux-gnu-gcc
344+
<< : *MERGE_BASE
345+
test_script:
346+
- ./ci/cirrus.sh
347+
<< : *CAT_LOGS
348+
349+
task:
350+
name: "C++ -fpermissive"
351+
container:
352+
dockerfile: ci/linux-debian.Dockerfile
353+
cpu: 1
354+
memory: 1G
355+
env:
356+
# ./configure correctly errors out when given CC=g++.
357+
# We hack around this by passing CC=g++ only to make.
358+
CC: gcc
359+
MAKEFLAGS: -j2 CC=g++ CFLAGS=-fpermissive
360+
WERROR_CFLAGS:
361+
EXPERIMENTAL: yes
362+
ECDH: yes
363+
RECOVERY: yes
364+
SCHNORRSIG: yes
365+
<< : *MERGE_BASE
366+
test_script:
367+
- ./ci/cirrus.sh
368+
<< : *CAT_LOGS

0 commit comments

Comments
 (0)