b41caaafd2bppp: replace memcmp in tests with secp256k1_memcmp_var (Jonas Nick)6a3aae8f1dgroup_parse: use secp256k1_memcmp_var instead of memcmp (Jonas Nick)e9d522fc64ci: turn on -zkp modules in macos-native job (Jonas Nick)c45b7c4fbbrefactor: introduce testutil.h (deduplicate `random_fe_`, `ge_equals_` helpers) (Sebastian Falbesoner)dc5514144ftests: simplify `random_fe_non_zero` (remove loop limit and unneeded normalize) (Sebastian Falbesoner)d9d80fd155ci: Bump major versions for docker actions (Hennadii Stepanov)421d84855aci: Align Autotools/CMake `CI_INSTALL` directory names (Hennadii Stepanov)9f005c60d6cmake: Install `libsecp256k1.pc` file (Hennadii Stepanov)b0f7bfedc9doc: Do not mention soname in CHANGELOG.md "ABI Compatibility" section (Hennadii Stepanov)bd9d98d353doc: Align documented scripts with CI ones (Hennadii Stepanov)70303643cftests: add CHECK_ERROR_VOID and use it in scratch tests (Jonas Nick)f8d7ea68dftests: Replace counting_illegal_callbacks with CHECK_ILLEGAL_VOID (Jonas Nick)a1d52e3e12tests: remove unnecessary test in run_ec_pubkey_parse_test (Jonas Nick)875b0ada25tests: remove unnecessary set_illegal_callback (Jonas Nick)9b118bc7fbrelease cleanup: bump version after 0.4.0 (Jonas Nick)16339804c9release: Prepare for 0.4.0 (Tim Ruffing)d9a85065a9changelog: Catch up in preparation of release (Tim Ruffing)8659a01714ci: Add `release` job (Hennadii Stepanov)f9b38894baci: Update `actions/checkout` version (Hennadii Stepanov)2635068abfci/gha: Let MSan continue checking after errors in all jobs (Tim Ruffing)e78c7b68ebci/Dockerfile: Reduce size of Docker image further (Tim Ruffing)2f0d3bbffbci/Dockerfile: Warn if `ulimit -n` is too high when running Docker (Tim Ruffing)4b8a647ad3ci/gha: Add ARM64 QEMU jobs for clang and clang-snapshot (Tim Ruffing)6ebe7d2bb3ci/Dockerfile: Always use versioned clang packages (Tim Ruffing)c223d7e33dci: Switch macOS from Ventura to Monterey and add Valgrind (Hennadii Stepanov)cce0456304ci: Make repetitive command the default one (Hennadii Stepanov)317a4c48f0ci: Move `git config ...` to `run-in-docker-action` (Hennadii Stepanov)676ed8f9cfci: Move "C++ (public headers)" from Cirrus to GitHub Actions (Hennadii Stepanov)61fc3a2dc8ci: Move "C++ -fpermissive..." from Cirrus to GitHub Actions (Hennadii Stepanov)d51fb0a533ci: Move "MSan" from Cirrus to GitHub Actions (Hennadii Stepanov)c22ac27529ci: Move sanitizers task from Cirrus to GitHub Actions (Hennadii Stepanov)ee1be62d84ci: Use concurrency for pull requests only (Hennadii Stepanov)fc3dea29eaci: Move "ppc64le: Linux..." from Cirrus to GitHub Actions (Hennadii Stepanov)7782dc8276ci: Move "ARM64: Linux..." from Cirrus to GitHub Actions (Hennadii Stepanov)0a16de671cci: Move "ARM32: Linux..." from Cirrus to GitHub Actions (Hennadii Stepanov)ea33914e00ci: Move "s390x (big-endian): Linux..." from Cirrus to GitHub Actions (Hennadii Stepanov)880be8af99ci: Move "i686: Linux (Debian stable)" from Cirrus to GiHub Actions (Hennadii Stepanov)e10878f58eci, gha: Drop `driver-opts.network` input for `setup-buildx-action` (Hennadii Stepanov)4ad4914bd1ci, gha: Add `retry_builder` Docker image builder (Hennadii Stepanov)6617a620d9ci: Remove "x86_64: Linux (Debian stable)" task from Cirrus CI (Hennadii Stepanov)03c9e6508cci, gha: Add "x86_64: Linux (Debian stable)" GitHub Actions job (Hennadii Stepanov)ad3e65d9feci: Remove GCC build files and sage to reduce size of Docker image (Tim Ruffing)ef9fe959deci: Drop no longer needed workaround (Hennadii Stepanov)87d35f30c0ci: Rename `cirrus.sh` to more general `ci.sh` (Hennadii Stepanov)d6281dd008ci: Remove Windows tasks from Cirrus CI (Hennadii Stepanov)2b6f9cd546ci, gha: Add Windows jobs based on Linux image (Hennadii Stepanov)b0886fd35cci, gha: Ensure only a single workflow processes `github.ref` at a time (Hennadii Stepanov)d23da6d557use secp256k1_scalar_verify checks (stratospher)c7d0454932add verification for scalars (stratospher)ad152151b0update max scalar in scalar_cmov_test and fix schnorrsig_verify exhaustive test (stratospher)d78bec7001ci: Remove Windows MSVC tasks from Cirrus CI (Hennadii Stepanov)3545dc2b9bci, gha: Run all MSVC tests on Windows natively (Hennadii Stepanov)54058d16fefield: remove `secp256k1_fe_equal_var` (siv2r)bb4efd6404tests: remove unwanted `secp256k1_fe_normalize_weak` call (siv2r)c2f6435802ci: Add comment about switching macOS to M1 on GHA later (Tim Ruffing)4a24fae0bcci: Remove "arm64: macOS Ventura" task from Cirrus CI (Hennadii Stepanov)8e54a346d2ci, gha: Run "x86_64: macOS Ventura" job on GitHub Actions (Hennadii Stepanov)747ada3587test: Silent noisy clang warnings about Valgrind code on macOS x86_64 (Hennadii Stepanov)d62db57427ci: Use Homebrew's gcc in native macOS task (Hennadii Stepanov)b7c685e74aSave _normalize_weak calls in group add methods (Peter Dettman)c83afa66e0Tighten group magnitude limits (Peter Dettman)173e8d061aImplement current magnitude assumptions (Peter Dettman)49afd2f5d8Take use of _fe_verify_magnitude in field_impl.h (Sebastian Falbesoner)4e9661fc42Add _fe_verify_magnitude (no-op unless VERIFY is enabled) (Peter Dettman)690b0fc05aadd missing group element invariant checks (Sebastian Falbesoner)9c91ea41b1ci: Enable ellswift module where it's missing (Tim Ruffing)db32a24761ctimetests: Use new SECP256K1_CHECKMEM macros also for ellswift (Tim Ruffing)8408dfdc4cRevert "ci: Run sage prover on CI" (Hennadii Stepanov)c8d9914fb1ci, gha: Run "SageMath prover" job on GitHub Actions (Hennadii Stepanov)f1774e5ec4ci, gha: Make MSVC job presentation more explicit (Hennadii Stepanov)5ee039bb58ci: Remove "Windows (VS 2022)" task from Cirrus CI (Hennadii Stepanov)a2f7ccdeccci: Run "Windows (VS 2022)" job on GitHub Actions (Hennadii Stepanov)175db31149ci: Drop no longer needed `PATH` variable update on Windows (Hennadii Stepanov)116d2ab3dfcmake: Set `ENVIRONMENT` property for examples on Windows (Hennadii Stepanov)cef373997ccmake, refactor: Use helper function instead of interface library (Hennadii Stepanov)a1bd4971d6refactor: take use of `secp256k1_scalar_{zero,one}` constants (part 2) (Sebastian Falbesoner) Pull request description: [bitcoin-core/secp256k1#1391]: refactor: take use of `secp256k1_scalar_{zero,one}` constants (part 2) [bitcoin-core/secp256k1#1290]: cmake: Set `ENVIRONMENT` property for examples on Windows [bitcoin-core/secp256k1#1389]: ci: Run "Windows (VS 2022)" job on GitHub Actions [bitcoin-core/secp256k1#1397]: ci: Remove "Windows (VS 2022)" task from Cirrus CI [bitcoin-core/secp256k1#1399]: ci, gha: Run "SageMath prover" job on GitHub Actions [bitcoin-core/secp256k1#1400]: ctimetests: Use new SECP256K1_CHECKMEM macros also for ellswift [bitcoin-core/secp256k1#1348]: tighten group magnitude limits, save normalize_weak calls in group add methods (revival of #1032) [bitcoin-core/secp256k1#1402]: ci: Use Homebrew'\''s gcc in native macOS task [bitcoin-core/secp256k1#1274]: test: Silent noisy clang warnings about Valgrind code on macOS x86_64 [bitcoin-core/secp256k1#1394]: ci, gha: Run "x86_64: macOS Ventura" job on GitHub Actions [bitcoin-core/secp256k1#1404]: ci: Remove "arm64: macOS Ventura" task from Cirrus CI [bitcoin-core/secp256k1#1062]: Removes `_fe_equal_var`, and unwanted `_fe_normalize_weak` calls (in tests) [bitcoin-core/secp256k1#1401]: ci, gha: Run all MSVC tests on Windows natively [bitcoin-core/secp256k1#1373]: Add invariant checking for scalars [bitcoin-core/secp256k1#1403]: ci, gha: Ensure only a single workflow processes `github.ref` at a time [bitcoin-core/secp256k1#1398]: ci, gha: Add Windows jobs based on Linux image [bitcoin-core/secp256k1#1405]: ci: Drop no longer needed workaround [bitcoin-core/secp256k1#1396]: ci, gha: Add "x86_64: Linux (Debian stable)" GitHub Actions job [bitcoin-core/secp256k1#1406]: ci, gha: Move more non-x86_64 tasks from Cirrus CI to GitHub Actions [bitcoin-core/secp256k1#1410]: ci: Use concurrency for pull requests only [bitcoin-core/secp256k1#1409]: ci: Move remained task from Cirrus to GitHub Actions [bitcoin-core/secp256k1#1411]: ci: Make repetitive command the default one [bitcoin-core/secp256k1#1412]: ci: Switch macOS from Ventura to Monterey and add Valgrind [bitcoin-core/secp256k1#1414]: ci/gha: Add ARM64 QEMU jobs for clang and clang-snapshot [bitcoin-core/secp256k1#1413]: ci: Add `release` job [bitcoin-core/secp256k1#1415]: release: Prepare for 0.4.0 [bitcoin-core/secp256k1#1417]: release cleanup: bump version after 0.4.0 [bitcoin-core/secp256k1#1390]: tests: Replace counting_illegal_callbacks with CHECK_ILLEGAL_VOID [bitcoin-core/secp256k1#1416]: doc: Align documented scripts with CI ones [bitcoin-core/secp256k1#1422]: cmake: Install `libsecp256k1.pc` file [bitcoin-core/secp256k1#1424]: ci: Bump major versions for docker actions [bitcoin-core/secp256k1#1395]: tests: simplify `random_fe_non_zero` (remove loop limit and unneeded normalize) This PR can be recreated with `./contrib/sync-upstream.sh -b master range ee7aaf213ea3eb42fc8960c7d178b5ffb286440f`. Tip: Use `git show --remerge-diff` to show the changes manually added to the merge commit.' --web - Replace fe_equal_var with fe_equal - Use CHECK_ILLEGAL instead of CHECK/ecount - Turn on secp256k1-zkp specific modules in CI ACKs for top commit: real-or-random: ACKb41caaafd2Tree-SHA512: e8994fa2590d6e277d60a130d3f11b0256dc7fbe67e8a2b85463d9849d3f9fbfccf366b17b3904f1974f8b7b27a24128d2a04a3337c1b8409d000d136714bf90
374e2b54 96294c00 8d2960c8 ce765a5b b2f6712d eedd7810 b327abfc 5d8fa825 3d05c86d bcffeb14 de657c20 060e32cb 0ba2b945 48b1d939 6b9507ad 5373693e 2e6cf9ba 6ee14550 26a98992 4d7fe609 ea26b71c 65c79fe2 727bec5b 0b4640ae 199d27ce cbf3053f 49be5be9 b10ddd2b 4fd00f4b ba9cb6f3 ee7aaf21 ' into temp-merge-1395
374e2b54 96294c00 8d2960c8 ce765a5b b2f6712d eedd7810 b327abfc 5d8fa825 3d05c86d bcffeb14 de657c20 060e32cb 0ba2b945 48b1d939 6b9507ad 5373693e 2e6cf9ba 6ee14550 26a98992 4d7fe609 ea26b71c 65c79fe2 727bec5b 0b4640ae 199d27ce cbf3053f 49be5be9 b10ddd2b 4fd00f4b ba9cb6f3 ee7aaf21 ' into temp-merge-1395
374e2b54 96294c00 8d2960c8 ce765a5b b2f6712d eedd7810 b327abfc 5d8fa825 3d05c86d bcffeb14 de657c20 060e32cb 0ba2b945 48b1d939 6b9507ad 5373693e 2e6cf9ba 6ee14550 26a98992 4d7fe609 ea26b71c 65c79fe2 727bec5b 0b4640ae 199d27ce cbf3053f 49be5be9 b10ddd2b 4fd00f4b ba9cb6f3 ee7aaf21 ' into temp-merge-1395
3aef6ab8 0fa84f86 249c81ea 7966aee3 fb758fe8 3fc1de5c 0aacf643 9e6d1b0e 332af315 afd7eb4a c9ebca95 cc557575 0f7657d5 907a6721 b40e2d30 c545fdc3 2bd5f3e6 0e00fc7d c734c642 26392da2 ' into temp-merge-1386
3aef6ab8 0fa84f86 249c81ea 7966aee3 fb758fe8 3fc1de5c 0aacf643 9e6d1b0e 332af315 afd7eb4a c9ebca95 cc557575 0f7657d5 907a6721 b40e2d30 c545fdc3 2bd5f3e6 0e00fc7d c734c642 26392da2 ' into temp-merge-1386
4258c54f 566faa17 9ce9984f 04bf3f67 5be353d6 2e035af2 5b0444a3 a6f4bcf6 5ec1333d f6bef03c 1f33bb2b 1c895367 6b7e5b71 596b336f 4b84f4bf 024a4094 222ecaf6 4b0f711d 3c818388 f30c7486 1cf15ebd 24c768ae 341cc197 c63ec88e 54d34b6c 073d98a0 9eb6934f ab5a9171 fb3a8063 006ddc1f 3353d3c7 b54a0672 7d4f86d2 e8295d07 3e3d125b acf5c55a ' into temp-merge-1312
374e2b54 96294c00 8d2960c8 ce765a5b b2f6712d eedd7810 b327abfc 5d8fa825 3d05c86d bcffeb14 de657c20 060e32cb 0ba2b945 48b1d939 6b9507ad 5373693e 2e6cf9ba 6ee14550 26a98992 4d7fe609 ea26b71c 65c79fe2 727bec5b 0b4640ae 199d27ce cbf3053f 49be5be9 b10ddd2b 4fd00f4b ba9cb6f3 ee7aaf21 ' into temp-merge-1395
3aef6ab8 0fa84f86 249c81ea 7966aee3 fb758fe8 3fc1de5c 0aacf643 9e6d1b0e 332af315 afd7eb4a c9ebca95 cc557575 0f7657d5 907a6721 b40e2d30 c545fdc3 2bd5f3e6 0e00fc7d c734c642 26392da2 ' into temp-merge-1386
374e2b54 96294c00 8d2960c8 ce765a5b b2f6712d eedd7810 b327abfc 5d8fa825 3d05c86d bcffeb14 de657c20 060e32cb 0ba2b945 48b1d939 6b9507ad 5373693e 2e6cf9ba 6ee14550 26a98992 4d7fe609 ea26b71c 65c79fe2 727bec5b 0b4640ae 199d27ce cbf3053f 49be5be9 b10ddd2b 4fd00f4b ba9cb6f3 ee7aaf21 ' into temp-merge-1395
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
libsecp256k1-zkp is built using 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.
Usage examples
Usage examples can be found in the examples directory. To compile them you need to configure with --enable-examples.
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.
Test coverage
This library aims to have full coverage of the reachable lines and branches.
To create a test coverage report, configure with --enable-coverage (use of GCC is necessary):
$ ./configure --enable-coverage
Run the tests:
$ make check
To create a report, gcovr is recommended, as it includes branch coverage reporting:
$ gcovr --exclude 'src/bench*' --print-summary
To create a HTML report with coloured and annotated source code:
$ mkdir -p coverage
$ gcovr --exclude 'src/bench*' --html --html-details -o coverage/coverage.html
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