Skip to content

Commit 681ac2d

Browse files
committed
fullagg: Add to build system
1 parent 8387ba5 commit 681ac2d

File tree

4 files changed

+71
-23
lines changed

4 files changed

+71
-23
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ option(SECP256K1_ENABLE_MODULE_RECOVERY "Enable ECDSA pubkey recovery module." O
5151
option(SECP256K1_ENABLE_MODULE_EXTRAKEYS "Enable extrakeys module." ON)
5252
option(SECP256K1_ENABLE_MODULE_SCHNORRSIG "Enable schnorrsig module." ON)
5353
option(SECP256K1_ENABLE_MODULE_MUSIG "Enable musig module." ON)
54+
option(SECP256K1_ENABLE_MODULE_SCHNORRSIG_FULLAGG "Enable schnorrsig full-aggregation module." OFF)
5455
option(SECP256K1_ENABLE_MODULE_ELLSWIFT "Enable ElligatorSwift module." ON)
5556

5657
option(SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS "Enable external default callback functions." OFF)
@@ -284,6 +285,7 @@ message(" ECDSA pubkey recovery ............... ${SECP256K1_ENABLE_MODULE_RECOV
284285
message(" extrakeys ........................... ${SECP256K1_ENABLE_MODULE_EXTRAKEYS}")
285286
message(" schnorrsig .......................... ${SECP256K1_ENABLE_MODULE_SCHNORRSIG}")
286287
message(" musig ............................... ${SECP256K1_ENABLE_MODULE_MUSIG}")
288+
message(" schnorrsig fullagg .................. ${SECP256K1_ENABLE_MODULE_SCHNORRSIG_FULLAGG}")
287289
message(" ElligatorSwift ...................... ${SECP256K1_ENABLE_MODULE_ELLSWIFT}")
288290
message("Parameters:")
289291
message(" ecmult window size .................. ${SECP256K1_ECMULT_WINDOW_SIZE}")

Makefile.am

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,17 @@ musig_example_LDFLAGS += -lbcrypt
207207
endif
208208
TESTS += musig_example
209209
endif
210+
if ENABLE_MODULE_SCHNORRSIG_FULLAGG
211+
noinst_PROGRAMS += fullagg_example
212+
fullagg_example_SOURCES = examples/fullagg.c
213+
fullagg_example_CPPFLAGS = -I$(top_srcdir)/include -DSECP256K1_STATIC
214+
fullagg_example_LDADD = libsecp256k1.la
215+
fullagg_example_LDFLAGS = -static
216+
if BUILD_WINDOWS
217+
fullagg_example_LDFLAGS += -lbcrypt
218+
endif
219+
TESTS += fullagg_example
220+
endif
210221
endif
211222

212223
### Precomputed tables
@@ -308,6 +319,10 @@ if ENABLE_MODULE_MUSIG
308319
include src/modules/musig/Makefile.am.include
309320
endif
310321

322+
if ENABLE_MODULE_SCHNORRSIG_FULLAGG
323+
include src/modules/schnorrsig_fullagg/Makefile.am.include
324+
endif
325+
311326
if ENABLE_MODULE_ELLSWIFT
312327
include src/modules/ellswift/Makefile.am.include
313328
endif

configure.ac

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ AC_ARG_ENABLE(module_musig,
187187
AS_HELP_STRING([--enable-module-musig],[enable MuSig2 module [default=yes]]), [],
188188
[SECP_SET_DEFAULT([enable_module_musig], [yes], [yes])])
189189

190+
AC_ARG_ENABLE(module_schnorrsig_fullagg,
191+
AS_HELP_STRING([--enable-module-schnorrsig-fullagg],[enable schnorrsig full-aggregation module (experimental) [default=no]]), [],
192+
[SECP_SET_DEFAULT([enable_module_schnorrsig_fullagg], [no], [yes])])
193+
190194
AC_ARG_ENABLE(module_ellswift,
191195
AS_HELP_STRING([--enable-module-ellswift],[enable ElligatorSwift module [default=yes]]), [],
192196
[SECP_SET_DEFAULT([enable_module_ellswift], [yes], [yes])])
@@ -397,6 +401,14 @@ SECP_CFLAGS="$SECP_CFLAGS $WERROR_CFLAGS"
397401

398402
# Processing must be done in a reverse topological sorting of the dependency graph
399403
# (dependent module first).
404+
if test x"$enable_module_schnorrsig_fullagg" = x"yes"; then
405+
if test x"$enable_module_schnorrsig" = x"no"; then
406+
AC_MSG_ERROR([Module dependency error: You have disabled the schnorrsig module explicitly, but it is required by the schnorrsig fullagg module.])
407+
fi
408+
enable_module_schnorrsig=yes
409+
SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_SCHNORRSIG_FULLAGG=1"
410+
fi
411+
400412
if test x"$enable_module_ellswift" = x"yes"; then
401413
SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_ELLSWIFT=1"
402414
fi
@@ -441,6 +453,10 @@ if test x"$enable_experimental" = x"no"; then
441453
if test x"$set_asm" = x"arm32"; then
442454
AC_MSG_ERROR([ARM32 assembly is experimental. Use --enable-experimental to allow.])
443455
fi
456+
457+
if test x"$enable_module_schnorrsig_fullagg" = x"yes"; then
458+
AC_MSG_ERROR([Schnorrsig Full-Aggregation module is experimental. Use --enable-experimental to allow.])
459+
fi
444460
fi
445461

446462
###
@@ -460,6 +476,7 @@ AM_CONDITIONAL([ENABLE_MODULE_ECDH], [test x"$enable_module_ecdh" = x"yes"])
460476
AM_CONDITIONAL([ENABLE_MODULE_RECOVERY], [test x"$enable_module_recovery" = x"yes"])
461477
AM_CONDITIONAL([ENABLE_MODULE_EXTRAKEYS], [test x"$enable_module_extrakeys" = x"yes"])
462478
AM_CONDITIONAL([ENABLE_MODULE_SCHNORRSIG], [test x"$enable_module_schnorrsig" = x"yes"])
479+
AM_CONDITIONAL([ENABLE_MODULE_SCHNORRSIG_FULLAGG], [test x"$enable_module_schnorrsig_fullagg" = x"yes"])
463480
AM_CONDITIONAL([ENABLE_MODULE_MUSIG], [test x"$enable_module_musig" = x"yes"])
464481
AM_CONDITIONAL([ENABLE_MODULE_ELLSWIFT], [test x"$enable_module_ellswift" = x"yes"])
465482
AM_CONDITIONAL([USE_EXTERNAL_ASM], [test x"$enable_external_asm" = x"yes"])
@@ -473,34 +490,35 @@ AC_OUTPUT
473490

474491
echo
475492
echo "Build Options:"
476-
echo " with external callbacks = $enable_external_default_callbacks"
477-
echo " with benchmarks = $enable_benchmark"
478-
echo " with tests = $enable_tests"
479-
echo " with exhaustive tests = $enable_exhaustive_tests"
480-
echo " with ctime tests = $enable_ctime_tests"
481-
echo " with coverage = $enable_coverage"
482-
echo " with examples = $enable_examples"
483-
echo " module ecdh = $enable_module_ecdh"
484-
echo " module recovery = $enable_module_recovery"
485-
echo " module extrakeys = $enable_module_extrakeys"
486-
echo " module schnorrsig = $enable_module_schnorrsig"
487-
echo " module musig = $enable_module_musig"
488-
echo " module ellswift = $enable_module_ellswift"
493+
echo " with external callbacks = $enable_external_default_callbacks"
494+
echo " with benchmarks = $enable_benchmark"
495+
echo " with tests = $enable_tests"
496+
echo " with exhaustive tests = $enable_exhaustive_tests"
497+
echo " with ctime tests = $enable_ctime_tests"
498+
echo " with coverage = $enable_coverage"
499+
echo " with examples = $enable_examples"
500+
echo " module ecdh = $enable_module_ecdh"
501+
echo " module recovery = $enable_module_recovery"
502+
echo " module extrakeys = $enable_module_extrakeys"
503+
echo " module schnorrsig = $enable_module_schnorrsig"
504+
echo " module schnorrsig-halfagg = $enable_module_schnorrsig_fullagg"
505+
echo " module musig = $enable_module_musig"
506+
echo " module ellswift = $enable_module_ellswift"
489507
echo
490-
echo " asm = $set_asm"
491-
echo " ecmult window size = $set_ecmult_window"
492-
echo " ecmult gen table size = $set_ecmult_gen_kb KiB"
508+
echo " asm = $set_asm"
509+
echo " ecmult window size = $set_ecmult_window"
510+
echo " ecmult gen table size = $set_ecmult_gen_kb KiB"
493511
# Hide test-only options unless they're used.
494512
if test x"$set_widemul" != xauto; then
495-
echo " wide multiplication = $set_widemul"
513+
echo " wide multiplication = $set_widemul"
496514
fi
497515
echo
498-
echo " valgrind = $enable_valgrind"
499-
echo " CC = $CC"
500-
echo " CPPFLAGS = $CPPFLAGS"
501-
echo " SECP_CFLAGS = $SECP_CFLAGS"
502-
echo " CFLAGS = $CFLAGS"
503-
echo " LDFLAGS = $LDFLAGS"
516+
echo " valgrind = $enable_valgrind"
517+
echo " CC = $CC"
518+
echo " CPPFLAGS = $CPPFLAGS"
519+
echo " SECP_CFLAGS = $SECP_CFLAGS"
520+
echo " CFLAGS = $CFLAGS"
521+
echo " LDFLAGS = $LDFLAGS"
504522

505523
if test x"$print_msan_notice" = x"yes"; then
506524
echo

src/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@ if(SECP256K1_ENABLE_MODULE_MUSIG)
2121
set_property(TARGET secp256k1 APPEND PROPERTY PUBLIC_HEADER ${PROJECT_SOURCE_DIR}/include/secp256k1_musig.h)
2222
endif()
2323

24+
option(SECP256K1_EXPERIMENTAL "Allow experimental configuration options." OFF)
25+
if(SECP256K1_ENABLE_MODULE_SCHNORRSIG_FULLAGG)
26+
if(NOT SECP256K1_EXPERIMENTAL)
27+
message(FATAL_ERROR "Schnorrsig full-aggregation is experimental. Use -DSECP256K1_EXPERIMENTAL=ON to allow.")
28+
endif()
29+
if(DEFINED SECP256K1_ENABLE_MODULE_SCHNORRSIG AND NOT SECP256K1_ENABLE_MODULE_SCHNORRSIG)
30+
message(FATAL_ERROR "Module dependency error: You have disabled the schnorrsig module explicitly, but it is required by the Schnorrsig full-aggregation module.")
31+
endif()
32+
set(SECP256K1_ENABLE_MODULE_SCHNORRSIG ON)
33+
add_compile_definitions(ENABLE_MODULE_SCHNORRSIG_FULLAGG=1)
34+
set_property(TARGET secp256k1 APPEND PROPERTY PUBLIC_HEADER ${PROJECT_SOURCE_DIR}/include/secp256k1_schnorrsig_fullagg.h)
35+
endif()
36+
2437
if(SECP256K1_ENABLE_MODULE_SCHNORRSIG)
2538
if(DEFINED SECP256K1_ENABLE_MODULE_EXTRAKEYS AND NOT SECP256K1_ENABLE_MODULE_EXTRAKEYS)
2639
message(FATAL_ERROR "Module dependency error: You have disabled the extrakeys module explicitly, but it is required by the schnorrsig module.")

0 commit comments

Comments
 (0)