Skip to content

Commit 4a09aa7

Browse files
fanquakejanus
authored andcommitted
Squashed 'src/secp256k1/' changes from d8311688bd..06bff6dec8
06bff6dec8 Merge bitcoin-core/secp256k1#1528: tests: call `secp256k1_ecmult_multi_var` with a non-`NULL` error callback 4155e62fcc Merge bitcoin-core/secp256k1#1526: cmake: Fix `check_arm32_assembly` when using as subproject 9554362b15 tests: call secp256k1_ecmult_multi_var with a non-NULL error callback 9f4c8cd730 cmake: Fix `check_arm32_assembly` when using as subproject 7712a53061 Merge bitcoin-core/secp256k1#1524: check-abi: explicitly provide public headers 7d0bc0870f Merge bitcoin-core/secp256k1#1525: changelog: Correct 0.5.0 release date d45d9b74bb changelog: Correct 0.5.0 release date d7f6613dbb Merge bitcoin-core/secp256k1#1523: release cleanup: bump version after 0.5.0 2f05e2da4b release cleanup: bump version after 0.5.0 e3a885d42a Merge bitcoin-core/secp256k1#1522: release: prepare for 0.5.0 dd695563e6 check-abi: explicitly provide public headers c0e4ec3fee release: prepare for 0.5.0 bb528cfb08 Merge bitcoin-core/secp256k1#1518: Add secp256k1_pubkey_sort 7d2591ce12 Add secp256k1_pubkey_sort da515074e3 Merge bitcoin-core/secp256k1#1058: Signed-digit multi-comb ecmult_gen algorithm 4c341f89ab Add changelog entry for SDMC a043940253 Permit COMB_BITS < 256 for exhaustive tests 39b2f2a321 Add test case for ecmult_gen recoded = {-1,0,1} 644e86de9a Reintroduce projective blinding 07810d9abb Reduce side channels from single-bit reads a0d32b597d Optimization: use Nx32 representation for recoded bits e03dcc44b5 Make secp256k1_scalar_get_bits support 32-bit reads 5005abee60 Rename scalar_get_bits -> scalar_get_bits_limb32; return uint32_t 6247f485b6 Optimization: avoid unnecessary doublings in precomputation 15d0cca2a6 Optimization: first table lookup needs no point addition 7a33db35cd Optimization: move (2^COMB_BITS-1)/2 term into ctx->scalar_offset ed2a056f3d Provide 3 configurations accessible through ./configure 5f7be9f6a5 Always generate tables for current (blocks,teeth) config fde1dfcd8d Signed-digit multi-comb ecmult_gen algorithm 486518b350 Make exhaustive tests's scalar_inverse(&x,&x) work ab45c3e089 Initial gej blinding -> final ge blinding aa00a6b892 Introduce CEIL_DIV macro and use it git-subtree-dir: src/secp256k1 git-subtree-split: 06bff6dec8d038f7b4112664a9b882293ebc5178
1 parent 96c756f commit 4a09aa7

29 files changed

+3116
-10149
lines changed

.cirrus.yml

+28-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,34 @@
11
env:
22
### cirrus config
33
CIRRUS_CLONE_DEPTH: 1
4-
PACKAGE_MANAGER_INSTALL: "apt-get update && apt-get install -y"
5-
MAKEJOBS: "-j10"
6-
TEST_RUNNER_PORT_MIN: "14000" # Must be larger than 12321, which is used for the http cache. See https://cirrus-ci.org/guide/writing-tasks/#http-cache
7-
CI_FAILFAST_TEST_LEAVE_DANGLING: "1" # Cirrus CI does not care about dangling processes and setting this variable avoids killing the CI script itself on error
8-
CCACHE_MAXSIZE: "200M"
9-
CCACHE_DIR: "/tmp/ccache_dir"
10-
CCACHE_NOHASHDIR: "1" # Debug info might contain a stale path if the build dir changes, but this is fine
4+
### compiler options
5+
HOST:
6+
WRAPPER_CMD:
7+
# Specific warnings can be disabled with -Wno-error=foo.
8+
# -pedantic-errors is not equivalent to -Werror=pedantic and thus not implied by -Werror according to the GCC manual.
9+
WERROR_CFLAGS: -Werror -pedantic-errors
10+
MAKEFLAGS: -j4
11+
BUILD: check
12+
### secp256k1 config
13+
ECMULTWINDOW: auto
14+
ECMULTGENKB: auto
15+
ASM: no
16+
WIDEMUL: auto
17+
WITH_VALGRIND: yes
18+
EXTRAFLAGS:
19+
### secp256k1 modules
20+
EXPERIMENTAL: no
21+
ECDH: no
22+
RECOVERY: no
23+
SCHNORRSIG: no
24+
ELLSWIFT: no
25+
### test options
26+
SECP256K1_TEST_ITERS:
27+
BENCH: yes
28+
SECP256K1_BENCH_ITERS: 2
29+
CTIMETESTS: yes
30+
# Compile and run the tests
31+
EXAMPLES: yes
1132

