Skip to content

Commit cea8ada

Browse files
committed
Merge #60: bump version to 0.7 and update CHANGELOG
32ed375 Update secp256k1-zkp-sys in Cargo.toml (Riccardo Casatta) ba2fecb Updates upstream to d22774e248c703a191049b78f8d04f37d6fcfa05 (Riccardo Casatta) 09102ff update patch so that is applicable (Riccardo Casatta) 10c024d update Readme with correct MSRV (Riccardo Casatta) 6c91269 bump version to 0.7 and update CHANGELOG (Riccardo Casatta) Pull request description: ACKs for top commit: jonasnick: ACK 32ed375 Tree-SHA512: d0411daeda445eb151e3472ed66311190bcf80c25b5bde3f78b6829338b90468b40386d59b9cd56c93a001957a1a1fbd709e7f72947aee9c7ee37454460add9c
2 parents 9f90268 + 32ed375 commit cea8ada

168 files changed

Lines changed: 11836 additions & 9864 deletions

File tree

Some content is hidden

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

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Unreleased
22

3+
# 0.7.0 - 2022-09-27
4+
5+
- Increment MSRV to 1.41.1 and edition to 2018
6+
- ffi: fix signature of whitelist_sign
7+
- Update secp256k1 to 0.24.0 and update deprecated functions
8+
- Fix RangeProof and SurjectionProof from_str
9+
10+
# 0.6.0 - 2022-03-28
11+
12+
- Update secp256k1 to 0.22.1
13+
- Updates upstream to 725d895fc54cf82da1c2a9c69048656405da556d
14+
- Comment out WASM build
15+
316
# 0.5.0 - 2021-10-22
417

