diff --git a/CMakeLists.txt b/CMakeLists.txt index d5a7a2de39..324181f7a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -138,13 +138,22 @@ elseif(SECP256K1_ASM) endif() endif() -option(SECP256K1_EXPERIMENTAL "Allow experimental configuration options." OFF) +option(SECP256K1_EXPERIMENTAL "Allow experimental configuration options." ON) if(NOT SECP256K1_EXPERIMENTAL) if(SECP256K1_ASM STREQUAL "arm32") message(FATAL_ERROR "ARM32 assembly is experimental. Use -DSECP256K1_EXPERIMENTAL=ON to allow.") endif() endif() +option(SECP256K1_ENABLE_MODULE_BATCH "Enable batch verification module." ON) +if(SECP256K1_ENABLE_MODULE_BATCH) + if(DEFINED SECP256K1_EXPERIMENTAL AND NOT SECP256K1_EXPERIMENTAL) + message(FATAL_ERROR "Batch verification module is experimental") + endif() + set(SECP256K1_ENABLE_MODULE_BATCH ON) + add_compile_definitions(ENABLE_MODULE_BATCH=1) +endif() + set(SECP256K1_VALGRIND "AUTO" CACHE STRING "Build with extra checks for running inside Valgrind. [default=AUTO]") set_property(CACHE SECP256K1_VALGRIND PROPERTY STRINGS "AUTO" "OFF" "ON") check_string_option_value(SECP256K1_VALGRIND) @@ -306,6 +315,7 @@ message(" ECDSA pubkey recovery ............... ${SECP256K1_ENABLE_MODULE_RECOV message(" extrakeys ........................... ${SECP256K1_ENABLE_MODULE_EXTRAKEYS}") message(" schnorrsig .......................... ${SECP256K1_ENABLE_MODULE_SCHNORRSIG}") message(" ElligatorSwift ...................... ${SECP256K1_ENABLE_MODULE_ELLSWIFT}") +message(" Batch ............................... ${SECP256K1_ENABLE_MODULE_BATCH}") message("Parameters:") message(" ecmult window size .................. ${SECP256K1_ECMULT_WINDOW_SIZE}") message(" ecmult gen table size ............... ${SECP256K1_ECMULT_GEN_KB} KiB") diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index fd1ebce395..4f74f9bf68 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -32,3 +32,7 @@ endif() if(SECP256K1_ENABLE_MODULE_ELLSWIFT) add_example(ellswift) endif() + +if(SECP256K1_ENABLE_MODULE_BATCH) + add_example(batch) +endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4cbaeb914d..73a9816acd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -135,6 +135,9 @@ if(SECP256K1_INSTALL) if(SECP256K1_ENABLE_MODULE_ELLSWIFT) list(APPEND ${PROJECT_NAME}_headers "${PROJECT_SOURCE_DIR}/include/secp256k1_ellswift.h") endif() + if(SECP256K1_ENABLE_MODULE_BATCH) + list(APPEND ${PROJECT_NAME}_headers "${PROJECT_SOURCE_DIR}/include/secp256k1_batch.h" "${PROJECT_SOURCE_DIR}/include/secp256k1_schnorrsig_batch.h" "${PROJECT_SOURCE_DIR}/include/secp256k1_tweak_check_batch.h") + endif() install(FILES ${${PROJECT_NAME}_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) diff --git a/src/modules/batch/main_impl.h b/src/modules/batch/main_impl.h index 81badd5b3b..ef3f5d1195 100644 --- a/src/modules/batch/main_impl.h +++ b/src/modules/batch/main_impl.h @@ -1,7 +1,7 @@ #ifndef SECP256K1_MODULE_BATCH_MAIN_H #define SECP256K1_MODULE_BATCH_MAIN_H -#include "include/secp256k1_batch.h" +#include "../../../include/secp256k1_batch.h" /* Maximum number of scalar-point pairs on the batch * for which `secp256k1_batch_verify` remains efficient */ diff --git a/src/modules/extrakeys/batch_add_impl.h b/src/modules/extrakeys/batch_add_impl.h index 3074214585..f8faf31d7c 100644 --- a/src/modules/extrakeys/batch_add_impl.h +++ b/src/modules/extrakeys/batch_add_impl.h @@ -1,9 +1,9 @@ #ifndef SECP256K1_MODULE_EXTRAKEYS_BATCH_ADD_IMPL_H #define SECP256K1_MODULE_EXTRAKEYS_BATCH_ADD_IMPL_H -#include "include/secp256k1_extrakeys.h" -#include "include/secp256k1_tweak_check_batch.h" -#include "src/modules/batch/main_impl.h" +#include "../../../include/secp256k1_extrakeys.h" +#include "../../../include/secp256k1_tweak_check_batch.h" +#include "../batch/main_impl.h" /* The number of scalar-point pairs allocated on the scratch space * by `secp256k1_batch_add_xonlypub_tweak_check` */ diff --git a/src/modules/schnorrsig/batch_add_impl.h b/src/modules/schnorrsig/batch_add_impl.h index d43e6a34db..7c3da4a29d 100644 --- a/src/modules/schnorrsig/batch_add_impl.h +++ b/src/modules/schnorrsig/batch_add_impl.h @@ -1,9 +1,9 @@ #ifndef SECP256K1_MODULE_SCHNORRSIG_BATCH_ADD_IMPL_H #define SECP256K1_MODULE_SCHNORRSIG_BATCH_ADD_IMPL_H -#include "include/secp256k1_schnorrsig.h" -#include "include/secp256k1_schnorrsig_batch.h" -#include "src/modules/batch/main_impl.h" +#include "../../../include/secp256k1_schnorrsig.h" +#include "../../../include/secp256k1_schnorrsig_batch.h" +#include "../batch/main_impl.h" /* The number of scalar-point pairs allocated on the scratch space * by `secp256k1_batch_add_schnorrsig` */