Skip to content

Commit 705ce7e

Browse files
committed
Merge #1129: ElligatorSwift + integrated x-only DH
90e360a Add doc/ellswift.md with ElligatorSwift explanation (Pieter Wuille) 4f09184 Add ellswift testing to CI (Pieter Wuille) 1bcea8c Add benchmarks for ellswift module (Pieter Wuille) 2d1d41a Add ctime tests for ellswift module (Pieter Wuille) df633cd Add _prefix and _bip324 ellswift_xdh hash functions (Pieter Wuille) 9695deb Add tests for ellswift module (Pieter Wuille) c47917b Add ellswift module implementing ElligatorSwift (Pieter Wuille) 79e5b2a Add functions to test if X coordinate is valid (Pieter Wuille) a597a5a Add benchmark for key generation (Pieter Wuille) Pull request description: ACKs for top commit: Davidson-Souza: tACK 90e360a. Full testing backlog: real-or-random: ACK 90e360a jonasnick: ACK 90e360a Tree-SHA512: cf59044c1b064f9a3fd57fd1c4c6ab154305ee6ad67a604bc254ddd6b8ee78626250d325174e10d2f2b19264ab0d58013508dc763aa07f5a1e6417e03551a378
2 parents 0702ecb + 90e360a commit 705ce7e

19 files changed

+2028
-17
lines changed

.cirrus.yml

+12-4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ env:
2121
ECDH: no
2222
RECOVERY: no
2323
SCHNORRSIG: no
24+
ELLSWIFT: no
2425
### test options
2526
SECP256K1_TEST_ITERS:
2627
BENCH: yes
@@ -74,12 +75,12 @@ task:
7475
<< : *LINUX_CONTAINER
7576
matrix: &ENV_MATRIX
7677
- env: {WIDEMUL: int64, RECOVERY: yes}
77-
- env: {WIDEMUL: int64, ECDH: yes, SCHNORRSIG: yes}
78+
- env: {WIDEMUL: int64, ECDH: yes, SCHNORRSIG: yes, ELLSWIFT: yes}
7879
- env: {WIDEMUL: int128}
79-
- env: {WIDEMUL: int128_struct}
80-
- env: {WIDEMUL: int128, RECOVERY: yes, SCHNORRSIG: yes}
80+
- env: {WIDEMUL: int128_struct, ELLSWIFT: yes}
81+
- env: {WIDEMUL: int128, RECOVERY: yes, SCHNORRSIG: yes, ELLSWIFT: yes}
8182
- env: {WIDEMUL: int128, ECDH: yes, SCHNORRSIG: yes}
82-
- env: {WIDEMUL: int128, ASM: x86_64}
83+
- env: {WIDEMUL: int128, ASM: x86_64 , ELLSWIFT: yes}
8384
- env: { RECOVERY: yes, SCHNORRSIG: yes}
8485
- env: {CTIMETESTS: no, RECOVERY: yes, ECDH: yes, SCHNORRSIG: yes, CPPFLAGS: -DVERIFY}
8586
- env: {BUILD: distcheck, WITH_VALGRIND: no, CTIMETESTS: no, BENCH: no}
@@ -154,6 +155,7 @@ task:
154155
ECDH: yes
155156
RECOVERY: yes
156157
SCHNORRSIG: yes
158+
ELLSWIFT: yes
157159
CTIMETESTS: no
158160
<< : *MERGE_BASE
159161
test_script:
@@ -173,6 +175,7 @@ task:
173175
ECDH: yes
174176
RECOVERY: yes
175177
SCHNORRSIG: yes
178+
ELLSWIFT: yes
176179
CTIMETESTS: no
177180
matrix:
178181
- env: {}
@@ -193,6 +196,7 @@ task:
193196
ECDH: yes
194197
RECOVERY: yes
195198
SCHNORRSIG: yes
199+
ELLSWIFT: yes
196200
CTIMETESTS: no
197201
<< : *MERGE_BASE
198202
test_script:
@@ -210,6 +214,7 @@ task:
210214
ECDH: yes
211215
RECOVERY: yes
212216
SCHNORRSIG: yes
217+
ELLSWIFT: yes
213218
CTIMETESTS: no
214219
<< : *MERGE_BASE
215220
test_script:
@@ -247,6 +252,7 @@ task:
247252
RECOVERY: yes
248253
EXPERIMENTAL: yes
249254
SCHNORRSIG: yes
255+
ELLSWIFT: yes
250256
CTIMETESTS: no
251257
# Use a MinGW-w64 host to tell ./configure we're building for Windows.
252258
# This will detect some MinGW-w64 tools but then make will need only
@@ -286,6 +292,7 @@ task:
286292
ECDH: yes
287293
RECOVERY: yes
288294
SCHNORRSIG: yes
295+
ELLSWIFT: yes
289296
CTIMETESTS: no
290297
matrix:
291298
- name: "Valgrind (memcheck)"
@@ -361,6 +368,7 @@ task:
361368
ECDH: yes
362369
RECOVERY: yes
363370
SCHNORRSIG: yes
371+
ELLSWIFT: yes
364372
<< : *MERGE_BASE
365373
test_script:
366374
- ./ci/cirrus.sh

CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ if(SECP256K1_ENABLE_MODULE_EXTRAKEYS)
7171
add_compile_definitions(ENABLE_MODULE_EXTRAKEYS=1)
7272
endif()
7373