518
- Encrypt ECDSA adaptor signatures in release builds. Previously encryption returned just zero bytes.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "secp256k1-zkp"
3-
version = "0.6.0"
3+
version = "0.7.0"
44
authors = [ "Dawid Ciężarkiewicz <dpc@ucore.info>",
55
"Andrew Poelstra <apoelstra@wpsoftware.net>",
66
"Lucas Soriano <lucas@comit.network>",
@@ -32,7 +32,7 @@ use-rand = ["rand", "secp256k1/rand"]
3232

3333
[dependencies]
3434
secp256k1 = "0.24.0"
35-
secp256k1-zkp-sys = { version = "0.6.0", default-features = false, path = "./secp256k1-zkp-sys" }
35+
secp256k1-zkp-sys = { version = "0.7.0", default-features = false, path = "./secp256k1-zkp-sys" }
3636
rand = { version = "0.8", default-features = false, optional = true }
3737
serde = { version = "1.0", default-features = false, optional = true }
3838

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ Contributions to this library are welcome. A few guidelines:
2020
- Any breaking changes must have an accompanied entry in CHANGELOG.md
2121
- No new dependencies, please.
2222
- No crypto should be implemented in Rust, with the possible exception of hash functions. Cryptographic contributions should be directed upstream to libsecp256k1.
23-
- This library should always compile with any combination of features on **Rust 1.29**.
23+
- This library should always compile with any combination of features on **Rust 1.41.1**.

secp256k1-zkp-sys/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "secp256k1-zkp-sys"
3-
version = "0.6.0"
3+
version = "0.7.0"
44
authors = [ "Dawid Ciężarkiewicz <dpc@ucore.info>",
55
"Andrew Poelstra <apoelstra@wpsoftware.net>",
66
"Steven Roose <steven@stevenroose.org>",
@@ -13,7 +13,7 @@ description = "FFI for `libsecp256k1-zkp` library."
1313
keywords = [ "secp256k1", "libsecp256k1-zkp", "ffi" ]
1414
readme = "README.md"
1515
build = "build.rs"
16-
links = "rustsecp256k1zkp_v0_6_0"
16+
links = "rustsecp256k1zkp_v0_7_0"
1717

1818
# Should make docs.rs show all functions, even those behind non-default features
1919
[package.metadata.docs.rs]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# This file was automatically created by ./vendor-libsecp.sh
2-
725d895fc54cf82da1c2a9c69048656405da556d
2+
d22774e248c703a191049b78f8d04f37d6fcfa05

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

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ env:
2828
BENCH: yes
2929
SECP256K1_BENCH_ITERS: 2
3030
CTIMETEST: yes
31+
# Compile and run the tests
32+
EXAMPLES: yes
3133

3234
cat_logs_snippet: &CAT_LOGS
3335
always:
@@ -70,12 +72,12 @@ task:
7072
<< : *LINUX_CONTAINER
7173
matrix: &ENV_MATRIX
7274
- env: {WIDEMUL: int64, RECOVERY: yes}
73-
- env: {WIDEMUL: int64, ECDH: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes}
75+
- env: {WIDEMUL: int64, ECDH: yes, SCHNORRSIG: yes, EXPERIMENTAL: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes}
7476
- env: {WIDEMUL: int128}
75-
- env: {WIDEMUL: int128, RECOVERY: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes}
76-
- env: {WIDEMUL: int128, ECDH: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes}
77+
- env: {WIDEMUL: int128, RECOVERY: yes, SCHNORRSIG: yes}
78+
- env: {WIDEMUL: int128, ECDH: yes, SCHNORRSIG: yes, EXPERIMENTAL: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes}
7779
- env: {WIDEMUL: int128, ASM: x86_64}
78-
- env: { RECOVERY: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes}
80+
- env: { RECOVERY: yes, SCHNORRSIG: yes, EXPERIMENTAL: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes}
7981
- env: {BUILD: distcheck, WITH_VALGRIND: no, CTIMETEST: no, BENCH: no}
8082
- env: {CPPFLAGS: -DDETERMINISTIC}
8183
- env: {CFLAGS: -O0, CTIMETEST: no}
@@ -98,8 +100,8 @@ task:
98100
HOST: i686-linux-gnu
99101
ECDH: yes
100102
RECOVERY: yes
101-
EXPERIMENTAL: yes
102103
SCHNORRSIG: yes
104+
EXPERIMENTAL: yes
103105
ECDSA_S2C: yes
104106
RANGEPROOF: yes
105107
WHITELIST: yes
@@ -148,7 +150,8 @@ task:
148150
## - rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
149151
##
150152
brew_valgrind_pre_script:
151-
- brew update
153+
# Retry a few times because this tends to fail randomly.
154+
- for i in {1..5}; do brew update && break || sleep 15; done
152155
- brew config
153156
- brew tap LouisBrunner/valgrind
154157
# Fetch valgrind source but don't build it yet.
@@ -188,8 +191,8 @@ task:
188191
WITH_VALGRIND: no
189192
ECDH: yes
190193
RECOVERY: yes
191-
EXPERIMENTAL: yes
192194
SCHNORRSIG: yes
195+
EXPERIMENTAL: yes
193196
ECDSA_S2C: yes
194197
RANGEPROOF: yes
195198
WHITELIST: yes
@@ -214,12 +217,11 @@ task:
214217
WITH_VALGRIND: no
215218
ECDH: yes
216219
RECOVERY: yes
217-
EXPERIMENTAL: yes
218220
SCHNORRSIG: yes
219221
CTIMETEST: no
220222
matrix:
221223
- env: {}
222-
- env: {ASM: arm}
224+
- env: {EXPERIMENTAL: yes, ASM: arm}
223225
<< : *MERGE_BASE
224226
test_script:
225227
- ./ci/cirrus.sh
@@ -235,7 +237,6 @@ task:
235237
WITH_VALGRIND: no
236238
ECDH: yes
237239
RECOVERY: yes
238-
EXPERIMENTAL: yes
239240
SCHNORRSIG: yes
240241
CTIMETEST: no
241242
<< : *MERGE_BASE
@@ -253,7 +254,6 @@ task:
253254
WITH_VALGRIND: no
254255
ECDH: yes
255256
RECOVERY: yes
256-
EXPERIMENTAL: yes
257257
SCHNORRSIG: yes
258258
CTIMETEST: no
259259
<< : *MERGE_BASE
@@ -271,7 +271,6 @@ task:
271271
WITH_VALGRIND: no
272272
ECDH: yes
273273
RECOVERY: yes
274-
EXPERIMENTAL: yes
275274
SCHNORRSIG: yes
276275
CTIMETEST: no
277276
<< : *MERGE_BASE
@@ -286,8 +285,8 @@ task:
286285
env:
287286
ECDH: yes
288287
RECOVERY: yes
289-
EXPERIMENTAL: yes
290288
SCHNORRSIG: yes
289+
EXPERIMENTAL: yes
291290
ECDSA_S2C: yes
292291
RANGEPROOF: yes
293292
WHITELIST: yes
@@ -340,11 +339,17 @@ task:
340339
CC: gcc
341340
MAKEFLAGS: -j4 CC=g++ CFLAGS=-fpermissive\ -g
342341
WERROR_CFLAGS:
343-
EXPERIMENTAL: yes
344342
ECDH: yes
345343
RECOVERY: yes
346344
SCHNORRSIG: yes
347345
<< : *MERGE_BASE
348346
test_script:
349347
- ./ci/cirrus.sh
350348
<< : *CAT_LOGS
349+
350+
task:
351+
name: "sage prover"
352+
<< : *LINUX_CONTAINER
353+
test_script:
354+
- cd sage
355+
- sage prove_group_implementations.sage

secp256k1-zkp-sys/depend/secp256k1/.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@ exhaustive_tests
88
precompute_ecmult_gen
99
precompute_ecmult
1010
valgrind_ctime_test
11+
ecdh_example
12+
ecdsa_example
13+
schnorr_example
1114
*.exe
1215
*.so
1316
*.a
1417
*.csv
1518
!.gitignore
19+
*.log
20+
*.trs
1621

1722
Makefile
1823
configure
@@ -43,6 +48,7 @@ coverage.*.html
4348

4449
src/libsecp256k1-config.h
4550
src/libsecp256k1-config.h.in
51+
build-aux/ar-lib
4652
build-aux/config.guess
4753
build-aux/config.sub
4854
build-aux/depcomp
@@ -60,4 +66,4 @@ src/stamp-h1
6066
libsecp256k1.pc
6167
contrib/gh-pr-create.sh
6268

63-
example_musig
69+
musig_example

secp256k1-zkp-sys/depend/secp256k1/Makefile.am

Lines changed: 54 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ AM_CFLAGS = $(SECP_CFLAGS)
88

99
lib_LTLIBRARIES = libsecp256k1.la
1010
include_HEADERS = include/secp256k1.h
11-
include_HEADERS += include/rustsecp256k1zkp_v0_6_0_preallocated.h
11+
include_HEADERS += include/rustsecp256k1zkp_v0_7_0_preallocated.h
1212
noinst_HEADERS =
1313
noinst_HEADERS += src/scalar.h
1414
noinst_HEADERS += src/scalar_4x64.h
@@ -65,14 +65,15 @@ noinst_HEADERS += contrib/lax_der_parsing.h
6565
noinst_HEADERS += contrib/lax_der_parsing.c
6666
noinst_HEADERS += contrib/lax_der_privatekey_parsing.h
6767
noinst_HEADERS += contrib/lax_der_privatekey_parsing.c
68+
noinst_HEADERS += examples/random.h
6869

69-
PRECOMPUTED_LIB = librustsecp256k1zkp_v0_6_0_precomputed.la
70+
PRECOMPUTED_LIB = librustsecp256k1zkp_v0_7_0_precomputed.la
7071
noinst_LTLIBRARIES = $(PRECOMPUTED_LIB)
71-
librustsecp256k1zkp_v0_6_0_precomputed_la_SOURCES = src/precomputed_ecmult.c src/precomputed_ecmult_gen.c
72-
librustsecp256k1zkp_v0_6_0_precomputed_la_CPPFLAGS = $(SECP_INCLUDES)
72+
librustsecp256k1zkp_v0_7_0_precomputed_la_SOURCES = src/precomputed_ecmult.c src/precomputed_ecmult_gen.c
73+
librustsecp256k1zkp_v0_7_0_precomputed_la_CPPFLAGS = $(SECP_INCLUDES)
7374

7475
if USE_EXTERNAL_ASM
75-
COMMON_LIB = librustsecp256k1zkp_v0_6_0_common.la
76+
COMMON_LIB = librustsecp256k1zkp_v0_7_0_common.la
7677
else
7778
COMMON_LIB =
7879
endif
@@ -83,17 +84,17 @@ pkgconfig_DATA = libsecp256k1.pc
8384

8485
if USE_EXTERNAL_ASM
8586
if USE_ASM_ARM
86-
librustsecp256k1zkp_v0_6_0_common_la_SOURCES = src/asm/field_10x26_arm.s
87+
librustsecp256k1zkp_v0_7_0_common_la_SOURCES = src/asm/field_10x26_arm.s
8788
endif
8889
endif
8990

90-
librustsecp256k1zkp_v0_6_0_la_SOURCES = src/secp256k1.c
91-
librustsecp256k1zkp_v0_6_0_la_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES)
92-
librustsecp256k1zkp_v0_6_0_la_LIBADD = $(SECP_LIBS) $(COMMON_LIB) $(PRECOMPUTED_LIB)
93-
librustsecp256k1zkp_v0_6_0_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_CURRENT):$(LIB_VERSION_REVISION):$(LIB_VERSION_AGE)
91+
librustsecp256k1zkp_v0_7_0_la_SOURCES = src/secp256k1.c
92+
librustsecp256k1zkp_v0_7_0_la_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES)
93+
librustsecp256k1zkp_v0_7_0_la_LIBADD = $(SECP_LIBS) $(COMMON_LIB) $(PRECOMPUTED_LIB)
94+
librustsecp256k1zkp_v0_7_0_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_CURRENT):$(LIB_VERSION_REVISION):$(LIB_VERSION_AGE)
9495

