From 505b04df49b3e7bd1bdee2aee477537683f74a90 Mon Sep 17 00:00:00 2001 From: Riccardo Casatta Date: Wed, 21 Jul 2021 09:10:35 +0200 Subject: [PATCH] Reduce size of precomputed signing table (ECMULT_GEN_PREC_BITS) for lowmemory --- secp256k1-sys/build.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/secp256k1-sys/build.rs b/secp256k1-sys/build.rs index 09c9a6f..ea4b370 100644 --- a/secp256k1-sys/build.rs +++ b/secp256k1-sys/build.rs @@ -36,15 +36,16 @@ fn main() { .define("ENABLE_MODULE_ECDH", Some("1")) .define("ENABLE_MODULE_SCHNORRSIG", 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 .define("USE_NUM_NONE", Some("1")) .define("USE_FIELD_INV_BUILTIN", Some("1")) .define("USE_SCALAR_INV_BUILTIN", Some("1")); 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 { + 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("USE_EXTERNAL_DEFAULT_CALLBACKS", Some("1"));