1233
# https://cirrus-ci.org/guide/persistent-workers/
1334
#

.github/workflows/ci.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ env:
2222
BUILD: 'check'
2323
### secp256k1 config
2424
ECMULTWINDOW: 'auto'
25-
ECMULTGENPRECISION: 'auto'
25+
ECMULTGENKB: 'auto'
2626
ASM: 'no'
2727
WIDEMUL: 'auto'
2828
WITH_VALGRIND: 'yes'
@@ -123,8 +123,8 @@ jobs:
123123
- env_vars: { CPPFLAGS: '-DDETERMINISTIC' }
124124
- env_vars: { CFLAGS: '-O0', CTIMETESTS: 'no' }
125125
- env_vars: { CFLAGS: '-O1', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
126-
- env_vars: { ECMULTGENPRECISION: 2, ECMULTWINDOW: 2 }
127-
- env_vars: { ECMULTGENPRECISION: 8, ECMULTWINDOW: 4 }
126+
- env_vars: { ECMULTGENKB: 2, ECMULTWINDOW: 2 }
127+
- env_vars: { ECMULTGENKB: 86, ECMULTWINDOW: 4 }
128128
cc:
129129
- 'gcc'
130130
- 'clang'
@@ -370,8 +370,8 @@ jobs:
370370
configuration:
371371
- env_vars: { CC: 'clang', ASM: 'auto' }
372372
- env_vars: { CC: 'i686-linux-gnu-gcc', HOST: 'i686-linux-gnu', ASM: 'auto' }
373-
- env_vars: { CC: 'clang', ASM: 'no', ECMULTGENPRECISION: 2, ECMULTWINDOW: 2 }
374-
- env_vars: { CC: 'i686-linux-gnu-gcc', HOST: 'i686-linux-gnu', ASM: 'no', ECMULTGENPRECISION: 2, ECMULTWINDOW: 2 }
373+
- env_vars: { CC: 'clang', ASM: 'no', ECMULTGENKB: 2, ECMULTWINDOW: 2 }
374+
- env_vars: { CC: 'i686-linux-gnu-gcc', HOST: 'i686-linux-gnu', ASM: 'no', ECMULTGENKB: 2, ECMULTWINDOW: 2 }
375375

376376
- name: Get tool information
377377
run: |
@@ -420,8 +420,8 @@ jobs:
420420
configuration:
421421
- env_vars: { CC: 'clang', ASM: 'auto' }
422422
- env_vars: { CC: 'i686-linux-gnu-gcc', HOST: 'i686-linux-gnu', ASM: 'auto' }
423-
- env_vars: { CC: 'clang', ASM: 'no', ECMULTGENPRECISION: 2, ECMULTWINDOW: 2 }
424-
- env_vars: { CC: 'i686-linux-gnu-gcc', HOST: 'i686-linux-gnu', ASM: 'no', ECMULTGENPRECISION: 2, ECMULTWINDOW: 2 }
423+
- env_vars: { CC: 'clang', ASM: 'no', ECMULTGENKB: 2, ECMULTWINDOW: 2 }
424+
- env_vars: { CC: 'i686-linux-gnu-gcc', HOST: 'i686-linux-gnu', ASM: 'no', ECMULTGENKB: 2, ECMULTWINDOW: 2 }
425425

426426
env:
427427
ECDH: 'yes'
@@ -500,7 +500,7 @@ jobs:
500500
- env_vars:
501501
CFLAGS: '-fsanitize=memory -fsanitize-recover=memory -g'
502502
- env_vars:
503-
ECMULTGENPRECISION: 2
503+
ECMULTGENKB: 2
504504
ECMULTWINDOW: 2
505505
CFLAGS: '-fsanitize=memory -fsanitize-recover=memory -g -O3'
506506

@@ -574,7 +574,7 @@ jobs:
574574
matrix:
575575
env_vars:
576576
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
577-
- { WIDEMUL: 'int128_struct', ECMULTGENPRECISION: 2, ECMULTWINDOW: 4 }
577+
- { WIDEMUL: 'int128_struct', ECMULTGENKB: 2, ECMULTWINDOW: 4 }
578578
- { WIDEMUL: 'int128', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
579579
- { WIDEMUL: 'int128', RECOVERY: 'yes' }
580580
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }

CHANGELOG.md

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

88
## [Unreleased]
99

10+
## [0.5.0] - 2024-05-06
11+
12+
#### Added
13+
- New function `secp256k1_ec_pubkey_sort` that sorts public keys using lexicographic (of compressed serialization) order.
14+
15+
#### Changed
16+
- 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).
18+
- 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).
19+
20+
#### ABI Compatibility
21+
The ABI is backward compatible with versions 0.4.x and 0.3.x.
22+
1023
## [0.4.1] - 2023-12-21
1124

