Skip to content

Commit 685112b

Browse files
committed
Update codebase to 0_10_0 to include secp256k1 musig module
1 parent 46d5ef8 commit 685112b

Some content is hidden

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

82 files changed

+10115
-10732
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# This file was automatically created by vendor-libsecp.sh
2-
1ad5185cd42c0636104129fcc9f6a4bf9c67cc40
2+
398051cba6052c77f801b0aa57f1b0f161b0b12d

secp256k1-sys/depend/secp256k1/.cirrus.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ env:
1010
MAKEFLAGS: -j4
1111
BUILD: check
1212
### secp256k1 config
13-
ECMULTWINDOW: auto
14-
ECMULTGENPRECISION: auto
13+
ECMULTWINDOW: 15
14+
ECMULTGENKB: 22
1515
ASM: no
1616
WIDEMUL: auto
1717
WITH_VALGRIND: yes
@@ -21,6 +21,7 @@ env:
2121
ECDH: no
2222
RECOVERY: no
2323
SCHNORRSIG: no
24+
MUSIG: no
2425
ELLSWIFT: no
2526
### test options
2627
SECP256K1_TEST_ITERS:
@@ -67,6 +68,7 @@ task:
6768
ECDH: yes
6869
RECOVERY: yes
6970
SCHNORRSIG: yes
71+
MUSIG: yes
7072
ELLSWIFT: yes
7173
matrix:
7274
# Currently only gcc-snapshot, the other compilers are tested on GHA with QEMU
@@ -83,6 +85,7 @@ task:
8385
ECDH: yes
8486
RECOVERY: yes
8587
SCHNORRSIG: yes
88+
MUSIG: yes
8689
ELLSWIFT: yes
8790
WRAPPER_CMD: 'valgrind --error-exitcode=42'
8891
SECP256K1_TEST_ITERS: 2

secp256k1-sys/depend/secp256k1/.github/actions/install-homebrew-valgrind/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ runs:
1616
cat valgrind_fingerprint
1717
shell: bash
1818
19-
- uses: actions/cache@v3
19+
- uses: actions/cache@v4
2020
id: cache
2121
with:
2222
path: ${{ env.CI_HOMEBREW_CELLAR_VALGRIND }}

secp256k1-sys/depend/secp256k1/.github/actions/run-in-docker-action/action.yml

+5
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ runs:
3636
load: true
3737
cache-from: type=gha
3838

39+
- # Workaround for https://github.com/google/sanitizers/issues/1614 .
40+
# The underlying issue has been fixed in clang 18.1.3.
41+
run: sudo sysctl -w vm.mmap_rnd_bits=28
42+
shell: bash
43+
3944
- # Tell Docker to pass environment variables in `env` into the container.
4045
run: >
4146
docker run \

secp256k1-sys/depend/secp256k1/.github/workflows/ci.yml

