Skip to content

Commit d66ec60

Browse files
committed
Squashed 'src/secp256k1/' changes from d543c0d917..f96f41f24f
f96f41f24f docs: update README c86ef7b21b ci: enable silentpayments module 8454a44a69 tests: add sha256 tag test a0559f55aa tests: add constant time tests 0d085b8616 tests: add BIP-352 test vectors d5f93574b8 silentpayments: add benchmarks for scanning 8edb04dd23 silentpayments: add examples/silentpayments.c 8caf19c3ac silentpayments: receiving 913fdee7e1 silentpayments: recipient label support ffffd7ff98 silentpayments: sending 8256fb3f41 build: add skeleton for new silentpayments (BIP352) module e7f7083b53 Merge bitcoin-core/secp256k1#1774: refactor: split up internal pubkey serialization function into compressed/uncompressed variants b6c2a3cd77 Merge bitcoin-core/secp256k1#1761: ecmult_multi: reduce strauss memory usage by 30% f5e815f430 remove secp256k1_eckey_pubkey_serialize function 0d3659c547 use new `_eckey_pubkey_serialize{33,65}` functions in modules (ellswift,musig) adb76f82ea use new `_eckey_pubkey_serialize{33,65}` functions in public API fc7458ca3e introduce `secp256k1_eckey_pubkey_serialize{33,65}` functions c8206b1ce6 Merge bitcoin-core/secp256k1#1771: ci: Use Python virtual environment in "x86_64-macos-native" job f252da7e6e ci: Use Python virtual environment in "x86_64-macos-native" job 115b135fe8 Merge bitcoin-core/secp256k1#1763: bench: Use `ALIGNMENT` macro instead of hardcoded value 153eea20c2 bench: Use `ALIGNMENT` macro instead of hardcoded value 26166c4f5f ecmult_multi: reduce strauss memory usage by 30% 7a2fff85e8 Merge bitcoin-core/secp256k1#1758: ci: Drop workaround for Valgrind older than 3.20.0 43e7b115f7 Merge bitcoin-core/secp256k1#1759: ci: Switch to macOS 15 Sequoia Intel-based image 8bc50b72ff ci: Switch to macOS 15 Sequoia Intel-based image c09519f0e3 ci: Drop workaround for Valgrind older than 3.20.0 git-subtree-dir: src/secp256k1 git-subtree-split: f96f41f24f8a43384e57a04d1cb73798c579b59a
1 parent 3cbf7cb commit d66ec60

30 files changed

