Page MenuHomePhabricator

[secp256k1] add usage examples
ClosedPublic

Authored by PiRK on Mon, Feb 9, 15:49.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC05a9cea4d28e: [secp256k1] add usage examples
Summary

Add an ECDSA signing and verifying example
Add a Schnorr signing and verifying example
Add a ecdh shared secret example

Co-authored-by: Jonas Nick <jonasd.nick@gmail.com>

Optionally compile the examples in autotools and cmake, compile+run on Github Actions

CMake code inspired by https://github.com/bitcoin-core/secp256k1/blob/master/examples/CMakeLists.txt (without the ctest / add_test wrappers)

Add usage examples to the readme

Add a copy of the CC0 license to the examples

This is a backport of secp256k1#748

with minor changes from secp256k1#1079 (backported earlier in D19499)

Test Plan
cmake .. -GNinja  -DSECP256K1_ENABLE_MODULE_SCHNORRSIG=ON -DSECP256K1_ENABLE_MODULE_ECDH=ON -DSECP256K1_ENABLE_MODULE_EXTRAKEYS=On
ninja secp256k1-examples

Push to github for CI actions

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Mon, Feb 9, 15:49
PiRK planned changes to this revision.Mon, Feb 9, 15:50

I missed a conflict

PiRK edited the summary of this revision. (Show Details)

fix conflicts (see D19499)

Fabien requested changes to this revision.Mon, Feb 9, 20:47
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/secp256k1/README.md
93 ↗(On Diff #58238)

Please mention the ninja target

96 ↗(On Diff #58238)

Schnorrsig (taproot)

src/secp256k1/examples/CMakeLists.txt
8 ↗(On Diff #58238)

file paths can have spaces

12 ↗(On Diff #58238)

Macro likestamp:

src/secp256k1/examples/random.h
66 ↗(On Diff #58238)

the location of this function is indeed random

This revision now requires changes to proceed.Mon, Feb 9, 20:47
This revision is now accepted and ready to land.Tue, Feb 10, 10:42
This revision was automatically updated to reflect the committed changes.