Commit Graph

2657 Commits

Author SHA1 Message Date
merge-script
68b55209f1 Merge bitcoin-core/secp256k1#1619: musig: ctimetests: fix _declassify range for generated nonce points
57eda3ba30 musig: ctimetests: fix _declassify range for generated nonce points (Sebastian Falbesoner)

Pull request description:

  As noticed in https://github.com/bitcoin-core/secp256k1/pull/1614#discussion_r1796215582, the area marked as non-secret exceeds the nonce_pts array in the second iteration of the for loop. Fix that by passing the correct size to the _declassify call.

ACKs for top commit:
  sipa:
    utACK 57eda3ba30
  real-or-random:
    utACK 57eda3ba30

Tree-SHA512: ff8074e3d1078d66a52d08c661997856ff586b3b4564a865a75212b32fafd7906d58885371bd63005007fde554ebcad121ab66125abe4331cf0aac63fc018ed0
2024-10-22 12:00:49 +02:00
merge-script
f0868a9b3d Merge bitcoin-core/secp256k1#1595: build: 45839th attempt to fix symbol visibility on Windows
447334cb06 include: Avoid visibility("default") on Windows (Tim Ruffing)

Pull request description:

  Fixes #1421. See code comments for rationale.

  Related meta-bug: #1181.  This reminds me that we should move forward with #1359.

ACKs for top commit:
  fanquake:
    ACK 447334cb06
  hebasto:
    ACK 447334cb06, tested on Ubuntu 24.04 using the following commands:
  theuni:
    ACK 447334cb06

Tree-SHA512: aaa47d88fd1b1f85c3e879a2b288c0eb3beebad0cc89e85f05d0b631f83e58d5a324fb441911970865eaa292f6820d03a1b516d6e8de37a87510e2082acc6e28
2024-10-21 18:02:53 +02:00
merge-script
1fae76f50c Merge bitcoin-core/secp256k1#1620: Remove unused scratch space from API
8be3839fb2 Remove unused scratch space from API (Jonas Nick)

Pull request description:

  We had already merged this in #1305, but it was reverted before a release (#1311) because this change is not backwards compatible but at the time we only wanted to make a patch release in order to fix an actual issue.

  Due to the musig module, the next release will increment the version number from 0.5.x to 0.6.0, so it would be a good time to remove the scratch space from the API.

ACKs for top commit:
  sipa:
    utACK 8be3839fb2
  real-or-random:
    utACK 8be3839fb2

Tree-SHA512: ecd6bc1d925992f9df8e26820388fc436bbb6bc5f250950edf00406f006ca0df52ab8cd56a1b7541e57af0682ddadf6d34bd638b27557d301a5dff6c327a5ebc
2024-10-21 18:01:08 +02:00
Jonas Nick
8be3839fb2 Remove unused scratch space from API 2024-10-21 09:18:44 +00:00
Sebastian Falbesoner
57eda3ba30 musig: ctimetests: fix _declassify range for generated nonce points
The area marked as non-secret exceeds the nonce_pts array in the
second iteration of the for loop. Fix that by passing the correct
size to the _declassify call.
2024-10-20 02:29:35 +02:00
Hennadii Stepanov
87384f5c0f cmake, test: Add secp256k1_ prefix to test names
This change improves regex matching options when using `ctest` in
downstream projects.
2024-10-17 09:59:04 +01:00
merge-script
e59158b6eb Merge bitcoin-core/secp256k1#1553: cmake: Set top-level target output locations
c232486d84 Revert "cmake: Set `ENVIRONMENT` property for examples on Windows" (Hennadii Stepanov)
26e4a7c214 cmake: Set top-level target output locations (Hennadii Stepanov)

Pull request description:

  While testing https://github.com/bitcoin-core/secp256k1/pull/1551, I noticed that when cross-compiling a shared library with examples for Windows, the `ctest` fails to run examples with Wine. Adjusting the `PATH` variable in 4af241b320/examples/CMakeLists.txt (L16-L18) does not help because `WINEPATH` is expected.

  Another issue with the current implementation is that the examples cannot run individually on Windows.

  This PR resolves both issues by reverting the implementation from https://github.com/bitcoin-core/secp256k1/pull/1290 in favour of the reworked and improved implementation from https://github.com/bitcoin-core/secp256k1/pull/1233.

