Skip to content

Commit 7a703fd

Browse files
committed
schnorrsig: Init empty experimental module
1 parent eabd9bc commit 7a703fd

File tree

8 files changed

+88
-1
lines changed

8 files changed

+88
-1
lines changed

Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,7 @@ endif
157157
if ENABLE_MODULE_EXTRAKEYS
158158
include src/modules/extrakeys/Makefile.am.include
159159
endif
160+
161+
if ENABLE_MODULE_SCHNORRSIG
162+
include src/modules/schnorrsig/Makefile.am.include
163+
endif

configure.ac

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ AC_ARG_ENABLE(module_extrakeys,
141141
[enable_module_extrakeys=$enableval],
142142
[enable_module_extrakeys=no])
143143

144+
AC_ARG_ENABLE(module_schnorrsig,
145+
AS_HELP_STRING([--enable-module-schnorrsig],[enable schnorrsig module (experimental)]),
146+
[enable_module_schnorrsig=$enableval],
147+
[enable_module_schnorrsig=no])
148+
144149
AC_ARG_ENABLE(external_default_callbacks,
145150
AS_HELP_STRING([--enable-external-default-callbacks],[enable external default callback functions [default=no]]),
146151
[use_external_default_callbacks=$enableval],
@@ -426,6 +431,13 @@ if test x"$enable_module_recovery" = x"yes"; then
426431
AC_DEFINE(ENABLE_MODULE_RECOVERY, 1, [Define this symbol to enable the ECDSA pubkey recovery module])
427432
fi
428433

434+
if test x"$enable_module_schnorrsig" = x"yes"; then
435+
AC_DEFINE(ENABLE_MODULE_SCHNORRSIG, 1, [Define this symbol to enable the schnorrsig module])
436+
enable_module_extrakeys=yes
437+
fi
438+
439+
# Test if extrakeys is set after the schnorrsig module to allow the schnorrsig
440+
# module to set enable_module_extrakeys=yes
429441
if test x"$enable_module_extrakeys" = x"yes"; then
430442
AC_DEFINE(ENABLE_MODULE_EXTRAKEYS, 1, [Define this symbol to enable the extrakeys module])
431443
fi
@@ -444,6 +456,7 @@ if test x"$enable_experimental" = x"yes"; then
444456
AC_MSG_NOTICE([Experimental features do not have stable APIs or properties, and may not be safe for production use.])
445457
AC_MSG_NOTICE([Building ECDH module: $enable_module_ecdh])
446458
AC_MSG_NOTICE([Building extrakeys module: $enable_module_extrakeys])
459+
AC_MSG_NOTICE([Building schnorrsig module: $enable_module_schnorrsig])
447460
AC_MSG_NOTICE([******])
448461
else
449462
if test x"$enable_module_ecdh" = x"yes"; then
@@ -452,6 +465,9 @@ else
452465
if test x"$enable_module_extrakeys" = x"yes"; then
453466
AC_MSG_ERROR([extrakeys module is experimental. Use --enable-experimental to allow.])
454467
fi
468+
if test x"$enable_module_schnorrsig" = x"yes"; then
469+
AC_MSG_ERROR([schnorrsig module is experimental. Use --enable-experimental to allow.])
470+
fi
455471
if test x"$set_asm" = x"arm"; then
456472
AC_MSG_ERROR([ARM assembly optimization is experimental. Use --enable-experimental to allow.])
457473
fi
@@ -469,8 +485,9 @@ AM_CONDITIONAL([USE_EXHAUSTIVE_TESTS], [test x"$use_exhaustive_tests" != x"no"])
469485
AM_CONDITIONAL([USE_BENCHMARK], [test x"$use_benchmark" = x"yes"])
470486
AM_CONDITIONAL([USE_ECMULT_STATIC_PRECOMPUTATION], [test x"$set_precomp" = x"yes"])
471487
AM_CONDITIONAL([ENABLE_MODULE_ECDH], [test x"$enable_module_ecdh" = x"yes"])
472-
AM_CONDITIONAL([ENABLE_MODULE_EXTRAKEYS], [test x"$enable_module_extrakeys" = x"yes"])
473488
AM_CONDITIONAL([ENABLE_MODULE_RECOVERY], [test x"$enable_module_recovery" = x"yes"])
489+
AM_CONDITIONAL([ENABLE_MODULE_EXTRAKEYS], [test x"$enable_module_extrakeys" = x"yes"])
490+
AM_CONDITIONAL([ENABLE_MODULE_SCHNORRSIG], [test x"$enable_module_schnorrsig" = x"yes"])
474491
AM_CONDITIONAL([USE_EXTERNAL_ASM], [test x"$use_external_asm" = x"yes"])
475492
AM_CONDITIONAL([USE_ASM_ARM], [test x"$set_asm" = x"arm"])
476493

@@ -491,6 +508,7 @@ echo " with coverage = $enable_coverage"
491508
echo " module ecdh = $enable_module_ecdh"
492509
echo " module recovery = $enable_module_recovery"
493510
echo " module extrakeys = $enable_module_extrakeys"
511+
echo " module schnorrsig = $enable_module_schnorrsig"
494512
echo
495513
echo " asm = $set_asm"
496514
echo " bignum = $set_bignum"

include/secp256k1_schnorrsig.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifndef SECP256K1_SCHNORRSIG_H
2+
#define SECP256K1_SCHNORRSIG_H
3+
4+
#include "secp256k1.h"
5+
#include "secp256k1_extrakeys.h"
6+
7+
#ifdef __cplusplus
8+
extern "C" {
9+
#endif
10+
11+
/* TODO */
12+
13+
#ifdef __cplusplus
14+
}
15+
#endif
16+
17+
#endif /* SECP256K1_SCHNORRSIG_H */
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include_HEADERS += include/secp256k1_schnorrsig.h
2+
noinst_HEADERS += src/modules/schnorrsig/main_impl.h
3+
noinst_HEADERS += src/modules/schnorrsig/tests_impl.h

src/modules/schnorrsig/main_impl.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**********************************************************************
2+
* Copyright (c) 2018-2020 Andrew Poelstra, Jonas Nick *
3+
* Distributed under the MIT software license, see the accompanying *
4+
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
5+
**********************************************************************/
6+
7+
#ifndef _SECP256K1_MODULE_SCHNORRSIG_MAIN_
8+
#define _SECP256K1_MODULE_SCHNORRSIG_MAIN_
9+
10+
#include "include/secp256k1.h"
11+
#include "include/secp256k1_schnorrsig.h"
12+
#include "hash.h"
13+
14+
/* TODO */
15+
16+
#endif
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**********************************************************************
2+
* Copyright (c) 2018-2020 Andrew Poelstra, Jonas Nick *
3+
* Distributed under the MIT software license, see the accompanying *
4+
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
5+
**********************************************************************/
6+
7+
#ifndef _SECP256K1_MODULE_SCHNORRSIG_TESTS_
8+
9+
#define _SECP256K1_MODULE_SCHNORRSIG_TESTS_
10+
11+
#include "secp256k1_schnorrsig.h"
12+
13+
void run_schnorrsig_tests(void) {
14+
/* TODO */
15+
}
16+
17+
#endif

src/secp256k1.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,3 +761,7 @@ int secp256k1_ec_pubkey_combine(const secp256k1_context* ctx, secp256k1_pubkey *
761761
#ifdef ENABLE_MODULE_EXTRAKEYS
762762
# include "modules/extrakeys/main_impl.h"
763763
#endif
764+
765+
#ifdef ENABLE_MODULE_SCHNORRSIG
766+
# include "modules/schnorrsig/main_impl.h"
767+
#endif

src/tests.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5310,6 +5310,10 @@ void run_ecdsa_openssl(void) {
53105310
# include "modules/extrakeys/tests_impl.h"
53115311
#endif
53125312

5313+
#ifdef ENABLE_MODULE_SCHNORRSIG
5314+
# include "modules/schnorrsig/tests_impl.h"
5315+
#endif
5316+
53135317
void run_memczero_test(void) {
53145318
unsigned char buf1[6] = {1, 2, 3, 4, 5, 6};
53155319
unsigned char buf2[sizeof(buf1)];
@@ -5620,6 +5624,10 @@ int main(int argc, char **argv) {
56205624
run_extrakeys_tests();
56215625
#endif
56225626

5627+
#ifdef ENABLE_MODULE_SCHNORRSIG
5628+
run_schnorrsig_tests();
5629+
#endif
5630+
56235631
/* util tests */
56245632
run_memczero_test();
56255633

0 commit comments

Comments
 (0)