From 62b9f06104889fd99e889908a813ac7210e0bf12 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 7 Aug 2019 18:00:35 +0000 Subject: [PATCH 1/2] build.rs: Add feature 'lowmemory' to reduce memory usage Currently, this only set `ECMULT_WINDOW_SIZE` to 4 instead of 15. Fixes #139. fixup --- .travis.yml | 1 + CHANGELOG.md | 7 +++++++ Cargo.toml | 1 + build.rs | 8 ++++++-- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5554a38a0..084a2ac18 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,7 @@ script: - cargo build --verbose --no-default-features --features="rand" - cargo build --verbose --no-default-features --features="rand serde recovery endomorphism" - cargo build --verbose --no-default-features --features="fuzztarget recovery" + - cargo build --verbose --no-default-features --features="lowmemory" - cargo build --verbose - cargo test --verbose - cargo build --release diff --git a/CHANGELOG.md b/CHANGELOG.md index 93f41d2e3..8f913bf37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# 0.15.1 - ????-??-?? + +- Add feature `lowmemory` that reduces the EC mult window size to require + significantly less memory for the validation context (~340B instead of + ~520kB), at the cost of slower validation. It does not affect signing, nor + the size of the signing context. + # 0.15.0 - 2019-07-25 * Implement hex human-readable serde for PublicKey diff --git a/Cargo.toml b/Cargo.toml index e0090ca39..4ee277bde 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,7 @@ fuzztarget = [] std = ["rand/std"] recovery = [] endomorphism = [] +lowmemory = [] [dev-dependencies] rand = "0.6" diff --git a/build.rs b/build.rs index 86d8125aa..3e11c594e 100644 --- a/build.rs +++ b/build.rs @@ -53,9 +53,13 @@ fn main() { .define("USE_FIELD_INV_BUILTIN", Some("1")) .define("USE_SCALAR_INV_BUILTIN", Some("1")) .define("ENABLE_MODULE_ECDH", Some("1")) - .define("USE_EXTERNAL_DEFAULT_CALLBACKS", Some("1")) - .define("ECMULT_WINDOW_SIZE", Some("15")); // This is the default in the configure file (`auto`) + .define("USE_EXTERNAL_DEFAULT_CALLBACKS", Some("1")); + if cfg!(feature = "lowmemory") { + base_config.define("ECMULT_WINDOW_SIZE", Some("4")); // A low-enough value to consume neglible memory + } else { + base_config.define("ECMULT_WINDOW_SIZE", Some("15")); // This is the default in the configure file (`auto`) + } #[cfg(feature = "endomorphism")] base_config.define("USE_ENDOMORPHISM", Some("1")); #[cfg(feature = "recovery")] From 62e5178638ab08949c7f6a2cc6dbd7abdfae76b5 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 8 Aug 2019 08:40:56 +0200 Subject: [PATCH 2/2] Bump version to 0.15.2 And fill in release date for 0.15.2. --- CHANGELOG.md | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f913bf37..c8e96f3dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,9 @@ -# 0.15.1 - ????-??-?? +# 0.15.2 - 2019-08-08 - Add feature `lowmemory` that reduces the EC mult window size to require - significantly less memory for the validation context (~340B instead of - ~520kB), at the cost of slower validation. It does not affect signing, nor - the size of the signing context. + significantly less memory for the validation context (~680B instead of + ~520kB), at the cost of slower validation. It does not affect the speed of + signing, nor the size of the signing context. # 0.15.0 - 2019-07-25 diff --git a/Cargo.toml b/Cargo.toml index 4ee277bde..198b900cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "secp256k1" -version = "0.15.1" +version = "0.15.2" authors = [ "Dawid Ciężarkiewicz ", "Andrew Poelstra " ] license = "CC0-1.0"