build: add skeleton for new silentpayments (BIP352) module
What changed, and why it matters
This commit is purely a build-system and header-file skeleton for a new Silent Payments (BIP352) module. It adds configuration options, dependency checks, and empty placeholder files, but contains no actual cryptographic code or implementation. There is nothing here that could introduce a security vulnerability.
No security action needed. Treat as normal feature scaffolding. Review the actual implementation when the TODO functions are later added.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit adds CMake/autotools plumbing for a new optional module named silentpayments. It creates include/secp256k1_silentpayments.h with only documentation comments, src/modules/silentpayments/main_impl.h with TODO comments and no functions, and wires the module into the build with a dependency on the extrakeys module. No executable code, no algorithmic changes, and no security-relevant logic are present.
Changed components
CMakeLists.txtMakefile.amconfigure.acsrc/CMakeLists.txtinclude/secp256k1_silentpayments.hsrc/modules/silentpayments/main_impl.hsrc/modules/silentpayments/Makefile.am.includesrc/secp256k1.cInspect captured patch +83 / −0
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a84305c..09ab67d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,6 +52,7 @@ option(SECP256K1_ENABLE_MODULE_EXTRAKEYS "Enable extrakeys module." ON)
option(SECP256K1_ENABLE_MODULE_SCHNORRSIG "Enable schnorrsig module." ON)
option(SECP256K1_ENABLE_MODULE_MUSIG "Enable musig module." ON)
option(SECP256K1_ENABLE_MODULE_ELLSWIFT "Enable ElligatorSwift module." ON)
+option(SECP256K1_ENABLE_MODULE_SILENTPAYMENTS "Enable Silent Payments module." ON)
option(SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS "Enable external default callback functions." OFF)
if(SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS)
@@ -289,6 +290,7 @@ message(" extrakeys ........................... ${SECP256K1_ENABLE_MODULE_EXTRA
message(" schnorrsig .......................... ${SECP256K1_ENABLE_MODULE_SCHNORRSIG}")
message(" musig ............................... ${SECP256K1_ENABLE_MODULE_MUSIG}")
message(" ElligatorSwift ...................... ${SECP256K1_ENABLE_MODULE_ELLSWIFT}")
+message(" Silent Payments ..................... ${SECP256K1_ENABLE_MODULE_SILENTPAYMENTS}")
message("Parameters:")
message(" ecmult window size .................. ${SECP256K1_ECMULT_WINDOW_SIZE}")
message(" ecmult gen table size ............... ${SECP256K1_ECMULT_GEN_KB} KiB")
diff --git a/Makefile.am b/Makefile.am
index 07d7a2b..5aa16da 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -314,3 +314,7 @@ endif
if ENABLE_MODULE_ELLSWIFT
include src/modules/ellswift/Makefile.am.include
endif
+
+if ENABLE_MODULE_SILENTPAYMENTS
+include src/modules/silentpayments/Makefile.am.include
+endif
diff --git a/configure.ac b/configure.ac
index a21447c..258437f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -193,6 +193,10 @@ AC_ARG_ENABLE(module_ellswift,
AS_HELP_STRING([--enable-module-ellswift],[enable ElligatorSwift module [default=yes]]), [],
[SECP_SET_DEFAULT([enable_module_ellswift], [yes], [yes])])
+AC_ARG_ENABLE(module_silentpayments,
+ AS_HELP_STRING([--enable-module-silentpayments],[enable Silent Payments module [default=yes]]), [],
+ [SECP_SET_DEFAULT([enable_module_silentpayments], [yes], [yes])])
+
AC_ARG_ENABLE(external_default_callbacks,
AS_HELP_STRING([--enable-external-default-callbacks],[enable external default callback functions [default=no]]), [],
[SECP_SET_DEFAULT([enable_external_default_callbacks], [no], [no])])
@@ -399,6 +403,14 @@ SECP_CFLAGS="$SECP_CFLAGS $WERROR_CFLAGS"
# Processing must be done in a reverse topological sorting of the dependency graph
# (dependent module first).
+if test x"$enable_module_silentpayments" = x"yes"; then
+ if test x"$enable_module_extrakeys" = x"no"; then
+ AC_MSG_ERROR([Module dependency error: You have disabled the extrakeys module explicitly, but it is required by the silentpayments module.])
+ fi
+ enable_module_extrakeys=yes
+ SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_SILENTPAYMENTS=1"
+fi
+
if test x"$enable_module_ellswift" = x"yes"; then
SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_ELLSWIFT=1"
fi
@@ -472,6 +484,7 @@ AM_CONDITIONAL([ENABLE_MODULE_EXTRAKEYS], [test x"$enable_module_extrakeys" = x"
AM_CONDITIONAL([ENABLE_MODULE_SCHNORRSIG], [test x"$enable_module_schnorrsig" = x"yes"])
AM_CONDITIONAL([ENABLE_MODULE_MUSIG], [test x"$enable_module_musig" = x"yes"])
AM_CONDITIONAL([ENABLE_MODULE_ELLSWIFT], [test x"$enable_module_ellswift" = x"yes"])
+AM_CONDITIONAL([ENABLE_MODULE_SILENTPAYMENTS], [test x"$enable_module_silentpayments" = x"yes"])
AM_CONDITIONAL([USE_EXTERNAL_ASM], [test x"$enable_external_asm" = x"yes"])
AM_CONDITIONAL([USE_ASM_ARM], [test x"$set_asm" = x"arm32"])
AM_CONDITIONAL([BUILD_WINDOWS], [test "$build_windows" = "yes"])
@@ -496,6 +509,7 @@ echo " module extrakeys = $enable_module_extrakeys"
echo " module schnorrsig = $enable_module_schnorrsig"
echo " module musig = $enable_module_musig"
echo " module ellswift = $enable_module_ellswift"
+echo " module silentpayments = $enable_module_silentpayments"
echo
echo " asm = $set_asm"
echo " ecmult window size = $set_ecmult_window"
diff --git a/include/secp256k1_silentpayments.h b/include/secp256k1_silentpayments.h
new file mode 100644
index 0000000..edc4609
--- /dev/null
+++ b/include/secp256k1_silentpayments.h
@@ -0,0 +1,32 @@
+#ifndef SECP256K1_SILENTPAYMENTS_H
+#define SECP256K1_SILENTPAYMENTS_H
+
+#include "secp256k1.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** This module provides an implementation for Silent Payments, as specified in
+ * BIP352. This particularly involves the creation of input tweak data by
+ * summing up secret or public keys and the derivation of a shared secret using
+ * Elliptic Curve Diffie-Hellman. Combined are either:
+ * - spender's secret keys and recipient's public key (a * B, sender side)
+ * - spender's public keys and recipient's secret key (A * b, recipient side)
+ * With this result, the necessary key material for ultimately creating/scanning
+ * or spending Silent Payments outputs can be determined.
+ *
+ * Note that this module is _not_ a full implementation of BIP352, as it
+ * inherently doesn't deal with higher-level concepts like addresses, output
+ * script types or transactions. The intent is to provide a module for
+ * abstracting away the elliptic-curve operations required for the protocol. For
+ * any wallet software already using libsecp256k1, this API should provide all
+ * the functions needed for a Silent Payments implementation without requiring
+ * any further elliptic-curve operations from the wallet.
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SECP256K1_SILENTPAYMENTS_H */
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a45eeb9..911804f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -21,6 +21,15 @@ if(SECP256K1_ENABLE_MODULE_MUSIG)
set_property(TARGET secp256k1 APPEND PROPERTY PUBLIC_HEADER ${PROJECT_SOURCE_DIR}/include/secp256k1_musig.h)
endif()
+if(SECP256K1_ENABLE_MODULE_SILENTPAYMENTS)
+ if(DEFINED SECP256K1_ENABLE_MODULE_EXTRAKEYS AND NOT SECP256K1_ENABLE_MODULE_EXTRAKEYS)
+ message(FATAL_ERROR "Module dependency error: You have disabled the extrakeys module explicitly, but it is required by the silent payments module.")
+ endif()
+ set(SECP256K1_ENABLE_MODULE_EXTRAKEYS ON)
+ add_compile_definitions(ENABLE_MODULE_SILENTPAYMENTS=1)
+ set_property(TARGET secp256k1 APPEND PROPERTY PUBLIC_HEADER ${PROJECT_SOURCE_DIR}/include/secp256k1_silentpayments.h)
+endif()
+
if(SECP256K1_ENABLE_MODULE_SCHNORRSIG)
if(DEFINED SECP256K1_ENABLE_MODULE_EXTRAKEYS AND NOT SECP256K1_ENABLE_MODULE_EXTRAKEYS)
message(FATAL_ERROR "Module dependency error: You have disabled the extrakeys module explicitly, but it is required by the schnorrsig module.")
diff --git a/src/modules/silentpayments/Makefile.am.include b/src/modules/silentpayments/Makefile.am.include
new file mode 100644
index 0000000..842a33e
--- /dev/null
+++ b/src/modules/silentpayments/Makefile.am.include
@@ -0,0 +1,2 @@
+include_HEADERS += include/secp256k1_silentpayments.h
+noinst_HEADERS += src/modules/silentpayments/main_impl.h
diff --git a/src/modules/silentpayments/main_impl.h b/src/modules/silentpayments/main_impl.h
new file mode 100644
index 0000000..f8ccdd7
--- /dev/null
+++ b/src/modules/silentpayments/main_impl.h
@@ -0,0 +1,16 @@
+/***********************************************************************
+ * Distributed under the MIT software license, see the accompanying *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_MODULE_SILENTPAYMENTS_MAIN_H
+#define SECP256K1_MODULE_SILENTPAYMENTS_MAIN_H
+
+#include "../../../include/secp256k1.h"
+#include "../../../include/secp256k1_silentpayments.h"
+
+/* TODO: implement functions for sender side. */
+
+/* TODO: implement functions for receiver side. */
+
+#endif
diff --git a/src/secp256k1.c b/src/secp256k1.c
index b216872..2668eee 100644
--- a/src/secp256k1.c
+++ b/src/secp256k1.c
@@ -849,3 +849,7 @@ int secp256k1_tagged_sha256(const secp256k1_context* ctx, unsigned char *hash32,
#ifdef ENABLE_MODULE_ELLSWIFT
# include "modules/ellswift/main_impl.h"
#endif
+
+#ifdef ENABLE_MODULE_SILENTPAYMENTS
+# include "modules/silentpayments/main_impl.h"
+#endif
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.