ACKs for top commit:
  theuni:
    Concept ACK and utACK c232486d84.
  real-or-random:
    utACK c232486d84

Tree-SHA512: 479b71d15d5d5670f6f69da3da599240c345711003383ca805c821b67065c9baaf269f987792cf1029211cdbfe799aecd401e6940a471539e3929b4a90e0781d
2024-10-15 13:37:21 +02:00
merge-script
18f9b967c2 Merge bitcoin-core/secp256k1#1616: examples: do not retry generating seckey randomness in musig
5bab8f6d3c examples: make key generation doc consistent (Jonas Nick)
e8908221a4 examples: do not retry generating seckey randomness in musig (Jonas Nick)
70b6be1834 extrakeys: improve doc of keypair_create (don't suggest retry) (Jonas Nick)

Pull request description:

  Follow-up to #1570.

ACKs for top commit:
  real-or-random:
    utACK 5bab8f6d3c
  theStack:
    ACK 5bab8f6d3c

Tree-SHA512: f29ceda87b0017aa2a2324f23527467c777223c9f7cbe43d814bb1cebfc6f4453b7e11f48a6bc718ae05d7eb9227ceb074adf576e8bb8c28639b47931136ce0a
2024-10-14 18:00:04 +02:00
Jonas Nick
5bab8f6d3c examples: make key generation doc consistent 2024-10-14 13:24:34 +00:00
Jonas Nick
e8908221a4 examples: do not retry generating seckey randomness in musig 2024-10-14 13:24:34 +00:00
Jonas Nick
70b6be1834 extrakeys: improve doc of keypair_create (don't suggest retry) 2024-10-14 13:24:30 +00:00
Jonas Nick
01b5893389 Merge bitcoin-core/secp256k1#1599: #1570 improve examples: remove key generation loop
cd4f84f3ba Improve examples/documentation: remove key generation loops (cheapshot003)

Pull request description:

ACKs for top commit:
  real-or-random:
    utACK cd4f84f3ba
  jonasnick:
    ACK cd4f84f3ba

Tree-SHA512: 242ab99c36302b539fc95421142c3eec5ccfa2cf918989457886338febde45a33b1794e0f08e7a632747bc21cbf5c47b7361fd9a28b9a1c6dff7caecf7b31a9f
2024-10-13 07:25:09 +00:00
cheapshot003
cd4f84f3ba Improve examples/documentation: remove key generation loops
Co-Authored by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
2024-10-09 16:24:38 +03:00
merge-script
a88aa93506 Merge bitcoin-core/secp256k1#1603: f can never equal -m
ef7ff03407 f can never equal -m (Russell O'Connor)

Pull request description:

  In fact, before reaching this particular VERIFY_CHECK, we had already successfully passed through

      VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&f, len, &modinfo->modulus, -1) > 0); /* f > -modulus */

  ensuring that f is not -m.

ACKs for top commit:
  sipa:
    ACK ef7ff03407
  real-or-random:
    utACK ef7ff03407

Tree-SHA512: a8a8dcbad4dff36b9c49e40e07b212312cbf915132aea008eab6ea61b35bddb6d7782229c2cc528fb404d05132482c602cad768414d76153bb425a3d23714fff
2024-10-08 02:09:18 +02:00
merge-script
3660fe5e2a Merge bitcoin-core/secp256k1#1479: Add module "musig" that implements MuSig2 multi-signatures (BIP 327)
168c92011f build: allow enabling the musig module in cmake (Jonas Nick)
f411841a46 Add module "musig" that implements MuSig2 multi-signatures (BIP 327) (Jonas Nick)
0be79660f3 util: add constant-time is_zero_array function (Jonas Nick)
c8fbdb1b97 group: add ge_to_bytes_ext and ge_from_bytes_ext (Jonas Nick)
85e224dd97 group: add ge_to_bytes and ge_from_bytes (Jonas Nick)

Pull request description:

  EDIT: based on #1518. Closes #1452. Most of the code is a copy from [libsecp256k1-zkp](https://github.com/BlockstreamResearch/secp256k1-zkp). The API added in this PR is identical with the exception of two modifications:

  1. I removed the unused `scratch_space` argument from `secp256k1_musig_pubkey_agg`. This argument was intended to allow using `ecmult_multi` algorithms for key aggregation in the future. But at this point it's unclear whether the `scratch_space` object will remain in its current form (see #1302).
  2. Support for adaptor signatures was removed and therefore the `adaptor` argument of `musig_nonce_process` was also removed.

  In contrast to the module in libsecp256k1-zkp, the module is non-experimental. I slightly cleaned up parts of the module, adjusted the code to the new definition of the VERIFY_CHECK macro and applied some simplifications that were possible because the module is now in the upstream repo (`ge_from_bytes`, `ge_to_bytes`). You can follow the changes I made to the libsecp256k1-zkp module at https://github.com/jonasnick/secp256k1-zkp/commits/musig2-upstream/.

ACKs for top commit:
  sipa:
    reACK 168c92011f
  real-or-random:
    reACK 168c92011f
  theStack:
    re-ACK 168c92011f

Tree-SHA512: e3a599a8d5a466107b9a86f76582b8fb9dc87ec95416c784c3ef39d1c64686e6c739806ed6ba62c91793eb7fa418a6270cf999027ee7bd3dd85c67bc2c74f677
2024-10-07 17:05:37 +02:00
Jonas Nick
168c92011f build: allow enabling the musig module in cmake 2024-10-07 14:03:42 +00:00
Jonas Nick
f411841a46 Add module "musig" that implements MuSig2 multi-signatures (BIP 327) 2024-10-07 14:03:42 +00:00
Jonas Nick
0be79660f3 util: add constant-time is_zero_array function 2024-10-07 14:03:42 +00:00
Jonas Nick
c8fbdb1b97 group: add ge_to_bytes_ext and ge_from_bytes_ext 2024-10-07 14:03:40 +00:00
Russell O'Connor
ef7ff03407 f can never equal -m
In fact, before reaching this particular VERIFY_CHECK, we had already successfully passed through

    VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&f, len, &modinfo->modulus, -1) > 0); /* f > -modulus */

