diff --git a/Makefile.am b/Makefile.am index 329f86ca..ce92c94f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -320,3 +320,7 @@ endif if ENABLE_MODULE_ECDSA_ADAPTOR include src/modules/ecdsa_adaptor/Makefile.am.include endif + +if ENABLE_MODULE_FROST +include src/modules/frost/Makefile.am.include +endif diff --git a/README.md b/README.md index 88bdb2ba..76bc0e10 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Added features: * Experimental module for Confidential Assets (Pedersen commitments, range proofs, and [surjection proofs](src/modules/surjection/surjection.md)). * Experimental module for Bulletproofs++ range proofs. * Experimental module for [address whitelisting](src/modules/whitelist/whitelist.md). +* Experimental module for FROST. Experimental features are made available for testing and review by the community. The APIs of these features should not be considered stable. diff --git a/configure.ac b/configure.ac index 4d2a6e67..dd9f514d 100644 --- a/configure.ac +++ b/configure.ac @@ -236,6 +236,11 @@ AC_ARG_ENABLE(module_ecdsa-adaptor, [], [SECP_SET_DEFAULT([enable_module_ecdsa_adaptor], [no], [yes])]) +AC_ARG_ENABLE(module_frost, + AS_HELP_STRING([--enable-module-frost],[enable FROST module [default=no]]), + [], + [SECP_SET_DEFAULT([enable_module_frost], [no], [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])]) @@ -470,6 +475,14 @@ if test x"$enable_module_ecdsa_adaptor" = x"yes"; then SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_ECDSA_ADAPTOR=1" fi +if test x"$enable_module_frost" = x"yes"; then + if test x"$enable_module_schnorrsig" = x"no"; then + AC_MSG_ERROR([Module dependency error: You have disabled the schnorrsig module explicitly, but it is required by the musig module.]) + fi + SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_FROST=1" + enable_module_schnorrsig=yes +fi + if test x"$enable_module_musig" = x"yes"; then if test x"$enable_module_schnorrsig" = x"no"; then AC_MSG_ERROR([Module dependency error: You have disabled the schnorrsig module explicitly, but it is required by the musig module.]) @@ -579,6 +592,9 @@ else if test x"$enable_module_generator" = x"yes"; then AC_MSG_ERROR([NUMS generator module is experimental. Use --enable-experimental to allow.]) fi + if test x"$enable_module_frost" = x"yes"; then + AC_MSG_ERROR([FROST module is experimental. Use --enable-experimental to allow.]) + fi if test x"$set_asm" = x"arm32"; then AC_MSG_ERROR([ARM32 assembly is experimental. Use --enable-experimental to allow.]) fi @@ -611,6 +627,7 @@ AM_CONDITIONAL([ENABLE_MODULE_ECDSA_S2C], [test x"$enable_module_ecdsa_s2c" = x" AM_CONDITIONAL([ENABLE_MODULE_ECDSA_ADAPTOR], [test x"$enable_module_ecdsa_adaptor" = x"yes"]) AM_CONDITIONAL([ENABLE_MODULE_BPPP], [test x"$enable_module_bppp" = x"yes"]) AM_CONDITIONAL([ENABLE_MODULE_SCHNORRSIG_HALFAGG], [test x"$enable_module_schnorrsig_halfagg" = x"yes"]) +AM_CONDITIONAL([ENABLE_MODULE_FROST], [test x"$enable_module_frost" = x"yes"]) AM_CONDITIONAL([USE_REDUCED_SURJECTION_PROOF_SIZE], [test x"$use_reduced_surjection_proof_size" = 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"]) @@ -649,6 +666,7 @@ echo " module whitelist = $enable_module_whitelist" echo " module musig = $enable_module_musig" echo " module ecdsa-s2c = $enable_module_ecdsa_s2c" echo " module ecdsa-adaptor = $enable_module_ecdsa_adaptor" +echo " module frost = $enable_module_frost" echo " module bppp = $enable_module_bppp" echo " module schnorrsig-halfagg = $enable_module_schnorrsig_halfagg" echo diff --git a/include/secp256k1_frost.h b/include/secp256k1_frost.h new file mode 100644 index 00000000..753eda0d --- /dev/null +++ b/include/secp256k1_frost.h @@ -0,0 +1,24 @@ +#ifndef SECP256K1_FROST_H +#define SECP256K1_FROST_H + +#include "secp256k1_extrakeys.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/** This code is currently a work in progress. It's not secure nor stable. IT + * IS EXTREMELY DANGEROUS AND RECKLESS TO USE THIS MODULE IN PRODUCTION! + + * This module implements a variant of Flexible Round-Optimized Schnorr + * Threshold Signatures (FROST) by Chelsea Komlo and Ian Goldberg + * (https://crysp.uwaterloo.ca/software/frost/). + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/modules/frost/Makefile.am.include b/src/modules/frost/Makefile.am.include new file mode 100644 index 00000000..5541884b --- /dev/null +++ b/src/modules/frost/Makefile.am.include @@ -0,0 +1,2 @@ +include_HEADERS += include/secp256k1_frost.h +noinst_HEADERS += src/modules/frost/main_impl.h diff --git a/src/modules/frost/main_impl.h b/src/modules/frost/main_impl.h new file mode 100644 index 00000000..73772ddd --- /dev/null +++ b/src/modules/frost/main_impl.h @@ -0,0 +1,10 @@ +/********************************************************************** + * Copyright (c) 2021-2023 Jesse Posner * + * Distributed under the MIT software license, see the accompanying * + * file COPYING or http://www.opensource.org/licenses/mit-license.php.* + **********************************************************************/ + +#ifndef SECP256K1_MODULE_FROST_MAIN +#define SECP256K1_MODULE_FROST_MAIN + +#endif diff --git a/src/secp256k1.c b/src/secp256k1.c index 4c578269..4be2b1ca 100644 --- a/src/secp256k1.c +++ b/src/secp256k1.c @@ -889,6 +889,10 @@ static int secp256k1_ge_parse_ext(secp256k1_ge* ge, const unsigned char *in33) { # include "modules/ecdsa_adaptor/main_impl.h" #endif +#ifdef ENABLE_MODULE_FROST +# include "modules/frost/main_impl.h" +#endif + #ifdef ENABLE_MODULE_MUSIG # include "modules/musig/main_impl.h" #endif