Skip to content

Commit

Permalink
Merge #60: bump version to 0.7 and update CHANGELOG
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jonasnick committed Sep 29, 2022
2 parents 9f90268 + 32ed375 commit cea8ada
Show file tree
Hide file tree
Showing 168 changed files with 11,836 additions and 9,864 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Unreleased

# 0.7.0 - 2022-09-27

- Increment MSRV to 1.41.1 and edition to 2018
- ffi: fix signature of whitelist_sign
- Update secp256k1 to 0.24.0 and update deprecated functions
- Fix RangeProof and SurjectionProof from_str

# 0.6.0 - 2022-03-28

- Update secp256k1 to 0.22.1
- Updates upstream to 725d895fc54cf82da1c2a9c69048656405da556d
- Comment out WASM build

# 0.5.0 - 2021-10-22

- Encrypt ECDSA adaptor signatures in release builds. Previously encryption returned just zero bytes.
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "secp256k1-zkp"
version = "0.6.0"
version = "0.7.0"
authors = [ "Dawid Ciężarkiewicz <dpc@ucore.info>",
"Andrew Poelstra <apoelstra@wpsoftware.net>",
"Lucas Soriano <lucas@comit.network>",
Expand Down Expand Up @@ -32,7 +32,7 @@ use-rand = ["rand", "secp256k1/rand"]

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

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ Contributions to this library are welcome. A few guidelines:
- Any breaking changes must have an accompanied entry in CHANGELOG.md
- No new dependencies, please.
- No crypto should be implemented in Rust, with the possible exception of hash functions. Cryptographic contributions should be directed upstream to libsecp256k1.
- This library should always compile with any combination of features on **Rust 1.29**.
- This library should always compile with any combination of features on **Rust 1.41.1**.
4 changes: 2 additions & 2 deletions secp256k1-zkp-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "secp256k1-zkp-sys"
version = "0.6.0"
version = "0.7.0"
authors = [ "Dawid Ciężarkiewicz <dpc@ucore.info>",
"Andrew Poelstra <apoelstra@wpsoftware.net>",
"Steven Roose <steven@stevenroose.org>",
Expand All @@ -13,7 +13,7 @@ description = "FFI for `libsecp256k1-zkp` library."
keywords = [ "secp256k1", "libsecp256k1-zkp", "ffi" ]
readme = "README.md"
build = "build.rs"
links = "rustsecp256k1zkp_v0_6_0"
links = "rustsecp256k1zkp_v0_7_0"

# Should make docs.rs show all functions, even those behind non-default features
[package.metadata.docs.rs]
Expand Down
2 changes: 1 addition & 1 deletion secp256k1-zkp-sys/depend/secp256k1-HEAD-revision.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# This file was automatically created by ./vendor-libsecp.sh
725d895fc54cf82da1c2a9c69048656405da556d
d22774e248c703a191049b78f8d04f37d6fcfa05
33 changes: 19 additions & 14 deletions secp256k1-zkp-sys/depend/secp256k1/.cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ env:
BENCH: yes
SECP256K1_BENCH_ITERS: 2
CTIMETEST: yes
# Compile and run the tests
EXAMPLES: yes

cat_logs_snippet: &CAT_LOGS
always:
Expand Down Expand Up @@ -70,12 +72,12 @@ task:
<< : *LINUX_CONTAINER
matrix: &ENV_MATRIX
- env: {WIDEMUL: int64, RECOVERY: yes}
- env: {WIDEMUL: int64, ECDH: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes}
- env: {WIDEMUL: int64, ECDH: yes, SCHNORRSIG: yes, EXPERIMENTAL: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes}
- env: {WIDEMUL: int128}
- env: {WIDEMUL: int128, RECOVERY: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes}
- env: {WIDEMUL: int128, ECDH: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes}
- env: {WIDEMUL: int128, RECOVERY: yes, SCHNORRSIG: yes}
- env: {WIDEMUL: int128, ECDH: yes, SCHNORRSIG: yes, EXPERIMENTAL: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes}
- env: {WIDEMUL: int128, ASM: x86_64}
- env: { RECOVERY: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes}
- env: { RECOVERY: yes, SCHNORRSIG: yes, EXPERIMENTAL: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes}
- env: {BUILD: distcheck, WITH_VALGRIND: no, CTIMETEST: no, BENCH: no}
- env: {CPPFLAGS: -DDETERMINISTIC}
- env: {CFLAGS: -O0, CTIMETEST: no}
Expand All @@ -98,8 +100,8 @@ task:
HOST: i686-linux-gnu
ECDH: yes
RECOVERY: yes
EXPERIMENTAL: yes
SCHNORRSIG: yes
EXPERIMENTAL: yes
ECDSA_S2C: yes
RANGEPROOF: yes
WHITELIST: yes
Expand Down Expand Up @@ -148,7 +150,8 @@ task:
## - rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
##
brew_valgrind_pre_script:
- brew update
# Retry a few times because this tends to fail randomly.
- for i in {1..5}; do brew update && break || sleep 15; done
- brew config
- brew tap LouisBrunner/valgrind
# Fetch valgrind source but don't build it yet.
Expand Down Expand Up @@ -188,8 +191,8 @@ task:
WITH_VALGRIND: no
ECDH: yes
RECOVERY: yes
EXPERIMENTAL: yes
SCHNORRSIG: yes
EXPERIMENTAL: yes
ECDSA_S2C: yes
RANGEPROOF: yes
WHITELIST: yes
Expand All @@ -214,12 +217,11 @@ task:
WITH_VALGRIND: no
ECDH: yes
RECOVERY: yes
EXPERIMENTAL: yes
SCHNORRSIG: yes
CTIMETEST: no
matrix:
- env: {}
- env: {ASM: arm}
- env: {EXPERIMENTAL: yes, ASM: arm}
<< : *MERGE_BASE
test_script:
- ./ci/cirrus.sh
Expand All @@ -235,7 +237,6 @@ task:
WITH_VALGRIND: no
ECDH: yes
RECOVERY: yes
EXPERIMENTAL: yes
SCHNORRSIG: yes
CTIMETEST: no
<< : *MERGE_BASE
Expand All @@ -253,7 +254,6 @@ task:
WITH_VALGRIND: no
ECDH: yes
RECOVERY: yes
EXPERIMENTAL: yes
SCHNORRSIG: yes
CTIMETEST: no
<< : *MERGE_BASE
Expand All @@ -271,7 +271,6 @@ task:
WITH_VALGRIND: no
ECDH: yes
RECOVERY: yes
EXPERIMENTAL: yes
SCHNORRSIG: yes
CTIMETEST: no
<< : *MERGE_BASE
Expand All @@ -286,8 +285,8 @@ task:
env:
ECDH: yes
RECOVERY: yes
EXPERIMENTAL: yes
SCHNORRSIG: yes
EXPERIMENTAL: yes
ECDSA_S2C: yes
RANGEPROOF: yes
WHITELIST: yes
Expand Down Expand Up @@ -340,11 +339,17 @@ task:
CC: gcc
MAKEFLAGS: -j4 CC=g++ CFLAGS=-fpermissive\ -g
WERROR_CFLAGS:
EXPERIMENTAL: yes
ECDH: yes
RECOVERY: yes
SCHNORRSIG: yes
<< : *MERGE_BASE
test_script:
- ./ci/cirrus.sh
<< : *CAT_LOGS

task:
name: "sage prover"
<< : *LINUX_CONTAINER
test_script:
- cd sage
- sage prove_group_implementations.sage
8 changes: 7 additions & 1 deletion secp256k1-zkp-sys/depend/secp256k1/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ exhaustive_tests
precompute_ecmult_gen
precompute_ecmult
valgrind_ctime_test
ecdh_example
ecdsa_example
schnorr_example
*.exe
*.so
*.a
*.csv
!.gitignore
*.log
*.trs

Makefile
configure
Expand Down Expand Up @@ -43,6 +48,7 @@ coverage.*.html

src/libsecp256k1-config.h
src/libsecp256k1-config.h.in
build-aux/ar-lib
build-aux/config.guess
build-aux/config.sub
build-aux/depcomp
Expand All @@ -60,4 +66,4 @@ src/stamp-h1
libsecp256k1.pc
contrib/gh-pr-create.sh

example_musig
musig_example
71 changes: 54 additions & 17 deletions secp256k1-zkp-sys/depend/secp256k1/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ AM_CFLAGS = $(SECP_CFLAGS)

lib_LTLIBRARIES = libsecp256k1.la
include_HEADERS = include/secp256k1.h
include_HEADERS += include/rustsecp256k1zkp_v0_6_0_preallocated.h
include_HEADERS += include/rustsecp256k1zkp_v0_7_0_preallocated.h
noinst_HEADERS =
noinst_HEADERS += src/scalar.h
noinst_HEADERS += src/scalar_4x64.h
Expand Down Expand Up @@ -65,14 +65,15 @@ noinst_HEADERS += contrib/lax_der_parsing.h
noinst_HEADERS += contrib/lax_der_parsing.c
noinst_HEADERS += contrib/lax_der_privatekey_parsing.h
noinst_HEADERS += contrib/lax_der_privatekey_parsing.c
noinst_HEADERS += examples/random.h

PRECOMPUTED_LIB = librustsecp256k1zkp_v0_6_0_precomputed.la
PRECOMPUTED_LIB = librustsecp256k1zkp_v0_7_0_precomputed.la
noinst_LTLIBRARIES = $(PRECOMPUTED_LIB)
librustsecp256k1zkp_v0_6_0_precomputed_la_SOURCES = src/precomputed_ecmult.c src/precomputed_ecmult_gen.c
librustsecp256k1zkp_v0_6_0_precomputed_la_CPPFLAGS = $(SECP_INCLUDES)
librustsecp256k1zkp_v0_7_0_precomputed_la_SOURCES = src/precomputed_ecmult.c src/precomputed_ecmult_gen.c
librustsecp256k1zkp_v0_7_0_precomputed_la_CPPFLAGS = $(SECP_INCLUDES)

if USE_EXTERNAL_ASM
COMMON_LIB = librustsecp256k1zkp_v0_6_0_common.la
COMMON_LIB = librustsecp256k1zkp_v0_7_0_common.la
else
COMMON_LIB =
endif
Expand All @@ -83,17 +84,17 @@ pkgconfig_DATA = libsecp256k1.pc

if USE_EXTERNAL_ASM
if USE_ASM_ARM
librustsecp256k1zkp_v0_6_0_common_la_SOURCES = src/asm/field_10x26_arm.s
librustsecp256k1zkp_v0_7_0_common_la_SOURCES = src/asm/field_10x26_arm.s
endif
endif

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

if VALGRIND_ENABLED
librustsecp256k1zkp_v0_6_0_la_CPPFLAGS += -DVALGRIND
librustsecp256k1zkp_v0_7_0_la_CPPFLAGS += -DVALGRIND
endif

noinst_PROGRAMS =
Expand Down Expand Up @@ -141,13 +142,49 @@ exhaustive_tests_LDFLAGS = -static
TESTS += exhaustive_tests
endif

if USE_EXAMPLES
noinst_PROGRAMS += ecdsa_example
ecdsa_example_SOURCES = examples/ecdsa.c
ecdsa_example_CPPFLAGS = -I$(top_srcdir)/include
ecdsa_example_LDADD = libsecp256k1.la
ecdsa_example_LDFLAGS = -static
if BUILD_WINDOWS
ecdsa_example_LDFLAGS += -lbcrypt
endif
TESTS += ecdsa_example
if ENABLE_MODULE_ECDH
noinst_PROGRAMS += ecdh_example
ecdh_example_SOURCES = examples/ecdh.c
ecdh_example_CPPFLAGS = -I$(top_srcdir)/include
ecdh_example_LDADD = libsecp256k1.la
ecdh_example_LDFLAGS = -static
if BUILD_WINDOWS
ecdh_example_LDFLAGS += -lbcrypt
endif
TESTS += ecdh_example
endif
if ENABLE_MODULE_SCHNORRSIG
noinst_PROGRAMS += schnorr_example
schnorr_example_SOURCES = examples/schnorr.c
schnorr_example_CPPFLAGS = -I$(top_srcdir)/include
schnorr_example_LDADD = libsecp256k1.la
schnorr_example_LDFLAGS = -static
if BUILD_WINDOWS
schnorr_example_LDFLAGS += -lbcrypt
endif
TESTS += schnorr_example
endif
if ENABLE_MODULE_MUSIG
noinst_PROGRAMS += example_musig
example_musig_SOURCES = examples/musig.c
example_musig_CPPFLAGS = -I$(top_srcdir)/include
example_musig_LDADD = libsecp256k1.la
example_musig_LDFLAGS = -static
TESTS += example_musig
noinst_PROGRAMS += musig_example
musig_example_SOURCES = examples/musig.c
musig_example_CPPFLAGS = -I$(top_srcdir)/include
musig_example_LDADD = libsecp256k1.la
musig_example_LDFLAGS = -static
if BUILD_WINDOWS
musig_example_LDFLAGS += -lbcrypt
endif
TESTS += musig_example
endif
endif

### Precomputed tables
Expand Down
13 changes: 12 additions & 1 deletion secp256k1-zkp-sys/depend/secp256k1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Features:
* Suitable for embedded systems.
* Optional module for public key recovery.
* Optional module for ECDH key exchange.
* Optional module for Schnorr signatures according to [BIP-340](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki) (experimental).
* Optional module for Schnorr signatures according to [BIP-340](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki).
* Optional module for ECDSA adaptor signatures (experimental).

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.
Expand All @@ -36,6 +36,7 @@ Implementation details
* Optimized implementation of arithmetic modulo the curve's field size (2^256 - 0x1000003D1).
* Using 5 52-bit limbs (including hand-optimized assembly for x86_64, by Diederik Huys).
* Using 10 26-bit limbs (including hand-optimized assembly for 32-bit ARM, by Wladimir J. van der Laan).
* 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.
* Scalar operations
* Optimized implementation without data-dependent branches of arithmetic modulo the curve's order.
* Using 4 64-bit limbs (relying on __int128 support in the compiler).
Expand Down Expand Up @@ -70,6 +71,16 @@ libsecp256k1 is built using autotools:
$ 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.

Usage examples
-----------
Usage examples can be found in the [examples](examples) directory. To compile them you need to configure with `--enable-examples`.
* [ECDSA example](examples/ecdsa.c)
* [Schnorr signatures example](examples/schnorr.c)
* [Deriving a shared secret (ECDH) example](examples/ecdh.c)
To compile the Schnorr signature and ECDH examples, you also need to configure with `--enable-module-schnorrsig` and `--enable-module-ecdh`.

Test coverage
-----------

Expand Down
13 changes: 13 additions & 0 deletions secp256k1-zkp-sys/depend/secp256k1/build-aux/m4/bitcoin_secp.m4
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,16 @@ AC_DEFUN([SECP_TRY_APPEND_CFLAGS], [
unset flag_works
AC_SUBST($2)
])

dnl SECP_SET_DEFAULT(VAR, default, default-dev-mode)
dnl Set VAR to default or default-dev-mode, depending on whether dev mode is enabled
AC_DEFUN([SECP_SET_DEFAULT], [
if test "${enable_dev_mode+set}" != set; then
AC_MSG_ERROR([[Set enable_dev_mode before calling SECP_SET_DEFAULT]])
fi
if test x"$enable_dev_mode" = x"yes"; then
$1="$3"
else
$1="$2"
fi
])
2 changes: 2 additions & 0 deletions secp256k1-zkp-sys/depend/secp256k1/ci/cirrus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ valgrind --version || true
--enable-module-ecdsa-s2c="$ECDSA_S2C" \
--enable-module-rangeproof="$RANGEPROOF" --enable-module-whitelist="$WHITELIST" --enable-module-generator="$GENERATOR" \
--enable-module-schnorrsig="$SCHNORRSIG" --enable-module-musig="$MUSIG" --enable-module-ecdsa-adaptor="$ECDSAADAPTOR" \
--enable-module-schnorrsig="$SCHNORRSIG" \
--enable-examples="$EXAMPLES" \
--with-valgrind="$WITH_VALGRIND" \
--host="$HOST" $EXTRAFLAGS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ RUN apt-get install --no-install-recommends --no-upgrade -y \
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross libc6-dbg:armhf \
gcc-aarch64-linux-gnu libc6-dev-arm64-cross libc6-dbg:arm64 \
gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross libc6-dbg:ppc64el \
wine gcc-mingw-w64-x86-64
wine gcc-mingw-w64-x86-64 \
sagemath

# Run a dummy command in wine to make it set up configuration
RUN wine64-stable xcopy || true
Loading

0 comments on commit cea8ada

Please sign in to comment.