9596
if VALGRIND_ENABLED
96-
librustsecp256k1zkp_v0_6_0_la_CPPFLAGS += -DVALGRIND
97+
librustsecp256k1zkp_v0_7_0_la_CPPFLAGS += -DVALGRIND
9798
endif
9899

99100
noinst_PROGRAMS =
@@ -141,13 +142,49 @@ exhaustive_tests_LDFLAGS = -static
141142
TESTS += exhaustive_tests
142143
endif
143144

145+
if USE_EXAMPLES
146+
noinst_PROGRAMS += ecdsa_example
147+
ecdsa_example_SOURCES = examples/ecdsa.c
148+
ecdsa_example_CPPFLAGS = -I$(top_srcdir)/include
149+
ecdsa_example_LDADD = libsecp256k1.la
150+
ecdsa_example_LDFLAGS = -static
151+
if BUILD_WINDOWS
152+
ecdsa_example_LDFLAGS += -lbcrypt
153+
endif
154+
TESTS += ecdsa_example
155+
if ENABLE_MODULE_ECDH
156+
noinst_PROGRAMS += ecdh_example
157+
ecdh_example_SOURCES = examples/ecdh.c
158+
ecdh_example_CPPFLAGS = -I$(top_srcdir)/include
159+
ecdh_example_LDADD = libsecp256k1.la
160+
ecdh_example_LDFLAGS = -static
161+
if BUILD_WINDOWS
162+
ecdh_example_LDFLAGS += -lbcrypt
163+
endif
164+
TESTS += ecdh_example
165+
endif
166+
if ENABLE_MODULE_SCHNORRSIG
167+
noinst_PROGRAMS += schnorr_example
168+
schnorr_example_SOURCES = examples/schnorr.c
169+
schnorr_example_CPPFLAGS = -I$(top_srcdir)/include
170+
schnorr_example_LDADD = libsecp256k1.la
171+
schnorr_example_LDFLAGS = -static
172+
if BUILD_WINDOWS
173+
schnorr_example_LDFLAGS += -lbcrypt
174+
endif
175+
TESTS += schnorr_example
176+
endif
144177
if ENABLE_MODULE_MUSIG
145-
noinst_PROGRAMS += example_musig
146-
example_musig_SOURCES = examples/musig.c
147-
example_musig_CPPFLAGS = -I$(top_srcdir)/include
148-
example_musig_LDADD = libsecp256k1.la
149-
example_musig_LDFLAGS = -static
150-
TESTS += example_musig
178+
noinst_PROGRAMS += musig_example
179+
musig_example_SOURCES = examples/musig.c
180+
musig_example_CPPFLAGS = -I$(top_srcdir)/include
181+
musig_example_LDADD = libsecp256k1.la
182+
musig_example_LDFLAGS = -static
183+
if BUILD_WINDOWS
184+
musig_example_LDFLAGS += -lbcrypt
185+
endif
186+
TESTS += musig_example
187+
endif
151188
endif
152189

