Skip to content

Commit 878e678

Browse files
committed
Provide 3 configurations accessible through ./configure
1 parent 1777163 commit 878e678

5 files changed

+1443
-19
lines changed

.cirrus.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ env:
88
BUILD: check
99
### secp256k1 config
1010
ECMULTWINDOW: auto
11-
ECMULTGENPRECISION: auto
11+
ECMULTGENKB: auto
1212
ASM: no
1313
WIDEMUL: auto
1414
WITH_VALGRIND: yes
@@ -75,7 +75,7 @@ task:
7575
- env: {CPPFLAGS: -DDETERMINISTIC}
7676
- env: {CFLAGS: -O0, CTIMETEST: no}
7777
- env: { ECMULTGENPRECISION: 2, ECMULTWINDOW: 2 }
78-
- env: { ECMULTGENPRECISION: 8, ECMULTWINDOW: 4 }
78+
- env: { ECMULTGENPRECISION: 22, ECMULTWINDOW: 4 }
7979
matrix:
8080
- env:
8181
CC: gcc

ci/cirrus.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ valgrind --version || true
1616
--enable-experimental="$EXPERIMENTAL" \
1717
--with-test-override-wide-multiply="$WIDEMUL" --with-asm="$ASM" \
1818
--with-ecmult-window="$ECMULTWINDOW" \
19-
--with-ecmult-gen-precision="$ECMULTGENPRECISION" \
19+
--with-ecmult-gen-kb="$ECMULTGENKB" \
2020
--enable-module-ecdh="$ECDH" --enable-module-recovery="$RECOVERY" \
2121
--enable-module-schnorrsig="$SCHNORRSIG" \
2222
--with-valgrind="$WITH_VALGRIND" \

configure.ac

+24-14
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,12 @@ AC_ARG_WITH([ecmult-window], [AS_HELP_STRING([--with-ecmult-window=SIZE|auto],
177177
)],
178178
[req_ecmult_window=$withval], [req_ecmult_window=auto])
179179

180-
AC_ARG_WITH([ecmult-gen-precision], [AS_HELP_STRING([--with-ecmult-gen-precision=2|4|8|auto],
181-
[Precision bits to tune the precomputed table size for signing.]
182-
[The size of the table is 32kB for 2 bits, 64kB for 4 bits, 512kB for 8 bits of precision.]
183-
[A larger table size usually results in possible faster signing.]
184-
["auto" is a reasonable setting for desktop machines (currently 4). [default=auto]]
180+
AC_ARG_WITH([ecmult-gen-kb], [AS_HELP_STRING([--with-ecmult-gen-kb=2|22|86|auto],
181+
[The size of the precomputed table for signing in multiples of 1024 bytes (on typical platforms).]
182+
[Larger values result in possibly better signing/keygeneration performance at the cost of a larger table.]
183+
["auto" is a reasonable setting for desktop machines (currently 86). [default=auto]]
185184
)],
186-
[req_ecmult_gen_precision=$withval], [req_ecmult_gen_precision=auto])
185+
[req_ecmult_gen_kb=$withval], [req_ecmult_gen_kb=auto])
187186

188187
AC_ARG_WITH([valgrind], [AS_HELP_STRING([--with-valgrind=yes|no|auto],
189188
[Build with extra checks for running inside Valgrind [default=auto]]
@@ -307,20 +306,31 @@ case $set_ecmult_window in
307306
esac
308307

309308
# Set ecmult gen precision
310-
if test x"$req_ecmult_gen_precision" = x"auto"; then
311-
set_ecmult_gen_precision=4
309+
if test x"$req_ecmult_gen_kb" = x"auto"; then
310+
set_ecmult_gen_kb=86
312311
else
313-
set_ecmult_gen_precision=$req_ecmult_gen_precision
312+
set_ecmult_gen_kb=$req_ecmult_gen_kb
314313
fi
315314

316-
case $set_ecmult_gen_precision in
317-
2|4|8)
318-
AC_DEFINE_UNQUOTED(ECMULT_GEN_PREC_BITS, $set_ecmult_gen_precision, [Set ecmult gen precision bits])
315+
case $set_ecmult_gen_kb in
316+
2)
317+
ecmult_gen_blocks=2
318+
ecmult_gen_teeth=5
319+
;;
320+
22)
321+
ecmult_gen_blocks=11
322+
ecmult_gen_teeth=6
323+
;;
324+
86)
325+
ecmult_gen_blocks=43
326+
ecmult_gen_teeth=6
319327
;;
320328
*)
321-
AC_MSG_ERROR(['ecmult gen precision not 2, 4, 8 or "auto"'])
329+
AC_MSG_ERROR(['ecmult gen table size not 2, 22, 86 or "auto"'])
322330
;;
323331
esac
332+
AC_DEFINE_UNQUOTED(COMB_BLOCKS, $ecmult_gen_blocks, [Number of blocks for ecmult_gen computation])
333+
AC_DEFINE_UNQUOTED(COMB_TEETH, $ecmult_gen_teeth, [Number of teeth for ecmult_gen computation])
324334

325335
if test x"$enable_valgrind" = x"yes"; then
326336
SECP_INCLUDES="$SECP_INCLUDES $VALGRIND_CPPFLAGS"
@@ -424,7 +434,7 @@ echo " module schnorrsig = $enable_module_schnorrsig"
424434
echo
425435
echo " asm = $set_asm"
426436
echo " ecmult window size = $set_ecmult_window"
427-
echo " ecmult gen prec. bits = $set_ecmult_gen_precision"
437+
echo " ecmult gen kB = $set_ecmult_gen_kb"
428438
# Hide test-only options unless they're used.
429439
if test x"$set_widemul" != xauto; then
430440
echo " wide multiplication = $set_widemul"

src/precompute_ecmult_gen.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
#include "ecmult_gen.h"
1515
#include "ecmult_gen_compute_table_impl.h"
1616

17-
static const int CONFIGS[1][2] = {
18-
{11, 6}
17+
static const int CONFIGS[][2] = {
18+
{2, 5},
19+
{11, 6},
20+
{43, 6}
1921
};
2022

2123
int main(int argc, char **argv) {

0 commit comments

Comments
 (0)