Port examples/iceberg.c from the source tree: a full Iceberg session demonstrating the call order from the module docs -- distributed key generation, pubshare_gen/pubkey_agg to obtain the group public key, nonce_gen/nonce_agg into an ordinary MuSig2 public nonce, and partial_sign/partial_sig_agg into an ordinary MuSig2 partial signature. One content adaptation: the secp256k1_musig_nonce_process call gains a NULL adaptor argument, matching this repo's zkp musig variant. Wired like the chilldkg example: autotools noinst_PROGRAMS + TESTS entry under ENABLE_MODULE_ICEBERG (the example runs as part of make check), CMake example target in examples/CMakeLists.txt, and iceberg_example added to .gitignore. Verified: ./iceberg_example runs to completion (exit 0) under both build systems.
46 lines
951 B
CMake
46 lines
951 B
CMake
function(add_example name)
|
|
set(target_name ${name}_example)
|
|
add_executable(${target_name} ${name}.c)
|
|
target_include_directories(${target_name} PRIVATE
|
|
${PROJECT_SOURCE_DIR}/include
|
|
)
|
|
target_link_libraries(${target_name}
|
|
secp256k1
|
|
$<$<PLATFORM_ID:Windows>:bcrypt>
|
|
)
|
|
add_test(NAME secp256k1.example.${name} COMMAND ${target_name})
|
|
set_tests_properties(secp256k1.example.${name} PROPERTIES
|
|
LABELS secp256k1_example
|
|
)
|
|
endfunction()
|
|
|
|
add_example(ecdsa)
|
|
|
|
if(SECP256K1_ENABLE_MODULE_ECDH)
|
|
add_example(ecdh)
|
|
endif()
|
|
|
|
if(SECP256K1_ENABLE_MODULE_SCHNORRSIG)
|
|
add_example(schnorr)
|
|
endif()
|
|
|
|
if(SECP256K1_ENABLE_MODULE_ELLSWIFT)
|
|
add_example(ellswift)
|
|
endif()
|
|
|
|
if(SECP256K1_ENABLE_MODULE_MUSIG)
|
|
add_example(musig)
|
|
endif()
|
|
|
|
if(SECP256K1_ENABLE_MODULE_FROST)
|
|
add_example(frost)
|
|
endif()
|
|
|
|
if(SECP256K1_ENABLE_MODULE_CHILLDKG)
|
|
add_example(chilldkg)
|
|
endif()
|
|
|
|
if(SECP256K1_ENABLE_MODULE_ICEBERG)
|
|
add_example(iceberg)
|
|
endif()
|