+99-26
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ env:
2121
MAKEFLAGS: '-j4'
2222
BUILD: 'check'
2323
### secp256k1 config
24-
ECMULTWINDOW: 'auto'
25-
ECMULTGENPRECISION: 'auto'
24+
ECMULTWINDOW: 15
25+
ECMULTGENKB: 86
2626
ASM: 'no'
2727
WIDEMUL: 'auto'
2828
WITH_VALGRIND: 'yes'
@@ -32,6 +32,7 @@ env:
3232
ECDH: 'no'
3333
RECOVERY: 'no'
3434
SCHNORRSIG: 'no'
35+
MUSIG: 'no'
3536
ELLSWIFT: 'no'
3637
### test options
3738
SECP256K1_TEST_ITERS:
@@ -71,20 +72,20 @@ jobs:
7172
matrix:
7273
configuration:
7374
- env_vars: { WIDEMUL: 'int64', RECOVERY: 'yes' }
74-
- env_vars: { WIDEMUL: 'int64', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
75+
- env_vars: { WIDEMUL: 'int64', ECDH: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
7576
- env_vars: { WIDEMUL: 'int128' }
76-
- env_vars: { WIDEMUL: 'int128_struct', ELLSWIFT: 'yes' }
77-
- env_vars: { WIDEMUL: 'int128', RECOVERY: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
78-
- env_vars: { WIDEMUL: 'int128', ECDH: 'yes', SCHNORRSIG: 'yes' }
79-
- env_vars: { WIDEMUL: 'int128', ASM: 'x86_64', ELLSWIFT: 'yes' }
77+
- env_vars: { WIDEMUL: 'int128_struct', ELLSWIFT: 'yes' }
78+
- env_vars: { WIDEMUL: 'int128', RECOVERY: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
79+
- env_vars: { WIDEMUL: 'int128', ECDH: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes' }
80+
- env_vars: { WIDEMUL: 'int128', ASM: 'x86_64', ELLSWIFT: 'yes' }
8081
- env_vars: { RECOVERY: 'yes', SCHNORRSIG: 'yes' }
8182
- env_vars: { CTIMETESTS: 'no', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', CPPFLAGS: '-DVERIFY' }
8283
- env_vars: { BUILD: 'distcheck', WITH_VALGRIND: 'no', CTIMETESTS: 'no', BENCH: 'no' }
8384
- env_vars: { CPPFLAGS: '-DDETERMINISTIC' }
8485
- env_vars: { CFLAGS: '-O0', CTIMETESTS: 'no' }
85-
- env_vars: { CFLAGS: '-O1', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
86-
- env_vars: { ECMULTGENPRECISION: 2, ECMULTWINDOW: 2 }
87-
- env_vars: { ECMULTGENPRECISION: 8, ECMULTWINDOW: 4 }
86+
- env_vars: { CFLAGS: '-O1', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
87+
- env_vars: { ECMULTGENKB: 2, ECMULTWINDOW: 2 }
88+
- env_vars: { ECMULTGENKB: 86, ECMULTWINDOW: 4 }
8889
cc:
8990
- 'gcc'
9091
- 'clang'
@@ -140,6 +141,7 @@ jobs:
140141
ECDH: 'yes'
141142
RECOVERY: 'yes'
142143
SCHNORRSIG: 'yes'
144+
MUSIG: 'yes'
143145
ELLSWIFT: 'yes'
144146
CC: ${{ matrix.cc }}
145147

@@ -184,6 +186,7 @@ jobs:
184186
ECDH: 'yes'
185187
RECOVERY: 'yes'
186188
SCHNORRSIG: 'yes'
189+
MUSIG: 'yes'
187190
ELLSWIFT: 'yes'
188191
CTIMETESTS: 'no'
189192

@@ -235,6 +238,7 @@ jobs:
235238
ECDH: 'yes'
236239
RECOVERY: 'yes'
237240
SCHNORRSIG: 'yes'
241+
MUSIG: 'yes'
238242
ELLSWIFT: 'yes'
239243
CTIMETESTS: 'no'
240244

@@ -280,6 +284,7 @@ jobs:
280284
ECDH: 'yes'
281285
RECOVERY: 'yes'
282286
SCHNORRSIG: 'yes'
287+
MUSIG: 'yes'
283288
ELLSWIFT: 'yes'
284289
CTIMETESTS: 'no'
285290

@@ -335,6 +340,7 @@ jobs:
335340
ECDH: 'yes'
336341
RECOVERY: 'yes'
337342
SCHNORRSIG: 'yes'
343+
MUSIG: 'yes'
338344
ELLSWIFT: 'yes'
339345
CTIMETESTS: 'no'
340346

@@ -377,8 +383,8 @@ jobs:
377383
configuration:
378384
- env_vars: { CC: 'clang', ASM: 'auto' }
379385
- env_vars: { CC: 'i686-linux-gnu-gcc', HOST: 'i686-linux-gnu', ASM: 'auto' }
380-
- env_vars: { CC: 'clang', ASM: 'no', ECMULTGENPRECISION: 2, ECMULTWINDOW: 2 }
381-
- env_vars: { CC: 'i686-linux-gnu-gcc', HOST: 'i686-linux-gnu', ASM: 'no', ECMULTGENPRECISION: 2, ECMULTWINDOW: 2 }
386+
- env_vars: { CC: 'clang', ASM: 'no', ECMULTGENKB: 2, ECMULTWINDOW: 2 }
387+
- env_vars: { CC: 'i686-linux-gnu-gcc', HOST: 'i686-linux-gnu', ASM: 'no', ECMULTGENKB: 2, ECMULTWINDOW: 2 }
382388

383389
env:
384390
# The `--error-exitcode` is required to make the test fail if valgrind found errors,
@@ -387,6 +393,7 @@ jobs:
387393
ECDH: 'yes'
388394
RECOVERY: 'yes'
389395
SCHNORRSIG: 'yes'
396+
MUSIG: 'yes'
390397
ELLSWIFT: 'yes'
391398
CTIMETESTS: 'no'
392399
SECP256K1_TEST_ITERS: 2
@@ -431,13 +438,14 @@ jobs:
431438
configuration:
432439
- env_vars: { CC: 'clang', ASM: 'auto' }
433440
- env_vars: { CC: 'i686-linux-gnu-gcc', HOST: 'i686-linux-gnu', ASM: 'auto' }
434-
- env_vars: { CC: 'clang', ASM: 'no', ECMULTGENPRECISION: 2, ECMULTWINDOW: 2 }
435-
- env_vars: { CC: 'i686-linux-gnu-gcc', HOST: 'i686-linux-gnu', ASM: 'no', ECMULTGENPRECISION: 2, ECMULTWINDOW: 2 }
441+
- env_vars: { CC: 'clang', ASM: 'no', ECMULTGENKB: 2, ECMULTWINDOW: 2 }
442+
- env_vars: { CC: 'i686-linux-gnu-gcc', HOST: 'i686-linux-gnu', ASM: 'no', ECMULTGENKB: 2, ECMULTWINDOW: 2 }
436443

437444
env:
438445
ECDH: 'yes'
439446
RECOVERY: 'yes'
440447
SCHNORRSIG: 'yes'
448+
MUSIG: 'yes'
441449
ELLSWIFT: 'yes'
442450
CTIMETESTS: 'no'
443451
CFLAGS: '-fsanitize=undefined,address -g'
@@ -485,18 +493,25 @@ jobs:
485493
matrix:
486494
configuration:
487495
- env_vars:
496+
CTIMETESTS: 'yes'
488497
CFLAGS: '-fsanitize=memory -fsanitize-recover=memory -g'
489498
- env_vars:
490-
ECMULTGENPRECISION: 2
499+
ECMULTGENKB: 2
491500
ECMULTWINDOW: 2
501+
CTIMETESTS: 'yes'
492502
CFLAGS: '-fsanitize=memory -fsanitize-recover=memory -g -O3'
503+
- env_vars:
504+
# -fsanitize-memory-param-retval is clang's default, but our build system disables it
505+
# when ctime_tests when enabled.
506+
CFLAGS: '-fsanitize=memory -fsanitize-recover=memory -fsanitize-memory-param-retval -g'
507+
CTIMETESTS: 'no'
493508

494509
env:
495510
ECDH: 'yes'
496511
RECOVERY: 'yes'
497512
SCHNORRSIG: 'yes'
513+
MUSIG: 'yes'
498514
ELLSWIFT: 'yes'
499-
CTIMETESTS: 'yes'
500515
CC: 'clang'
501516
SECP256K1_TEST_ITERS: 32
502517
ASM: 'no'
@@ -542,6 +557,7 @@ jobs:
542557
ECDH: 'yes'
543558
RECOVERY: 'yes'
544559
SCHNORRSIG: 'yes'
560+
MUSIG: 'yes'
545561
ELLSWIFT: 'yes'
546562
CTIMETESTS: 'no'
547563

@@ -585,15 +601,76 @@ jobs:
585601
run: env
586602
if: ${{ always() }}
587603

588-
macos-native:
589-
name: "x86_64: macOS Monterey"
604+
x86_64-macos-native:
605+
name: "x86_64: macOS Monterey, Valgrind"
606+
# See: https://github.com/actions/runner-images#available-images.
607+
runs-on: macos-12
608+
609+
env:
610+
CC: 'clang'
611+
HOMEBREW_NO_AUTO_UPDATE: 1
612+
HOMEBREW_NO_INSTALL_CLEANUP: 1
613+
614+
strategy:
615+
fail-fast: false
616+
matrix:
617+
env_vars:
618+
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
619+
- { WIDEMUL: 'int128_struct', ECMULTGENKB: 2, ECMULTWINDOW: 4 }
620+
- { WIDEMUL: 'int128', ECDH: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
621+
- { WIDEMUL: 'int128', RECOVERY: 'yes' }
622+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
623+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc' }
624+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', WRAPPER_CMD: 'valgrind --error-exitcode=42', SECP256K1_TEST_ITERS: 2 }
625+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc', WRAPPER_CMD: 'valgrind --error-exitcode=42', SECP256K1_TEST_ITERS: 2 }
626+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes', CPPFLAGS: '-DVERIFY', CTIMETESTS: 'no' }
627+
- BUILD: 'distcheck'
628+
629+
steps:
630+
- name: Checkout
631+
uses: actions/checkout@v4
632+
633+
- name: Install Homebrew packages
634+
run: |
635+
brew install automake libtool gcc
636+
ln -s $(brew --prefix gcc)/bin/gcc-?? /usr/local/bin/gcc
637+
638+
- name: Install and cache Valgrind
639+
uses: ./.github/actions/install-homebrew-valgrind
640+
641+
- name: CI script
642+
env: ${{ matrix.env_vars }}
643+
run: ./ci/ci.sh
644+
645+
- run: cat tests.log || true
646+
if: ${{ always() }}
647+
- run: cat noverify_tests.log || true
648+
if: ${{ always() }}
649+
- run: cat exhaustive_tests.log || true
650+
if: ${{ always() }}
651+
- run: cat ctime_tests.log || true
652+
if: ${{ always() }}
653+
- run: cat bench.log || true
654+
if: ${{ always() }}
655+
- run: cat config.log || true
656+
if: ${{ always() }}
657+
- run: cat test_env.log || true
658+
if: ${{ always() }}
659+
- name: CI env
660+
run: env
661+
if: ${{ always() }}
662+
663+
arm64-macos-native:
664+
name: "ARM64: macOS Sonoma"
590665
# See: https://github.com/actions/runner-images#available-images.
591-
runs-on: macos-12 # Use M1 once available https://github.com/github/roadmap/issues/528
666+
runs-on: macos-14
592667

593668
env:
594669
CC: 'clang'
595670
HOMEBREW_NO_AUTO_UPDATE: 1
596671
HOMEBREW_NO_INSTALL_CLEANUP: 1
672+
WITH_VALGRIND: 'no'
673+
CTIMETESTS: 'no'
597674

598675
strategy:
599676
fail-fast: false
@@ -605,9 +682,7 @@ jobs:
605682
- { WIDEMUL: 'int128', RECOVERY: 'yes' }
606683
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
607684
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc' }
608-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', WRAPPER_CMD: 'valgrind --error-exitcode=42', SECP256K1_TEST_ITERS: 2 }
609-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc', WRAPPER_CMD: 'valgrind --error-exitcode=42', SECP256K1_TEST_ITERS: 2 }
610-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CPPFLAGS: '-DVERIFY', CTIMETESTS: 'no' }
685+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CPPFLAGS: '-DVERIFY' }
611686
- BUILD: 'distcheck'
612687

613688
steps:
@@ -619,9 +694,6 @@ jobs:
619694
brew install automake libtool gcc
620695
ln -s $(brew --prefix gcc)/bin/gcc-?? /usr/local/bin/gcc
621696
622-
- name: Install and cache Valgrind
623-
uses: ./.github/actions/install-homebrew-valgrind
624-
625697
- name: CI script
626698
env: ${{ matrix.env_vars }}
627699
run: ./ci/ci.sh
@@ -717,6 +789,7 @@ jobs:
717789
ECDH: 'yes'
718790
RECOVERY: 'yes'
719791
SCHNORRSIG: 'yes'
792+
MUSIG: 'yes'
720793
ELLSWIFT: 'yes'
721794

722795
steps:
@@ -802,5 +875,5 @@ jobs:
802875
CI_BUILD: ${{ runner.temp }}/${{ github.run_id }}${{ github.action }}/build
803876
CI_INSTALL: ${{ runner.temp }}/${{ github.run_id }}${{ github.action }}/install
804877
run: |
805-
cmake -B ${{ env.CI_BUILD }} -DCMAKE_INSTALL_PREFIX=${{ env.CI_INSTALL }} && cmake --build ${{ env.CI_BUILD }} --target install && ls -RlAh ${{ env.CI_INSTALL }}
878+
cmake -B ${{ env.CI_BUILD }} -DCMAKE_INSTALL_PREFIX=${{ env.CI_INSTALL }} && cmake --build ${{ env.CI_BUILD }} && cmake --install ${{ env.CI_BUILD }} && ls -RlAh ${{ env.CI_INSTALL }}
806879
gcc -o ecdsa examples/ecdsa.c -I ${{ env.CI_INSTALL }}/include -L ${{ env.CI_INSTALL }}/lib*/ -l secp256k1 -Wl,-rpath,"${{ env.CI_INSTALL }}/lib",-rpath,"${{ env.CI_INSTALL }}/lib64" && ./ecdsa

secp256k1-sys/depend/secp256k1/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ ctime_tests
1010
ecdh_example
1111
ecdsa_example
1212
schnorr_example
13+
ellswift_example
1314
*.exe
1415
*.so
1516
*.a

secp256k1-sys/depend/secp256k1/CHANGELOG.md

+24
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,28 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
#### Added
11+
- Added usage example for an ElligatorSwift key exchange.
12+
- 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:
13+
- Header file `include/secp256k1_musig.h` which defines the new API.
14+
- Document `doc/musig.md` for further notes on API usage.
15+
- Usage example `examples/musig.c`.
16+
17+
## [0.5.0] - 2024-05-06
18+
19+
#### Added
20+
- New function `secp256k1_ec_pubkey_sort` that sorts public keys using lexicographic (of compressed serialization) order.
21+
22+
#### Changed
23+
- The implementation of the point multiplication algorithm used for signing and public key generation was changed, resulting in improved performance for those operations.
24+
- The related configure option `--ecmult-gen-precision` was replaced with `--ecmult-gen-kb` (`ECMULT_GEN_KB` for CMake).
25+
- This changes the supported precomputed table sizes for these operations. The new supported sizes are 2 KiB, 22 KiB, or 86 KiB (while the old supported sizes were 32 KiB, 64 KiB, or 512 KiB).
26+
27+
#### ABI Compatibility
28+
The ABI is backward compatible with versions 0.4.x and 0.3.x.
29+
830
## [0.4.1] - 2023-12-21
931

1032
#### Changed
@@ -113,6 +135,8 @@ This version was in fact never released.
113135
The number was given by the build system since the introduction of autotools in Jan 2014 (ea0fe5a5bf0c04f9cc955b2966b614f5f378c6f6).
114136
Therefore, this version number does not uniquely identify a set of source files.
115137

138+
[unreleased]: https://github.com/bitcoin-core/secp256k1/compare/v0.5.0...HEAD
139+
[0.5.0]: https://github.com/bitcoin-core/secp256k1/compare/v0.4.1...v0.5.0
116140
[0.4.1]: https://github.com/bitcoin-core/secp256k1/compare/v0.4.0...v0.4.1
117141
[0.4.0]: https://github.com/bitcoin-core/secp256k1/compare/v0.3.2...v0.4.0
118142
[0.3.2]: https://github.com/bitcoin-core/secp256k1/compare/v0.3.1...v0.3.2

0 commit comments

Comments
 (0)