Skip to content

Commit 798f788

Browse files
fjahrb-wagn
andcommitted
Experimental: Add incremental half-aggregation for Schnorr signatures
Co-authored-by: Benedikt <crypto@benedikt-wagner.dev>
1 parent 8deef00 commit 798f788

File tree

11 files changed

+753
-28
lines changed

11 files changed

+753
-28
lines changed

.cirrus.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ env:
2222
RECOVERY: no
2323
EXTRAKEYS: no
2424
SCHNORRSIG: no
25+
EXPERIMENTAL: no
26+
SCHNORRSIG_HALFAGG: no
2527
MUSIG: no
2628
ELLSWIFT: no
2729
### test options
@@ -70,6 +72,8 @@ task:
7072
RECOVERY: yes
7173
EXTRAKEYS: yes
7274
SCHNORRSIG: yes
75+
EXPERIMENTAL: yes
76+
SCHNORRSIG_HALFAGG: yes
7377
MUSIG: yes
7478
ELLSWIFT: yes
7579
matrix:
@@ -88,6 +92,8 @@ task:
8892
RECOVERY: yes
8993
EXTRAKEYS: yes
9094
SCHNORRSIG: yes
95+
EXPERIMENTAL: yes
96+
SCHNORRSIG_HALFAGG: yes
9197
MUSIG: yes
9298
ELLSWIFT: yes
9399
WRAPPER_CMD: 'valgrind --error-exitcode=42'