153190
### Precomputed tables

secp256k1-zkp-sys/depend/secp256k1/README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Features:
1717
* Suitable for embedded systems.
1818
* Optional module for public key recovery.
1919
* Optional module for ECDH key exchange.
20-
* Optional module for Schnorr signatures according to [BIP-340](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki) (experimental).
20+
* Optional module for Schnorr signatures according to [BIP-340](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki).
2121
* Optional module for ECDSA adaptor signatures (experimental).
2222

2323
Experimental features have not received enough scrutiny to satisfy the standard of quality of this library but are made available for testing and review by the community. The APIs of these features should not be considered stable.
@@ -36,6 +36,7 @@ Implementation details
3636
* Optimized implementation of arithmetic modulo the curve's field size (2^256 - 0x1000003D1).
3737
* Using 5 52-bit limbs (including hand-optimized assembly for x86_64, by Diederik Huys).
3838
* Using 10 26-bit limbs (including hand-optimized assembly for 32-bit ARM, by Wladimir J. van der Laan).
39+
* This is an experimental feature that has not received enough scrutiny to satisfy the standard of quality of this library but is made available for testing and review by the community.
3940
* Scalar operations
4041
* Optimized implementation without data-dependent branches of arithmetic modulo the curve's order.
4142
* Using 4 64-bit limbs (relying on __int128 support in the compiler).
@@ -70,6 +71,16 @@ libsecp256k1 is built using autotools:
7071
$ make check # run the test suite
7172
$ sudo make install # optional
7273

