31f84595c4Add ellswift usage example (Sebastian Falbesoner)fe4fbaa7f3examples: fix case typos in secret clearing paragraphs (s/, Or/, or/) (Sebastian Falbesoner)16685649d2doc: Add convention for defaults (Tim Ruffing)e2af491263ci: Switch to the new default value of the precomputed table for signing (Hennadii Stepanov)d94a9273f8build: Adjust the default size of the precomputed table for signing (Hennadii Stepanov)9420eece24cmake: Bump CMake minimum required version up to 3.16 (Hennadii Stepanov)b8fe33332bcmake: Fixed O3 replacement (Eduardo Menges Mattje)4d9645bee0cmake: Remove "AUTO" value of `SECP256K1_ECMULT_GEN_KB` option (Hennadii Stepanov)a06805ee74cmake: Remove "AUTO" value of `SECP256K1_ECMULT_WINDOW_SIZE` option (Hennadii Stepanov)26b94ee92aautotools: Remove "auto" value of `--with-ecmult-gen-kb` option (Hennadii Stepanov)122dbaeb37autotools: Remove "auto" value of `--with-ecmult-window` option (Hennadii Stepanov)158f9e5eaecmake: Do not modify build types when integrating by downstream project (Hennadii Stepanov)4706be2cd0cmake: Reimplement `SECP256K1_APPEND_CFLAGS` using Bitcoin Core approach (Hennadii Stepanov)c2764dbb99cmake: Rename `SECP256K1_LATE_CFLAGS` to `SECP256K1_APPEND_CFLAGS` (Hennadii Stepanov)0e2fadb20cfix: typos in secp256k1.c (Elliot Lee)f87a3589f4cmake: Do not set `CTEST_TEST_TARGET_ALIAS` (Hennadii Stepanov)7454a53736README: mention ellswift module (Sebastian Falbesoner)ec4c002faacmake: Simplify `PROJECT_IS_TOP_LEVEL` emulation (Hennadii Stepanov)cae9a7ad14cmake: Do not set emulated PROJECT_IS_TOP_LEVEL as cache variable (Hennadii Stepanov) Pull request description: Merge bitcoin-core/secp256k1#1529: cmake: Fix cache issue when integrating by downstream project Merge bitcoin-core/secp256k1#1548: README: mention ellswift module Merge bitcoin-core/secp256k1#1545: cmake: Do not set `CTEST_TEST_TARGET_ALIAS` Merge bitcoin-core/secp256k1#1550: fix: typos in secp256k1.c Merge bitcoin-core/secp256k1#1546: cmake: Rename `SECP256K1_LATE_CFLAGS` and switch to Bitcoin Core's approach Merge bitcoin-core/secp256k1#1543: cmake: Do not modify build types when integrating by downstream project Merge bitcoin-core/secp256k1#1535: build: Replace hardcoded "auto" value with default one Merge bitcoin-core/secp256k1#1555: Fixed O3 replacement Merge bitcoin-core/secp256k1#1565: cmake: Bump CMake minimum required version up to 3.16 Merge bitcoin-core/secp256k1#1564: build, ci: Adjust the default size of the precomputed table for signing Merge bitcoin-core/secp256k1#1563: doc: Add convention for defaults Merge bitcoin-core/secp256k1#1551: Add ellswift usage example This PR can be recreated with `./contrib/sync-upstream.sh -b master range 0055b86`. Tips: * Use `git show --remerge-diff <pr-branch>` to show the conflict resolution in the merge commit. * Use `git read-tree --reset -u <pr-branch>` to replay these resolutions during the conflict resolution stage when recreating the PR branch locally. Be aware that this may discard your index as well as the uncommitted changes and untracked files in your worktree. ACKs for top commit: real-or-random: ACKd0dde4aa2aTree-SHA512: 8551626c0f183c495cbbc12d9c292e1995ce4b5558f950e1a2ca84188724884180117f9bcc10c0d2f3e73da054c5b4647efaa8282be74936f4d156038b1c10da
5dd637f 69b2192 d7ae25c d403eea f473c95 4af241b a526937 fcc5d73 ca06e58 ea2d5f0 0055b86 ' into temp-merge-1551
5dd637f 69b2192 d7ae25c d403eea f473c95 4af241b a526937 fcc5d73 ca06e58 ea2d5f0 0055b86 ' into temp-merge-1551
5dd637f 69b2192 d7ae25c d403eea f473c95 4af241b a526937 fcc5d73 ca06e58 ea2d5f0 0055b86 ' into temp-merge-1551
3aef6ab8 0fa84f86 249c81ea 7966aee3 fb758fe8 3fc1de5c 0aacf643 9e6d1b0e 332af315 afd7eb4a c9ebca95 cc557575 0f7657d5 907a6721 b40e2d30 c545fdc3 2bd5f3e6 0e00fc7d c734c642 26392da2 ' into temp-merge-1386
5dd637f 69b2192 d7ae25c d403eea f473c95 4af241b a526937 fcc5d73 ca06e58 ea2d5f0 0055b86 ' into temp-merge-1551
5dd637f 69b2192 d7ae25c d403eea f473c95 4af241b a526937 fcc5d73 ca06e58 ea2d5f0 0055b86 ' into temp-merge-1551
5dd637f 69b2192 d7ae25c d403eea f473c95 4af241b a526937 fcc5d73 ca06e58 ea2d5f0 0055b86 ' into temp-merge-1551
5dd637f 69b2192 d7ae25c d403eea f473c95 4af241b a526937 fcc5d73 ca06e58 ea2d5f0 0055b86 ' into temp-merge-1551
5dd637f 69b2192 d7ae25c d403eea f473c95 4af241b a526937 fcc5d73 ca06e58 ea2d5f0 0055b86 ' into temp-merge-1551
5dd637f 69b2192 d7ae25c d403eea f473c95 4af241b a526937 fcc5d73 ca06e58 ea2d5f0 0055b86 ' into temp-merge-1551
libsecp256k1-zkp
A fork of libsecp256k1 with support for advanced and experimental features such as Confidential Assets and MuSig2
Added features:
- Experimental module for ECDSA adaptor signatures.
- Experimental module for ECDSA sign-to-contract.
- Experimental module for MuSig2.
- Experimental module for Confidential Assets (Pedersen commitments, range proofs, and surjection proofs).
- Experimental module for Bulletproofs++ range proofs.
- Experimental module for address whitelisting.
Experimental features are made available for testing and review by the community. The APIs of these features should not be considered stable.
Build steps
Building with Autotools
$ ./autogen.sh
$ ./configure
$ make
$ make check # run the test suite
$ sudo make install # optional
To compile optional modules (such as Schnorr signatures), you need to run ./configure with additional flags (such as --enable-module-schnorrsig). Run ./configure --help to see the full list of available flags. For experimental modules, you will also need --enable-experimental as well as a flag for each individual module, e.g. --enable-module-musig.
Building with CMake (experimental)
To maintain a pristine source tree, CMake encourages to perform an out-of-source build by using a separate dedicated build tree.
Building on POSIX systems
$ mkdir build && cd build
$ cmake ..
$ cmake --build .
$ ctest # run the test suite
$ sudo cmake --install . # optional
To compile optional modules (such as Schnorr signatures), you need to run cmake with additional flags (such as -DSECP256K1_ENABLE_MODULE_SCHNORRSIG=ON). Run cmake .. -LH to see the full list of available flags.
Cross compiling
To alleviate issues with cross compiling, preconfigured toolchain files are available in the cmake directory.
For example, to cross compile for Windows:
$ cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/x86_64-w64-mingw32.toolchain.cmake
To cross compile for Android with NDK (using NDK's toolchain file, and assuming the ANDROID_NDK_ROOT environment variable has been set):
$ cmake .. -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake" -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=28
Building on Windows
To build on Windows with Visual Studio, a proper generator must be specified for a new build tree.
The following example assumes using of Visual Studio 2022 and CMake v3.21+.
In "Developer Command Prompt for VS 2022":
>cmake -G "Visual Studio 17 2022" -A x64 -S . -B build
>cmake --build build --config RelWithDebInfo
Usage examples
Usage examples can be found in the examples directory. To compile them you need to configure with --enable-examples.
- ECDSA example
- Schnorr signatures example
- Deriving a shared secret (ECDH) example
- ElligatorSwift key exchange example
- MuSig example
To compile the Schnorr signature, ECDH and MuSig examples, you need to enable the corresponding module by providing a flag to the configure script, for example --enable-module-schnorrsig.
Benchmark
If configured with --enable-benchmark (which is the default), binaries for benchmarking the libsecp256k1-zkp functions will be present in the root directory after the build.
To print the benchmark result to the command line:
$ ./bench_name
To create a CSV file for the benchmark result :
$ ./bench_name | sed '2d;s/ \{1,\}//g' > bench_name.csv
Reporting a vulnerability
See SECURITY.md
Contributing to libsecp256k1
See CONTRIBUTING.md