Jesse Posner
97c472da92
frost trusted dealer: add example file
...
This commit adds an example file to demonstrate how to use the module.
2024-07-16 09:46:36 -07:00
Jonas Nick
775f5e242b
Merge commits '1b13415d 374e2b54 96294c00 8d2960c8 ce765a5b b2f6712d eedd7810 b327abfc 5d8fa825 3d05c86d bcffeb14 de657c20 060e32cb 0ba2b945 48b1d939 6b9507ad 5373693e 2e6cf9ba 6ee14550 26a98992 4d7fe609 ea26b71c 65c79fe2 727bec5b 0b4640ae 199d27ce cbf3053f 49be5be9 b10ddd2b 4fd00f4b ba9cb6f3 ee7aaf21 ' into temp-merge-1395
...
- Replace fe_equal_var with fe_equal
- Use CHECK_ILLEGAL instead of CHECK/ecount
- Turn on secp256k1-zkp specific modules in CI
2023-09-20 09:38:36 +00:00
Jonas Nick
80187089ff
Merge commits '4494a369 3aef6ab8 0fa84f86 249c81ea 7966aee3 fb758fe8 3fc1de5c 0aacf643 9e6d1b0e 332af315 afd7eb4a c9ebca95 cc557575 0f7657d5 907a6721 b40e2d30 c545fdc3 2bd5f3e6 0e00fc7d c734c642 26392da2 ' into temp-merge-1386
2023-07-27 18:57:30 +00:00
Jonas Nick
7a07f3d33f
Merge commits '3bab71cf 4258c54f 566faa17 9ce9984f 04bf3f67 5be353d6 2e035af2 5b0444a3 a6f4bcf6 5ec1333d f6bef03c 1f33bb2b 1c895367 6b7e5b71 596b336f 4b84f4bf 024a4094 222ecaf6 4b0f711d 3c818388 f30c7486 1cf15ebd 24c768ae 341cc197 c63ec88e 54d34b6c 073d98a0 9eb6934f ab5a9171 fb3a8063 006ddc1f 3353d3c7 b54a0672 7d4f86d2 e8295d07 3e3d125b acf5c55a ' into temp-merge-1312
2023-07-24 20:15:07 +00:00
Jonas Nick
dc733595b0
Merge commits 'df323b5c 3295aa14 ef4f8bd0 90b513aa bdf39000 ' into temp-merge-1223
2023-07-21 13:34:46 +00:00
Jonas Nick
0d540ec942
Merge commits '88e80722 ff8edf89 f29a3270 a7a7bfaf a01a7d86 b1579cf5 ad7433b1 233822d8 5fbff5d3 2b77240b 1bff2005 e1817a6f 5596ec5c 8ebe5c52 1cca7c17 1b21aa51 cbd25559 09b1d466 57573187 8962fc95 9d1b458d eb8749fc 6048e6c0 ' into temp-merge-1222
2023-07-20 16:29:40 +00:00
Jonas Nick
6c54db1987
Merge commits '2286f809 751c4354 477f02c4 e3f84777 5c789dcd 8c949f56 21ffe4b2 ' into temp-merge-1055
2023-07-18 12:51:17 +00:00
Hennadii Stepanov
116d2ab3df
cmake: Set ENVIRONMENT
property for examples on Windows
...
This change simplifies running examples on Windows, because the DLL
must reside either in the same folder where the executable is or
somewhere in PATH.
2023-07-14 08:42:48 +01:00
Hennadii Stepanov
cef373997c
cmake, refactor: Use helper function instead of interface library
...
This change aims to simplify the following commit.
2023-07-14 08:41:26 +01:00
Tim Ruffing
9e6d1b0e9b
Merge bitcoin-core/secp256k1#1367 : build: Improvements to symbol visibility logic on Windows (attempt 3)
...
c6cd2b15a007ad0a2d5c4656ae641ba442d8b2fe ci: Add task for static library on Windows + CMake (Hennadii Stepanov)
020bf69a44ba700624d09de0c18ceb867369d24e build: Add extensive docs on visibility issues (Tim Ruffing)
0196e8ade16e2b2d8efadac01d8520205553ee39 build: Introduce `SECP256k1_DLL_EXPORT` macro (Hennadii Stepanov)
9f1b1904a358e4ce7248c6542e8c7ac143ba0e3f refactor: Replace `SECP256K1_API_VAR` with `SECP256K1_API` (Hennadii Stepanov)
ae9db95ceaa2605138fac9c237c640acea3f3bd6 build: Introduce `SECP256K1_STATIC` macro for Windows users (Hennadii Stepanov)
Pull request description:
Previous attempts:
- https://github.com/bitcoin-core/secp256k1/pull/1346
- https://github.com/bitcoin-core/secp256k1/pull/1362
The result is as follows:
1. Simple, concise and extensively documented code.
2. Explicitly documented use cases with no ambiguities.
3. No workarounds for linker warnings.
4. Solves one item in https://github.com/bitcoin-core/secp256k1/issues/1235 .
ACKs for top commit:
real-or-random:
utACK c6cd2b15a007ad0a2d5c4656ae641ba442d8b2fe
Tree-SHA512: d58694452d630aefbd047916033249891bc726b7475433aaaa7c3ea2a07ded8f185a598385b67c2ee3440ec5904ff9d9452c97b0961d84dcb2eb2cf46caa171e
2023-07-03 18:53:38 +02:00
Alejandro
b6b9834e8d
small fixes
...
restoring wycheproof files
restoring wycheproof files2
2023-07-03 17:05:55 +02:00
Hennadii Stepanov
ae9db95cea
build: Introduce SECP256K1_STATIC
macro for Windows users
...
It is a non-Libtool-specific way to explicitly specify the user's
intention to consume a static `libseck256k1`.
This change allows to get rid of MSVC linker warnings LNK4217 and
LNK4286. Also, it makes possible to merge the `SECP256K1_API` and
`SECP256K1_API_VAR` into one.
2023-07-03 13:57:11 +01:00
Hennadii Stepanov
755629bc03
cmake: Use full signature of add_test()
command
...
An executable target in the `COMMAND` option will automatically be
replaced by the location of the executable created at build time.
This change fixes tests for Windows binaries using Wine.
2023-04-29 09:49:25 +01:00
Tim Ruffing
6b7e5b717d
Merge bitcoin-core/secp256k1#1275 : build: Fix C4005 "macro redefinition" MSVC warnings in examples
...
dc0657c7622f5a13afc3876eca7e2fc7cabb9a10 build: Fix C4005 "macro redefinition" MSVC warnings in examples (Hennadii Stepanov)
Pull request description:
This PR:
- fixes C4005 "macro redefinition" MSVC warnings in examples
- removes warning suppressions in both build systems, Autotools-based and CMake-based ones
ACKs for top commit:
real-or-random:
utACK dc0657c7622f5a13afc3876eca7e2fc7cabb9a10
Tree-SHA512: fe3bb8f06b3ff1d51e5e20754a289e0e6b99ddf4c0bd4e6e4786e2558e71e043ab23ff7782a83a902df5db28d18ae65312674c373fdc49f5af252763a22bd0fb
2023-04-26 16:44:51 +01:00
Tim Ruffing
a6f4bcf6e1
Merge bitcoin-core/secp256k1#1231 : Move SECP256K1_INLINE
macro definition out from include/secp256k1.h
...
8e142ca4102ade1b90dcb06d6c78405ef3220599 Move `SECP256K1_INLINE` macro definition out from `include/secp256k1.h` (Hennadii Stepanov)
77445898a5852ecd38ab95cfb329333a82673115 Remove `SECP256K1_INLINE` usage from examples (Hennadii Stepanov)
Pull request description:
From [IRC](https://gnusha.org/secp256k1/2023-01-31.log ):
> 06:29 \< hebasto\> What are reasons to define the `SECP256K1_INLINE` macro in user's `include/secp256k1.h` header, while it is used internally only?
> 06:32 \< hebasto\> I mean, any other (or a new dedicated) header in `src` looks more appropriate, no?
> 06:35 \< sipa\> I think it may just predate any "utility" internal headers.
> 06:42 \< sipa\> I think it makes sense to move it to util.h
Pros:
- it is a step in direction to better organized headers (in context of #924 , #1039 )
Cons:
- code duplication for `SECP256K1_GNUC_PREREQ` macro
ACKs for top commit:
sipa:
utACK 8e142ca4102ade1b90dcb06d6c78405ef3220599
real-or-random:
utACK 8e142ca410
Tree-SHA512: 180e0ba7c2ef242b765f20698b67d06c492b7b70866c21db27c18d8b2e85c3e11f86c6cb99ffa88bbd23891ce3ee8a24bc528f2c91167ec2fddc167463f78eac
2023-04-20 18:18:11 +02:00
Cory Fields
ef49a11d29
build: allow static or shared but not both
2023-04-17 16:25:27 +00:00
Hennadii Stepanov
dc0657c762
build: Fix C4005 "macro redefinition" MSVC warnings in examples
2023-04-13 12:23:30 +01:00
Hennadii Stepanov
77445898a5
Remove SECP256K1_INLINE
usage from examples
2023-03-09 13:05:14 +00:00
Hennadii Stepanov
8be82d4362
cmake: Rename project to "libsecp256k1"
2023-03-08 21:22:24 +00:00
Pieter Wuille
df323b5c14
Merge bitcoin-core/secp256k1#1113 : build: Add CMake-based build system
...
e1eb33724c2ca47855a8c1dada421cabdb717fe7 ci: Add "x86_64: Windows (VS 2022)" task (Hennadii Stepanov)
10602b0030e67c830596e08ffc775039ee0b2607 cmake: Export config files (Hennadii Stepanov)
5468d709644823b6302141ff93d0b946b70def4a build: Add CMake-based build system (Hennadii Stepanov)
Pull request description:
This PR adds a [CMake](https://cmake.org/ )-based build system.
Added build instructions and examples to the [`README.md`](https://github.com/hebasto/secp256k1/blob/220628-cmake/README.md#building-with-cmake-experimental ) file.
Ways to integrate with downstream CMake-based projects:
- if `secp256k1` is a subtree (including Bitcoin Core project) -- `add_subdirectory(secp256k1)`
- if `secp256k1` has been installed -- `find_package(secp256k1 0.2.1 CONFIG)`, see https://github.com/hebasto/secp256k1-CMake-example
Added a few toolchain files for easy cross compiling.
Discussions on IRC:
- https://gnusha.org/secp256k1/2022-06-23.log
- https://gnusha.org/secp256k1/2022-06-24.log
- https://gnusha.org/secp256k1/2022-06-27.log
- https://gnusha.org/secp256k1/2023-01-30.log
---
Related PRs:
- #315
- #549
- #761
---
**Implementation notes**
Minimum required CMake version is 3.1. This was required to provide [`C_STANDARD`](https://cmake.org/cmake/help/latest/prop_tgt/C_STANDARD.html ) property.
In turn, this choice of CMake version implies it is not possible to build with default CMake on Debian 8, which has CMake v3.0.2 only.
Also see:
- [CMake Versions on Linux Distros](https://gitlab.kitware.com/cmake/community/-/wikis/CMake-Versions-on-Linux-Distros )
- https://repology.org/project/cmake/versions
---
# Autotools -- CMake Feature Parity Tables
## 1. Configuration options
Autotool-based build system features being listed according to the `./configure --help` output.
| Autotools | CMake |
|---|---|
| `--prefix` | `-DCMAKE_INSTALL_PREFIX`
| `--enable-shared` | `-DSECP256K1_BUILD_SHARED` |
| `--enable-static` | `-DSECP256K1_BUILD_STATIC` |
| `--enable-dev-mode` _hidden_ | N/A, see https://github.com/bitcoin-core/secp256k1/pull/1113#discussion_r916979117 |
| `--enable-benchmark` | `-DSECP256K1_BUILD_BENCHMARK` |
| `--enable-coverage` | `-DCMAKE_BUILD_TYPE=Coverage` |
| `--enable-tests` | `-DSECP256K1_BUILD_TESTS` |
| `--enable-ctime-tests` | `-DSECP256K1_BUILD_CTIME_TESTS` |
| `--enable-experimental` | `-DSECP256K1_EXPERIMENTAL` |
| `--enable-exhaustive-tests` | `-DSECP256K1_BUILD_EXHAUSTIVE_TESTS` |
| `--enable-examples` | `-DSECP256K1_BUILD_EXAMPLES` |
| `--enable-module-ecdh` | `-DSECP256K1_ENABLE_MODULE_ECDH` |
| `--enable-module-recovery` | `-DSECP256K1_ENABLE_MODULE_RECOVERY` |
| `--enable-module-extrakeys` | `-DSECP256K1_ENABLE_MODULE_EXTRAKEYS` |
| `--enable-module-schnorrsig` | `-DSECP256K1_ENABLE_MODULE_SCHNORRSIG` |
| `--enable-external-default-callbacks` | `-DSECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS` |
| `--with-test-override-wide-multiply` _hidden_ | `-DSECP256K1_TEST_OVERRIDE_WIDE_MULTIPLY` |
| `--with-asm` | `-DSECP256K1_ASM` |
| `--with-ecmult-window` | `-DSECP256K1_ECMULT_WINDOW_SIZE` |
| `--with-ecmult-gen-precision` | `-DSECP256K1_ECMULT_GEN_PREC_BITS` |
| `--with-valgrind` | `-DSECP256K1_VALGRING` |
A screenshot of grouped options from `cmake-gui`:

## 2. `make` targets
| Autotools | CMake |
|---|---|
| `make` | `make` |
| `make check` | `make check` |
| `make install` | `make install` * |
* Installation of `lib/pkgconfig/libsecp256k1.pc` not implemented.
ACKs for top commit:
theuni:
ACK e1eb33724c2ca47855a8c1dada421cabdb717fe7.
sipa:
ACK e1eb33724c2ca47855a8c1dada421cabdb717fe7
real-or-random:
ACK e1eb33724c2ca47855a8c1dada421cabdb717fe7
Tree-SHA512: ebe2772eeb1a430a0a7ae767fb1a9a82d52d5e9bf2306956cd08f7b442c862be2539774dd10d5555817353d37d1c6add78b8fe5a85bb71239304fb42c98ff337
2023-03-08 10:33:09 -05:00
Hennadii Stepanov
5468d70964
build: Add CMake-based build system
...
Co-authored-by: Tim Ruffing <crypto@timruffing.de>
2023-03-08 13:33:16 +00:00
Tim Ruffing
5757318782
Merge bitcoin-core/secp256k1#1212 : Prevent dead-store elimination when clearing secrets in examples
...
5660c137552c657da5265691dea0fb10faae6a76 prevent optimization in algorithms (Harshil Jani)
Pull request description:
Signed-off-by: Harshil Jani <harshiljani2002@gmail.com>
ACKs for top commit:
sipa:
utACK 5660c137552c657da5265691dea0fb10faae6a76
real-or-random:
utACK 5660c137552c657da5265691dea0fb10faae6a76
Tree-SHA512: 90024b7445c04e18a88af4099fc1ac6d1b9b2309b88dd22ae2b1f50aed7bac28b2c180cc28e1a95d5e9ec94b4c4adc44b9ada1477e6abe8efae7884c2382645c
2023-03-02 23:30:20 +01:00
Harshil Jani
5660c13755
prevent optimization in algorithms
...
Signed-off-by: Harshil Jani <harshiljani2002@gmail.com>
Add secure_erase function to clear secrets
Signed-off-by: Harshil Jani <harshiljani2002@gmail.com>
Update the function with good practices
Signed-off-by: Harshil Jani <harshiljani2002@gmail.com>
Renaming random.h to examples_util.h
Signed-off-by: Harshil Jani <harshiljani2002@gmail.com>
2023-03-02 15:36:41 +05:30
Jonas Nick
36621d13be
musig: update to BIP v1.0.0-rc.2 "Add ''pk'' arg to ''NonceGen''"
2023-02-13 14:03:51 +00:00
Jonas Nick
d717a4980b
musig: update to BIP v0.8 "Switch from X-only to plain pk inputs."
2023-02-13 14:03:51 +00:00
Jonas Nick
060887e9d7
musig: update to BIP v0.5.1 "Rename ordinary tweaking to plain"
2023-02-13 14:03:51 +00:00
Tim Ruffing
739c53b19a
examples: Extend sig examples by call that uses static context
...
Besides improving the examples, this makes sure that the examples
import a variable (instead of a function), namely the static context,
from the library. This is helpful when testing MSVC builds, because
the MSVC linker tends to be awkward when importing variables.
2023-02-06 21:44:56 +01:00
Tim Ruffing
4386a2306c
examples: Switch to NONE contexts
2022-12-05 11:26:44 +01:00
Jonas Nick
645d9c53c4
examples: let musig use random.h instead of /dev/urandom
2022-03-31 13:38:30 +00:00
Jonas Nick
eccba5b4e5
examples: relicense musig example to CC0 public domain
2022-03-31 13:33:30 +00:00
Jonas Nick
8298c0c79b
Merge commits 'c8aa516b 0a40a486 d8a24632 85b00a1c 59547943 5dcc6f8d 07752831 3ef94aa5 1253a277 64b34979 ac83be33 0e5cbd01 e0508ee9 587239db 1ac7e31c d0ad5814 912b7ccc 8746600e ' into temp-merge-1093
...
Revert: util: Remove endianness detection
2022-03-30 15:00:03 +00:00
Tim Ruffing
f813bb0df3
schnorrsig: Adapt example to new API
2022-03-17 22:41:36 +01:00
Tim Ruffing
99e6568fc6
schnorrsig: Rename schnorrsig_sign to schnorsig_sign32 and deprecate
2022-03-17 22:41:36 +01:00
Elichai Turkel
7c9502cece
Add a copy of the CC0 license to the examples
2022-02-23 16:15:00 +02:00
Elichai Turkel
422a7cc86a
Add a ecdh shared secret example
...
Co-authored-by: Jonas Nick <jonasd.nick@gmail.com>
2022-02-23 16:14:57 +02:00
Elichai Turkel
b0cfbcc143
Add a Schnorr signing and verifying example
...
Co-authored-by: Jonas Nick <jonasd.nick@gmail.com>
2022-02-23 16:14:55 +02:00
Elichai Turkel
fee7d4bf9e
Add an ECDSA signing and verifying example
...
Co-authored-by: Jonas Nick <jonasd.nick@gmail.com>
2022-02-23 16:14:53 +02:00
Tim Ruffing
8fd97d8116
Merge ElementsProject/secp256k1-zkp#158 : Small musig improvements
...
d895b10c18b8aa19a77f0a80f318e1a2052e7c9b musig: mention musig.md in example (Jonas Nick)
588009d26ffc58864b6e9fc3f1ab2eae633476c3 musig: improve doc of partial_sig_verify regarding signing sessions (Jonas Nick)
b1094953c4497947222df12ef8f9adb2191e2b17 musig: remove superfluous comment (Jonas Nick)
Pull request description:
ACKs for top commit:
robot-dreams:
ACK d895b10c18b8aa19a77f0a80f318e1a2052e7c9b
real-or-random:
ACK d895b10c18b8aa19a77f0a80f318e1a2052e7c9b
Tree-SHA512: 35169240868500bb27e5a6b8779f090d3f33a6c0cb1a4574e6e53e9c52782f454fe7df6d49b68e0acdd174e25a756bf6267339f0d4e94f28d5ae49145f21e298
2022-01-25 10:53:38 +01:00
Jonas Nick
57a17929fc
musig: add ordinary and xonly tweaking to the example
2022-01-21 17:07:06 +00:00
Jonas Nick
d895b10c18
musig: mention musig.md in example
2022-01-02 19:42:15 +00:00
Jonas Nick
22c88815c7
musig: replace MuSig(1) with MuSig2
2021-12-17 13:47:23 +00:00