1225
#### Changed
@@ -115,7 +128,8 @@ This version was in fact never released.
115128
The number was given by the build system since the introduction of autotools in Jan 2014 (ea0fe5a5bf0c04f9cc955b2966b614f5f378c6f6).
116129
Therefore, this version number does not uniquely identify a set of source files.
117130

118-
[unreleased]: https://github.com/bitcoin-core/secp256k1/compare/v0.4.1...HEAD
131+
[unreleased]: https://github.com/bitcoin-core/secp256k1/compare/v0.5.0...HEAD
132+
[0.5.0]: https://github.com/bitcoin-core/secp256k1/compare/v0.4.1...v0.5.0
119133
[0.4.1]: https://github.com/bitcoin-core/secp256k1/compare/v0.4.0...v0.4.1
120134
[0.4.0]: https://github.com/bitcoin-core/secp256k1/compare/v0.3.2...v0.4.0
121135
[0.3.2]: https://github.com/bitcoin-core/secp256k1/compare/v0.3.1...v0.3.2

Makefile.am

+83-8
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,89 @@
22
# Distributed under the MIT software license, see the accompanying
33
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5-
# Pattern rule to print variables, e.g. make print-top_srcdir
6-
print-%: FORCE
7-
@echo '$*'='$($*)'
8-
9-
ACLOCAL_AMFLAGS = -I build-aux/m4
10-
SUBDIRS = src
11-
if ENABLE_MAN
12-
SUBDIRS += doc/man
5+
# AM_CFLAGS will be automatically prepended to CFLAGS by Automake when compiling some foo
6+
# which does not have an explicit foo_CFLAGS variable set.
7+
AM_CFLAGS = $(SECP_CFLAGS)
8+
9+
lib_LTLIBRARIES = libsecp256k1.la
10+
include_HEADERS = include/secp256k1.h
11+
include_HEADERS += include/secp256k1_preallocated.h
12+
noinst_HEADERS =
13+
noinst_HEADERS += src/scalar.h
14+
noinst_HEADERS += src/scalar_4x64.h
15+
noinst_HEADERS += src/scalar_8x32.h
16+
noinst_HEADERS += src/scalar_low.h
17+
noinst_HEADERS += src/scalar_impl.h
18+
noinst_HEADERS += src/scalar_4x64_impl.h
19+
noinst_HEADERS += src/scalar_8x32_impl.h
20+
noinst_HEADERS += src/scalar_low_impl.h
21+
noinst_HEADERS += src/group.h
22+
noinst_HEADERS += src/group_impl.h
23+
noinst_HEADERS += src/ecdsa.h
24+
noinst_HEADERS += src/ecdsa_impl.h
25+
noinst_HEADERS += src/eckey.h
26+
noinst_HEADERS += src/eckey_impl.h
27+
noinst_HEADERS += src/ecmult.h
28+
noinst_HEADERS += src/ecmult_impl.h
29+
noinst_HEADERS += src/ecmult_compute_table.h
30+
noinst_HEADERS += src/ecmult_compute_table_impl.h
31+
noinst_HEADERS += src/ecmult_const.h
32+
noinst_HEADERS += src/ecmult_const_impl.h
33+
noinst_HEADERS += src/ecmult_gen.h
34+
noinst_HEADERS += src/ecmult_gen_impl.h
35+
noinst_HEADERS += src/ecmult_gen_compute_table.h
36+
noinst_HEADERS += src/ecmult_gen_compute_table_impl.h
37+
noinst_HEADERS += src/field_10x26.h
38+
noinst_HEADERS += src/field_10x26_impl.h
39+
noinst_HEADERS += src/field_5x52.h
40+
noinst_HEADERS += src/field_5x52_impl.h
41+
noinst_HEADERS += src/field_5x52_int128_impl.h
42+
noinst_HEADERS += src/modinv32.h
43+
noinst_HEADERS += src/modinv32_impl.h
44+
noinst_HEADERS += src/modinv64.h
45+
noinst_HEADERS += src/modinv64_impl.h
46+
noinst_HEADERS += src/precomputed_ecmult.h
47+
noinst_HEADERS += src/precomputed_ecmult_gen.h
48+
noinst_HEADERS += src/assumptions.h
49+
noinst_HEADERS += src/checkmem.h
50+
noinst_HEADERS += src/testutil.h
51+
noinst_HEADERS += src/util.h
52+
noinst_HEADERS += src/int128.h
53+
noinst_HEADERS += src/int128_impl.h
54+
noinst_HEADERS += src/int128_native.h
55+
noinst_HEADERS += src/int128_native_impl.h
56+
noinst_HEADERS += src/int128_struct.h
57+
noinst_HEADERS += src/int128_struct_impl.h
58+
noinst_HEADERS += src/scratch.h
59+
noinst_HEADERS += src/scratch_impl.h
60+
noinst_HEADERS += src/selftest.h
61+
noinst_HEADERS += src/testrand.h
62+
noinst_HEADERS += src/testrand_impl.h
63+
noinst_HEADERS += src/hash.h
64+
noinst_HEADERS += src/hash_impl.h
65+
noinst_HEADERS += src/field.h
66+
noinst_HEADERS += src/field_impl.h
67+
noinst_HEADERS += src/bench.h
68+
noinst_HEADERS += src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.h
69+
noinst_HEADERS += src/hsort.h
70+
noinst_HEADERS += src/hsort_impl.h
71+
noinst_HEADERS += contrib/lax_der_parsing.h
72+
noinst_HEADERS += contrib/lax_der_parsing.c
73+
noinst_HEADERS += contrib/lax_der_privatekey_parsing.h
74+
noinst_HEADERS += contrib/lax_der_privatekey_parsing.c
75+
noinst_HEADERS += examples/examples_util.h
76+
77+
PRECOMPUTED_LIB = libsecp256k1_precomputed.la
78+
noinst_LTLIBRARIES = $(PRECOMPUTED_LIB)
79+
libsecp256k1_precomputed_la_SOURCES = src/precomputed_ecmult.c src/precomputed_ecmult_gen.c
80+
# We need `-I$(top_srcdir)/src` in VPATH builds if libsecp256k1_precomputed_la_SOURCES have been recreated in the build tree.
81+
# This helps users and packagers who insist on recreating the precomputed files (e.g., Gentoo).
82+
libsecp256k1_precomputed_la_CPPFLAGS = -I$(top_srcdir)/src $(SECP_CONFIG_DEFINES)
83+
84+
if USE_EXTERNAL_ASM
85+
COMMON_LIB = libsecp256k1_common.la
86+
else
87+
COMMON_LIB =
1388
endif
1489
.PHONY: deploy FORCE
1590
.INTERMEDIATE: $(COVERAGE_INFO)