.github/workflows/ci.yml

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ env:
3535
SCHNORRSIG: 'no'
3636
MUSIG: 'no'
3737
ELLSWIFT: 'no'
38+
SCHNORRSIG_HALFAGG: 'no'
3839
### test options
3940
SECP256K1_TEST_ITERS: 64
4041
BENCH: 'yes'
@@ -73,6 +74,7 @@ jobs:
7374
matrix:
7475
configuration:
7576
- env_vars: { WIDEMUL: 'int64', RECOVERY: 'yes' }
77+
<<<<<<< HEAD
7678
- env_vars: { WIDEMUL: 'int64', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', ELLSWIFT: 'yes' }
7779
- env_vars: { WIDEMUL: 'int128' }
7880
- env_vars: { WIDEMUL: 'int128_struct', ELLSWIFT: 'yes' }
@@ -81,6 +83,16 @@ jobs:
8183
- env_vars: { WIDEMUL: 'int128', ASM: 'x86_64', ELLSWIFT: 'yes' }
8284
- env_vars: { RECOVERY: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes' }
8385
- env_vars: { CTIMETESTS: 'no', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', MUSIG: 'yes', CPPFLAGS: '-DVERIFY' }
86+
=======
87+
- env_vars: { WIDEMUL: 'int64', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', EXPERIMENTAL: 'yes', SCHNORRSIG_HALFAGG: 'yes' }
88+
- env_vars: { WIDEMUL: 'int128' }
89+
- env_vars: { WIDEMUL: 'int128_struct', ELLSWIFT: 'yes' }
90+
- env_vars: { WIDEMUL: 'int128', RECOVERY: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
91+
- env_vars: { WIDEMUL: 'int128', ECDH: 'yes', SCHNORRSIG: 'yes', EXPERIMENTAL: 'yes', SCHNORRSIG_HALFAGG: 'yes' }
92+
- env_vars: { WIDEMUL: 'int128', ASM: 'x86_64', ELLSWIFT: 'yes' }
93+
- env_vars: { RECOVERY: 'yes', SCHNORRSIG: 'yes', EXPERIMENTAL: 'yes', SCHNORRSIG_HALFAGG: 'yes' }
94+
- env_vars: { CTIMETESTS: 'no', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', EXPERIMENTAL: 'yes', SCHNORRSIG_HALFAGG: 'yes', CPPFLAGS: '-DVERIFY' }
95+
>>>>>>> 5d9854b (Experimental: Add incremental half-aggregation for Schnorr signatures)
8496
- env_vars: { BUILD: 'distcheck', WITH_VALGRIND: 'no', CTIMETESTS: 'no', BENCH: 'no' }
8597
- env_vars: { CPPFLAGS: '-DDETERMINISTIC' }
8698
- env_vars: { CFLAGS: '-O0', CTIMETESTS: 'no' }
@@ -143,7 +155,12 @@ jobs:
143155
RECOVERY: 'yes'
144156
EXTRAKEYS: 'yes'
145157
SCHNORRSIG: 'yes'
158+
<<<<<<< HEAD
146159
MUSIG: 'yes'
160+
=======
161+
EXPERIMENTAL: 'yes'
162+
SCHNORRSIG_HALFAGG: 'yes'
163+
>>>>>>> 5d9854b (Experimental: Add incremental half-aggregation for Schnorr signatures)
147164
ELLSWIFT: 'yes'
148165
CC: ${{ matrix.cc }}
149166

@@ -189,6 +206,8 @@ jobs:
189206
RECOVERY: 'yes'
190207
EXTRAKEYS: 'yes'
191208
SCHNORRSIG: 'yes'
209+
EXPERIMENTAL: 'yes'
210+
SCHNORRSIG_HALFAGG: 'yes'
192211
MUSIG: 'yes'
193212
ELLSWIFT: 'yes'
194213
CTIMETESTS: 'no'
@@ -242,6 +261,8 @@ jobs:
242261
RECOVERY: 'yes'
243262
EXTRAKEYS: 'yes'
244263
SCHNORRSIG: 'yes'
264+
EXPERIMENTAL: 'yes'
265+
SCHNORRSIG_HALFAGG: 'yes'
245266
MUSIG: 'yes'
246267
ELLSWIFT: 'yes'
247268
CTIMETESTS: 'no'
@@ -289,6 +310,8 @@ jobs:
289310
RECOVERY: 'yes'
290311
EXTRAKEYS: 'yes'
291312
SCHNORRSIG: 'yes'
313+
EXPERIMENTAL: 'yes'
314+
SCHNORRSIG_HALFAGG: 'yes'
292315
MUSIG: 'yes'
293316
ELLSWIFT: 'yes'
294317
CTIMETESTS: 'no'
@@ -346,6 +369,8 @@ jobs:
346369
RECOVERY: 'yes'
347370
EXTRAKEYS: 'yes'
348371
SCHNORRSIG: 'yes'
372+
EXPERIMENTAL: 'yes'
373+
SCHNORRSIG_HALFAGG: 'yes'
349374
MUSIG: 'yes'
350375
ELLSWIFT: 'yes'
351376
CTIMETESTS: 'no'
@@ -400,6 +425,8 @@ jobs:
400425
RECOVERY: 'yes'
401426
EXTRAKEYS: 'yes'
402427
SCHNORRSIG: 'yes'
428+
EXPERIMENTAL: 'yes'
429+
SCHNORRSIG_HALFAGG: 'yes'
403430
MUSIG: 'yes'
404431
ELLSWIFT: 'yes'
405432
CTIMETESTS: 'no'
@@ -453,6 +480,8 @@ jobs:
453480
RECOVERY: 'yes'
454481
EXTRAKEYS: 'yes'
455482
SCHNORRSIG: 'yes'
483+
EXPERIMENTAL: 'yes'
484+
SCHNORRSIG_HALFAGG: 'yes'
456485
MUSIG: 'yes'
457486
ELLSWIFT: 'yes'
458487
CTIMETESTS: 'no'
@@ -519,6 +548,8 @@ jobs:
519548
RECOVERY: 'yes'
520549
EXTRAKEYS: 'yes'
521550
SCHNORRSIG: 'yes'
551+
EXPERIMENTAL: 'yes'
552+
SCHNORRSIG_HALFAGG: 'yes'
522553
MUSIG: 'yes'
523554
ELLSWIFT: 'yes'
524555
CC: 'clang'
@@ -567,6 +598,8 @@ jobs:
567598
RECOVERY: 'yes'
568599
EXTRAKEYS: 'yes'
569600
SCHNORRSIG: 'yes'
601+
EXPERIMENTAL: 'yes'
602+
SCHNORRSIG_HALFAGG: 'yes'
570603
MUSIG: 'yes'
571604
ELLSWIFT: 'yes'
572605
CTIMETESTS: 'no'
@@ -686,13 +719,13 @@ jobs:
686719
fail-fast: false
687720
matrix:
688721
env_vars:
689-
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
722+
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', EXPERIMENTAL: 'yes', SCHNORRSIG_HALFAGG: 'yes' }
690723
- { WIDEMUL: 'int128_struct', ECMULTGENPRECISION: 2, ECMULTWINDOW: 4 }
691-
- { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
724+
- { WIDEMUL: 'int128', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', EXPERIMENTAL: 'yes', SCHNORRSIG_HALFAGG: 'yes' }
692725
- { WIDEMUL: 'int128', RECOVERY: 'yes' }
693-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
694-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc' }
695-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CPPFLAGS: '-DVERIFY' }
726+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', EXPERIMENTAL: 'yes', SCHNORRSIG_HALFAGG: 'yes' }
727+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc', EXPERIMENTAL: 'yes', SCHNORRSIG_HALFAGG: 'yes' }
728+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', EXTRAKEYS: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CPPFLAGS: '-DVERIFY', EXPERIMENTAL: 'yes', SCHNORRSIG_HALFAGG: 'yes' }
696729
- BUILD: 'distcheck'
697730

698731
steps:
@@ -800,7 +833,12 @@ jobs:
800833
RECOVERY: 'yes'
801834
EXTRAKEYS: 'yes'
802835
SCHNORRSIG: 'yes'
836+
<<<<<<< HEAD
803837
MUSIG: 'yes'
838+
=======
839+
EXPERIMENTAL: 'yes'
840+
SCHNORRSIG_HALFAGG: 'yes'
841+
>>>>>>> 5d9854b (Experimental: Add incremental half-aggregation for Schnorr signatures)
804842
ELLSWIFT: 'yes'
805843

806844
steps:

Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,3 +300,7 @@ endif
300300
if ENABLE_MODULE_ELLSWIFT
301301
include src/modules/ellswift/Makefile.am.include
302302
endif
303+
304+
if ENABLE_MODULE_SCHNORRSIG_HALFAGG
305+
include src/modules/schnorrsig_halfagg/Makefile.am.include
306+
endif

ci/ci.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ print_environment() {
1313
# does not rely on bash.
1414
for var in WERROR_CFLAGS MAKEFLAGS BUILD \
1515
ECMULTWINDOW ECMULTGENKB ASM WIDEMUL WITH_VALGRIND EXTRAFLAGS \
16-
EXPERIMENTAL ECDH RECOVERY EXTRAKEYS MUSIG SCHNORRSIG ELLSWIFT \
16+
EXPERIMENTAL ECDH RECOVERY SCHNORRSIG SCHNORRSIG_HALFAGG MUSIG ELLSWIFT \
1717
SECP256K1_TEST_ITERS BENCH SECP256K1_BENCH_ITERS CTIMETESTS\
1818
EXAMPLES \
1919
HOST WRAPPER_CMD \
@@ -79,6 +79,7 @@ esac
7979
--enable-module-ellswift="$ELLSWIFT" \
8080
--enable-module-extrakeys="$EXTRAKEYS" \
8181
--enable-module-schnorrsig="$SCHNORRSIG" \
82+
--enable-module-schnorrsig-halfagg="$SCHNORRSIG_HALFAGG" \
8283
--enable-module-musig="$MUSIG" \
8384
--enable-examples="$EXAMPLES" \
8485
--enable-ctime-tests="$CTIMETESTS" \

configure.ac

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

191+
AC_ARG_ENABLE(module_schnorrsig_halfagg,
192+
AS_HELP_STRING([--enable-module-schnorrsig-halfagg],[enable schnorrsig half-aggregation module (experimental) [default=no]]), [],
193+
[SECP_SET_DEFAULT([enable_module_schnorrsig_halfagg], [no], [yes])])
194+
191195
AC_ARG_ENABLE(module_ellswift,
192196
AS_HELP_STRING([--enable-module-ellswift],[enable ElligatorSwift module [default=yes]]), [],
193197
[SECP_SET_DEFAULT([enable_module_ellswift], [yes], [yes])])
@@ -398,6 +402,11 @@ SECP_CFLAGS="$SECP_CFLAGS $WERROR_CFLAGS"
398402

399403
# Processing must be done in a reverse topological sorting of the dependency graph
400404
# (dependent module first).
405+
if test x"$enable_module_schnorrsig_halfagg" = x"yes"; then
406+
SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_SCHNORRSIG_HALFAGG=1"
407+
enable_module_schnorrsig=yes
408+
fi
409+
401410
if test x"$enable_module_ellswift" = x"yes"; then
402411
SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_ELLSWIFT=1"
403412
fi
@@ -442,6 +451,9 @@ if test x"$enable_experimental" = x"no"; then
442451
if test x"$set_asm" = x"arm32"; then
443452
AC_MSG_ERROR([ARM32 assembly is experimental. Use --enable-experimental to allow.])
444453
fi
454+
if test x"$enable_module_schnorrsig_halfagg" = x"yes"; then
455+
AC_MSG_ERROR([Schnorrsig Half-Aggregation module is experimental. Use --enable-experimental to allow.])
456+
fi
445457
fi
446458

447459
###
@@ -461,6 +473,7 @@ AM_CONDITIONAL([ENABLE_MODULE_ECDH], [test x"$enable_module_ecdh" = x"yes"])
461473
AM_CONDITIONAL([ENABLE_MODULE_RECOVERY], [test x"$enable_module_recovery" = x"yes"])
462474
AM_CONDITIONAL([ENABLE_MODULE_EXTRAKEYS], [test x"$enable_module_extrakeys" = x"yes"])
463475
AM_CONDITIONAL([ENABLE_MODULE_SCHNORRSIG], [test x"$enable_module_schnorrsig" = x"yes"])
476+
AM_CONDITIONAL([ENABLE_MODULE_SCHNORRSIG_HALFAGG], [test x"$enable_module_schnorrsig_halfagg" = x"yes"])
464477
AM_CONDITIONAL([ENABLE_MODULE_MUSIG], [test x"$enable_module_musig" = x"yes"])
465478
AM_CONDITIONAL([ENABLE_MODULE_ELLSWIFT], [test x"$enable_module_ellswift" = x"yes"])
466479
AM_CONDITIONAL([USE_EXTERNAL_ASM], [test x"$enable_external_asm" = x"yes"])
@@ -474,33 +487,34 @@ AC_OUTPUT
474487

475488
echo
476489
echo "Build Options:"
477-
echo " with external callbacks = $enable_external_default_callbacks"
478-
echo " with benchmarks = $enable_benchmark"
479-
echo " with tests = $enable_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"
490+
echo " with external callbacks = $enable_external_default_callbacks"
491+
echo " with benchmarks = $enable_benchmark"
492+
echo " with tests = $enable_tests"
493+
echo " with ctime tests = $enable_ctime_tests"
494+
echo " with coverage = $enable_coverage"
495+
echo " with examples = $enable_examples"
496+
echo " module ecdh = $enable_module_ecdh"
497+
echo " module recovery = $enable_module_recovery"
498+
echo " module extrakeys = $enable_module_extrakeys"
499+
echo " module schnorrsig = $enable_module_schnorrsig"
500+
echo " module schnorrsig-halfagg = $enable_module_schnorrsig_halfagg"
501+
echo " module musig = $enable_module_musig"
502+
echo " module ellswift = $enable_module_ellswift"
489503
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"
504+
echo " asm = $set_asm"
505+
echo " ecmult window size = $set_ecmult_window"
506+
echo " ecmult gen table size = $set_ecmult_gen_kb KiB"
493507
# Hide test-only options unless they're used.
494508
if test x"$set_widemul" != xauto; then
495-
echo " wide multiplication = $set_widemul"
509+
echo " wide multiplication = $set_widemul"
496510
fi
497511
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"
512+
echo " valgrind = $enable_valgrind"
513+
echo " CC = $CC"
514+
echo " CPPFLAGS = $CPPFLAGS"
515+
echo " SECP_CFLAGS = $SECP_CFLAGS"
516+
echo " CFLAGS = $CFLAGS"
517+
echo " LDFLAGS = $LDFLAGS"
504518

505519
if test x"$print_msan_notice" = x"yes"; then
506520
echo

0 commit comments

Comments
 (0)