Skip to content

Commit 41797f8

Browse files
committed
Squashed 'src/secp256k1/' changes from 4af241b320..642c885b61
642c885b61 Merge bitcoin-core/secp256k1#1575: release: prepare for 0.5.1 cdf08c1a2b Merge bitcoin-core/secp256k1#1576: doc: mention `needs-changelog` github label in release process 40d87b8e45 release: prepare for 0.5.1 5770226176 changelog: clarify CMake option 759bd4bbc8 doc: mention `needs-changelog` github label in release process fded437c4c Merge bitcoin-core/secp256k1#1574: Fix compilation when extrakeys module isn't enabled 763d938cf0 ci: only enable extrakeys module when schnorrsig is enabled af551ab9db tests: do not use functions from extrakeys module 0055b86780 Merge bitcoin-core/secp256k1#1551: Add ellswift usage example ea2d5f0f17 Merge bitcoin-core/secp256k1#1563: doc: Add convention for defaults ca06e58b2c Merge bitcoin-core/secp256k1#1564: build, ci: Adjust the default size of the precomputed table for signing e2af491263 ci: Switch to the new default value of the precomputed table for signing d94a9273f8 build: Adjust the default size of the precomputed table for signing fcc5d7381b Merge bitcoin-core/secp256k1#1565: cmake: Bump CMake minimum required version up to 3.16 9420eece24 cmake: Bump CMake minimum required version up to 3.16 16685649d2 doc: Add convention for defaults a5269373fa Merge bitcoin-core/secp256k1#1555: Fixed O3 replacement b8fe33332b cmake: Fixed O3 replacement 31f84595c4 Add ellswift usage example fe4fbaa7f3 examples: fix case typos in secret clearing paragraphs (s/, Or/, or/) git-subtree-dir: src/secp256k1 git-subtree-split: 642c885b6102725e25623738529895a95addc4f4
1 parent 1408944 commit 41797f8

18 files changed

+217
-56
lines changed

.cirrus.yml

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ env:
2020
EXPERIMENTAL: no
2121
ECDH: no
2222
RECOVERY: no
23+
EXTRAKEYS: no
2324
SCHNORRSIG: no
2425
ELLSWIFT: no
2526
### test options
@@ -66,6 +67,7 @@ task:
6667
env:
6768
ECDH: yes
6869
RECOVERY: yes
70+
EXTRAKEYS: yes
6971
SCHNORRSIG: yes
7072
ELLSWIFT: yes
7173
matrix:
@@ -82,6 +84,7 @@ task:
8284
env:
8385
ECDH: yes
8486
RECOVERY: yes
87+
EXTRAKEYS: yes
8588
SCHNORRSIG: yes
8689
ELLSWIFT: yes
8790
WRAPPER_CMD: 'valgrind --error-exitcode=42'

.github/workflows/ci.yml