ci/ci.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ print_environment() {
1212
# There are many ways to print variable names and their content. This one
1313
# does not rely on bash.
1414
for var in WERROR_CFLAGS MAKEFLAGS BUILD \
15-
ECMULTWINDOW ECMULTGENPRECISION ASM WIDEMUL WITH_VALGRIND EXTRAFLAGS \
15+
ECMULTWINDOW ECMULTGENKB ASM WIDEMUL WITH_VALGRIND EXTRAFLAGS \
1616
EXPERIMENTAL ECDH RECOVERY SCHNORRSIG ELLSWIFT \
1717
SECP256K1_TEST_ITERS BENCH SECP256K1_BENCH_ITERS CTIMETESTS\
1818
EXAMPLES \
@@ -74,7 +74,7 @@ esac
7474
--enable-experimental="$EXPERIMENTAL" \
7575
--with-test-override-wide-multiply="$WIDEMUL" --with-asm="$ASM" \
7676
--with-ecmult-window="$ECMULTWINDOW" \
77-
--with-ecmult-gen-precision="$ECMULTGENPRECISION" \
77+
--with-ecmult-gen-kb="$ECMULTGENKB" \
7878
--enable-module-ecdh="$ECDH" --enable-module-recovery="$RECOVERY" \
7979
--enable-module-ellswift="$ELLSWIFT" \
8080
--enable-module-schnorrsig="$SCHNORRSIG" \

0 commit comments

Comments
 (0)