Merge pull request #140 from laanwj/2019_08_lowmemory

build.rs: Add feature 'lowmemory' to reduce memory usage
This commit is contained in:
Andrew Poelstra 2019-08-12 17:48:45 +00:00 committed by GitHub
commit 288cc1e4ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 3 deletions

View File

@ -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

View File

@ -1,3 +1,10 @@
# 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 (~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
* Implement hex human-readable serde for PublicKey

View File

@ -1,7 +1,7 @@
[package]
name = "secp256k1"
version = "0.15.1"
version = "0.15.2"
authors = [ "Dawid Ciężarkiewicz <dpc@ucore.info>",
"Andrew Poelstra <apoelstra@wpsoftware.net>" ]
license = "CC0-1.0"
@ -32,6 +32,7 @@ fuzztarget = []
std = ["rand/std"]
recovery = []
endomorphism = []
lowmemory = []
[dev-dependencies]
rand = "0.6"

View File

@ -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")]