@@ -170,13 +170,21 @@ AC_ARG_WITH([ecmult-window], [AS_HELP_STRING([--with-ecmult-window=SIZE|auto],
170170) ] ,
171171[ req_ecmult_window=$withval] , [ req_ecmult_window=auto] )
172172
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 .]
177177[ "auto" is a reasonable setting for desktop machines (currently 4). [ default=auto] ]
178178) ] ,
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] )
180188
181189AC_ARG_WITH ( [ valgrind] , [ AS_HELP_STRING ( [ --with-valgrind=yes|no|auto] ,
182190[ Build with extra checks for running inside Valgrind [ default=auto] ]
@@ -340,19 +348,45 @@ case $set_ecmult_window in
340348 ;;
341349esac
342350
343- # Set ecmult gen precision
344- if test x"$req_ecmult_gen_precision " = x"auto"; then
345- set_ecmult_gen_precision =4
351+ # Set ecmult gen blocks
352+ if test x"$req_ecmult_gen_blocks " = x"auto"; then
353+ set_ecmult_gen_blocks =4
346354else
347- set_ecmult_gen_precision=$req_ecmult_gen_precision
355+ set_ecmult_gen_blocks=$req_ecmult_gen_blocks
348356fi
357+ error_gen_blocks=[ 'option to --with-ecmult-gen-blocks not an integer in range [ 1..256] or "auto"']
358+ case $set_ecmult_gen_blocks in
359+ ''|*[ [ !0-9] ] *)
360+ # no valid integer
361+ AC_MSG_ERROR ( $error_gen_blocks )
362+ ;;
363+ *)
364+ if test "$set_ecmult_gen_blocks" -lt 1 -o "$set_ecmult_gen_blocks" -gt 256 ; then
365+ # not in range
366+ AC_MSG_ERROR ( $error_gen_blocks )
367+ fi
368+ AC_DEFINE_UNQUOTED ( COMB_BLOCKS , $set_ecmult_gen_blocks , [ Set number of blocks in ecmult_gen precomputation] )
369+ ;;
370+ esac
349371
350- case $set_ecmult_gen_precision in
351- 2|4|8)
352- AC_DEFINE_UNQUOTED ( ECMULT_GEN_PREC_BITS , $set_ecmult_gen_precision , [ Set ecmult gen precision bits] )
372+ # set ecmult gen teeth
373+ if test x"$req_ecmult_gen_teeth" = x"auto"; then
374+ set_ecmult_gen_teeth=5
375+ else
376+ set_ecmult_gen_teeth=$req_ecmult_gen_teeth
377+ fi
378+ error_gen_teeth=[ 'option to --with-ecmult-gen-teeth not an integer in range [ 1..8] or "auto"']
379+ case $set_ecmult_gen_teeth in
380+ ''|*[ [ !0-9] ] *)
381+ # no valid integer
382+ AC_MSG_ERROR ( $error_gen_teeth )
353383 ;;
354384*)
355- AC_MSG_ERROR ( [ 'ecmult gen precision not 2, 4, 8 or "auto"'] )
385+ if test "$set_ecmult_gen_teeth" -lt 1 -o "$set_ecmult_gen_teeth" -gt 8 ; then
386+ # not in range
387+ AC_MSG_ERROR ( $error_gen_teeth )
388+ fi
389+ AC_DEFINE_UNQUOTED ( COMB_TEETH , $set_ecmult_gen_teeth , [ Set number of teeth in ecmult_gen precomputation] )
356390 ;;
357391esac
358392
565599echo " asm = $set_asm"
566600echo " bignum = $set_bignum"
567601echo " ecmult window size = $set_ecmult_window"
568- echo " ecmult gen prec. bits = $set_ecmult_gen_precision"
602+ echo " ecmult gen blocks = $set_ecmult_gen_blocks"
603+ echo " ecmult gen teeth = $set_ecmult_gen_teeth"
569604# Hide test-only options unless they're used.
570605if test x"$set_widemul" != xauto; then
571606echo " wide multiplication = $set_widemul"
0 commit comments