@@ -170,13 +170,21 @@ AC_ARG_WITH([ecmult-window], [AS_HELP_STRING([--with-ecmult-window=SIZE|auto],
170
170
) ] ,
171
171
[ req_ecmult_window=$withval] , [ req_ecmult_window=auto] )
172
172
173
- AC_ARG_WITH ( [ ecmult-gen-precision ] , [ AS_HELP_STRING ( [ --with-ecmult-gen-precision=2|4|8 |auto] ,
174
- [ Precision bits to tune the precomputed table size for signing .]
175
- [ The size of the table is 32kB for 2 bits, 64kB for 4 bits, 512kB for 8 bits of precision .]
176
- [ A larger table size usually results in possible faster signing .]
173
+ AC_ARG_WITH ( [ ecmult-gen-blocks ] , [ AS_HELP_STRING ( [ --with-ecmult-gen-blocks=BLOCKS |auto] ,
174
+ [ The number of blocks to use in the multi-comb multiplication algorithm, in the range [ 1..256 ] .]
175
+ [ Larger values result in possibly better performance at the cost of a linearly larger precomputed table .]
176
+ [ There must exist a multiple of BLOCKS*TEETH that is between 256 and 288, inclusive .]
177
177
[ "auto" is a reasonable setting for desktop machines (currently 4). [ default=auto] ]
178
178
) ] ,
179
- [ req_ecmult_gen_precision=$withval] , [ req_ecmult_gen_precision=auto] )
179
+ [ req_ecmult_gen_blocks=$withval] , [ req_ecmult_gen_blocks=auto] )
180
+
181
+ AC_ARG_WITH ( [ ecmult-gen-teeth] , [ AS_HELP_STRING ( [ --with-ecmult-gen-teeth=TEETH|auto] ,
182
+ [ The number of teeth to use in the multi-comb multiplication algorithm, in the range [ 1..8] .]
183
+ [ Larger values result in possibly better performance at the cost of an exponentially larger precomputed table.]
184
+ [ There must exist a multiple of BLOCKS*TEETH that is between 256 and 288, inclusive.]
185
+ [ "auto" is a reasonable setting for desktop machines (currently 5). [ default=auto] ]
186
+ ) ] ,
187
+ [ req_ecmult_gen_teeth=$withval] , [ req_ecmult_gen_teeth=auto] )
180
188
181
189
AC_ARG_WITH ( [ valgrind] , [ AS_HELP_STRING ( [ --with-valgrind=yes|no|auto] ,
182
190
[ Build with extra checks for running inside Valgrind [ default=auto] ]
@@ -296,19 +304,45 @@ case $set_ecmult_window in
296
304
;;
297
305
esac
298
306
299
- # Set ecmult gen precision
300
- if test x"$req_ecmult_gen_precision " = x"auto"; then
301
- set_ecmult_gen_precision =4
307
+ # Set ecmult gen blocks
308
+ if test x"$req_ecmult_gen_blocks " = x"auto"; then
309
+ set_ecmult_gen_blocks =4
302
310
else
303
- set_ecmult_gen_precision=$req_ecmult_gen_precision
311
+ set_ecmult_gen_blocks=$req_ecmult_gen_blocks
304
312
fi
313
+ error_gen_blocks=[ 'option to --with-ecmult-gen-blocks not an integer in range [ 1..256] or "auto"']
314
+ case $set_ecmult_gen_blocks in
315
+ ''|*[ [ !0-9] ] *)
316
+ # no valid integer
317
+ AC_MSG_ERROR ( $error_gen_blocks )
318
+ ;;
319
+ *)
320
+ if test "$set_ecmult_gen_blocks" -lt 1 -o "$set_ecmult_gen_blocks" -gt 256 ; then
321
+ # not in range
322
+ AC_MSG_ERROR ( $error_gen_blocks )
323
+ fi
324
+ AC_DEFINE_UNQUOTED ( COMB_BLOCKS , $set_ecmult_gen_blocks , [ Set number of blocks in ecmult_gen precomputation] )
325
+ ;;
326
+ esac
305
327
306
- case $set_ecmult_gen_precision in
307
- 2|4|8)
308
- AC_DEFINE_UNQUOTED ( ECMULT_GEN_PREC_BITS , $set_ecmult_gen_precision , [ Set ecmult gen precision bits] )
328
+ # set ecmult gen teeth
329
+ if test x"$req_ecmult_gen_teeth" = x"auto"; then
330
+ set_ecmult_gen_teeth=5
331
+ else
332
+ set_ecmult_gen_teeth=$req_ecmult_gen_teeth
333
+ fi
334
+ error_gen_teeth=[ 'option to --with-ecmult-gen-teeth not an integer in range [ 1..8] or "auto"']
335
+ case $set_ecmult_gen_teeth in
336
+ ''|*[ [ !0-9] ] *)
337
+ # no valid integer
338
+ AC_MSG_ERROR ( $error_gen_teeth )
309
339
;;
310
340
*)
311
- AC_MSG_ERROR ( [ 'ecmult gen precision not 2, 4, 8 or "auto"'] )
341
+ if test "$set_ecmult_gen_teeth" -lt 1 -o "$set_ecmult_gen_teeth" -gt 8 ; then
342
+ # not in range
343
+ AC_MSG_ERROR ( $error_gen_teeth )
344
+ fi
345
+ AC_DEFINE_UNQUOTED ( COMB_TEETH , $set_ecmult_gen_teeth , [ Set number of teeth in ecmult_gen precomputation] )
312
346
;;
313
347
esac
314
348
@@ -515,7 +549,8 @@ echo " module schnorrsig = $enable_module_schnorrsig"
515
549
echo
516
550
echo " asm = $set_asm"
517
551
echo " ecmult window size = $set_ecmult_window"
518
- echo " ecmult gen prec. bits = $set_ecmult_gen_precision"
552
+ echo " ecmult gen blocks = $set_ecmult_gen_blocks"
553
+ echo " ecmult gen teeth = $set_ecmult_gen_teeth"
519
554
# Hide test-only options unless they're used.
520
555
if test x"$set_widemul" != xauto; then
521
556
echo " wide multiplication = $set_widemul"
0 commit comments