Skip to content

Commit a9a5fe8

Browse files
committed
build: add skeleton for new silentpayments (BIP352) module
1 parent 2483627 commit a9a5fe8

File tree

7 files changed

+62
-0
lines changed

7 files changed

+62
-0
lines changed

CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,14 @@ option(SECP256K1_ENABLE_MODULE_RECOVERY "Enable ECDSA pubkey recovery module." O
6060
option(SECP256K1_ENABLE_MODULE_EXTRAKEYS "Enable extrakeys module." ON)
6161
option(SECP256K1_ENABLE_MODULE_SCHNORRSIG "Enable schnorrsig module." ON)
6262
option(SECP256K1_ENABLE_MODULE_ELLSWIFT "Enable ElligatorSwift module." ON)
63+
option(SECP256K1_ENABLE_MODULE_SILENTPAYMENTS "Enable Silent Payments module." OFF)
6364

6465
# Processing must be done in a topological sorting of the dependency graph
6566
# (dependent module first).
67+
if(SECP256K1_ENABLE_MODULE_SILENTPAYMENTS)
68+
add_compile_definitions(ENABLE_MODULE_SILENTPAYMENTS=1)
69+
endif()
70+
6671
if(SECP256K1_ENABLE_MODULE_ELLSWIFT)
6772
add_compile_definitions(ENABLE_MODULE_ELLSWIFT=1)
6873
endif()
@@ -292,6 +297,7 @@ message(" ECDSA pubkey recovery ............... ${SECP256K1_ENABLE_MODULE_RECOV
292297
message(" extrakeys ........................... ${SECP256K1_ENABLE_MODULE_EXTRAKEYS}")
293298
message(" schnorrsig .......................... ${SECP256K1_ENABLE_MODULE_SCHNORRSIG}")
294299
message(" ElligatorSwift ...................... ${SECP256K1_ENABLE_MODULE_ELLSWIFT}")
300+
message(" Silent Payments ..................... ${SECP256K1_ENABLE_MODULE_SILENTPAYMENTS}")
295301
message("Parameters:")
296302
message(" ecmult window size .................. ${SECP256K1_ECMULT_WINDOW_SIZE}")
297303
message(" ecmult gen precision bits ........... ${SECP256K1_ECMULT_GEN_PREC_BITS}")

Makefile.am

+4
Original file line numberDiff line numberDiff line change
@@ -271,3 +271,7 @@ endif
271271
if ENABLE_MODULE_ELLSWIFT
272272
include src/modules/ellswift/Makefile.am.include
273273
endif
274+
275+
if ENABLE_MODULE_SILENTPAYMENTS
276+
include src/modules/silentpayments/Makefile.am.include
277+
endif

configure.ac

+10
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ AC_ARG_ENABLE(module_ellswift,
188188
AS_HELP_STRING([--enable-module-ellswift],[enable ElligatorSwift module [default=yes]]), [],
189189
[SECP_SET_DEFAULT([enable_module_ellswift], [yes], [yes])])
190190

191+
AC_ARG_ENABLE(module_silentpayments,
192+
AS_HELP_STRING([--enable-module-silentpayments],[enable Silent Payments module [default=no]]), [],
193+
[SECP_SET_DEFAULT([enable_module_silentpayments], [no], [yes])])
194+
191195
AC_ARG_ENABLE(external_default_callbacks,
192196
AS_HELP_STRING([--enable-external-default-callbacks],[enable external default callback functions [default=no]]), [],
193197
[SECP_SET_DEFAULT([enable_external_default_callbacks], [no], [no])])
@@ -389,6 +393,10 @@ SECP_CFLAGS="$SECP_CFLAGS $WERROR_CFLAGS"
389393

390394
# Processing must be done in a reverse topological sorting of the dependency graph
391395
# (dependent module first).
396+
if test x"$enable_module_silentpayments" = x"yes"; then
397+
SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_SILENTPAYMENTS=1"
398+
fi
399+
392400
if test x"$enable_module_ellswift" = x"yes"; then
393401
SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_ELLSWIFT=1"
394402
fi
@@ -450,6 +458,7 @@ AM_CONDITIONAL([ENABLE_MODULE_RECOVERY], [test x"$enable_module_recovery" = x"ye
450458
AM_CONDITIONAL([ENABLE_MODULE_EXTRAKEYS], [test x"$enable_module_extrakeys" = x"yes"])
451459
AM_CONDITIONAL([ENABLE_MODULE_SCHNORRSIG], [test x"$enable_module_schnorrsig" = x"yes"])
452460
AM_CONDITIONAL([ENABLE_MODULE_ELLSWIFT], [test x"$enable_module_ellswift" = x"yes"])
461+
AM_CONDITIONAL([ENABLE_MODULE_SILENTPAYMENTS], [test x"$enable_module_silentpayments" = x"yes"])
453462
AM_CONDITIONAL([USE_EXTERNAL_ASM], [test x"$enable_external_asm" = x"yes"])
454463
AM_CONDITIONAL([USE_ASM_ARM], [test x"$set_asm" = x"arm32"])
455464
AM_CONDITIONAL([BUILD_WINDOWS], [test "$build_windows" = "yes"])
@@ -472,6 +481,7 @@ echo " module recovery = $enable_module_recovery"
472481
echo " module extrakeys = $enable_module_extrakeys"
473482
echo " module schnorrsig = $enable_module_schnorrsig"
474483
echo " module ellswift = $enable_module_ellswift"
484+
echo " module silentpayments = $enable_module_silentpayments"
475485
echo
476486
echo " asm = $set_asm"
477487
echo " ecmult window size = $set_ecmult_window"

include/secp256k1_silentpayments.h

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#ifndef SECP256K1_SILENTPAYMENTS_H
2+
#define SECP256K1_SILENTPAYMENTS_H
3+
4+
#include "secp256k1.h"
5+
6+
#ifdef __cplusplus
7+
extern "C" {
8+
#endif
9+
10+
/* TODO: add module description */
11+
12+
/* TODO: add function API for sender side. */
13+
14+
/* TODO: add function API for receiver side. */
15+
16+
#ifdef __cplusplus
17+
}
18+
#endif
19+
20+
#endif /* SECP256K1_SILENTPAYMENTS_H */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include_HEADERS += include/secp256k1_silentpayments.h
2+
noinst_HEADERS += src/modules/silentpayments/main_impl.h
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/***********************************************************************
2+
* Distributed under the MIT software license, see the accompanying *
3+
* file COPYING or https://www.opensource.org/licenses/mit-license.php.*
4+
***********************************************************************/
5+
6+
#ifndef SECP256K1_MODULE_SILENTPAYMENTS_MAIN_H
7+
#define SECP256K1_MODULE_SILENTPAYMENTS_MAIN_H
8+
9+
#include "../../../include/secp256k1.h"
10+
#include "../../../include/secp256k1_silentpayments.h"
11+
12+
/* TODO: implement functions for sender side. */
13+
14+
/* TODO: implement functions for receiver side. */
15+
16+
#endif

src/secp256k1.c

+4
Original file line numberDiff line numberDiff line change
@@ -804,3 +804,7 @@ int secp256k1_tagged_sha256(const secp256k1_context* ctx, unsigned char *hash32,
804804
#ifdef ENABLE_MODULE_ELLSWIFT
805805
# include "modules/ellswift/main_impl.h"
806806
#endif
807+
808+
#ifdef ENABLE_MODULE_SILENTPAYMENTS
809+
# include "modules/silentpayments/main_impl.h"
810+
#endif

0 commit comments

Comments
 (0)