@@ -136,20 +136,28 @@ AC_ARG_ENABLE(module_recovery,
136136 [ enable_module_recovery=$enableval] ,
137137 [ enable_module_recovery=no] )
138138
139+ AC_ARG_ENABLE ( module_extrakeys ,
140+ AS_HELP_STRING ( [ --enable-module-extrakeys] ,[ enable extrakeys module (experimental)] ) ,
141+ [ enable_module_extrakeys=$enableval] ,
142+ [ enable_module_extrakeys=no] )
143+
144+ AC_ARG_ENABLE ( module_schnorrsig ,
145+ AS_HELP_STRING ( [ --enable-module-schnorrsig] ,[ enable schnorrsig module (experimental)] ) ,
146+ [ enable_module_schnorrsig=$enableval] ,
147+ [ enable_module_schnorrsig=no] )
148+
139149AC_ARG_ENABLE ( external_default_callbacks ,
140150 AS_HELP_STRING ( [ --enable-external-default-callbacks] ,[ enable external default callback functions [ default=no] ] ) ,
141151 [ use_external_default_callbacks=$enableval] ,
142152 [ use_external_default_callbacks=no] )
143153
144- AC_ARG_WITH ( [ field] , [ AS_HELP_STRING ( [ --with-field=64bit|32bit|auto] ,
145- [ finite field implementation to use [ default=auto] ] ) ] ,[ req_field=$withval] , [ req_field=auto] )
154+ dnl Test-only override of the (autodetected by the C code) "widemul" setting.
155+ dnl Legal values are int64 (for [u]int64_t), int128 (for [unsigned] __int128), and auto (the default).
156+ AC_ARG_WITH ( [ test-override-wide-multiply] , [ ] ,[ set_widemul=$withval] , [ set_widemul=auto] )
146157
147158AC_ARG_WITH ( [ bignum] , [ AS_HELP_STRING ( [ --with-bignum=gmp|no|auto] ,
148159[ bignum implementation to use [ default=auto] ] ) ] ,[ req_bignum=$withval] , [ req_bignum=auto] )
149160
150- AC_ARG_WITH ( [ scalar] , [ AS_HELP_STRING ( [ --with-scalar=64bit|32bit|auto] ,
151- [ scalar implementation to use [ default=auto] ] ) ] ,[ req_scalar=$withval] , [ req_scalar=auto] )
152-
153161AC_ARG_WITH ( [ asm] , [ AS_HELP_STRING ( [ --with-asm=x86_64|arm|no|auto] ,
154162[ assembly optimizations to use (experimental: arm) [ default=auto] ] ) ] ,[ req_asm=$withval] , [ req_asm=auto] )
155163
@@ -170,8 +178,6 @@ AC_ARG_WITH([ecmult-gen-precision], [AS_HELP_STRING([--with-ecmult-gen-precision
170178) ] ,
171179[ req_ecmult_gen_precision=$withval] , [ req_ecmult_gen_precision=auto] )
172180
173- AC_CHECK_TYPES ( [ __int128] )
174-
175181AC_CHECK_HEADER ( [ valgrind/memcheck.h] , [ enable_valgrind=yes] , [ enable_valgrind=no] , [ ] )
176182AM_CONDITIONAL([ VALGRIND_ENABLED] ,[ test "$enable_valgrind" = "yes"] )
177183
@@ -265,63 +271,6 @@ else
265271 esac
266272fi
267273
268- if test x"$req_field" = x"auto"; then
269- if test x"set_asm" = x"x86_64"; then
270- set_field=64bit
271- fi
272- if test x"$set_field" = x; then
273- SECP_INT128_CHECK
274- if test x"$has_int128" = x"yes"; then
275- set_field=64bit
276- fi
277- fi
278- if test x"$set_field" = x; then
279- set_field=32bit
280- fi
281- else
282- set_field=$req_field
283- case $set_field in
284- 64bit)
285- if test x"$set_asm" != x"x86_64"; then
286- SECP_INT128_CHECK
287- if test x"$has_int128" != x"yes"; then
288- AC_MSG_ERROR ( [ 64bit field explicitly requested but neither __int128 support or x86_64 assembly available] )
289- fi
290- fi
291- ;;
292- 32bit)
293- ;;
294- *)
295- AC_MSG_ERROR ( [ invalid field implementation selection] )
296- ;;
297- esac
298- fi
299-
300- if test x"$req_scalar" = x"auto"; then
301- SECP_INT128_CHECK
302- if test x"$has_int128" = x"yes"; then
303- set_scalar=64bit
304- fi
305- if test x"$set_scalar" = x; then
306- set_scalar=32bit
307- fi
308- else
309- set_scalar=$req_scalar
310- case $set_scalar in
311- 64bit)
312- SECP_INT128_CHECK
313- if test x"$has_int128" != x"yes"; then
314- AC_MSG_ERROR ( [ 64bit scalar explicitly requested but __int128 support not available] )
315- fi
316- ;;
317- 32bit)
318- ;;
319- *)
320- AC_MSG_ERROR ( [ invalid scalar implementation selected] )
321- ;;
322- esac
323- fi
324-
325274if test x"$req_bignum" = x"auto"; then
326275 SECP_GMP_CHECK
327276 if test x"$has_gmp" = x"yes"; then
@@ -365,16 +314,18 @@ no)
365314 ;;
366315esac
367316
368- # select field implementation
369- case $set_field in
370- 64bit)
371- AC_DEFINE ( USE_FIELD_5X52 , 1 , [ Define this symbol to use the FIELD_5X52 implementation] )
317+ # select wide multiplication implementation
318+ case $set_widemul in
319+ int128)
320+ AC_DEFINE ( USE_FORCE_WIDEMUL_INT128 , 1 , [ Define this symbol to force the use of the (unsigned) __int128 based wide multiplication implementation] )
321+ ;;
322+ int64)
323+ AC_DEFINE ( USE_FORCE_WIDEMUL_INT64 , 1 , [ Define this symbol to force the use of the (u)int64_t based wide multiplication implementation] )
372324 ;;
373- 32bit)
374- AC_DEFINE ( USE_FIELD_10X26 , 1 , [ Define this symbol to use the FIELD_10X26 implementation] )
325+ auto)
375326 ;;
376327*)
377- AC_MSG_ERROR ( [ invalid field implementation] )
328+ AC_MSG_ERROR ( [ invalid wide multiplication implementation] )
378329 ;;
379330esac
380331
396347 ;;
397348esac
398349
399- # select scalar implementation
400- case $set_scalar in
401- 64bit)
402- AC_DEFINE ( USE_SCALAR_4X64 , 1 , [ Define this symbol to use the 4x64 scalar implementation] )
403- ;;
404- 32bit)
405- AC_DEFINE ( USE_SCALAR_8X32 , 1 , [ Define this symbol to use the 8x32 scalar implementation] )
406- ;;
407- *)
408- AC_MSG_ERROR ( [ invalid scalar implementation] )
409- ;;
410- esac
411-
412350# set ecmult window size
413351if test x"$req_ecmult_window" = x"auto"; then
414352 set_ecmult_window=15
@@ -493,7 +431,16 @@ if test x"$enable_module_recovery" = x"yes"; then
493431 AC_DEFINE ( ENABLE_MODULE_RECOVERY , 1 , [ Define this symbol to enable the ECDSA pubkey recovery module] )
494432fi
495433
496- AC_C_BIGENDIAN ( )
434+ if test x"$enable_module_schnorrsig" = x"yes"; then
435+ AC_DEFINE ( ENABLE_MODULE_SCHNORRSIG , 1 , [ Define this symbol to enable the schnorrsig module] )
436+ enable_module_extrakeys=yes
437+ fi
438+
439+ # Test if extrakeys is set after the schnorrsig module to allow the schnorrsig
440+ # module to set enable_module_extrakeys=yes
441+ if test x"$enable_module_extrakeys" = x"yes"; then
442+ AC_DEFINE ( ENABLE_MODULE_EXTRAKEYS , 1 , [ Define this symbol to enable the extrakeys module] )
443+ fi
497444
498445if test x"$use_external_asm" = x"yes"; then
499446 AC_DEFINE ( USE_EXTERNAL_ASM , 1 , [ Define this symbol if an external (non-inline) assembly implementation is used] )
@@ -508,11 +455,19 @@ if test x"$enable_experimental" = x"yes"; then
508455 AC_MSG_NOTICE ( [ WARNING: experimental build] )
509456 AC_MSG_NOTICE ( [ Experimental features do not have stable APIs or properties, and may not be safe for production use.] )
510457 AC_MSG_NOTICE ( [ Building ECDH module: $enable_module_ecdh] )
458+ AC_MSG_NOTICE ( [ Building extrakeys module: $enable_module_extrakeys] )
459+ AC_MSG_NOTICE ( [ Building schnorrsig module: $enable_module_schnorrsig] )
511460 AC_MSG_NOTICE ( [ ******] )
512461else
513462 if test x"$enable_module_ecdh" = x"yes"; then
514463 AC_MSG_ERROR ( [ ECDH module is experimental. Use --enable-experimental to allow.] )
515464 fi
465+ if test x"$enable_module_extrakeys" = x"yes"; then
466+ AC_MSG_ERROR ( [ extrakeys module is experimental. Use --enable-experimental to allow.] )
467+ fi
468+ if test x"$enable_module_schnorrsig" = x"yes"; then
469+ AC_MSG_ERROR ( [ schnorrsig module is experimental. Use --enable-experimental to allow.] )
470+ fi
516471 if test x"$set_asm" = x"arm"; then
517472 AC_MSG_ERROR ( [ ARM assembly optimization is experimental. Use --enable-experimental to allow.] )
518473 fi
@@ -531,6 +486,8 @@ AM_CONDITIONAL([USE_BENCHMARK], [test x"$use_benchmark" = x"yes"])
531486AM_CONDITIONAL([ USE_ECMULT_STATIC_PRECOMPUTATION] , [ test x"$set_precomp" = x"yes"] )
532487AM_CONDITIONAL([ ENABLE_MODULE_ECDH] , [ test x"$enable_module_ecdh" = x"yes"] )
533488AM_CONDITIONAL([ ENABLE_MODULE_RECOVERY] , [ test x"$enable_module_recovery" = x"yes"] )
489+ AM_CONDITIONAL([ ENABLE_MODULE_EXTRAKEYS] , [ test x"$enable_module_extrakeys" = x"yes"] )
490+ AM_CONDITIONAL([ ENABLE_MODULE_SCHNORRSIG] , [ test x"$enable_module_schnorrsig" = x"yes"] )
534491AM_CONDITIONAL([ USE_EXTERNAL_ASM] , [ test x"$use_external_asm" = x"yes"] )
535492AM_CONDITIONAL([ USE_ASM_ARM] , [ test x"$set_asm" = x"arm"] )
536493
@@ -550,13 +507,17 @@ echo " with benchmarks = $use_benchmark"
550507echo " with coverage = $enable_coverage"
551508echo " module ecdh = $enable_module_ecdh"
552509echo " module recovery = $enable_module_recovery"
510+ echo " module extrakeys = $enable_module_extrakeys"
511+ echo " module schnorrsig = $enable_module_schnorrsig"
553512echo
554513echo " asm = $set_asm"
555514echo " bignum = $set_bignum"
556- echo " field = $set_field"
557- echo " scalar = $set_scalar"
558515echo " ecmult window size = $set_ecmult_window"
559516echo " ecmult gen prec. bits = $set_ecmult_gen_precision"
517+ dnl Hide test-only options unless they're used.
518+ if test x"$set_widemul" != xauto; then
519+ echo " wide multiplication = $set_widemul"
520+ fi
560521echo
561522echo " valgrind = $enable_valgrind"
562523echo " CC = $CC"
0 commit comments