+33-22
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ env:
2222
BUILD: 'check'
2323
### secp256k1 config
2424
ECMULTWINDOW: 15
25-
ECMULTGENKB: 22
25+
ECMULTGENKB: 86
2626
ASM: 'no'
2727
WIDEMUL: 'auto'
2828
WITH_VALGRIND: 'yes'
@@ -31,6 +31,7 @@ env:
3131
EXPERIMENTAL: 'no'
3232
ECDH: 'no'
3333
RECOVERY: 'no'
34+
EXTRAKEYS: 'no'
3435
SCHNORRSIG: 'no'
3536
ELLSWIFT: 'no'
3637
### test options
@@ -71,18 +72,18 @@ 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', EXTRAKEYS: 'yes', SCHNORRSIG: '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' }
80-
- env_vars: { RECOVERY: 'yes', SCHNORRSIG: 'yes' }
81-
- env_vars: { CTIMETESTS: 'no', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', CPPFLAGS: '-DVERIFY' }
77+
- 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', 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' }
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: { CFLAGS: '-O1', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
8687
- env_vars: { ECMULTGENKB: 2, ECMULTWINDOW: 2 }
8788
- env_vars: { ECMULTGENKB: 86, ECMULTWINDOW: 4 }
8889
cc:
@@ -139,6 +140,7 @@ jobs:
139140
HOST: 'i686-linux-gnu'
140141
ECDH: 'yes'
141142
RECOVERY: 'yes'
143+
EXTRAKEYS: 'yes'
142144
SCHNORRSIG: 'yes'
143145
ELLSWIFT: 'yes'
144146
CC: ${{ matrix.cc }}
@@ -183,6 +185,7 @@ jobs:
183185
WITH_VALGRIND: 'no'
184186
ECDH: 'yes'
185187
RECOVERY: 'yes'
188+
EXTRAKEYS: 'yes'
186189
SCHNORRSIG: 'yes'
187190
ELLSWIFT: 'yes'
188191
CTIMETESTS: 'no'
@@ -234,6 +237,7 @@ jobs:
234237
WITH_VALGRIND: 'no'
235238
ECDH: 'yes'
236239
RECOVERY: 'yes'
240+
EXTRAKEYS: 'yes'
237241
SCHNORRSIG: 'yes'
238242
ELLSWIFT: 'yes'
239243
CTIMETESTS: 'no'
@@ -279,6 +283,7 @@ jobs:
279283
WITH_VALGRIND: 'no'
280284
ECDH: 'yes'
281285
RECOVERY: 'yes'
286+
EXTRAKEYS: 'yes'
282287
SCHNORRSIG: 'yes'
283288
ELLSWIFT: 'yes'
284289
CTIMETESTS: 'no'
@@ -334,6 +339,7 @@ jobs:
334339
WITH_VALGRIND: 'no'
335340
ECDH: 'yes'
336341
RECOVERY: 'yes'
342+
EXTRAKEYS: 'yes'
337343
SCHNORRSIG: 'yes'
338344
ELLSWIFT: 'yes'
339345
CTIMETESTS: 'no'
@@ -386,6 +392,7 @@ jobs:
386392
WRAPPER_CMD: 'valgrind --error-exitcode=42'
387393
ECDH: 'yes'
388394
RECOVERY: 'yes'
395+
EXTRAKEYS: 'yes'
389396
SCHNORRSIG: 'yes'
390397
ELLSWIFT: 'yes'
391398
CTIMETESTS: 'no'
@@ -437,6 +444,7 @@ jobs:
437444
env:
438445
ECDH: 'yes'
439446
RECOVERY: 'yes'
447+
EXTRAKEYS: 'yes'
440448
SCHNORRSIG: 'yes'
441449
ELLSWIFT: 'yes'
442450
CTIMETESTS: 'no'
@@ -501,6 +509,7 @@ jobs:
501509
env:
502510
ECDH: 'yes'
503511
RECOVERY: 'yes'
512+
EXTRAKEYS: 'yes'
504513
SCHNORRSIG: 'yes'
505514
ELLSWIFT: 'yes'
506515
CC: 'clang'
@@ -547,6 +556,7 @@ jobs:
547556
WITH_VALGRIND: 'no'
548557
ECDH: 'yes'
549558
RECOVERY: 'yes'
559+
EXTRAKEYS: 'yes'
550560
SCHNORRSIG: 'yes'
551561
ELLSWIFT: 'yes'
552562
CTIMETESTS: 'no'
@@ -605,15 +615,15 @@ jobs:
605615
fail-fast: false
606616
matrix:
607617
env_vars:
608-
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
618+
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
609619
- { WIDEMUL: 'int128_struct', ECMULTGENKB: 2, ECMULTWINDOW: 4 }
610-
- { WIDEMUL: 'int128', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
620+
- { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
611621
- { WIDEMUL: 'int128', RECOVERY: 'yes' }
612-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
613-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc' }
614-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', WRAPPER_CMD: 'valgrind --error-exitcode=42', SECP256K1_TEST_ITERS: 2 }
615-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc', WRAPPER_CMD: 'valgrind --error-exitcode=42', SECP256K1_TEST_ITERS: 2 }
616-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CPPFLAGS: '-DVERIFY', CTIMETESTS: 'no' }
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' }
617627
- BUILD: 'distcheck'
618628

619629
steps:
@@ -666,13 +676,13 @@ jobs:
666676
fail-fast: false
667677
matrix:
668678
env_vars:
669-
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
679+
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
670680
- { WIDEMUL: 'int128_struct', ECMULTGENPRECISION: 2, ECMULTWINDOW: 4 }
671-
- { WIDEMUL: 'int128', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
681+
- { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
672682
- { WIDEMUL: 'int128', RECOVERY: 'yes' }
673-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
674-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc' }
675-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CPPFLAGS: '-DVERIFY' }
683+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
684+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc' }
685+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CPPFLAGS: '-DVERIFY' }
676686
- BUILD: 'distcheck'
677687

678688
steps:
@@ -778,6 +788,7 @@ jobs:
778788
WERROR_CFLAGS:
779789
ECDH: 'yes'
780790
RECOVERY: 'yes'
791+
EXTRAKEYS: 'yes'
781792
SCHNORRSIG: 'yes'
782793
ELLSWIFT: 'yes'
783794

@@ -864,5 +875,5 @@ jobs:
864875
CI_BUILD: ${{ runner.temp }}/${{ github.run_id }}${{ github.action }}/build
865876
CI_INSTALL: ${{ runner.temp }}/${{ github.run_id }}${{ github.action }}/install
866877
run: |
867-
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 }}
868879
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

