Skip to content

Commit 497f153

Browse files
committed
Squashed 'src/secp256k1/' changes from 4187a46649..c0db6509bd
c0db6509bd docs: update README 8339232b7e ci: enable silentpayments module 635745fc3a tests: add constant time tests b1de2ee2f7 tests: add BIP-352 test vectors aea372837f silentpayments: add benchmarks for scanning 1ec7857aed silentpayments: add examples/silentpayments.c c9bec084eb silentpayments: receiving 28fd17d7c4 silentpayments: recipient label support 065e8b7793 silentpayments: sending a6d8b11754 build: add skeleton for new silentpayments (BIP352) module 6274359346 bench: add ellswift to bench help output 0258186573 configure: Show exhaustive tests in summary 53b578d10b include: remove WARN_UNUSED_RESULT for functions always returning 1 f75c985604 ci: Fix exiting from ci.sh on error 947761b842 tests: remove unused uncounting_illegal_callback_fn 5d01f375c6 build: Drop no longer needed `-fvisibility=hidden` compiler option dbf1e95d2a ci: Run `tools/symbol-check.py` 8174c88f47 test: Add `tools/symbol-check.py` 8a287f9a32 Introduce `SECP256K1_LOCAL_VAR` macro 7106544a16 Remove deprecated _ec_privkey_{negate,tweak_add,tweak_mul} aliases 1e2da62eff gha: Print all *.log files, in a separate action REVERT: 4187a46649 Merge bitcoin-core/secp256k1#1492: tests: Add Wycheproof ECDH vectors REVERT: e266ba11ae tests: Add Wycheproof ECDH vectors REVERT: 13906b7154 Merge bitcoin-core/secp256k1#1669: gitignore: Add Python cache files REVERT: c1bcb03276 gitignore: Add Python cache files REVERT: 70f149b9a1 Merge bitcoin-core/secp256k1#1662: bench: add ellswift to bench help output REVERT: 6b3fe51fb6 bench: add ellswift to bench help output REVERT: d84bb83e26 Merge bitcoin-core/secp256k1#1661: configure: Show exhaustive tests in summary REVERT: 3f54ed8c1b Merge bitcoin-core/secp256k1#1659: include: remove WARN_UNUSED_RESULT for functions always returning 1 REVERT: 20b05c9d3f configure: Show exhaustive tests in summary REVERT: e56716a3bc Merge bitcoin-core/secp256k1#1660: ci: Fix exiting from ci.sh on error REVERT: d87c3bc58f ci: Fix exiting from ci.sh on error REVERT: 1b6e081538 include: remove WARN_UNUSED_RESULT for functions always returning 1 REVERT: 2abb35b034 Merge bitcoin-core/secp256k1#1657: tests: remove unused uncounting_illegal_callback_fn REVERT: 51907fa918 tests: remove unused uncounting_illegal_callback_fn REVERT: a7a5117144 Merge bitcoin-core/secp256k1#1359: Fix symbol visibility issues, add test for it REVERT: 13ed6f65dc Merge bitcoin-core/secp256k1#1593: Remove deprecated `_ec_privkey_{negate,tweak_add,tweak_mul}` aliases from API REVERT: d1478763a5 build: Drop no longer needed `-fvisibility=hidden` compiler option REVERT: 8ed1d83d92 ci: Run `tools/symbol-check.py` REVERT: 41d32ab2de test: Add `tools/symbol-check.py` REVERT: 88548058b3 Introduce `SECP256K1_LOCAL_VAR` macro REVERT: 03bbe8c615 Merge bitcoin-core/secp256k1#1655: gha: Print all *.log files, in a separate action REVERT: 59860bcc24 gha: Print all *.log files, in a separate action REVERT: 37d2c60bec Remove deprecated _ec_privkey_{negate,tweak_add,tweak_mul} aliases git-subtree-dir: src/secp256k1 git-subtree-split: c0db6509bd2cb0777ce0d335e2582f74364fb8ec
1 parent c31fcaa commit 497f153

33 files changed

+9999
-10709
lines changed

.cirrus.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ env:
2424
SCHNORRSIG: no
2525
MUSIG: no
2626
ELLSWIFT: no
27+
SILENTPAYMENTS: no
2728
### test options
2829
SECP256K1_TEST_ITERS: 64
2930
BENCH: yes
@@ -75,6 +76,7 @@ task:
7576
SCHNORRSIG: yes
7677
MUSIG: yes
7778
ELLSWIFT: yes
79+
SILENTPAYMENTS: yes
7880
matrix:
7981
# Currently only gcc-snapshot, the other compilers are tested on GHA with QEMU
8082
- env: { CC: 'gcc-snapshot' }
@@ -93,6 +95,7 @@ task:
9395
SCHNORRSIG: yes
9496
MUSIG: yes
9597
ELLSWIFT: yes
98+
SILENTPAYMENTS: yes
9699
WRAPPER_CMD: 'valgrind --error-exitcode=42'
97100
SECP256K1_TEST_ITERS: 2
98101
matrix:

