Skip to content

Commit b8e5e5f

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

File tree

7 files changed

+62
-0
lines changed

7 files changed

+62
-0
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ if(SECP256K1_ENABLE_MODULE_ELLSWIFT)
7676
add_compile_definitions(ENABLE_MODULE_ELLSWIFT=1)
7777
endif()
7878

79+
option(SECP256K1_ENABLE_MODULE_SILENTPAYMENTS "Enable Silent Payments module." OFF)
80+
if(SECP256K1_ENABLE_MODULE_SILENTPAYMENTS)
81+
add_compile_definitions(ENABLE_MODULE_SILENTPAYMENTS=1)
82+
endif()
83+
7984
option(SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS "Enable external default callback functions." OFF)
8085
if(SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS)
8186
add_compile_definitions(USE_EXTERNAL_DEFAULT_CALLBACKS=1)
@@ -276,6 +281,7 @@ message(" ECDSA pubkey recovery ............... ${SECP256K1_ENABLE_MODULE_RECOV
276281
message(" extrakeys ........................... ${SECP256K1_ENABLE_MODULE_EXTRAKEYS}")
277282
message(" schnorrsig .......................... ${SECP256K1_ENABLE_MODULE_SCHNORRSIG}")
278283
message(" ElligatorSwift ...................... ${SECP256K1_ENABLE_MODULE_ELLSWIFT}")
284+
message(" Silent Payments ..................... ${SECP256K1_ENABLE_MODULE_SILENTPAYMENTS}")
279285
message("Parameters:")
280286
message(" ecmult window size .................. ${SECP256K1_ECMULT_WINDOW_SIZE}")
281287
message(" ecmult gen precision bits ........... ${SECP256K1_ECMULT_GEN_PREC_BITS}")

Makefile.am

Lines changed: 4 additions & 0 deletions
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

Lines changed: 10 additions & 0 deletions
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])])
@@ -404,6 +408,10 @@ if test x"$enable_module_ellswift" = x"yes"; then
404408
SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_ELLSWIFT=1"
405409
fi
406410

411+
if test x"$enable_module_silentpayments" = x"yes"; then
412+
SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_SILENTPAYMENTS=1"
413+
fi
414+
407415
# Test if extrakeys is set after the schnorrsig module to allow the schnorrsig
408416
# module to set enable_module_extrakeys=yes
409417
if test x"$enable_module_extrakeys" = x"yes"; then
@@ -447,6 +455,7 @@ AM_CONDITIONAL([ENABLE_MODULE_RECOVERY], [test x"$enable_module_recovery" = x"ye
447455
AM_CONDITIONAL([ENABLE_MODULE_EXTRAKEYS], [test x"$enable_module_extrakeys" = x"yes"])
448456
AM_CONDITIONAL([ENABLE_MODULE_SCHNORRSIG], [test x"$enable_module_schnorrsig" = x"yes"])
449457
AM_CONDITIONAL([ENABLE_MODULE_ELLSWIFT], [test x"$enable_module_ellswift" = x"yes"])
458+
AM_CONDITIONAL([ENABLE_MODULE_SILENTPAYMENTS], [test x"$enable_module_silentpayments" = x"yes"])
450459
AM_CONDITIONAL([USE_EXTERNAL_ASM], [test x"$enable_external_asm" = x"yes"])
451460
AM_CONDITIONAL([USE_ASM_ARM], [test x"$set_asm" = x"arm32"])
452461
AM_CONDITIONAL([BUILD_WINDOWS], [test "$build_windows" = "yes"])
@@ -469,6 +478,7 @@ echo " module recovery = $enable_module_recovery"
469478
echo " module extrakeys = $enable_module_extrakeys"
470479
echo " module schnorrsig = $enable_module_schnorrsig"
471480
echo " module ellswift = $enable_module_ellswift"
481+
echo " module silentpayments = $enable_module_silentpayments"
472482
echo
473483
echo " asm = $set_asm"
474484
echo " ecmult window size = $set_ecmult_window"

include/secp256k1_silentpayments.h

Lines changed: 20 additions & 0 deletions
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 */
Lines changed: 2 additions & 0 deletions
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
Lines changed: 16 additions & 0 deletions
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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,3 +815,7 @@ int secp256k1_tagged_sha256(const secp256k1_context* ctx, unsigned char *hash32,
815815
#ifdef ENABLE_MODULE_ELLSWIFT
816816
# include "modules/ellswift/main_impl.h"
817817
#endif
818+
819+
#ifdef ENABLE_MODULE_SILENTPAYMENTS
820+
# include "modules/silentpayments/main_impl.h"
821+
#endif

0 commit comments

Comments
 (0)