74+
option(SECP256K1_ENABLE_MODULE_ELLSWIFT "Enable ElligatorSwift module." ON)
75+
if(SECP256K1_ENABLE_MODULE_ELLSWIFT)
76+
add_compile_definitions(ENABLE_MODULE_ELLSWIFT=1)
77+
endif()
78+
7479
option(SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS "Enable external default callback functions." OFF)
7580
if(SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS)
7681
add_compile_definitions(USE_EXTERNAL_DEFAULT_CALLBACKS=1)
@@ -270,6 +275,7 @@ message(" ECDH ................................ ${SECP256K1_ENABLE_MODULE_ECDH}
270275
message(" ECDSA pubkey recovery ............... ${SECP256K1_ENABLE_MODULE_RECOVERY}")
271276
message(" extrakeys ........................... ${SECP256K1_ENABLE_MODULE_EXTRAKEYS}")
272277
message(" schnorrsig .......................... ${SECP256K1_ENABLE_MODULE_SCHNORRSIG}")
278+
message(" ElligatorSwift ...................... ${SECP256K1_ENABLE_MODULE_ELLSWIFT}")
273279
message("Parameters:")
274280
message(" ecmult window size .................. ${SECP256K1_ECMULT_WINDOW_SIZE}")
275281
message(" ecmult gen precision bits ........... ${SECP256K1_ECMULT_GEN_PREC_BITS}")

Makefile.am

+4
Original file line numberDiff line numberDiff line change
@@ -267,3 +267,7 @@ endif
267267
if ENABLE_MODULE_SCHNORRSIG
268268
include src/modules/schnorrsig/Makefile.am.include
269269
endif
270+
271+
if ENABLE_MODULE_ELLSWIFT
272+
include src/modules/ellswift/Makefile.am.include
273+
endif

ci/cirrus.sh

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ fi
6161
--with-ecmult-window="$ECMULTWINDOW" \
6262
--with-ecmult-gen-precision="$ECMULTGENPRECISION" \
6363
--enable-module-ecdh="$ECDH" --enable-module-recovery="$RECOVERY" \
64+
--enable-module-ellswift="$ELLSWIFT" \
6465
--enable-module-schnorrsig="$SCHNORRSIG" \
6566
--enable-examples="$EXAMPLES" \
6667
--enable-ctime-tests="$CTIMETESTS" \

configure.ac

+10
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@ AC_ARG_ENABLE(module_schnorrsig,
190190
AS_HELP_STRING([--enable-module-schnorrsig],[enable schnorrsig module [default=yes]]), [],
191191
[SECP_SET_DEFAULT([enable_module_schnorrsig], [yes], [yes])])
192192

193+
AC_ARG_ENABLE(module_ellswift,
194+
AS_HELP_STRING([--enable-module-ellswift],[enable ElligatorSwift module [default=yes]]), [],
195+
[SECP_SET_DEFAULT([enable_module_ellswift], [yes], [yes])])
196+
193197
AC_ARG_ENABLE(external_default_callbacks,
194198
AS_HELP_STRING([--enable-external-default-callbacks],[enable external default callback functions [default=no]]), [],
195199
[SECP_SET_DEFAULT([enable_external_default_callbacks], [no], [no])])
@@ -402,6 +406,10 @@ if test x"$enable_module_schnorrsig" = x"yes"; then
402406
enable_module_extrakeys=yes
403407
fi
404408

409+
if test x"$enable_module_ellswift" = x"yes"; then
410+
AC_DEFINE(ENABLE_MODULE_ELLSWIFT, 1, [Define this symbol to enable the ElligatorSwift module])
411+
fi
412+
405413
# Test if extrakeys is set after the schnorrsig module to allow the schnorrsig
406414
# module to set enable_module_extrakeys=yes
407415
if test x"$enable_module_extrakeys" = x"yes"; then
@@ -444,6 +452,7 @@ AM_CONDITIONAL([ENABLE_MODULE_ECDH], [test x"$enable_module_ecdh" = x"yes"])
444452
AM_CONDITIONAL([ENABLE_MODULE_RECOVERY], [test x"$enable_module_recovery" = x"yes"])
445453
AM_CONDITIONAL([ENABLE_MODULE_EXTRAKEYS], [test x"$enable_module_extrakeys" = x"yes"])
446454
AM_CONDITIONAL([ENABLE_MODULE_SCHNORRSIG], [test x"$enable_module_schnorrsig" = x"yes"])
455+
AM_CONDITIONAL([ENABLE_MODULE_ELLSWIFT], [test x"$enable_module_ellswift" = x"yes"])
447456
AM_CONDITIONAL([USE_EXTERNAL_ASM], [test x"$enable_external_asm" = x"yes"])
448457
AM_CONDITIONAL([USE_ASM_ARM], [test x"$set_asm" = x"arm32"])
449458
AM_CONDITIONAL([BUILD_WINDOWS], [test "$build_windows" = "yes"])
@@ -465,6 +474,7 @@ echo " module ecdh = $enable_module_ecdh"
465474
echo " module recovery = $enable_module_recovery"
466475
echo " module extrakeys = $enable_module_extrakeys"
467476
echo " module schnorrsig = $enable_module_schnorrsig"
477+
echo " module ellswift = $enable_module_ellswift"
468478
echo
469479
echo " asm = $set_asm"
470480
echo " ecmult window size = $set_ecmult_window"

0 commit comments

Comments
 (0)