ensuring that f is not -m.
2024-09-25 11:05:23 -04:00
Hennadii Stepanov
c232486d84 Revert "cmake: Set ENVIRONMENT property for examples on Windows"
This reverts commit 116d2ab3df.
2024-09-18 18:13:44 +01:00
Hennadii Stepanov
26e4a7c214 cmake: Set top-level target output locations
This change:
1. Collects build artifacts in dedicated locations.
2. Allows to run individual examples with a shared library on Windows.
3. Is compatible with Wine when testing cross-compiled Windows binaries
   on Linux.
4. Is compatible with integration the project into a larger project
   hierarchy.
2024-09-18 18:13:37 +01:00
merge-script
4c57c7a5a9 Merge bitcoin-core/secp256k1#1554: cmake: Clean up testing code
7c987ec89e cmake: Call `enable_testing()` unconditionally (Hennadii Stepanov)
6aa576515e cmake: Delete `CTest` module (Hennadii Stepanov)

Pull request description:

  1. Delete `CTest` module.

  The `CTest` module handles `CDash` integration, which we do not use. It is not required for testing functionality.

  2. Clean up cases when to invoke `enable_testing()`

  The `enable_testing()` command invocation is required for `add_test()` commands, which are used only for `{noverify_}tests`, `exhaustive_tests` and examples.

ACKs for top commit:
  real-or-random:
    utACK 7c987ec89e
  theStack:
    ACK 7c987ec89e

