Skip to content

Commit 5f1622f

Browse files
authored
Merge pull request #257 from apoelstra/2020-12--no-endo
update libsecp, remove endomorphism feature flag and release 0.20.0
2 parents c534b54 + c4d2fef commit 5f1622f

File tree

107 files changed

+6635
-6325
lines changed

Some content is hidden

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

107 files changed

+6635
-6325
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11

2+
# 0.20.0 - 2020-12-21
3+
4+
* [remove `ffi::PublicKey::blank`](https://github.com/rust-bitcoin/rust-secp256k1/pull/232) and replace with unsafe [`ffi::PublicKey::new` and `ffi::PublicKey::from_array_unchecked`](https://github.com/rust-bitcoin/rust-secp256k1/pull/253/); similar for all other FFI types
5+
* [support wasm32-wasi target](https://github.com/rust-bitcoin/rust-secp256k1/pull/242)
6+
* [make the global-context feature depend on the rand-std feature](https://github.com/rust-bitcoin/rust-secp256k1/pull/246)
7+
* [add a lexicographic ordering to `PublicKey`](https://github.com/rust-bitcoin/rust-secp256k1/pull/248) which does **not** match the ordering used by Bitcoin Core (matching this would be impossible as it requires tracking a compressedness flag, which libsecp256k1 does not have)
8+
* [implement BIP340 Schnorr signatures](https://github.com/rust-bitcoin/rust-secp256k1/pull/237)
9+
* [require use of new `AlignedType` in preallocated-context API to enforce alignment requirements](https://github.com/rust-bitcoin/rust-secp256k1/pull/233); previously it was possible to get UB by using misaligned memory stores
10+
* [enforce correct alignment when using preallocated context API](https://github.com/rust-bitcoin/rust-secp256k1/pull/233)
11+
* [stop using cargo features for dangerous build-breaking options, require setting `RUSTFLAGS` instead](https://github.com/rust-bitcoin/rust-secp256k1/pull/263)
12+
* [implement low-R signing and function to grind even smaller signatures](https://github.com/rust-bitcoin/rust-secp256k1/pull/259)
13+
* [remove endomorphism feature, following upstream in enabling it by default](https://github.com/rust-bitcoin/rust-secp256k1/pull/257)
14+
215
# 0.19.0 - 2020-08-27
316

417
* **Update MSRV to 1.29.0**

Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "secp256k1"
3-
version = "0.19.0"
3+
version = "0.20.0"
44
authors = [ "Dawid Ciężarkiewicz <dpc@ucore.info>",
55
"Andrew Poelstra <apoelstra@wpsoftware.net>" ]
66
license = "CC0-1.0"
@@ -14,20 +14,19 @@ autoexamples = false # Remove when edition 2018 https://github.com/rust-lang/car
1414

1515
# Should make docs.rs show all functions, even those behind non-default features
1616
[package.metadata.docs.rs]
17-
features = [ "rand", "rand-std", "serde", "recovery", "endomorphism" ]
17+
features = [ "rand", "rand-std", "serde", "recovery" ]
1818

1919
[features]
2020
unstable = ["recovery", "rand-std"]
2121
default = ["std"]
2222
std = ["secp256k1-sys/std"]
2323
rand-std = ["rand/std"]
2424
recovery = ["secp256k1-sys/recovery"]
25-
endomorphism = ["secp256k1-sys/endomorphism"]
2625
lowmemory = ["secp256k1-sys/lowmemory"]
2726
global-context = ["std", "rand-std"]
2827

2928
[dependencies]
30-
secp256k1-sys = { version = "0.3.1", default-features = false, path = "./secp256k1-sys" }
29+
secp256k1-sys = { version = "0.4.0", default-features = false, path = "./secp256k1-sys" }
3130
bitcoin_hashes = { version = "0.9", optional = true }
3231
rand = { version = "0.6", default-features = false, optional = true }
3332
serde = { version = "1.0", default-features = false, optional = true }

contrib/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh -ex
22

3-
FEATURES="bitcoin_hashes endomorphism global-context lowmemory rand rand-std recovery serde"
3+
FEATURES="bitcoin_hashes global-context lowmemory rand rand-std recovery serde"
44

55
# Use toolchain if explicitly specified
66
if [ -n "$TOOLCHAIN" ]

no_std_test/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl RngCore for FakeRng {
8383

8484
#[start]
8585
fn start(_argc: isize, _argv: *const *const u8) -> isize {
86-
let mut buf = [AlignedType::zeroed(); 37_000];
86+
let mut buf = [AlignedType::zeroed(); 70_000];
8787
let size = Secp256k1::preallocate_size();
8888
unsafe { libc::printf("needed size: %d\n\0".as_ptr() as _, size) };
8989

secp256k1-sys/Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "secp256k1-sys"
3-
version = "0.3.1"
3+
version = "0.4.0"
44
authors = [ "Dawid Ciężarkiewicz <dpc@ucore.info>",
55
"Andrew Poelstra <apoelstra@wpsoftware.net>",
66
"Steven Roose <steven@stevenroose.org>" ]
@@ -12,11 +12,11 @@ description = "FFI for Pieter Wuille's `libsecp256k1` library."
1212
keywords = [ "secp256k1", "libsecp256k1", "ffi" ]
1313
readme = "README.md"
1414
build = "build.rs"
15-
links = "rustsecp256k1_v0_3_1"
15+
links = "rustsecp256k1_v0_4_0"
1616

1717
# Should make docs.rs show all functions, even those behind non-default features
1818
[package.metadata.docs.rs]
19-
features = [ "recovery", "endomorphism", "lowmemory" ]
19+
features = [ "recovery", "lowmemory" ]
2020

2121
[build-dependencies]
2222
cc = "1.0.28"
@@ -27,7 +27,6 @@ libc = "0.2"
2727
[features]
2828
default = ["std"]
2929
recovery = []
30-
endomorphism = []
3130
lowmemory = []
3231
std = []
3332

secp256k1-sys/build.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,9 @@ fn main() {
4848
base_config.define("ECMULT_WINDOW_SIZE", Some("15")); // This is the default in the configure file (`auto`)
4949
}
5050
base_config.define("USE_EXTERNAL_DEFAULT_CALLBACKS", Some("1"));
51-
#[cfg(feature = "endomorphism")]
52-
base_config.define("USE_ENDOMORPHISM", Some("1"));
5351
#[cfg(feature = "recovery")]
5452
base_config.define("ENABLE_MODULE_RECOVERY", Some("1"));
5553

56-
if let Ok(target_endian) = env::var("CARGO_CFG_TARGET_ENDIAN") {
57-
if target_endian == "big" {
58-
base_config.define("WORDS_BIGENDIAN", Some("1"));
59-
}
60-
}
61-
6254
match &env::var("TARGET").unwrap() as &str {
6355
"wasm32-unknown-unknown"|"wasm32-wasi" =>
6456
{ base_config.include("wasm-sysroot"); },

secp256k1-sys/depend/scratch_impl.h.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
< static void secp256k1_scratch_destroy(const secp256k1_callback* error_callback, secp256k1_scratch* scratch) {
1616
< if (scratch != NULL) {
1717
< VERIFY_CHECK(scratch->alloc_size == 0); /* all checkpoints should be applied */
18-
< if (memcmp(scratch->magic, "scratch", 8) != 0) {
18+
< if (secp256k1_memcmp_var(scratch->magic, "scratch", 8) != 0) {
1919
< secp256k1_callback_call(error_callback, "invalid scratch space");
2020
< return;
2121
< }
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-
63150ab4da1ef13ebfb4396064e1ff501dbd015e
2+
98dac87839838b86094f1bccc71cc20e67b146cc

secp256k1-sys/depend/secp256k1/.travis.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,30 @@ compiler:
1717
- gcc
1818
env:
1919
global:
20-
- WIDEMUL=auto BIGNUM=auto ENDOMORPHISM=no STATICPRECOMPUTATION=yes ECMULTGENPRECISION=auto ASM=no BUILD=check WITH_VALGRIND=yes RUN_VALGRIND=no EXTRAFLAGS= HOST= ECDH=no RECOVERY=no SCHNORRSIG=no EXPERIMENTAL=no CTIMETEST=yes BENCH=yes ITERS=2
20+
- WIDEMUL=auto BIGNUM=auto STATICPRECOMPUTATION=yes ECMULTGENPRECISION=auto ASM=no BUILD=check WITH_VALGRIND=yes RUN_VALGRIND=no EXTRAFLAGS= HOST= ECDH=no RECOVERY=no SCHNORRSIG=no EXPERIMENTAL=no CTIMETEST=yes BENCH=yes ITERS=2
2121
matrix:
2222
- WIDEMUL=int64 RECOVERY=yes
2323
- WIDEMUL=int64 ECDH=yes EXPERIMENTAL=yes SCHNORRSIG=yes
24-
- WIDEMUL=int64 ENDOMORPHISM=yes
2524
- WIDEMUL=int128
2625
- WIDEMUL=int128 RECOVERY=yes EXPERIMENTAL=yes SCHNORRSIG=yes
27-
- WIDEMUL=int128 ENDOMORPHISM=yes
28-
- WIDEMUL=int128 ENDOMORPHISM=yes ECDH=yes EXPERIMENTAL=yes SCHNORRSIG=yes
26+
- WIDEMUL=int128 ECDH=yes EXPERIMENTAL=yes SCHNORRSIG=yes
2927
- WIDEMUL=int128 ASM=x86_64
30-
- WIDEMUL=int128 ENDOMORPHISM=yes ASM=x86_64
3128
- BIGNUM=no
32-
- BIGNUM=no ENDOMORPHISM=yes RECOVERY=yes EXPERIMENTAL=yes SCHNORRSIG=yes
29+
- BIGNUM=no RECOVERY=yes EXPERIMENTAL=yes SCHNORRSIG=yes
3330
- BIGNUM=no STATICPRECOMPUTATION=no
3431
- BUILD=distcheck WITH_VALGRIND=no CTIMETEST=no BENCH=no
3532
- CPPFLAGS=-DDETERMINISTIC
3633
- CFLAGS=-O0 CTIMETEST=no
34+
- CFLAGS="-fsanitize=undefined -fno-omit-frame-pointer" LDFLAGS="-fsanitize=undefined -fno-omit-frame-pointer" UBSAN_OPTIONS="print_stacktrace=1:halt_on_error=1" BIGNUM=no ASM=x86_64 ECDH=yes RECOVERY=yes EXPERIMENTAL=yes SCHNORRSIG=yes CTIMETEST=no
3735
- ECMULTGENPRECISION=2
3836
- ECMULTGENPRECISION=8
39-
- RUN_VALGRIND=yes ENDOMORPHISM=yes BIGNUM=no ASM=x86_64 EXPERIMENTAL=yes ECDH=yes RECOVERY=yes EXTRAFLAGS="--disable-openssl-tests" BUILD=
40-
- RUN_VALGRIND=yes BIGNUM=no ASM=x86_64 EXPERIMENTAL=yes ECDH=yes RECOVERY=yes EXTRAFLAGS="--disable-openssl-tests" BUILD=
37+
- RUN_VALGRIND=yes BIGNUM=no ASM=x86_64 ECDH=yes RECOVERY=yes EXPERIMENTAL=yes SCHNORRSIG=yes EXTRAFLAGS="--disable-openssl-tests" BUILD=
4138
matrix:
4239
fast_finish: true
4340
include:
4441
- compiler: clang
4542
os: linux
46-
env: HOST=i686-linux-gnu ENDOMORPHISM=yes
43+
env: HOST=i686-linux-gnu
4744
addons:
4845
apt:
4946
packages:
@@ -63,7 +60,7 @@ matrix:
6360
- libtool-bin
6461
- libc6-dbg:i386
6562
- compiler: gcc
66-
env: HOST=i686-linux-gnu ENDOMORPHISM=yes
63+
env: HOST=i686-linux-gnu
6764
os: linux
6865
addons:
6966
apt:
@@ -85,7 +82,7 @@ matrix:
8582
- libc6-dbg:i386
8683
# S390x build (big endian system)
8784
- compiler: gcc
88-
env: HOST=s390x-unknown-linux-gnu ECDH=yes RECOVERY=yes EXPERIMENTAL=yes CTIMETEST=
85+
env: HOST=s390x-unknown-linux-gnu ECDH=yes RECOVERY=yes EXPERIMENTAL=yes SCHNORRSIG=yes CTIMETEST=
8986
arch: s390x
9087

9188
# We use this to install macOS dependencies instead of the built in `homebrew` plugin,

secp256k1-sys/depend/secp256k1/Makefile.am

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS = -I build-aux/m4
22

33
lib_LTLIBRARIES = libsecp256k1.la
44
include_HEADERS = include/secp256k1.h
5-
include_HEADERS += include/rustsecp256k1_v0_3_1_preallocated.h
5+
include_HEADERS += include/rustsecp256k1_v0_4_0_preallocated.h
66
noinst_HEADERS =
77
noinst_HEADERS += src/scalar.h
88
noinst_HEADERS += src/scalar_4x64.h
@@ -52,7 +52,7 @@ noinst_HEADERS += contrib/lax_der_privatekey_parsing.h
5252
noinst_HEADERS += contrib/lax_der_privatekey_parsing.c
5353

5454
if USE_EXTERNAL_ASM
55-
COMMON_LIB = librustsecp256k1_v0_3_1_common.la
55+
COMMON_LIB = librustsecp256k1_v0_4_0_common.la
5656
noinst_LTLIBRARIES = $(COMMON_LIB)
5757
else
5858
COMMON_LIB =
@@ -63,16 +63,16 @@ pkgconfig_DATA = libsecp256k1.pc
6363

6464
if USE_EXTERNAL_ASM
6565
if USE_ASM_ARM
66-
librustsecp256k1_v0_3_1_common_la_SOURCES = src/asm/field_10x26_arm.s
66+
librustsecp256k1_v0_4_0_common_la_SOURCES = src/asm/field_10x26_arm.s
6767
endif
6868
endif
6969

70-
librustsecp256k1_v0_3_1_la_SOURCES = src/secp256k1.c
71-
librustsecp256k1_v0_3_1_la_CPPFLAGS = -DSECP256K1_BUILD -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES)
72-
librustsecp256k1_v0_3_1_la_LIBADD = $(SECP_LIBS) $(COMMON_LIB)
70+
librustsecp256k1_v0_4_0_la_SOURCES = src/secp256k1.c
71+
librustsecp256k1_v0_4_0_la_CPPFLAGS = -DSECP256K1_BUILD -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES)
72+
librustsecp256k1_v0_4_0_la_LIBADD = $(SECP_LIBS) $(COMMON_LIB)
7373

7474
if VALGRIND_ENABLED
75-
librustsecp256k1_v0_3_1_la_CPPFLAGS += -DVALGRIND
75+
librustsecp256k1_v0_4_0_la_CPPFLAGS += -DVALGRIND
7676
endif
7777

7878
noinst_PROGRAMS =
@@ -134,7 +134,7 @@ gen_%.o: src/gen_%.c src/libsecp256k1-config.h
134134
$(gen_context_BIN): $(gen_context_OBJECTS)
135135
$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $^ -o $@
136136

137-
$(librustsecp256k1_v0_3_1_la_OBJECTS): src/ecmult_static_context.h
137+
$(librustsecp256k1_v0_4_0_la_OBJECTS): src/ecmult_static_context.h
138138
$(tests_OBJECTS): src/ecmult_static_context.h
139139
$(bench_internal_OBJECTS): src/ecmult_static_context.h
140140
$(bench_ecmult_OBJECTS): src/ecmult_static_context.h

0 commit comments

Comments
 (0)