Skip to content

Commit 05c5447

Browse files
committed
Squashed 'src/secp256k1/' changes from b9313c6e1a..aa85bfb530
aa85bfb530 docs: update README 9f42a30b82 ci: enable silentpayments module d504e48145 tests: add sha256 tag test 124750d580 tests: add constant time tests b35ffa2e30 tests: add BIP-352 test vectors 038c5b9c9d silentpayments: add benchmarks for scanning 88eb3d4545 silentpayments: add examples/silentpayments.c 22b20fd617 silentpayments: receiving df1de93765 silentpayments: recipient label support 76a0451c76 silentpayments: sending 3cd3a93bff build: add skeleton for new silentpayments (BIP352) module f36afb8b3d Merge bitcoin-core/secp256k1#1725: tests: refactor tagged hash verification 5153cf1c91 tests: refactor tagged hash tests d2dcf52091 Merge bitcoin-core/secp256k1#1726: docs: fix broken link to Tromer's cache.pdf paper 489a43d1bf docs: fix broken link to eprint cache.pdf paper d599714147 Merge bitcoin-core/secp256k1#1722: docs: Exclude modules' `bench_impl.h` headers from coverage report 0458def51e doc: Add `--gcov-ignore-parse-errors=all` option to `gcovr` invocations 1aecce5936 doc: Add `--merge-mode-functions=separate` option to `gcovr` invocations 106a7cbf41 doc: Exclude modules' `bench_impl.h` headers from coverage report a9e955d3ea autotools, docs: Adjust help string for `--enable-coverage` option e523e4f90e Merge bitcoin-core/secp256k1#1720: chore(ci): Fix typo in Dockerfile comment 24ba8ff168 chore(ci): Fix typo in Dockerfile comment 74b8068c5d Merge bitcoin-core/secp256k1#1717: test: update wycheproof test vectors c25c3c8a88 test: update wycheproof test vectors 20e3b44746 Merge bitcoin-core/secp256k1#1688: cmake: Avoid contaminating parent project's cache with `BUILD_SHARED_LIBS` 2c076d907a Merge bitcoin-core/secp256k1#1711: tests: update Wycheproof 7b07b22957 cmake: Avoid contaminating parent project's cache with BUILD_SHARED_LIBS 5433648ca0 Fix typos and spellings 9ea54c69b7 tests: update Wycheproof files git-subtree-dir: src/secp256k1 git-subtree-split: aa85bfb530b9ffc3dde6eaa7a976e129b8bd2f58
1 parent 5600e6f commit 05c5447

31 files changed

