Skip to content

Commit 5c425b5

Browse files
committed
Squashed 'src/secp256k1/' changes from 2f2ccc4695..4f64b9f4cd
4f64b9f4cd build: Drop no longer needed `-fvisibility=hidden` compiler option 5d978f1899 ci: Run `tools/symbol-check.py` 258dba9e11 test: Add `tools/symbol-check.py` 3144ba99f3 Introduce `SECP256K1_LOCAL_VAR` macro e2571385e0 Do not export `secp256k1_musig_nonce_gen_internal` e59158b6eb Merge bitcoin-core/secp256k1#1553: cmake: Set top-level target output locations 18f9b967c2 Merge bitcoin-core/secp256k1#1616: examples: do not retry generating seckey randomness in musig 5bab8f6d3c examples: make key generation doc consistent e8908221a4 examples: do not retry generating seckey randomness in musig 70b6be1834 extrakeys: improve doc of keypair_create (don't suggest retry) 01b5893389 Merge bitcoin-core/secp256k1#1599: bitcoin#1570 improve examples: remove key generation loop cd4f84f3ba Improve examples/documentation: remove key generation loops a88aa93506 Merge bitcoin-core/secp256k1#1603: f can never equal -m 3660fe5e2a Merge bitcoin-core/secp256k1#1479: Add module "musig" that implements MuSig2 multi-signatures (BIP 327) 168c92011f build: allow enabling the musig module in cmake f411841a46 Add module "musig" that implements MuSig2 multi-signatures (BIP 327) 0be79660f3 util: add constant-time is_zero_array function c8fbdb1b97 group: add ge_to_bytes_ext and ge_from_bytes_ext ef7ff03407 f can never equal -m c232486d84 Revert "cmake: Set `ENVIRONMENT` property for examples on Windows" 26e4a7c214 cmake: Set top-level target output locations 4c57c7a5a9 Merge bitcoin-core/secp256k1#1554: cmake: Clean up testing code 472faaa8ee Merge bitcoin-core/secp256k1#1604: doc: fix typos in `secp256k1_ecdsa_{recoverable_,}signature` API description 292310fbb2 doc: fix typos in `secp256k1_ecdsa_{recoverable_,}signature` API description 85e224dd97 group: add ge_to_bytes and ge_from_bytes 7c987ec89e cmake: Call `enable_testing()` unconditionally 6aa576515e cmake: Delete `CTest` module git-subtree-dir: src/secp256k1 git-subtree-split: 4f64b9f4cdf130d2c6d6b7bd855a04faf6f88e08
1 parent 6115628 commit 5c425b5

Some content is hidden

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

43 files changed

+4777
-125
lines changed

.cirrus.yml

+6
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ env:
2222
RECOVERY: no
2323
EXTRAKEYS: no
2424
SCHNORRSIG: no
25+
MUSIG: no
2526
ELLSWIFT: no
2627
### test options
2728
SECP256K1_TEST_ITERS:
2829
BENCH: yes
2930
SECP256K1_BENCH_ITERS: 2
3031
CTIMETESTS: yes
32+
SYMBOL_CHECK: yes
33+
VIRTUAL_ENV: /root/venv
3134
# Compile and run the tests
3235
EXAMPLES: yes
3336

@@ -52,6 +55,7 @@ cat_logs_snippet: &CAT_LOGS
5255

5356
linux_arm64_container_snippet: &LINUX_ARM64_CONTAINER
5457
env_script:
58+
- export PATH="$VIRTUAL_ENV/bin:$PATH"
5559
- env | tee /tmp/env
5660
build_script:
5761
- DOCKER_BUILDKIT=1 docker build --file "ci/linux-debian.Dockerfile" --tag="ci_secp256k1_arm"
@@ -69,6 +73,7 @@ task:
6973
RECOVERY: yes
7074
EXTRAKEYS: yes
7175
SCHNORRSIG: yes
76+
MUSIG: yes
7277
ELLSWIFT: yes
7378
matrix:
7479
# Currently only gcc-snapshot, the other compilers are tested on GHA with QEMU
@@ -86,6 +91,7 @@ task:
8691
RECOVERY: yes
8792
EXTRAKEYS: yes
8893
SCHNORRSIG: yes
94+
MUSIG: yes
8995
ELLSWIFT: yes
9096
WRAPPER_CMD: 'valgrind --error-exitcode=42'
9197
SECP256K1_TEST_ITERS: 2