Tree-SHA512: f2628a4c4363b86f7c49d705df192e76368997e3f01cb736fcc272330bbf481af023d29d9faec17878d3bf74e4d265870cd93953406ae4612cd717811f22dd1a
2024-09-18 15:42:00 +02:00
Tim Ruffing
447334cb06 include: Avoid visibility("default") on Windows
Fixes #1421.
2024-09-17 16:21:39 +02:00
merge-script
472faaa8ee Merge bitcoin-core/secp256k1#1604: doc: fix typos in secp256k1_ecdsa_{recoverable_,}signature API description
292310fbb2 doc: fix typos in `secp256k1_ecdsa_{recoverable_,}signature` API description (Sebastian Falbesoner)

Pull request description:

  This small PR fixes two small typos I noticed while looking at the pubkey recovery module (s/structured/structure/).

ACKs for top commit:
  real-or-random:
    utACK 292310fbb2

Tree-SHA512: 7abda2d5b56d810fd83c7de9b018818a28fd5969f669b53b9dc0e1034428feef63a3157714f45002185b94c6c35617cab21861fa56dba51883d1326b4a1cb033
2024-09-09 15:32:35 +02:00
Sebastian Falbesoner
292310fbb2 doc: fix typos in secp256k1_ecdsa_{recoverable_,}signature API description 2024-09-09 12:07:21 +02:00
Jonas Nick
2f2ccc4695 Merge bitcoin-core/secp256k1#1600: cmake: Introduce SECP256K1_APPEND_LDFLAGS variable
421ed1b46f cmake: Introduce `SECP256K1_APPEND_LDFLAGS` variable (Hennadii Stepanov)

Pull request description:

ACKs for top commit:
  jonasnick:
    ACK 421ed1b46f

Tree-SHA512: 044b84b86a98e30268189dc92c4b8045e146451f3849a9863eb8f99490df53f1f02ae0fc74d74dc6ede0ea0c55653c142f409c77e1967505a085f31e4c472443
2024-09-07 17:07:37 +00:00
Hennadii Stepanov
421ed1b46f cmake: Introduce SECP256K1_APPEND_LDFLAGS variable
Downstream projects may include libsecp test executables in their test
suites. In such cases, if a `-fsanitize=...` flag is passed via the
`SECP256K1_APPEND_CFLAGS` variable, the same flag must also be passed to
the linker.
2024-09-02 21:41:03 +01:00
Jonas Nick
85e224dd97 group: add ge_to_bytes and ge_from_bytes 2024-09-02 19:05:47 +00:00
merge-script
1988855079 Merge bitcoin-core/secp256k1#1586: fix: remove duplicate 'the' from header file comment
9b0f37bff1 fix: remove duplicate 'the' from header file comment (Epic Curious)

Pull request description:

  Replaces:
  ` * Changes w.r.t. the the paper:`

  With:
  ` * Changes w.r.t. the paper:`

  in the `include/secp256k1_ellswift.h` header file.

ACKs for top commit:
  real-or-random:
    ACK 9b0f37bff1

Tree-SHA512: a0ac153d91f0d27959d626ede116e5322fcab7e32d8e6e81bd570cbb3eae55054ab6d0310bdf963bf4fddf9792c79fad61bc90a69bc24ab5234f29e4a2763ef3
2024-08-19 18:28:26 +02:00
merge-script
b307614401 Merge bitcoin-core/secp256k1#1583: ci: Bump GCC_SNAPSHOT_MAJOR to 15
fa67b6752d refactor: Use array initialization for unterminated strings (MarcoFalke)
e34b476730 ci: Bump GCC_SNAPSHOT_MAJOR to 15 (maflcko)

Pull request description:

  Follow-up to https://github.com/bitcoin-core/secp256k1/pull/1313

  Clang should silently follow the `main` devel branch, but GCC needs to be bumped manually.

ACKs for top commit:
  hebasto:
    ACK fa67b6752d, I have reviewed the code and it looks OK.
  real-or-random:
    utACK fa67b6752d

Tree-SHA512: e76371e5b1ff259ec501671872352c0d46d34a96aadae04e6ee37f9457308412e18010e724df667a15c3a85997a16da191f50cd3a01ee3f20d5f16b5893d179a
2024-08-17 16:06:20 +02:00
MarcoFalke
fa67b6752d refactor: Use array initialization for unterminated strings
The previous code is correct and harmless to initialize an array with a
non-terminated character sequence using a string literal.