+8352
-84
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ env:
3535
SCHNORRSIG: 'no'
3636
MUSIG: 'no'
3737
ELLSWIFT: 'no'
38+
SILENTPAYMENTS: 'no'
3839
### test options
3940
SECP256K1_TEST_ITERS: 64
4041
BENCH: 'yes'
@@ -84,18 +85,18 @@ jobs:
8485
matrix:
8586
configuration:
8687
- env_vars: { WIDEMUL: 'int64', RECOVERY: 'yes' }
87-
- env_vars: { WIDEMUL: 'int64', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
88+
- env_vars: { WIDEMUL: 'int64', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
8889
- env_vars: { WIDEMUL: 'int128' }
8990
- env_vars: { WIDEMUL: 'int128_struct', ELLSWIFT: 'yes' }
9091
- env_vars: { WIDEMUL: 'int128', RECOVERY: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
91-
- env_vars: { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes' }
92+
- env_vars: { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', SILENTPAYMENTS: 'yes' }
9293
- env_vars: { WIDEMUL: 'int128', ASM: 'x86_64', ELLSWIFT: 'yes' }
9394
- env_vars: { RECOVERY: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes' }
94-
- env_vars: { CTIMETESTS: 'no', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', CPPFLAGS: '-DVERIFY' }
95+
- env_vars: { CTIMETESTS: 'no', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', SILENTPAYMENTS: 'yes', CPPFLAGS: '-DVERIFY' }
9596
- env_vars: { BUILD: 'distcheck', WITH_VALGRIND: 'no', CTIMETESTS: 'no', BENCH: 'no' }
9697
- env_vars: { CPPFLAGS: '-DDETERMINISTIC' }
9798
- env_vars: { CFLAGS: '-O0', CTIMETESTS: 'no' }
98-
- env_vars: { CFLAGS: '-O1', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
99+
- env_vars: { CFLAGS: '-O1', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
99100
- env_vars: { ECMULTGENKB: 2, ECMULTWINDOW: 2 }
100101
- env_vars: { ECMULTGENKB: 86, ECMULTWINDOW: 4 }
101102
cc:
@@ -142,6 +143,7 @@ jobs:
142143
SCHNORRSIG: 'yes'
143144
MUSIG: 'yes'
144145
ELLSWIFT: 'yes'
146+
SILENTPAYMENTS: 'yes'
145147
CC: ${{ matrix.cc }}
146148

147149
steps:
@@ -174,6 +176,7 @@ jobs:
174176
SCHNORRSIG: 'yes'
175177
MUSIG: 'yes'
176178
ELLSWIFT: 'yes'
179+
SILENTPAYMENTS: 'yes'
177180
CTIMETESTS: 'no'
178181

179182
steps:
@@ -214,6 +217,7 @@ jobs:
214217
SCHNORRSIG: 'yes'
215218
MUSIG: 'yes'
216219
ELLSWIFT: 'yes'
220+
SILENTPAYMENTS: 'yes'
217221
CTIMETESTS: 'no'
218222

219223
steps:
@@ -245,6 +249,7 @@ jobs:
245249
SCHNORRSIG: 'yes'
246250
MUSIG: 'yes'
247251
ELLSWIFT: 'yes'
252+
SILENTPAYMENTS: 'yes'
248253
CTIMETESTS: 'no'
249254
CC: ${{ matrix.cc }}
250255

@@ -287,6 +292,7 @@ jobs:
287292
SCHNORRSIG: 'yes'
288293
MUSIG: 'yes'
289294
ELLSWIFT: 'yes'
295+
SILENTPAYMENTS: 'yes'
290296
CTIMETESTS: 'no'
291297

292298
steps:
@@ -348,6 +354,7 @@ jobs:
348354
SCHNORRSIG: 'yes'
349355
MUSIG: 'yes'
350356
ELLSWIFT: 'yes'
357+
SILENTPAYMENTS: 'yes'
351358
CTIMETESTS: 'no'
352359
SECP256K1_TEST_ITERS: 2
353360

@@ -387,6 +394,7 @@ jobs:
387394
SCHNORRSIG: 'yes'
388395
MUSIG: 'yes'
389396
ELLSWIFT: 'yes'
397+
SILENTPAYMENTS: 'yes'
390398
CTIMETESTS: 'no'
391399
CFLAGS: '-fsanitize=undefined,address -g'
392400
UBSAN_OPTIONS: 'print_stacktrace=1:halt_on_error=1'
@@ -440,6 +448,7 @@ jobs:
440448
SCHNORRSIG: 'yes'
441449
MUSIG: 'yes'
442450
ELLSWIFT: 'yes'
451+
SILENTPAYMENTS: 'yes'
443452
CC: 'clang'
444453
SECP256K1_TEST_ITERS: 32
445454
ASM: 'no'
@@ -476,6 +485,7 @@ jobs:
476485
SCHNORRSIG: 'yes'
477486
MUSIG: 'yes'
478487
ELLSWIFT: 'yes'
488+
SILENTPAYMENTS: 'yes'
479489
CTIMETESTS: 'no'
480490

481491
strategy:
@@ -519,14 +529,14 @@ jobs:
519529
fail-fast: false
520530
matrix:
521531
env_vars:
522-
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
532+
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
523533
- { WIDEMUL: 'int128_struct', ECMULTGENKB: 2, ECMULTWINDOW: 4 }
524-
- { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
534+
- { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
525535
- { WIDEMUL: 'int128', RECOVERY: 'yes' }
526-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
527-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc' }
528-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', WRAPPER_CMD: 'valgrind --error-exitcode=42', SECP256K1_TEST_ITERS: 2 }
529-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc', WRAPPER_CMD: 'valgrind --error-exitcode=42', SECP256K1_TEST_ITERS: 2 }
536+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
537+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes', CC: 'gcc' }
538+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes', WRAPPER_CMD: 'valgrind --error-exitcode=42', SECP256K1_TEST_ITERS: 2 }
539+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes', CC: 'gcc', WRAPPER_CMD: 'valgrind --error-exitcode=42', SECP256K1_TEST_ITERS: 2 }
530540
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', CPPFLAGS: '-DVERIFY', CTIMETESTS: 'no' }
531541
- BUILD: 'distcheck'
532542

@@ -573,13 +583,13 @@ jobs:
573583
fail-fast: false
574584
matrix:
575585
env_vars:
576-
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
586+
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
577587
- { WIDEMUL: 'int128_struct', ECMULTGENPRECISION: 2, ECMULTWINDOW: 4 }
578-
- { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
588+
- { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
579589
- { WIDEMUL: 'int128', RECOVERY: 'yes' }
580-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
581-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc' }
582-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', CPPFLAGS: '-DVERIFY' }
590+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
591+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes', CC: 'gcc' }
592+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes', CPPFLAGS: '-DVERIFY' }
583593
- BUILD: 'distcheck'
584594

585595
steps:
@@ -697,6 +707,7 @@ jobs:
697707
SCHNORRSIG: 'yes'
698708
MUSIG: 'yes'
699709
ELLSWIFT: 'yes'
710+
SILENTPAYMENTS: 'yes'
700711

701712
steps:
702713
- name: Checkout

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ ecdsa_example
1212
schnorr_example
1313
ellswift_example
1414
musig_example
15+
silentpayments_example
1516
*.exe
1617
*.so
1718
*.a

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@ set(CMAKE_C_EXTENSIONS OFF)
3434
#=============================
3535
# Configurable options
3636
#=============================
37-
option(BUILD_SHARED_LIBS "Build shared libraries." ON)
38-
option(SECP256K1_DISABLE_SHARED "Disable shared library. Overrides BUILD_SHARED_LIBS." OFF)
39-
if(SECP256K1_DISABLE_SHARED)
40-
set(BUILD_SHARED_LIBS OFF)
37+
if(libsecp256k1_IS_TOP_LEVEL)
38+
option(BUILD_SHARED_LIBS "Build shared libraries." ON)
4139
endif()
4240

4341
option(SECP256K1_INSTALL "Enable installation." ${PROJECT_IS_TOP_LEVEL})
@@ -54,6 +52,7 @@ option(SECP256K1_ENABLE_MODULE_EXTRAKEYS "Enable extrakeys module." ON)
5452
option(SECP256K1_ENABLE_MODULE_SCHNORRSIG "Enable schnorrsig module." ON)
5553
option(SECP256K1_ENABLE_MODULE_MUSIG "Enable musig module." ON)
5654
option(SECP256K1_ENABLE_MODULE_ELLSWIFT "Enable ElligatorSwift module." ON)
55+
option(SECP256K1_ENABLE_MODULE_SILENTPAYMENTS "Enable Silent Payments module." ON)
5756

5857
option(SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS "Enable external default callback functions." OFF)
5958
if(SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS)
@@ -287,6 +286,7 @@ message(" extrakeys ........................... ${SECP256K1_ENABLE_MODULE_EXTRA
287286
message(" schnorrsig .......................... ${SECP256K1_ENABLE_MODULE_SCHNORRSIG}")
288287
message(" musig ............................... ${SECP256K1_ENABLE_MODULE_MUSIG}")
289288
message(" ElligatorSwift ...................... ${SECP256K1_ENABLE_MODULE_ELLSWIFT}")
289+
message(" Silent Payments ..................... ${SECP256K1_ENABLE_MODULE_SILENTPAYMENTS}")
290290
message("Parameters:")
291291
message(" ecmult window size .................. ${SECP256K1_ECMULT_WINDOW_SIZE}")
292292
message(" ecmult gen table size ............... ${SECP256K1_ECMULT_GEN_KB} KiB")

CONTRIBUTING.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,14 @@ Run the tests:
9292

9393
To create a report, `gcovr` is recommended, as it includes branch coverage reporting:
9494

95-
$ gcovr --exclude 'src/bench*' --print-summary
95+
$ gcovr --gcov-ignore-parse-errors=all --merge-mode-functions=separate --exclude 'src/bench*' --exclude 'src/modules/.*/bench_impl.h' --print-summary
9696

9797
To create a HTML report with coloured and annotated source code:
9898

9999
$ mkdir -p coverage
100-
$ gcovr --exclude 'src/bench*' --html --html-details -o coverage/coverage.html
100+
$ gcovr --gcov-ignore-parse-errors=all --merge-mode-functions=separate --exclude 'src/bench*' --exclude 'src/modules/.*/bench_impl.h' --html --html-details -o coverage/coverage.html
101+
102+
On `gcovr` >=8.3, `--gcov-ignore-parse-errors=all` can be replaced with `--gcov-suspicious-hits-threshold=140737488355330`.
101103

102104
#### Exhaustive tests
103105

Makefile.am

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,17 @@ musig_example_LDFLAGS += -lbcrypt
207207
endif
208208
TESTS += musig_example
209209
endif
210+
if ENABLE_MODULE_SILENTPAYMENTS
211+
noinst_PROGRAMS += silentpayments_example
212+
silentpayments_example_SOURCES = examples/silentpayments.c
213+
silentpayments_example_CPPFLAGS = -I$(top_srcdir)/include -DSECP256K1_STATIC
214+
silentpayments_example_LDADD = libsecp256k1.la
215+
silentpayments_example_LDFLAGS = -static
216+
if BUILD_WINDOWS
217+
silentpayments_example_LDFLAGS += -lbcrypt
218+
endif
219+
TESTS += silentpayments_example
220+
endif
210221
endif
211222

212223
### Precomputed tables
@@ -249,6 +260,7 @@ maintainer-clean-local: clean-precomp
249260
### Pregenerated test vectors
250261
### (see the comments in the previous section for detailed rationale)
251262
TESTVECTORS = src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.h
263+
TESTVECTORS += src/modules/silentpayments/vectors.h
252264

253265
if ENABLE_MODULE_ECDH
254266
TESTVECTORS += src/wycheproof/ecdh_secp256k1_test.h
@@ -262,6 +274,10 @@ src/wycheproof/ecdh_secp256k1_test.h:
262274
mkdir -p $(@D)
263275
python3 $(top_srcdir)/tools/tests_wycheproof_generate_ecdh.py $(top_srcdir)/src/wycheproof/ecdh_secp256k1_test.json > $@
264276

277+
src/modules/silentpayments/vectors.h:
278+
mkdir -p $(@D)
279+
python3 $(top_srcdir)/tools/tests_silentpayments_generate.py $(top_srcdir)/src/modules/silentpayments/bip352_send_and_receive_test_vectors.json > $@
280+
265281
testvectors: $(TESTVECTORS)
266282

267283
BUILT_SOURCES += $(TESTVECTORS)
@@ -311,3 +327,7 @@ endif
311327
if ENABLE_MODULE_ELLSWIFT
312328
include src/modules/ellswift/Makefile.am.include
313329
endif
330+
331+
if ENABLE_MODULE_SILENTPAYMENTS
332+
include src/modules/silentpayments/Makefile.am.include
333+
endif

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Features:
2222
* Optional module for Schnorr signatures according to [BIP-340](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki).
2323
* Optional module for ElligatorSwift key exchange according to [BIP-324](https://github.com/bitcoin/bips/blob/master/bip-0324.mediawiki).
2424
* Optional module for MuSig2 Schnorr multi-signatures according to [BIP-327](https://github.com/bitcoin/bips/blob/master/bip-0327.mediawiki).
25+
* Optional module for Silent Payments sending and receiving according to [BIP-352](https://github.com/bitcoin/bips/blob/master/bip-0352.mediawiki).
2526

2627
Implementation details
2728
----------------------
@@ -152,6 +153,7 @@ Usage examples can be found in the [examples](examples) directory. To compile th
152153
* [Deriving a shared secret (ECDH) example](examples/ecdh.c)
153154
* [ElligatorSwift key exchange example](examples/ellswift.c)
154155
* [MuSig2 Schnorr multi-signatures example](examples/musig.c)
156+
* [Silent Payments send and receive example](examples/silentpayments.c)
155157
156158
To compile the examples, make sure the corresponding modules are enabled.
157159

ci/ci.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ print_environment() {
1313
# does not rely on bash.
1414
for var in WERROR_CFLAGS MAKEFLAGS BUILD \
1515
ECMULTWINDOW ECMULTGENKB ASM WIDEMUL WITH_VALGRIND EXTRAFLAGS \
16-
EXPERIMENTAL ECDH RECOVERY EXTRAKEYS MUSIG SCHNORRSIG ELLSWIFT \
16+
EXPERIMENTAL ECDH RECOVERY EXTRAKEYS MUSIG SCHNORRSIG ELLSWIFT SILENTPAYMENTS \
1717
SECP256K1_TEST_ITERS BENCH SECP256K1_BENCH_ITERS CTIMETESTS SYMBOL_CHECK \
1818
EXAMPLES \
1919
HOST WRAPPER_CMD \
@@ -80,6 +80,7 @@ esac
8080
--enable-module-extrakeys="$EXTRAKEYS" \
8181
--enable-module-schnorrsig="$SCHNORRSIG" \
8282
--enable-module-musig="$MUSIG" \
83+
--enable-module-silentpayments="$SILENTPAYMENTS" \
8384
--enable-examples="$EXAMPLES" \
8485
--enable-ctime-tests="$CTIMETESTS" \
8586
--with-valgrind="$WITH_VALGRIND" \

ci/linux-debian.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ RUN dpkg --add-architecture i386 && \
1919
dpkg --add-architecture arm64 && \
2020
dpkg --add-architecture ppc64el
2121

22-
# dkpg-dev: to make pkg-config work in cross-builds
22+
# dpkg-dev: to make pkg-config work in cross-builds
2323
# llvm: for llvm-symbolizer, which is used by clang's UBSan for symbolized stack traces
2424
RUN apt-get update && apt-get install --no-install-recommends -y \
2525
git ca-certificates \

configure.ac

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ AC_ARG_ENABLE(benchmark,
144144
[SECP_SET_DEFAULT([enable_benchmark], [yes], [yes])])
145145

146146
AC_ARG_ENABLE(coverage,
147-
AS_HELP_STRING([--enable-coverage],[enable compiler flags to support kcov coverage analysis [default=no]]), [],
147+
AS_HELP_STRING([--enable-coverage],[enable coverage analysis support [default=no]]), [],
148148
[SECP_SET_DEFAULT([enable_coverage], [no], [no])])
149149

150150
AC_ARG_ENABLE(tests,
@@ -191,6 +191,10 @@ AC_ARG_ENABLE(module_ellswift,
191191
AS_HELP_STRING([--enable-module-ellswift],[enable ElligatorSwift module [default=yes]]), [],
192192
[SECP_SET_DEFAULT([enable_module_ellswift], [yes], [yes])])
193193

194+
AC_ARG_ENABLE(module_silentpayments,
195+
AS_HELP_STRING([--enable-module-silentpayments],[enable Silent Payments module [default=yes]]), [],
196+
[SECP_SET_DEFAULT([enable_module_silentpayments], [yes], [yes])])
197+
194198
AC_ARG_ENABLE(external_default_callbacks,
195199
AS_HELP_STRING([--enable-external-default-callbacks],[enable external default callback functions [default=no]]), [],
196200
[SECP_SET_DEFAULT([enable_external_default_callbacks], [no], [no])])
@@ -397,6 +401,14 @@ SECP_CFLAGS="$SECP_CFLAGS $WERROR_CFLAGS"
397401

398402
# Processing must be done in a reverse topological sorting of the dependency graph
399403
# (dependent module first).
404+
if test x"$enable_module_silentpayments" = x"yes"; then
405+
if test x"$enable_module_schnorrsig" = x"no"; then
406+
AC_MSG_ERROR([Module dependency error: You have disabled the schnorrsig module explicitly, but it is required by the silentpayments module.])
407+
fi
408+
enable_module_schnorrsig=yes
409+
SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_SILENTPAYMENTS=1"
410+
fi
411+
400412
if test x"$enable_module_ellswift" = x"yes"; then
401413
SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_ELLSWIFT=1"
402414
fi
@@ -462,6 +474,7 @@ AM_CONDITIONAL([ENABLE_MODULE_EXTRAKEYS], [test x"$enable_module_extrakeys" = x"
462474
AM_CONDITIONAL([ENABLE_MODULE_SCHNORRSIG], [test x"$enable_module_schnorrsig" = x"yes"])
463475
AM_CONDITIONAL([ENABLE_MODULE_MUSIG], [test x"$enable_module_musig" = x"yes"])
464476
AM_CONDITIONAL([ENABLE_MODULE_ELLSWIFT], [test x"$enable_module_ellswift" = x"yes"])
477+
AM_CONDITIONAL([ENABLE_MODULE_SILENTPAYMENTS], [test x"$enable_module_silentpayments" = x"yes"])
465478
AM_CONDITIONAL([USE_EXTERNAL_ASM], [test x"$enable_external_asm" = x"yes"])
466479
AM_CONDITIONAL([USE_ASM_ARM], [test x"$set_asm" = x"arm32"])
467480
AM_CONDITIONAL([BUILD_WINDOWS], [test "$build_windows" = "yes"])
@@ -486,6 +499,7 @@ echo " module extrakeys = $enable_module_extrakeys"
486499
echo " module schnorrsig = $enable_module_schnorrsig"
487500
echo " module musig = $enable_module_musig"
488501
echo " module ellswift = $enable_module_ellswift"
502+
echo " module silentpayments = $enable_module_silentpayments"
489503
echo
490504
echo " asm = $set_asm"
491505
echo " ecmult window size = $set_ecmult_window"

examples/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,7 @@ endif()
2929
if(SECP256K1_ENABLE_MODULE_MUSIG)
3030
add_example(musig)
3131
endif()
32+
33+
if(SECP256K1_ENABLE_MODULE_SILENTPAYMENTS)
34+
add_example(silentpayments)
35+
endif()

0 commit comments

Comments
 (0)