.github/workflows/ci.yml

Lines changed: 21 additions & 10 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'
@@ -74,18 +75,18 @@ jobs:
7475
matrix:
7576
configuration:
7677
- env_vars: { WIDEMUL: 'int64', RECOVERY: 'yes' }
77-
- env_vars: { WIDEMUL: 'int64', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
78+
- env_vars: { WIDEMUL: 'int64', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
7879
- env_vars: { WIDEMUL: 'int128' }
7980
- env_vars: { WIDEMUL: 'int128_struct', ELLSWIFT: 'yes' }
8081
- env_vars: { WIDEMUL: 'int128', RECOVERY: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
81-
- env_vars: { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes' }
82+
- env_vars: { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', SILENTPAYMENTS: 'yes' }
8283
- env_vars: { WIDEMUL: 'int128', ASM: 'x86_64', ELLSWIFT: 'yes' }
8384
- env_vars: { RECOVERY: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes' }
84-
- env_vars: { CTIMETESTS: 'no', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', CPPFLAGS: '-DVERIFY' }
85+
- env_vars: { CTIMETESTS: 'no', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', SILENTPAYMENTS: 'yes', CPPFLAGS: '-DVERIFY' }
8586
- env_vars: { BUILD: 'distcheck', WITH_VALGRIND: 'no', CTIMETESTS: 'no', BENCH: 'no' }
8687
- env_vars: { CPPFLAGS: '-DDETERMINISTIC' }
8788
- env_vars: { CFLAGS: '-O0', CTIMETESTS: 'no' }
88-
- env_vars: { CFLAGS: '-O1', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
89+
- env_vars: { CFLAGS: '-O1', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
8990
- env_vars: { ECMULTGENKB: 2, ECMULTWINDOW: 2 }
9091
- env_vars: { ECMULTGENKB: 86, ECMULTWINDOW: 4 }
9192
cc:
@@ -132,6 +133,7 @@ jobs:
132133
SCHNORRSIG: 'yes'
133134
MUSIG: 'yes'
134135
ELLSWIFT: 'yes'
136+
SILENTPAYMENTS: 'yes'
135137
CC: ${{ matrix.cc }}
136138

137139
steps:
@@ -164,6 +166,7 @@ jobs:
164166
SCHNORRSIG: 'yes'
165167
MUSIG: 'yes'
166168
ELLSWIFT: 'yes'
169+
SILENTPAYMENTS: 'yes'
167170
CTIMETESTS: 'no'
168171

169172
steps:
@@ -204,6 +207,7 @@ jobs:
204207
SCHNORRSIG: 'yes'
205208
MUSIG: 'yes'
206209
ELLSWIFT: 'yes'
210+
SILENTPAYMENTS: 'yes'
207211
CTIMETESTS: 'no'
208212

209213
steps:
@@ -237,6 +241,7 @@ jobs:
237241
SCHNORRSIG: 'yes'
238242
MUSIG: 'yes'
239243
ELLSWIFT: 'yes'
244+
SILENTPAYMENTS: 'yes'
240245
CTIMETESTS: 'no'
241246

242247
strategy:
@@ -280,6 +285,7 @@ jobs:
280285
SCHNORRSIG: 'yes'
281286
MUSIG: 'yes'
282287
ELLSWIFT: 'yes'
288+
SILENTPAYMENTS: 'yes'
283289
CTIMETESTS: 'no'
284290

285291
steps:
@@ -321,6 +327,7 @@ jobs:
321327
SCHNORRSIG: 'yes'
322328
MUSIG: 'yes'
323329
ELLSWIFT: 'yes'
330+
SILENTPAYMENTS: 'yes'
324331
CTIMETESTS: 'no'
325332
SECP256K1_TEST_ITERS: 2
326333

@@ -360,6 +367,7 @@ jobs:
360367
SCHNORRSIG: 'yes'
361368
MUSIG: 'yes'
362369
ELLSWIFT: 'yes'
370+
SILENTPAYMENTS: 'yes'
363371
CTIMETESTS: 'no'
364372
CFLAGS: '-fsanitize=undefined,address -g'
365373
UBSAN_OPTIONS: 'print_stacktrace=1:halt_on_error=1'
@@ -413,6 +421,7 @@ jobs:
413421
SCHNORRSIG: 'yes'
414422
MUSIG: 'yes'
415423
ELLSWIFT: 'yes'
424+
SILENTPAYMENTS: 'yes'
416425
CC: 'clang'
417426
SECP256K1_TEST_ITERS: 32
418427
ASM: 'no'
@@ -449,6 +458,7 @@ jobs:
449458
SCHNORRSIG: 'yes'
450459
MUSIG: 'yes'
451460
ELLSWIFT: 'yes'
461+
SILENTPAYMENTS: 'yes'
452462
CTIMETESTS: 'no'
453463

454464
strategy:
@@ -492,14 +502,14 @@ jobs:
492502
fail-fast: false
493503
matrix:
494504
env_vars:
495-
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
505+
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
496506
- { WIDEMUL: 'int128_struct', ECMULTGENKB: 2, ECMULTWINDOW: 4 }
497-
- { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
507+
- { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
498508
- { WIDEMUL: 'int128', RECOVERY: 'yes' }
499-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
500-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc' }
501-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', WRAPPER_CMD: 'valgrind --error-exitcode=42', SECP256K1_TEST_ITERS: 2 }
502-
- { 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 }
509+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
510+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes', CC: 'gcc' }
511+
- { 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 }
512+
- { 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 }
503513
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', CPPFLAGS: '-DVERIFY', CTIMETESTS: 'no' }
504514
- BUILD: 'distcheck'
505515

@@ -669,6 +679,7 @@ jobs:
669679
SCHNORRSIG: 'yes'
670680
MUSIG: 'yes'
671681
ELLSWIFT: 'yes'
682+
SILENTPAYMENTS: 'yes'
672683

673684
steps:
674685
- name: Checkout

.gitignore

Lines changed: 1 addition & 4 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
@@ -65,7 +66,3 @@ libsecp256k1.pc
6566
/CMakeUserPresets.json
6667
# Default CMake build directory.
6768
/build
68-
69-
### Python
70-
__pycache__/
71-
*.py[oc]

CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,22 @@ option(SECP256K1_ENABLE_MODULE_EXTRAKEYS "Enable extrakeys module." ON)
6262
option(SECP256K1_ENABLE_MODULE_SCHNORRSIG "Enable schnorrsig module." ON)
6363
option(SECP256K1_ENABLE_MODULE_MUSIG "Enable musig module." ON)
6464
option(SECP256K1_ENABLE_MODULE_ELLSWIFT "Enable ElligatorSwift module." ON)
65+
option(SECP256K1_ENABLE_MODULE_SILENTPAYMENTS "Enable Silent Payments module." ON)
6566

6667
# Processing must be done in a topological sorting of the dependency graph
6768
# (dependent module first).
69+
if(SECP256K1_ENABLE_MODULE_SILENTPAYMENTS)
70+
if(DEFINED SECP256K1_ENABLE_MODULE_SCHNORRSIG AND NOT SECP256K1_ENABLE_MODULE_SCHNORRSIG)
71+
message(FATAL_ERROR "Module dependency error: You have disabled the schnorrsig module explicitly, but it is required by the silentpayments module.")
72+
endif()
73+
if(DEFINED SECP256K1_ENABLE_MODULE_EXTRAKEYS AND NOT SECP256K1_ENABLE_MODULE_EXTRAKEYS)
74+
message(FATAL_ERROR "Module dependency error: You have disabled the extrakeys module explicitly, but it is required by the silentpayments module.")
75+
endif()
76+
set(SECP256K1_ENABLE_MODULE_EXTRAKEYS ON)
77+
set(SECP256K1_ENABLE_MODULE_SCHNORRSIG ON)
78+
add_compile_definitions(ENABLE_MODULE_SILENTPAYMENTS=1)
79+
endif()
80+
6881
if(SECP256K1_ENABLE_MODULE_ELLSWIFT)
6982
add_compile_definitions(ENABLE_MODULE_ELLSWIFT=1)
7083
endif()
@@ -329,6 +342,7 @@ message(" extrakeys ........................... ${SECP256K1_ENABLE_MODULE_EXTRA
329342
message(" schnorrsig .......................... ${SECP256K1_ENABLE_MODULE_SCHNORRSIG}")
330343
message(" musig ............................... ${SECP256K1_ENABLE_MODULE_MUSIG}")
331344
message(" ElligatorSwift ...................... ${SECP256K1_ENABLE_MODULE_ELLSWIFT}")
345+
message(" Silent Payments ..................... ${SECP256K1_ENABLE_MODULE_SILENTPAYMENTS}")
332346
message("Parameters:")
333347
message(" ecmult window size .................. ${SECP256K1_ECMULT_WINDOW_SIZE}")
334348
message(" ecmult gen table size ............... ${SECP256K1_ECMULT_GEN_KB} KiB")

Makefile.am

Lines changed: 20 additions & 10 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,18 +260,15 @@ 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
252-
253-
if ENABLE_MODULE_ECDH
254-
TESTVECTORS += src/wycheproof/ecdh_secp256k1_test.h
255-
endif
263+
TESTVECTORS += src/modules/silentpayments/vectors.h
256264

257265
src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.h:
258266
mkdir -p $(@D)
259-
python3 $(top_srcdir)/tools/tests_wycheproof_generate_ecdsa.py $(top_srcdir)/src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.json > $@
267+
python3 $(top_srcdir)/tools/tests_wycheproof_generate.py $(top_srcdir)/src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.json > $@
260268

261-
src/wycheproof/ecdh_secp256k1_test.h:
269+
src/modules/silentpayments/vectors.h:
262270
mkdir -p $(@D)
263-
python3 $(top_srcdir)/tools/tests_wycheproof_generate_ecdh.py $(top_srcdir)/src/wycheproof/ecdh_secp256k1_test.json > $@
271+
python3 $(top_srcdir)/tools/tests_silentpayments_generate.py $(top_srcdir)/src/modules/silentpayments/bip352_send_and_receive_test_vectors.json > $@
264272

265273
testvectors: $(TESTVECTORS)
266274

@@ -284,9 +292,7 @@ EXTRA_DIST += sage/secp256k1_params.sage
284292
EXTRA_DIST += sage/weierstrass_prover.sage
285293
EXTRA_DIST += src/wycheproof/WYCHEPROOF_COPYING
286294
EXTRA_DIST += src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.json
287-
EXTRA_DIST += src/wycheproof/ecdh_secp256k1_test.json
288-
EXTRA_DIST += tools/tests_wycheproof_generate_ecdsa.py
289-
EXTRA_DIST += tools/tests_wycheproof_generate_ecdh.py
295+
EXTRA_DIST += tools/tests_wycheproof_generate.py
290296

291297
if ENABLE_MODULE_ECDH
292298
include src/modules/ecdh/Makefile.am.include
@@ -311,3 +317,7 @@ endif
311317
if ENABLE_MODULE_ELLSWIFT
312318
include src/modules/ellswift/Makefile.am.include
313319
endif
320+
321+
if ENABLE_MODULE_SILENTPAYMENTS
322+
include src/modules/silentpayments/Makefile.am.include
323+
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 send and receive according to [BIP-352](https://github.com/bitcoin/bips/blob/master/bip-0352.mediawiki).
2526

2627
Implementation details
2728
----------------------
@@ -151,6 +152,7 @@ Usage examples can be found in the [examples](examples) directory. To compile th
151152
* [Schnorr signatures example](examples/schnorr.c)
152153
* [Deriving a shared secret (ECDH) example](examples/ecdh.c)
153154
* [ElligatorSwift key exchange example](examples/ellswift.c)
155+
* [Silent Payments send and receive example](examples/silentpayments.c)
154156
155157
To compile the Schnorr signature and ECDH examples, you also need to configure with `--enable-module-schnorrsig` and `--enable-module-ecdh`.
156158

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" \

configure.ac

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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,19 @@ 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+
410+
if test x"$enable_module_extrakeys" = x"no"; then
411+
AC_MSG_ERROR([Module dependency error: You have disabled the extrakeys module explicitly, but it is required by the silentpayments module.])
412+
fi
413+
enable_module_extrakeys=yes
414+
SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_SILENTPAYMENTS=1"
415+
fi
416+
400417
if test x"$enable_module_ellswift" = x"yes"; then
401418
SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_ELLSWIFT=1"
402419
fi
@@ -462,6 +479,7 @@ AM_CONDITIONAL([ENABLE_MODULE_EXTRAKEYS], [test x"$enable_module_extrakeys" = x"
462479
AM_CONDITIONAL([ENABLE_MODULE_SCHNORRSIG], [test x"$enable_module_schnorrsig" = x"yes"])
463480
AM_CONDITIONAL([ENABLE_MODULE_MUSIG], [test x"$enable_module_musig" = x"yes"])
464481
AM_CONDITIONAL([ENABLE_MODULE_ELLSWIFT], [test x"$enable_module_ellswift" = x"yes"])
482+
AM_CONDITIONAL([ENABLE_MODULE_SILENTPAYMENTS], [test x"$enable_module_silentpayments" = x"yes"])
465483
AM_CONDITIONAL([USE_EXTERNAL_ASM], [test x"$enable_external_asm" = x"yes"])
466484
AM_CONDITIONAL([USE_ASM_ARM], [test x"$set_asm" = x"arm32"])
467485
AM_CONDITIONAL([BUILD_WINDOWS], [test "$build_windows" = "yes"])
@@ -486,6 +504,7 @@ echo " module extrakeys = $enable_module_extrakeys"
486504
echo " module schnorrsig = $enable_module_schnorrsig"
487505
echo " module musig = $enable_module_musig"
488506
echo " module ellswift = $enable_module_ellswift"
507+
echo " module silentpayments = $enable_module_silentpayments"
489508
echo
490509
echo " asm = $set_asm"
491510
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)