However, it requires exactly specifying the array size, which can be
cumbersome.

Also, GCC-15 may issue the -Wunterminated-string-initialization warning.
[1]

Fix both issues by using array initialization. This refactoring commit
does not change behavior.

[1] Example warning:

src/modules/schnorrsig/main_impl.h:48:46: error: initializer-string for array of 'unsigned char' is too long [-Werror=unterminated-string-initialization]
   48 | static const unsigned char bip340_algo[13] = "BIP0340/nonce";
      |                                              ^~~~~~~~~~~~~~~
2024-08-15 17:58:14 +02:00
Epic Curious
9b0f37bff1 fix: remove duplicate 'the' from header file comment 2024-08-13 16:06:24 -04:00
maflcko
e34b476730 ci: Bump GCC_SNAPSHOT_MAJOR to 15 2024-08-12 19:41:04 +02:00
merge-script
3fdf146bad Merge bitcoin-core/secp256k1#1578: ci: Silent Homebrew's noisy reinstall warnings
7057d3c9af ci: Silent Homebrew's noisy reinstall warnings (Hennadii Stepanov)

Pull request description:

  Homebrew's warnings are quite noisy on the master branch:
  ![image](https://github.com/user-attachments/assets/82b95369-b8c9-4b99-b72c-41d0b084d4b8)

  This PR silents them to allow us to focus on any other CI infra warnings once they happen.

ACKs for top commit:
  real-or-random:
    utACK 7057d3c9af

Tree-SHA512: 4dbdb459e97cb5956219214fd7407ec52fc018dba24ae945337ad5c94df510472cfc708f9f67d4df5b8e983bf4e78b2efd56533f28113b3463a1397d4d7a032a
2024-08-05 00:56:30 +02:00
Jonas Nick
f8c1b0e0e6 Merge bitcoin-core/secp256k1#1577: release cleanup: bump version after 0.5.1
c3e40d75db release cleanup: bump version after 0.5.1 (Jonas Nick)

Pull request description:

ACKs for top commit:
  sipa:
    ACK c3e40d75db
  hebasto:
    ACK c3e40d75db.

Tree-SHA512: e7ae20a4b88c046c66720a6f8a2ba0c47e113bb95357020908dd378e58633d86f5fdd6b1e3d552da5ba3e0a7ba7de918a561862f66ef7c909ea64045a50955ef
2024-08-02 13:20:18 +00:00
Hennadii Stepanov
7057d3c9af ci: Silent Homebrew's noisy reinstall warnings 2024-08-02 14:03:44 +01:00
Jonas Nick
c3e40d75db release cleanup: bump version after 0.5.1 2024-08-01 19:23:27 +00:00
Jonas Nick
642c885b61 Merge bitcoin-core/secp256k1#1575: release: prepare for 0.5.1
40d87b8e45 release: prepare for 0.5.1 (Jonas Nick)
5770226176 changelog: clarify CMake option (Jonas Nick)

Pull request description:

ACKs for top commit:
  sipa:
    ACK 40d87b8e45
  hebasto:
    ACK 40d87b8e45.

Tree-SHA512: f021cd948239ad1a9b2feb854a95d4a559f06a559d0e4932bc176458475f13a81082a2f7410f2fc6ae259c93a484101f44ff1d3f720773c0fda877562de08bc3
v0.5.1
2024-08-01 19:20:10 +00:00
Jonas Nick
cdf08c1a2b Merge bitcoin-core/secp256k1#1576: doc: mention needs-changelog github label in release process
759bd4bbc8 doc: mention `needs-changelog` github label in release process (Jonas Nick)

Pull request description:

ACKs for top commit:
  sipa:
    ACK 759bd4bbc8

Tree-SHA512: fc38f0da81fee10c46dc22409d27dfe2742555991328554fc6b7eb3d1f3e50fea6213ebd10d5b58473aa89a21117a46f97b36f5cf50e7f95197a339ccc185447
2024-08-01 19:13:56 +00:00
Jonas Nick
40d87b8e45 release: prepare for 0.5.1 2024-08-01 16:58:24 +00:00
Jonas Nick
5770226176 changelog: clarify CMake option 2024-08-01 16:58:24 +00:00
Jonas Nick
759bd4bbc8 doc: mention needs-changelog github label in release process 2024-08-01 15:55:01 +00:00
Jonas Nick
fded437c4c Merge bitcoin-core/secp256k1#1574: Fix compilation when extrakeys module isn't enabled
763d938cf0 ci: only enable extrakeys module when schnorrsig is enabled (Jonas Nick)
af551ab9db tests: do not use functions from extrakeys module (Jonas Nick)

Pull request description:

ACKs for top commit:
  sipa:
    ACK 763d938cf0
  hebasto:
    ACK 763d938cf0.

Tree-SHA512: a5d52e69af896e7bb43c6826f269b5f26e8d1b8c0d040d71a369fdaebf894e47dcf9ff1bbe1b62864adb85437d2c93eabd655c4d690d5d894b712145c2bd252f
2024-07-29 19:30:20 +00:00
Jonas Nick
763d938cf0 ci: only enable extrakeys module when schnorrsig is enabled 2024-07-24 06:57:42 +00:00
Jonas Nick
af551ab9db tests: do not use functions from extrakeys module
This fixes a bug introduced in 7d2591ce12 that
prevented compiling the library without enabling the extrakeys module.
2024-07-24 06:57:38 +00:00
Jonas Nick
0055b86780 Merge bitcoin-core/secp256k1#1551: Add ellswift usage example
31f84595c4 Add ellswift usage example (Sebastian Falbesoner)
fe4fbaa7f3 examples: fix case typos in secret clearing paragraphs (s/, Or/, or/) (Sebastian Falbesoner)

Pull request description:

ACKs for top commit:
  real-or-random:
    utACK 31f84595c4
  jonasnick:
    ACK 31f84595c4

Tree-SHA512: 5fe894b599c78db585a6d5238c17a894d020106561a625027efc4d67c870a288aad0814e77e7c3cb03e96b7cf940db95a6933d5a5e34a93aa644b3dcbfd8e938
2024-07-10 18:23:58 +00:00
Jonas Nick
ea2d5f0f17 Merge bitcoin-core/secp256k1#1563: doc: Add convention for defaults
16685649d2 doc: Add convention for defaults (Tim Ruffing)

Pull request description:

ACKs for top commit:
  hebasto:
    ACK 16685649d2
  jonasnick:
    ACK 16685649d2

Tree-SHA512: cb359e20f1944b4095512413df4d55ccd89e1838da8e006cea4e523e6d1d5008afbab4e0d87b05a6e6ad991d1a0003066fc205d15443c8f1eb2b02e13196155a
2024-07-09 18:21:37 +00:00
merge-script
ca06e58b2c Merge bitcoin-core/secp256k1#1564: build, ci: Adjust the default size of the precomputed table for signing
e2af491263 ci: Switch to the new default value of the precomputed table for signing (Hennadii Stepanov)
d94a9273f8 build: Adjust the default size of the precomputed table for signing (Hennadii Stepanov)

Pull request description:

  This PR implements the [outcomes](https://github.com/bitcoin-core/secp256k1/issues/1549#issuecomment-2200559257) from today's IRC meeting:

  1. The default size of the precomputed table for signing is now aligned with Bitcoin Core's [default](a057869aa3).

  2. The default value in CI has been updated to reflect the new default.

ACKs for top commit:
  sipa:
    utACK e2af491263
  real-or-random:
    utACK e2af491263

Tree-SHA512: aa9db5bc2aec29a35a503a80617a4c096e9909648084fe1ce43b5dd7e74dd812e7642305bd5bc13eb581efc23f12904e200e13cb1a35955b773e05ab4f84be4e
2024-07-03 22:18:28 +02:00
Hennadii Stepanov
e2af491263 ci: Switch to the new default value of the precomputed table for signing 2024-07-03 14:04:18 +01:00