.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

CHANGELOG.md

+16-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,20 @@ 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]
8+
## [0.5.1] - 2024-08-01
9+
10+
#### Added
11+
- Added usage example for an ElligatorSwift key exchange.
12+
13+
#### Changed
14+
- The default size of the precomputed table for signing was changed from 22 KiB to 86 KiB. The size can be changed with the configure option `--ecmult-gen-kb` (`SECP256K1_ECMULT_GEN_KB` for CMake).
15+
- "auto" is no longer an accepted value for the `--with-ecmult-window` and `--with-ecmult-gen-kb` configure options (this also applies to `SECP256K1_ECMULT_WINDOW_SIZE` and `SECP256K1_ECMULT_GEN_KB` in CMake). To achieve the same configuration as previously provided by the "auto" value, omit setting the configure option explicitly.
16+
17+
#### Fixed
18+
- Fixed compilation when the extrakeys module is disabled.
19+
20+
#### ABI Compatibility
21+
The ABI is backward compatible with versions 0.5.0, 0.4.x and 0.3.x.
922

1023
## [0.5.0] - 2024-05-06
1124

@@ -14,7 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1427

1528
#### Changed
1629
- The implementation of the point multiplication algorithm used for signing and public key generation was changed, resulting in improved performance for those operations.
17-
- The related configure option `--ecmult-gen-precision` was replaced with `--ecmult-gen-kb` (`ECMULT_GEN_KB` for CMake).
30+
- The related configure option `--ecmult-gen-precision` was replaced with `--ecmult-gen-kb` (`SECP256K1_ECMULT_GEN_KB` for CMake).
1831
- 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).
1932

2033
#### ABI Compatibility
@@ -128,7 +141,7 @@ This version was in fact never released.
128141
The number was given by the build system since the introduction of autotools in Jan 2014 (ea0fe5a5bf0c04f9cc955b2966b614f5f378c6f6).
129142
Therefore, this version number does not uniquely identify a set of source files.
130143

131-
[unreleased]: https://github.com/bitcoin-core/secp256k1/compare/v0.5.0...HEAD
144+
[0.5.1]: https://github.com/bitcoin-core/secp256k1/compare/v0.5.0...v0.5.1
132145
[0.5.0]: https://github.com/bitcoin-core/secp256k1/compare/v0.4.1...v0.5.0
133146
[0.4.1]: https://github.com/bitcoin-core/secp256k1/compare/v0.4.0...v0.4.1
134147
[0.4.0]: https://github.com/bitcoin-core/secp256k1/compare/v0.3.2...v0.4.0

CMakeLists.txt

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
cmake_minimum_required(VERSION 3.13)
2-
3-
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.15)
4-
# MSVC runtime library flags are selected by the CMAKE_MSVC_RUNTIME_LIBRARY abstraction.
5-
cmake_policy(SET CMP0091 NEW)
6-
# MSVC warning flags are not in CMAKE_<LANG>_FLAGS by default.
7-
cmake_policy(SET CMP0092 NEW)
8-
endif()
1+
cmake_minimum_required(VERSION 3.16)
92

