Merge pull request #323 from RCasatta/lower_memory

Reduce the size of precomputed signing table for lowmemory
This commit is contained in:
Andrew Poelstra 2021-09-08 20:48:34 +00:00 committed by GitHub
commit acba77cb63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -36,15 +36,16 @@ fn main() {
.define("ENABLE_MODULE_ECDH", Some("1")) .define("ENABLE_MODULE_ECDH", Some("1"))
.define("ENABLE_MODULE_SCHNORRSIG", Some("1")) .define("ENABLE_MODULE_SCHNORRSIG", Some("1"))
.define("ENABLE_MODULE_EXTRAKEYS", Some("1")) .define("ENABLE_MODULE_EXTRAKEYS", Some("1"))
.define("ECMULT_GEN_PREC_BITS", Some("4"))
// TODO these three should be changed to use libgmp, at least until secp PR 290 is merged // TODO these three should be changed to use libgmp, at least until secp PR 290 is merged
.define("USE_NUM_NONE", Some("1")) .define("USE_NUM_NONE", Some("1"))
.define("USE_FIELD_INV_BUILTIN", Some("1")) .define("USE_FIELD_INV_BUILTIN", Some("1"))
.define("USE_SCALAR_INV_BUILTIN", Some("1")); .define("USE_SCALAR_INV_BUILTIN", Some("1"));
if cfg!(feature = "lowmemory") { if cfg!(feature = "lowmemory") {
base_config.define("ECMULT_WINDOW_SIZE", Some("4")); // A low-enough value to consume neglible memory base_config.define("ECMULT_WINDOW_SIZE", Some("4")); // A low-enough value to consume negligible memory
base_config.define("ECMULT_GEN_PREC_BITS", Some("2"));
} else { } else {
base_config.define("ECMULT_GEN_PREC_BITS", Some("4"));
base_config.define("ECMULT_WINDOW_SIZE", Some("15")); // This is the default in the configure file (`auto`) base_config.define("ECMULT_WINDOW_SIZE", Some("15")); // This is the default in the configure file (`auto`)
} }
base_config.define("USE_EXTERNAL_DEFAULT_CALLBACKS", Some("1")); base_config.define("USE_EXTERNAL_DEFAULT_CALLBACKS", Some("1"));