74+
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.
75+
76+
Usage examples
77+
-----------
78+
Usage examples can be found in the [examples](examples) directory. To compile them you need to configure with `--enable-examples`.
79+
* [ECDSA example](examples/ecdsa.c)
80+
* [Schnorr signatures example](examples/schnorr.c)
81+
* [Deriving a shared secret (ECDH) example](examples/ecdh.c)
82+
To compile the Schnorr signature and ECDH examples, you also need to configure with `--enable-module-schnorrsig` and `--enable-module-ecdh`.
83+
7384
Test coverage
7485
-----------
7586

secp256k1-zkp-sys/depend/secp256k1/build-aux/m4/bitcoin_secp.m4

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,16 @@ AC_DEFUN([SECP_TRY_APPEND_CFLAGS], [
3838
unset flag_works
3939
AC_SUBST($2)
4040
])
41+
42+
dnl SECP_SET_DEFAULT(VAR, default, default-dev-mode)
43+
dnl Set VAR to default or default-dev-mode, depending on whether dev mode is enabled
44+
AC_DEFUN([SECP_SET_DEFAULT], [
45+
if test "${enable_dev_mode+set}" != set; then
46+
AC_MSG_ERROR([[Set enable_dev_mode before calling SECP_SET_DEFAULT]])
47+
fi
48+
if test x"$enable_dev_mode" = x"yes"; then
49+
$1="$3"
50+
else
51+
$1="$2"
52+
fi
53+
])

0 commit comments

Comments
 (0)