.github/workflows/ci.yml

+53-17
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ env:
3333
RECOVERY: 'no'
3434
EXTRAKEYS: 'no'
3535
SCHNORRSIG: 'no'
36+
MUSIG: 'no'
3637
ELLSWIFT: 'no'
3738
### test options
3839
SECP256K1_TEST_ITERS:
3940
BENCH: 'yes'
4041
SECP256K1_BENCH_ITERS: 2
4142
CTIMETESTS: 'yes'
43+
SYMBOL_CHECK: 'yes'
4244
# Compile and run the examples.
4345
EXAMPLES: 'yes'
4446

@@ -72,18 +74,18 @@ jobs:
7274
matrix:
7375
configuration:
7476
- env_vars: { WIDEMUL: 'int64', RECOVERY: 'yes' }
75-
- env_vars: { WIDEMUL: 'int64', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
77+
- env_vars: { WIDEMUL: 'int64', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
7678
- env_vars: { WIDEMUL: 'int128' }
7779
- env_vars: { WIDEMUL: 'int128_struct', ELLSWIFT: 'yes' }
78-
- env_vars: { WIDEMUL: 'int128', RECOVERY: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
79-
- env_vars: { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes' }
80+
- 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' }
8082
- env_vars: { WIDEMUL: 'int128', ASM: 'x86_64', ELLSWIFT: 'yes' }
81-
- env_vars: { RECOVERY: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes' }
82-
- env_vars: { CTIMETESTS: 'no', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', CPPFLAGS: '-DVERIFY' }
83+
- 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' }
8385
- env_vars: { BUILD: 'distcheck', WITH_VALGRIND: 'no', CTIMETESTS: 'no', BENCH: 'no' }
8486
- env_vars: { CPPFLAGS: '-DDETERMINISTIC' }
8587
- env_vars: { CFLAGS: '-O0', CTIMETESTS: 'no' }
86-
- env_vars: { CFLAGS: '-O1', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
88+
- env_vars: { CFLAGS: '-O1', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
8789
- env_vars: { ECMULTGENKB: 2, ECMULTWINDOW: 2 }
8890
- env_vars: { ECMULTGENKB: 86, ECMULTWINDOW: 4 }
8991
cc:
@@ -142,6 +144,7 @@ jobs:
142144
RECOVERY: 'yes'
143145
EXTRAKEYS: 'yes'
144146
SCHNORRSIG: 'yes'
147+
MUSIG: 'yes'
145148
ELLSWIFT: 'yes'
146149
CC: ${{ matrix.cc }}
147150

@@ -187,6 +190,7 @@ jobs:
187190
RECOVERY: 'yes'
188191
EXTRAKEYS: 'yes'
189192
SCHNORRSIG: 'yes'
193+
MUSIG: 'yes'
190194
ELLSWIFT: 'yes'
191195
CTIMETESTS: 'no'
192196

@@ -239,6 +243,7 @@ jobs:
239243
RECOVERY: 'yes'
240244
EXTRAKEYS: 'yes'
241245
SCHNORRSIG: 'yes'
246+
MUSIG: 'yes'
242247
ELLSWIFT: 'yes'
243248
CTIMETESTS: 'no'
244249

@@ -285,6 +290,7 @@ jobs:
285290
RECOVERY: 'yes'
286291
EXTRAKEYS: 'yes'
287292
SCHNORRSIG: 'yes'
293+
MUSIG: 'yes'
288294
ELLSWIFT: 'yes'
289295
CTIMETESTS: 'no'
290296

@@ -341,6 +347,7 @@ jobs:
341347
RECOVERY: 'yes'
342348
EXTRAKEYS: 'yes'
343349
SCHNORRSIG: 'yes'
350+
MUSIG: 'yes'
344351
ELLSWIFT: 'yes'
345352
CTIMETESTS: 'no'
346353

@@ -394,6 +401,7 @@ jobs:
394401
RECOVERY: 'yes'
395402
EXTRAKEYS: 'yes'
396403
SCHNORRSIG: 'yes'
404+
MUSIG: 'yes'
397405
ELLSWIFT: 'yes'
398406
CTIMETESTS: 'no'
399407
SECP256K1_TEST_ITERS: 2
@@ -446,13 +454,15 @@ jobs:
446454
RECOVERY: 'yes'
447455
EXTRAKEYS: 'yes'
448456
SCHNORRSIG: 'yes'
457+
MUSIG: 'yes'
449458
ELLSWIFT: 'yes'
450459
CTIMETESTS: 'no'
451460
CFLAGS: '-fsanitize=undefined,address -g'
452461
UBSAN_OPTIONS: 'print_stacktrace=1:halt_on_error=1'
453462
ASAN_OPTIONS: 'strict_string_checks=1:detect_stack_use_after_return=1:detect_leaks=1'
454463
LSAN_OPTIONS: 'use_unaligned=1'
455464
SECP256K1_TEST_ITERS: 32
465+
SYMBOL_CHECK: 'no'
456466

457467
steps:
458468
- name: Checkout
@@ -511,11 +521,13 @@ jobs:
511521
RECOVERY: 'yes'
512522
EXTRAKEYS: 'yes'
513523
SCHNORRSIG: 'yes'
524+
MUSIG: 'yes'
514525
ELLSWIFT: 'yes'
515526
CC: 'clang'
516527
SECP256K1_TEST_ITERS: 32
517528
ASM: 'no'
518529
WITH_VALGRIND: 'no'
530+
SYMBOL_CHECK: 'no'
519531

520532
steps:
521533
- name: Checkout
@@ -558,6 +570,7 @@ jobs:
558570
RECOVERY: 'yes'
559571
EXTRAKEYS: 'yes'
560572
SCHNORRSIG: 'yes'
573+
MUSIG: 'yes'
561574
ELLSWIFT: 'yes'
562575
CTIMETESTS: 'no'
563576

@@ -610,20 +623,21 @@ jobs:
610623
CC: 'clang'
611624
HOMEBREW_NO_AUTO_UPDATE: 1
612625
HOMEBREW_NO_INSTALL_CLEANUP: 1
626+
SYMBOL_CHECK: 'no'
613627

614628
strategy:
615629
fail-fast: false
616630
matrix:
617631
env_vars:
618-
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
632+
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
619633
- { WIDEMUL: 'int128_struct', ECMULTGENKB: 2, ECMULTWINDOW: 4 }
620-
- { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
634+
- { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
621635
- { WIDEMUL: 'int128', RECOVERY: 'yes' }
622-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
623-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc' }
624-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', WRAPPER_CMD: 'valgrind --error-exitcode=42', SECP256K1_TEST_ITERS: 2 }
625-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc', WRAPPER_CMD: 'valgrind --error-exitcode=42', SECP256K1_TEST_ITERS: 2 }
626-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CPPFLAGS: '-DVERIFY', CTIMETESTS: 'no' }
636+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
637+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc' }
638+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', WRAPPER_CMD: 'valgrind --error-exitcode=42', SECP256K1_TEST_ITERS: 2 }
639+
- { 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 }
640+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', CPPFLAGS: '-DVERIFY', CTIMETESTS: 'no' }
627641
- BUILD: 'distcheck'
628642

629643
steps:
@@ -642,6 +656,11 @@ jobs:
642656
env: ${{ matrix.env_vars }}
643657
run: ./ci/ci.sh
644658

659+
- name: Symbol check
660+
run: |
661+
python3 -m pip install lief
662+
python3 ./tools/symbol-check.py .libs/libsecp256k1.dylib
663+
645664
- run: cat tests.log || true
646665
if: ${{ always() }}
647666
- run: cat noverify_tests.log || true
@@ -671,6 +690,7 @@ jobs:
671690
HOMEBREW_NO_INSTALL_CLEANUP: 1
672691
WITH_VALGRIND: 'no'
673692
CTIMETESTS: 'no'
693+
SYMBOL_CHECK: 'no'
674694

675695
strategy:
676696
fail-fast: false
@@ -698,6 +718,15 @@ jobs:
698718
env: ${{ matrix.env_vars }}
699719
run: ./ci/ci.sh
700720

721+
- name: Symbol check
722+
env:
723+
VIRTUAL_ENV: '${{ github.workspace }}/venv'
724+
run: |
725+
python3 -m venv $VIRTUAL_ENV
726+
export PATH="$VIRTUAL_ENV/bin:$PATH"
727+
python3 -m pip install lief
728+
python3 ./tools/symbol-check.py .libs/libsecp256k1.dylib
729+
701730
- run: cat tests.log || true
702731
if: ${{ always() }}
703732
- run: cat noverify_tests.log || true
@@ -751,14 +780,20 @@ jobs:
751780
# Use the bash shell included with Git for Windows.
752781
shell: bash
753782
run: |
754-
cd build/src/RelWithDebInfo && file *tests.exe bench*.exe libsecp256k1-*.dll || true
783+
cd build/bin/RelWithDebInfo && file *tests.exe bench*.exe libsecp256k1-*.dll || true
784+
785+
- name: Symbol check
786+
if: ${{ matrix.configuration.cmake_options != '-A x64 -DBUILD_SHARED_LIBS=OFF' }}
787+
run: |
788+
python -m pip install lief
789+
python .\tools\symbol-check.py build\bin\RelWithDebInfo\libsecp256k1-2.dll
755790
756791
- name: Check
757792
run: |
758793
ctest -C RelWithDebInfo --test-dir build -j ([int]$env:NUMBER_OF_PROCESSORS + 1)
759-
build\src\RelWithDebInfo\bench_ecmult.exe
760-
build\src\RelWithDebInfo\bench_internal.exe
761-
build\src\RelWithDebInfo\bench.exe
794+
build\bin\RelWithDebInfo\bench_ecmult.exe
795+
build\bin\RelWithDebInfo\bench_internal.exe
796+
build\bin\RelWithDebInfo\bench.exe
762797
763798
win64-native-headers:
764799
name: "x64 (MSVC): C++ (public headers)"
@@ -790,6 +825,7 @@ jobs:
790825
RECOVERY: 'yes'
791826
EXTRAKEYS: 'yes'
792827
SCHNORRSIG: 'yes'
828+
MUSIG: 'yes'
793829
ELLSWIFT: 'yes'
794830

795831
steps:

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ecdh_example
1111
ecdsa_example
1212
schnorr_example
1313
ellswift_example
14+
musig_example
1415
*.exe
1516
*.so
1617
*.a

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
#### Added
11+
- New module `musig` implements the MuSig2 multisignature scheme according to the [BIP 327 specification](https://github.com/bitcoin/bips/blob/master/bip-0327.mediawiki). See:
12+
- Header file `include/secp256k1_musig.h` which defines the new API.
13+
- Document `doc/musig.md` for further notes on API usage.
14+
- Usage example `examples/musig.c`.
15+
1016
## [0.5.1] - 2024-08-01
1117

1218
#### Added

CMakeLists.txt

+30-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
cmake_minimum_required(VERSION 3.16)
22

3+
#=============================
4+
# Project / Package metadata
5+
#=============================
36
project(libsecp256k1
47
# The package (a.k.a. release) version is based on semantic versioning 2.0.0 of
58
# the API. All changes in experimental modules are treated as
@@ -9,6 +12,8 @@ project(libsecp256k1
912
HOMEPAGE_URL "https://github.com/bitcoin-core/secp256k1"
1013
LANGUAGES C
1114
)
15+
enable_testing()
16+
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
1217

1318
if(CMAKE_VERSION VERSION_LESS 3.21)
1419
# Emulates CMake 3.21+ behavior.
@@ -30,11 +35,15 @@ set(${PROJECT_NAME}_LIB_VERSION_CURRENT 4)
3035
set(${PROJECT_NAME}_LIB_VERSION_REVISION 2)
3136
set(${PROJECT_NAME}_LIB_VERSION_AGE 2)
3237

38+
#=============================
39+
# Language setup
40+
#=============================
3341
set(CMAKE_C_STANDARD 90)
3442
set(CMAKE_C_EXTENSIONS OFF)
3543

36-
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
37-
44+
#=============================
45+
# Configurable options
46+
#=============================
3847
option(BUILD_SHARED_LIBS "Build shared libraries." ON)
3948
option(SECP256K1_DISABLE_SHARED "Disable shared library. Overrides BUILD_SHARED_LIBS." OFF)
4049
if(SECP256K1_DISABLE_SHARED)
@@ -51,6 +60,7 @@ option(SECP256K1_ENABLE_MODULE_ECDH "Enable ECDH module." ON)
5160
option(SECP256K1_ENABLE_MODULE_RECOVERY "Enable ECDSA pubkey recovery module." OFF)
5261
option(SECP256K1_ENABLE_MODULE_EXTRAKEYS "Enable extrakeys module." ON)
5362
option(SECP256K1_ENABLE_MODULE_SCHNORRSIG "Enable schnorrsig module." ON)
63+
option(SECP256K1_ENABLE_MODULE_MUSIG "Enable musig module." ON)
5464
option(SECP256K1_ENABLE_MODULE_ELLSWIFT "Enable ElligatorSwift module." ON)
5565

5666
# Processing must be done in a topological sorting of the dependency graph
@@ -59,6 +69,14 @@ if(SECP256K1_ENABLE_MODULE_ELLSWIFT)
5969
add_compile_definitions(ENABLE_MODULE_ELLSWIFT=1)
6070
endif()
6171

72+
if(SECP256K1_ENABLE_MODULE_MUSIG)
73+
if(DEFINED SECP256K1_ENABLE_MODULE_SCHNORRSIG AND NOT SECP256K1_ENABLE_MODULE_SCHNORRSIG)
74+
message(FATAL_ERROR "Module dependency error: You have disabled the schnorrsig module explicitly, but it is required by the musig module.")
75+
endif()
76+
set(SECP256K1_ENABLE_MODULE_SCHNORRSIG ON)
77+
add_compile_definitions(ENABLE_MODULE_MUSIG=1)
78+
endif()
79+
6280
if(SECP256K1_ENABLE_MODULE_SCHNORRSIG)
6381
if(DEFINED SECP256K1_ENABLE_MODULE_EXTRAKEYS AND NOT SECP256K1_ENABLE_MODULE_EXTRAKEYS)
6482
message(FATAL_ERROR "Module dependency error: You have disabled the extrakeys module explicitly, but it is required by the schnorrsig module.")
@@ -249,8 +267,6 @@ else()
249267
try_append_c_flags(-Wundef)
250268
endif()
251269

252-
set(CMAKE_C_VISIBILITY_PRESET hidden)
253-
254270
set(print_msan_notice)
255271
if(SECP256K1_BUILD_CTIME_TESTS)
256272
include(CheckMemorySanitizer)
@@ -262,13 +278,6 @@ if(SECP256K1_BUILD_CTIME_TESTS)
262278
unset(msan_enabled)
263279
endif()
264280

265-
include(CTest)
266-
# We do not use CTest's BUILD_TESTING because a single toggle for all tests is too coarse for our needs.
267-
mark_as_advanced(BUILD_TESTING)
268-
if(SECP256K1_BUILD_BENCHMARK OR SECP256K1_BUILD_TESTS OR SECP256K1_BUILD_EXHAUSTIVE_TESTS OR SECP256K1_BUILD_CTIME_TESTS OR SECP256K1_BUILD_EXAMPLES)
269-
enable_testing()
270-
endif()
271-
272281
set(SECP256K1_APPEND_CFLAGS "" CACHE STRING "Compiler flags that are appended to the command line after all other flags added by the build system. This variable is intended for debugging and special builds.")
273282
if(SECP256K1_APPEND_CFLAGS)
274283
# Appending to this low-level rule variable is the only way to
@@ -284,6 +293,15 @@ if(SECP256K1_APPEND_LDFLAGS)
284293
string(APPEND CMAKE_C_LINK_EXECUTABLE " ${SECP256K1_APPEND_LDFLAGS}")
285294
endif()
286295

296+
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
297+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
298+
endif()
299+
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
300+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
301+
endif()
302+
if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
303+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
304+
endif()
287305
add_subdirectory(src)
288306
if(SECP256K1_BUILD_EXAMPLES)
289307
add_subdirectory(examples)
@@ -305,6 +323,7 @@ message(" ECDH ................................ ${SECP256K1_ENABLE_MODULE_ECDH}
305323
message(" ECDSA pubkey recovery ............... ${SECP256K1_ENABLE_MODULE_RECOVERY}")
306324
message(" extrakeys ........................... ${SECP256K1_ENABLE_MODULE_EXTRAKEYS}")
307325
message(" schnorrsig .......................... ${SECP256K1_ENABLE_MODULE_SCHNORRSIG}")
326+
message(" musig ............................... ${SECP256K1_ENABLE_MODULE_MUSIG}")
308327
message(" ElligatorSwift ...................... ${SECP256K1_ENABLE_MODULE_ELLSWIFT}")
309328
message("Parameters:")
310329
message(" ecmult window size .................. ${SECP256K1_ECMULT_WINDOW_SIZE}")

0 commit comments

Comments
 (0)