+7995
-146
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 30 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'
@@ -83,18 +84,18 @@ jobs:
8384
matrix:
8485
configuration:
8586
- env_vars: { WIDEMUL: 'int64', RECOVERY: 'yes' }
86-
- env_vars: { WIDEMUL: 'int64', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
87+
- env_vars: { WIDEMUL: 'int64', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
8788
- env_vars: { WIDEMUL: 'int128' }
8889
- env_vars: { WIDEMUL: 'int128_struct', ELLSWIFT: 'yes' }
8990
- env_vars: { WIDEMUL: 'int128', RECOVERY: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
90-
- env_vars: { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes' }
91+
- env_vars: { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', SILENTPAYMENTS: 'yes' }
9192
- env_vars: { WIDEMUL: 'int128', ASM: 'x86_64', ELLSWIFT: 'yes' }
9293
- env_vars: { RECOVERY: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes' }
93-
- env_vars: { CTIMETESTS: 'no', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', CPPFLAGS: '-DVERIFY' }
94+
- env_vars: { CTIMETESTS: 'no', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', SILENTPAYMENTS: 'yes', CPPFLAGS: '-DVERIFY' }
9495
- env_vars: { BUILD: 'distcheck', WITH_VALGRIND: 'no', CTIMETESTS: 'no', BENCH: 'no' }
9596
- env_vars: { CPPFLAGS: '-DDETERMINISTIC' }
9697
- env_vars: { CFLAGS: '-O0', CTIMETESTS: 'no' }
97-
- env_vars: { CFLAGS: '-O1', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
98+
- env_vars: { CFLAGS: '-O1', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
9899
- env_vars: { ECMULTGENKB: 2, ECMULTWINDOW: 2 }
99100
- env_vars: { ECMULTGENKB: 86, ECMULTWINDOW: 4 }
100101
cc:
@@ -146,6 +147,7 @@ jobs:
146147
SCHNORRSIG: 'yes'
147148
MUSIG: 'yes'
148149
ELLSWIFT: 'yes'
150+
SILENTPAYMENTS: 'yes'
149151
CC: ${{ matrix.cc }}
150152

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

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

209213
steps:
@@ -225,6 +229,7 @@ jobs:
225229
SCHNORRSIG: 'yes'
226230
MUSIG: 'yes'
227231
ELLSWIFT: 'yes'
232+
SILENTPAYMENTS: 'yes'
228233
CTIMETESTS: 'no'
229234
CC: ${{ matrix.cc }}
230235

@@ -265,6 +270,7 @@ jobs:
265270
SCHNORRSIG: 'yes'
266271
MUSIG: 'yes'
267272
ELLSWIFT: 'yes'
273+
SILENTPAYMENTS: 'yes'
268274
CTIMETESTS: 'no'
269275

270276
steps:
@@ -310,6 +316,7 @@ jobs:
310316
SCHNORRSIG: 'yes'
311317
MUSIG: 'yes'
312318
ELLSWIFT: 'yes'
319+
SILENTPAYMENTS: 'yes'
313320
CTIMETESTS: 'no'
314321
SECP256K1_TEST_ITERS: 2
315322

@@ -339,6 +346,7 @@ jobs:
339346
SCHNORRSIG: 'yes'
340347
MUSIG: 'yes'
341348
ELLSWIFT: 'yes'
349+
SILENTPAYMENTS: 'yes'
342350
CTIMETESTS: 'no'
343351
CFLAGS: '-fsanitize=undefined,address -g'
344352
UBSAN_OPTIONS: 'print_stacktrace=1:halt_on_error=1'
@@ -385,6 +393,7 @@ jobs:
385393
SCHNORRSIG: 'yes'
386394
MUSIG: 'yes'
387395
ELLSWIFT: 'yes'
396+
SILENTPAYMENTS: 'yes'
388397
CC: ${{ matrix.cc }}
389398
SECP256K1_TEST_ITERS: 32
390399
ASM: 'no'
@@ -410,6 +419,7 @@ jobs:
410419
SCHNORRSIG: 'yes'
411420
MUSIG: 'yes'
412421
ELLSWIFT: 'yes'
422+
SILENTPAYMENTS: 'yes'
413423
CTIMETESTS: 'no'
414424

415425
strategy:
@@ -429,9 +439,8 @@ jobs:
429439
- *PRINT_LOGS
430440

431441
x86_64-macos-native:
432-
name: "x86_64: macOS Ventura, Valgrind"
433-
# See: https://github.com/actions/runner-images#available-images.
434-
runs-on: macos-13
442+
name: "x86_64: macOS Sequoia, Valgrind"
443+
runs-on: macos-15-intel
435444

436445
env:
437446
CC: 'clang'
@@ -443,14 +452,14 @@ jobs:
443452
fail-fast: false
444453
matrix:
445454
env_vars:
446-
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
455+
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
447456
- { WIDEMUL: 'int128_struct', ECMULTGENKB: 2, ECMULTWINDOW: 4 }
448-
- { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
457+
- { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
449458
- { WIDEMUL: 'int128', RECOVERY: 'yes' }
450-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
451-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc' }
452-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', WRAPPER_CMD: 'valgrind --error-exitcode=42', SECP256K1_TEST_ITERS: 2 }
453-
- { 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 }
459+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
460+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes', CC: 'gcc' }
461+
- { 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 }
462+
- { 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 }
454463
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', CPPFLAGS: '-DVERIFY', CTIMETESTS: 'no' }
455464
- BUILD: 'distcheck'
456465

@@ -470,9 +479,14 @@ jobs:
470479
env: ${{ matrix.env_vars }}
471480
run: ./ci/ci.sh
472481

473-
- name: Symbol check
482+
- &SYMBOL_CHECK_MACOS
483+
name: Symbol check
484+
env:
485+
VIRTUAL_ENV: '${{ github.workspace }}/venv'
474486
run: |
475487
python3 --version
488+
python3 -m venv $VIRTUAL_ENV
489+
export PATH="$VIRTUAL_ENV/bin:$PATH"
476490
python3 -m pip install lief
477491
python3 ./tools/symbol-check.py .libs/libsecp256k1.dylib
478492
@@ -495,13 +509,13 @@ jobs:
495509
fail-fast: false
496510
matrix:
497511
env_vars:
498-
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
512+
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
499513
- { WIDEMUL: 'int128_struct', ECMULTGENPRECISION: 2, ECMULTWINDOW: 4 }
500-
- { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
514+
- { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
501515
- { WIDEMUL: 'int128', RECOVERY: 'yes' }
502-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
503-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc' }
504-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', CPPFLAGS: '-DVERIFY' }
516+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
517+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes', CC: 'gcc' }
518+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes', CPPFLAGS: '-DVERIFY' }
505519
- BUILD: 'distcheck'
506520

507521
steps:
@@ -513,17 +527,7 @@ jobs:
513527
ln -s $(brew --prefix gcc)/bin/gcc-?? /usr/local/bin/gcc
514528
515529
- *CI_SCRIPT_ON_HOST
516-
517-
- name: Symbol check
518-
env:
519-
VIRTUAL_ENV: '${{ github.workspace }}/venv'
520-
run: |
521-
python3 --version
522-
python3 -m venv $VIRTUAL_ENV
523-
export PATH="$VIRTUAL_ENV/bin:$PATH"
524-
python3 -m pip install lief
525-
python3 ./tools/symbol-check.py .libs/libsecp256k1.dylib
526-
530+
- *SYMBOL_CHECK_MACOS
527531
- *PRINT_LOGS
528532

529533
win64-native:
@@ -624,6 +628,7 @@ jobs:
624628
SCHNORRSIG: 'yes'
625629
MUSIG: 'yes'
626630
ELLSWIFT: 'yes'
631+
SILENTPAYMENTS: 'yes'
627632

628633
steps:
629634
- *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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ option(SECP256K1_ENABLE_MODULE_EXTRAKEYS "Enable extrakeys module." ON)
5252
option(SECP256K1_ENABLE_MODULE_SCHNORRSIG "Enable schnorrsig module." ON)
5353
option(SECP256K1_ENABLE_MODULE_MUSIG "Enable musig module." ON)
5454
option(SECP256K1_ENABLE_MODULE_ELLSWIFT "Enable ElligatorSwift module." ON)
55+
option(SECP256K1_ENABLE_MODULE_SILENTPAYMENTS "Enable Silent Payments module." ON)
5556

5657
option(SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS "Enable external default callback functions." OFF)
5758
if(SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS)
@@ -285,6 +286,7 @@ message(" extrakeys ........................... ${SECP256K1_ENABLE_MODULE_EXTRA
285286
message(" schnorrsig .......................... ${SECP256K1_ENABLE_MODULE_SCHNORRSIG}")
286287
message(" musig ............................... ${SECP256K1_ENABLE_MODULE_MUSIG}")
287288
message(" ElligatorSwift ...................... ${SECP256K1_ENABLE_MODULE_ELLSWIFT}")
289+
message(" Silent Payments ..................... ${SECP256K1_ENABLE_MODULE_SILENTPAYMENTS}")
288290
message("Parameters:")
289291
message(" ecmult window size .................. ${SECP256K1_ECMULT_WINDOW_SIZE}")
290292
message(" ecmult gen table size ............... ${SECP256K1_ECMULT_GEN_KB} KiB")

Makefile.am

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,17 @@ musig_example_LDFLAGS += -lbcrypt
210210
endif
211211
TESTS += musig_example
212212
endif
213+
if ENABLE_MODULE_SILENTPAYMENTS
214+
noinst_PROGRAMS += silentpayments_example
215+
silentpayments_example_SOURCES = examples/silentpayments.c
216+
silentpayments_example_CPPFLAGS = -I$(top_srcdir)/include -DSECP256K1_STATIC
217+
silentpayments_example_LDADD = libsecp256k1.la
218+
silentpayments_example_LDFLAGS = -static
219+
if BUILD_WINDOWS
220+
silentpayments_example_LDFLAGS += -lbcrypt
221+
endif
222+
TESTS += silentpayments_example
223+
endif
213224
endif
214225

215226
### Precomputed tables
@@ -252,6 +263,11 @@ maintainer-clean-local: clean-precomp
252263
### Pregenerated test vectors
253264
### (see the comments in the previous section for detailed rationale)
254265
TESTVECTORS = src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.h
266+
TESTVECTORS += src/modules/silentpayments/vectors.h
267+
268+
if ENABLE_MODULE_SILENTPAYMENTS
269+
TESTVECTORS += src/modules/silentpayments/vectors.h
270+
endif
255271

256272
if ENABLE_MODULE_ECDH
257273
TESTVECTORS += src/wycheproof/ecdh_secp256k1_test.h
@@ -265,6 +281,10 @@ src/wycheproof/ecdh_secp256k1_test.h:
265281
mkdir -p $(@D)
266282
python3 $(top_srcdir)/tools/tests_wycheproof_generate_ecdh.py $(top_srcdir)/src/wycheproof/ecdh_secp256k1_test.json > $@
267283

284+
src/modules/silentpayments/vectors.h:
285+
mkdir -p $(@D)
286+
python3 $(top_srcdir)/tools/tests_silentpayments_generate.py $(top_srcdir)/src/modules/silentpayments/bip352_send_and_receive_test_vectors.json > $@
287+
268288
testvectors: $(TESTVECTORS)
269289

270290
BUILT_SOURCES += $(TESTVECTORS)
@@ -314,3 +334,7 @@ endif
314334
if ENABLE_MODULE_ELLSWIFT
315335
include src/modules/ellswift/Makefile.am.include
316336
endif
337+
338+
if ENABLE_MODULE_SILENTPAYMENTS
339+
include src/modules/silentpayments/Makefile.am.include
340+
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
----------------------
@@ -150,6 +151,7 @@ Usage examples can be found in the [examples](examples) directory. To compile th
150151
* [Deriving a shared secret (ECDH) example](examples/ecdh.c)
151152
* [ElligatorSwift key exchange example](examples/ellswift.c)
152153
* [MuSig2 Schnorr multi-signatures example](examples/musig.c)
154+
* [Silent Payments send and receive example](examples/silentpayments.c)
153155
154156
To compile the examples, make sure the corresponding modules are enabled.
155157

ci/ci.sh

Lines changed: 2 additions & 17 deletions
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 \
@@ -52,22 +52,6 @@ if [ -n "$WRAPPER_CMD" ]; then
5252
$WRAPPER_CMD --version
5353
fi
5454

55-
# Workaround for https://bugs.kde.org/show_bug.cgi?id=452758 (fixed in valgrind 3.20.0).
56-
case "${CC:-undefined}" in
57-
clang*)
58-
if [ "$CTIMETESTS" = "yes" ] && [ "$WITH_VALGRIND" = "yes" ]
59-
then
60-
export CFLAGS="${CFLAGS:+$CFLAGS }-gdwarf-4"
61-
else
62-
case "$WRAPPER_CMD" in
63-
valgrind*)
64-
export CFLAGS="${CFLAGS:+$CFLAGS }-gdwarf-4"
65-
;;
66-
esac
67-
fi
68-
;;
69-
esac
70-
7155
./autogen.sh
7256

7357
./configure \
@@ -80,6 +64,7 @@ esac
8064
--enable-module-extrakeys="$EXTRAKEYS" \
8165
--enable-module-schnorrsig="$SCHNORRSIG" \
8266
--enable-module-musig="$MUSIG" \
67+
--enable-module-silentpayments="$SILENTPAYMENTS" \
8368
--enable-examples="$EXAMPLES" \
8469
--enable-ctime-tests="$CTIMETESTS" \
8570
--with-valgrind="$WITH_VALGRIND" \

configure.ac

Lines changed: 14 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,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
@@ -470,6 +482,7 @@ AM_CONDITIONAL([ENABLE_MODULE_EXTRAKEYS], [test x"$enable_module_extrakeys" = x"
470482
AM_CONDITIONAL([ENABLE_MODULE_SCHNORRSIG], [test x"$enable_module_schnorrsig" = x"yes"])
471483
AM_CONDITIONAL([ENABLE_MODULE_MUSIG], [test x"$enable_module_musig" = x"yes"])
472484
AM_CONDITIONAL([ENABLE_MODULE_ELLSWIFT], [test x"$enable_module_ellswift" = x"yes"])
485+
AM_CONDITIONAL([ENABLE_MODULE_SILENTPAYMENTS], [test x"$enable_module_silentpayments" = x"yes"])
473486
AM_CONDITIONAL([USE_EXTERNAL_ASM], [test x"$enable_external_asm" = x"yes"])
474487
AM_CONDITIONAL([USE_ASM_ARM], [test x"$set_asm" = x"arm32"])
475488
AM_CONDITIONAL([BUILD_WINDOWS], [test "$build_windows" = "yes"])
@@ -494,6 +507,7 @@ echo " module extrakeys = $enable_module_extrakeys"
494507
echo " module schnorrsig = $enable_module_schnorrsig"
495508
echo " module musig = $enable_module_musig"
496509
echo " module ellswift = $enable_module_ellswift"
510+
echo " module silentpayments = $enable_module_silentpayments"
497511
echo
498512
echo " asm = $set_asm"
499513
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)