Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build.rs: Add feature 'lowmemory' to reduce memory usage #140

Merged
merged 2 commits into from
Aug 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -32,6 +32,7 @@ fuzztarget = []
std = ["rand/std"]
recovery = []
endomorphism = []
lowmemory = []

[dev-dependencies]
rand = "0.6"
Expand Down
8 changes: 6 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down