103
project(libsecp256k1
114
# The package (a.k.a. release) version is based on semantic versioning 2.0.0 of
@@ -97,7 +90,7 @@ include(CheckStringOptionValue)
9790
check_string_option_value(SECP256K1_ECMULT_WINDOW_SIZE)
9891
add_compile_definitions(ECMULT_WINDOW_SIZE=${SECP256K1_ECMULT_WINDOW_SIZE})
9992

100-
set(SECP256K1_ECMULT_GEN_KB 22 CACHE STRING "The size of the precomputed table for signing in multiples of 1024 bytes (on typical platforms). Larger values result in possibly better signing or key generation performance at the cost of a larger table. Valid choices are 2, 22, 86. The default value is a reasonable setting for desktop machines (currently 22). [default=22]")
93+
set(SECP256K1_ECMULT_GEN_KB 86 CACHE STRING "The size of the precomputed table for signing in multiples of 1024 bytes (on typical platforms). Larger values result in possibly better signing or key generation performance at the cost of a larger table. Valid choices are 2, 22, 86. The default value is a reasonable setting for desktop machines (currently 86). [default=86]")
10194
set_property(CACHE SECP256K1_ECMULT_GEN_KB PROPERTY STRINGS 2 22 86)
10295
check_string_option_value(SECP256K1_ECMULT_GEN_KB)
10396
if(SECP256K1_ECMULT_GEN_KB EQUAL 2)
@@ -185,7 +178,7 @@ else()
185178
string(REGEX REPLACE "-DNDEBUG[ \t\r\n]*" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
186179
string(REGEX REPLACE "-DNDEBUG[ \t\r\n]*" "" CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}")
187180
# Prefer -O2 optimization level. (-O3 is CMake's default for Release for many compilers.)
188-
string(REGEX REPLACE "-O3[ \t\r\n]*" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
181+
string(REGEX REPLACE "-O3( |$)" "-O2\\1" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
189182
endif()
190183

191184
# Define custom "Coverage" build type.

CONTRIBUTING.md

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ In addition, libsecp256k1 tries to maintain the following coding conventions:
4949
* Operations involving secret data should be tested for being constant time with respect to the secrets (see [src/ctime_tests.c](src/ctime_tests.c)).
5050
* Local variables containing secret data should be cleared explicitly to try to delete secrets from memory.
5151
* Use `secp256k1_memcmp_var` instead of `memcmp` (see [#823](https://github.com/bitcoin-core/secp256k1/issues/823)).
52+
* As a rule of thumb, the default values for configuration options should target standard desktop machines and align with Bitcoin Core's defaults, and the tests should mostly exercise the default configuration (see [#1549](https://github.com/bitcoin-core/secp256k1/issues/1549#issuecomment-2200559257)).
5253

5354
#### Style conventions
5455

Makefile.am

+11
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,17 @@ schnorr_example_LDFLAGS += -lbcrypt
184184
endif
185185
TESTS += schnorr_example
186186
endif
187+
if ENABLE_MODULE_ELLSWIFT
188+
noinst_PROGRAMS += ellswift_example
189+
ellswift_example_SOURCES = examples/ellswift.c
190+
ellswift_example_CPPFLAGS = -I$(top_srcdir)/include -DSECP256K1_STATIC
191+
ellswift_example_LDADD = libsecp256k1.la
192+
ellswift_example_LDFLAGS = -static
193+
if BUILD_WINDOWS
194+
ellswift_example_LDFLAGS += -lbcrypt
195+
endif
196+
TESTS += ellswift_example
197+
endif
187198
endif
188199

189200
### Precomputed tables

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ To maintain a pristine source tree, CMake encourages to perform an out-of-source
8282
$ cmake ..
8383
$ cmake --build .
8484
$ ctest # run the test suite
85-
$ sudo cmake --build . --target install # optional
85+
$ sudo cmake --install . # optional
8686

8787
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.
8888

@@ -114,6 +114,7 @@ Usage examples can be found in the [examples](examples) directory. To compile th
114114
* [ECDSA example](examples/ecdsa.c)
115115
* [Schnorr signatures example](examples/schnorr.c)
116116
* [Deriving a shared secret (ECDH) example](examples/ecdh.c)
117+
* [ElligatorSwift key exchange example](examples/ellswift.c)
117118

118119
To compile the Schnorr signature and ECDH examples, you also need to configure with `--enable-module-schnorrsig` and `--enable-module-ecdh`.
119120

ci/ci.sh

+2-1
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 SCHNORRSIG ELLSWIFT \
16+
EXPERIMENTAL ECDH RECOVERY EXTRAKEYS SCHNORRSIG ELLSWIFT \
1717
SECP256K1_TEST_ITERS BENCH SECP256K1_BENCH_ITERS CTIMETESTS\
1818
EXAMPLES \
1919
HOST WRAPPER_CMD \
@@ -77,6 +77,7 @@ esac
7777
--with-ecmult-gen-kb="$ECMULTGENKB" \
7878
--enable-module-ecdh="$ECDH" --enable-module-recovery="$RECOVERY" \
7979
--enable-module-ellswift="$ELLSWIFT" \
80+
--enable-module-extrakeys="$EXTRAKEYS" \
8081
--enable-module-schnorrsig="$SCHNORRSIG" \
8182
--enable-examples="$EXAMPLES" \
8283
--enable-ctime-tests="$CTIMETESTS" \

configure.ac

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ AC_PREREQ([2.60])
66
define(_PKG_VERSION_MAJOR, 0)
77
define(_PKG_VERSION_MINOR, 5)
88
define(_PKG_VERSION_PATCH, 1)
9-
define(_PKG_VERSION_IS_RELEASE, false)
9+
define(_PKG_VERSION_IS_RELEASE, true)
1010

1111
# The library version is based on libtool versioning of the ABI. The set of
1212
# rules for updating the version can be found here:
@@ -216,9 +216,9 @@ AC_ARG_WITH([ecmult-window], [AS_HELP_STRING([--with-ecmult-window=SIZE],
216216
AC_ARG_WITH([ecmult-gen-kb], [AS_HELP_STRING([--with-ecmult-gen-kb=2|22|86],
217217
[The size of the precomputed table for signing in multiples of 1024 bytes (on typical platforms).]
218218
[Larger values result in possibly better signing/keygeneration performance at the cost of a larger table.]
219-
[The default value is a reasonable setting for desktop machines (currently 22). [default=22]]
219+
[The default value is a reasonable setting for desktop machines (currently 86). [default=86]]
220220
)],
221-
[set_ecmult_gen_kb=$withval], [set_ecmult_gen_kb=22])
221+
[set_ecmult_gen_kb=$withval], [set_ecmult_gen_kb=86])
222222

223223
AC_ARG_WITH([valgrind], [AS_HELP_STRING([--with-valgrind=yes|no|auto],
224224
[Build with extra checks for running inside Valgrind [default=auto]]

doc/release-process.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Perform these checks when reviewing the release PR (see below):
3131
```shell
3232
dir=$(mktemp -d)
3333
build=$(mktemp -d)
34-
cmake -B $build -DCMAKE_INSTALL_PREFIX=$dir && cmake --build $build --target install && ls -RlAh $dir
34+
cmake -B $build -DCMAKE_INSTALL_PREFIX=$dir && cmake --build $build && cmake --install $build && ls -RlAh $dir
3535
gcc -o ecdsa examples/ecdsa.c -I $dir/include -L $dir/lib*/ -l secp256k1 -Wl,-rpath,"$dir/lib",-rpath,"$dir/lib64" && ./ecdsa
3636
```
3737
4. Use the [`check-abi.sh`](/tools/check-abi.sh) tool to verify that there are no unexpected ABI incompatibilities and that the version number and the release notes accurately reflect all potential ABI changes. To run this tool, the `abi-dumper` and `abi-compliance-checker` packages are required.
@@ -44,7 +44,8 @@ Perform these checks when reviewing the release PR (see below):
4444
1. Open a PR to the master branch with a commit (using message `"release: prepare for $MAJOR.$MINOR.$PATCH"`, for example) that
4545
* finalizes the release notes in [CHANGELOG.md](../CHANGELOG.md) by
4646
* adding a section for the release (make sure that the version number is a link to a diff between the previous and new version),
47-
* removing the `[Unreleased]` section header, and
47+
* removing the `[Unreleased]` section header,
48+
* ensuring that the release notes are not missing entries (check the `needs-changelog` label on github), and
4849
* including an entry for `### ABI Compatibility` if it doesn't exist,
4950
* sets `_PKG_VERSION_IS_RELEASE` to `true` in `configure.ac`, and,
5051
* if this is not a patch release,

examples/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,7 @@ endif()
2828
if(SECP256K1_ENABLE_MODULE_SCHNORRSIG)
2929
add_example(schnorr)
3030
endif()
31+
32+
if(SECP256K1_ENABLE_MODULE_ELLSWIFT)
33+
add_example(ellswift)
34+
endif()

0 commit comments

Comments
 (0)