3440 Commits

Author SHA1 Message Date
Tim Ruffing
895f53d1cf docs: Clarify that callback can be called more than once 2025-09-22 12:58:48 +02:00
merge-script
de6af6ae35 Merge bitcoin-core/secp256k1#1748: bench: improve context creation in ECDH benchmark
dfe284ed2d bench: improve context creation in ECDH benchmark (Sebastian Falbesoner)

Pull request description:

  Calling `secp256k1_context_create` with `SECP256K1_FLAGS_TYPE_CONTEXT` seems to be confusing and not strictly API-compliant, as the only allowed (non-deprecated) value is `SECP256K1_CONTEXT_NONE`, even if the former happens to map to the latter currently.

  Fix this by not dynamically creating a context in the first place and switch to using the static context, as it is sufficient for this benchmark and presumably matches what the "no capabilities" comment intended back then.

  Alternatives are:
  * keep the signing context and only fix the name, i.e. s/_FLAGS_TYPE_CONTEXT/_CONTEXT_NONE/
  * use `secp256k1_context_static` everywhere directly and get rid of the `ctx` field in the `bench_ecdh_data` struct (less flexible for future changes, deviates from other bench structures)

  Found while reviewing #1698, see https://github.com/bitcoin-core/secp256k1/pull/1698#discussion_r2350395913.

ACKs for top commit:
  sipa:
    utACK dfe284ed2d
  stratospher:
    ACK dfe284e. not sure whether the alternative is preferred though.
  real-or-random:
    utACK dfe284ed2d
  furszy:
    ACK dfe284ed2d

Tree-SHA512: 106d115ec11577fcd66e93293289545aa0fa78480f4bdc8c440963e4e6b050c81d4775268cfa0e1ab44db4c08a5768a0ff80f74b866e550ddd22a4e17ccb9014
2025-09-22 12:21:30 +02:00
merge-script
42e75b613b Merge BlockstreamResearch/secp256k1-zkp#304: ci: Backport MSan fixes for ctime_tests
b9a82b481f ci: Update macOS image (Hennadii Stepanov)
a1be8ed1b1 ci: Silent Homebrew's noisy reinstall warnings (Hennadii Stepanov)
fd259fe9ad ci: Add job with -fsanitize-memory-param-retval (Tim Ruffing)
76b3396516 configure: Move "experimental" warning to bottom (Tim Ruffing)
e639e6caa9 autotools: Disable eager MSan in ctime_tests (Tim Ruffing)

Pull request description:

  Cherry-picked the upstream fixes from bitcoin-core/secp256k1#1517 to align behaviour here and silence the false 'use-of-uninitialized-value' reports in ctime_tests under Clang ≥16.

  #### Result:
  - `ctime_tests` is clean under MSan.
  - Other tests are unchanged.
  - No API or behaviour changes.

  #### Commits cherry-picked:
  - [55e5d975db](55e5d975db),
  - [e1bef0961c](e1bef0961c),
  - [ebfb82ee2f](ebfb82ee2f)

  #### References:
  Upstream: https://github.com/bitcoin-core/secp256k1/pull/1517

ACKs for top commit:
  apoelstra:
    ACK b9a82b481fc35c5db3a127185ffada77fe107d46; successfully ran local tests
  jonasnick:
    ACK b9a82b481f

Tree-SHA512: b6c9ae38b142c7fadf1157a1b25cdc8e85e6cd271222b950b1246f14daf85b072979d4f2ee8791c8b81b2f6a94ad1094fc8110bbd4ff19153de6a6efad2e3cc0
2025-09-19 17:58:29 +02:00
merge-script
5817885153 Merge bitcoin-core/secp256k1#1749: build: Fix warnings in x86_64 assembly check
ab560078aa build: Fix warnings in x86_64 assembly check (Hennadii Stepanov)

Pull request description:

  On the master branch @ 10dab907e7, the x86_64 assembly check in both the Autotools and CMake build systems can fail depending on externally provided flags. For example:
  ```
  $ env CFLAGS="-Wall -Werror" ./configure --with-asm=x86_64
  <snip>
  checking for x86_64 assembly availability... no
  configure: error: x86_64 assembly requested but not available
  ```
  or
  ```
  $ env CFLAGS="-Wall -Werror" cmake -B build -DSECP256K1_ASM=x86_64
  <snip>
  -- Performing Test HAVE_X86_64_ASM
  -- Performing Test HAVE_X86_64_ASM - Failed
  CMake Error at CMakeLists.txt:111 (message):
    x86_64 assembly requested but not available.

  -- Configuring incomplete, errors occurred!
  ```

  The same issue occurs in CI jobs that build on Windows using clang-cl.

  This PR fixes both build systems.

ACKs for top commit:
  real-or-random:
    utACK ab560078aa
  furszy:
    ACK ab560078aa

Tree-SHA512: d556b642d58c601e7f027ac54975249e05a8b3927c5efd229be43d264b024d00eab9973193adb52f2f60075fca0571644662d61150a19098820091ced2d56fa0
2025-09-19 08:35:08 +02:00
Hennadii Stepanov
ab560078aa build: Fix warnings in x86_64 assembly check
This change fixes:
- `-Wuninitialized` in both Autotools and CMake;
- `-Wreturn-type` in CMake only.
2025-09-18 14:56:47 +01:00
Hennadii Stepanov
b9a82b481f ci: Update macOS image
The macOS 12 GHA image has been deprecated since 2024-10-07.
See: https://github.com/actions/runner-images/issues/10721
2025-09-18 13:12:29 +05:30
Hennadii Stepanov
a1be8ed1b1 ci: Silent Homebrew's noisy reinstall warnings 2025-09-18 13:12:18 +05:30
Jonas Nick
10dab907e7 Merge bitcoin-core/secp256k1#1741: doc: clarify API doc of secp256k1_ecdsa_recover return value
7321bdf27b doc: clarify API doc of `secp256k1_ecdsa_recover` return value (Jonas Nick)

Pull request description:

ACKs for top commit:
  jonasnick:
    ACK 7321bdf27b

Tree-SHA512: a7bac228cf504f6c8a53fdc15c7f3241ac27c214e10b9aabdf962e8d7c4c5107d0c0898467bd3f491cecf0ca2851c604da1ec5520a353b27c8aa02ce3daf2334
2025-09-17 08:35:41 +00:00
Sebastian Falbesoner
dfe284ed2d bench: improve context creation in ECDH benchmark
Calling `secp256k1_context_create` with `SECP256K1_FLAGS_TYPE_CONTEXT`
seems to be not strictly API-compliant, as the only allowed
(non-deprecated) value is `SECP256K1_CONTEXT_NONE`, even if the
former happens to map to the latter currently.

Fix this by not dynamically creating a context in the first place and
switch to using the static context, as it is sufficient for this
benchmark and presumably matches what the "no capabilities" comment
intended back then.
2025-09-16 23:17:08 +02:00
Jonas Nick
7321bdf27b doc: clarify API doc of secp256k1_ecdsa_recover return value
Co-authored-by: Tim Ruffing <me@real-or-random.org>
2025-09-16 21:29:16 +02:00
Tim Ruffing
fd259fe9ad ci: Add job with -fsanitize-memory-param-retval 2025-09-16 15:27:23 +05:30
Tim Ruffing
76b3396516 configure: Move "experimental" warning to bottom
to make it more promiment
2025-09-16 15:24:23 +05:30
Tim Ruffing
e639e6caa9 autotools: Disable eager MSan in ctime_tests
Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
2025-09-16 15:17:35 +05:30
Jonas Nick
f92fd5cc91 Merge elementsproject/secp256k1-zkp#303: ci: backport upstream string-initializer fixes and clean up related tests
7d779c6d9d examples/musig: use brace-enclosed initializer for 32-byte msg (BEULAHEVANJALIN)
53fd89b635 musig/tests: initialize keypair (Jonas Nick)
40bd8549dd musig/test: Remove dead code (Tim Ruffing)
c4570307ec test/fix: refactor unterminated string initializers to brace arrays - Mirror upstream fix (bitcoin-core/secp256k1 fa67b675) - Convert tags, test vectors, and constants in -zkp-only modules (ecdsa_adaptor, ecdsa_s2c, musig, bppp, rangeproof, schnorrsig_halfagg) - Avoid -Wunterminated-string-initialization without changing behavior (BEULAHEVANJALIN)
654a8c327c refactor: Use array initialization for unterminated strings (MarcoFalke)

Pull request description:

ACKs for top commit:
  real-or-random:
    utACK 7d779c6d9d thanks!
  jonasnick:
    ACK 7d779c6d9d

Tree-SHA512: edb9885a36eab499dee05e0c87a184f139ba6f68c01128ae692ab1195546ba8ff77d0c0b06faa22164fd89fd27935fd68b1e9c04a1fc9bcd0b7d6472515095dd
2025-09-16 06:00:35 +00:00
Jonas Nick
b475654302 Merge bitcoin-core/secp256k1#1745: test: introduce group order byte-array constant for deduplication
0c91c56041 test: introduce group order byte-array constant for deduplication (Sebastian Falbesoner)

Pull request description:

ACKs for top commit:
  real-or-random:
    utACK 0c91c56041
  furszy:
    ACK 0c91c56041
  jonasnick:
    ACK 0c91c56041

Tree-SHA512: c33fc43cdccd7d27e1aa0a7660b91581d663a77130849ee0946fe41a61d6f1ba37304d307ee5c69333336e1f191c4e686e2b423053c8e3ae7bced2d31005b99c
2025-09-15 07:31:03 +00:00
furszy
9cce703863 refactor: move 'gettime_i64()' to tests_common.h
Relocate the clock time getter to tests_common.h to
make it easily reusable across test programs. This
will be useful for the upcoming unit test framework.

Context - why not placing it inside testutil.h?:
The bench program links against the production-compiled library,
not its own compiled version. Therefore, `gettime_i64()` cannot
be moved to testutil.h, because testutil.h calls
`secp256k1_pubkey_save()`, which exists only in the internal
secp256k1.c and not in the public API.
2025-09-13 09:55:28 -04:00
Sebastian Falbesoner
0c91c56041 test: introduce group order byte-array constant for deduplication 2025-09-12 15:52:43 +02:00
merge-script
88be4e8d86 Merge bitcoin-core/secp256k1#1735: musig: Invalidate secnonce in secp256k1_musig_partial_sign
399b582a5f Split memclear into two versions (John Moffett)

Pull request description:

  Replace `memset` which can still be optimized out as `secnonce` isn't read later in this function. The API makes it clear the callee is responsible for it, so we need to assure it's cleared properly.

ACKs for top commit:
  real-or-random:
    utACK 399b582a5f thanks!
  jonasnick:
    ACK 399b582a5f

Tree-SHA512: 98cd6c44a45218ad66ca99ceacb9bbccee7ff105957363bcde9c3e17d55ac4a81afc881af8adfce7ff3d6ef5d75f3b111d7220256914ca0bedeb43769b38dd20
2025-09-12 13:00:58 +02:00
BEULAHEVANJALIN
7d779c6d9d examples/musig: use brace-enclosed initializer for 32-byte msg
Switch msg initialization from a string literal to a brace-enclosed
array to avoid -Wunterminated-string-initialization. Upstream removed
the trailing '!' from the message; this change retains it.
2025-09-09 21:56:53 +05:30
Jonas Nick
53fd89b635 musig/tests: initialize keypair
The keypair is unused in musig_partial_sign, but clang-snapshot gives a compiler
warning anyway.
2025-09-09 21:56:00 +05:30
Tim Ruffing
40bd8549dd musig/test: Remove dead code
This avoids a compiler warning on clang-snapshot about &keypair being uninitialized.

(cherry picked from commit 8d967a602b)
2025-09-09 21:55:51 +05:30
BEULAHEVANJALIN
c4570307ec test/fix: refactor unterminated string initializers to brace arrays
- Mirror upstream fix (bitcoin-core/secp256k1 fa67b675)
- Convert tags, test vectors, and constants in -zkp-only modules (ecdsa_adaptor, ecdsa_s2c, musig, bppp, rangeproof, schnorrsig_halfagg)
- Avoid -Wunterminated-string-initialization without changing behavior
2025-09-09 21:55:17 +05:30
MarcoFalke
654a8c327c 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";
      |                                              ^~~~~~~~~~~~~~~

(cherry picked from commit fa67b6752d)

Conflicts:
	src/testrand_impl.h (kept local name `secp256k1_testrand_seed`)
2025-09-09 21:47:12 +05:30
Andrew Poelstra
f9a04ae405 Merge BlockstreamResearch/secp256k1-zkp#302: extrakeys: fix pubkey_sort_cmp test
83d0fa25a8 extrakeys: fix pubkey_sort_cmp test (Jonas Nick)

Pull request description:

  Instead of providing CTX directly, pass a cmp_data object containing CTX. Otherwise, memory sanitizer fails with "use-of-uninitialized-value".


ACKs for top commit:
  real-or-random:
    utACK 83d0fa25a8
  apoelstra:
    ACK 83d0fa25a826d716f809e00ef0a67385b776aec9; successfully ran local tests


Tree-SHA512: eb36c9f90632a3fb472653686ffb5c7a9c29849e05ab1084106a49c23e60ca1c90022ee1accd99ab5bfaa4fd5b3f4670cea8d5a2c415f00c05d645c793b6bedd
2025-09-09 15:27:50 +00:00
merge-script
36e76952cb Merge bitcoin-core/secp256k1#1738: check-abi: remove support for obsolete CMake library output location (src/libsecp256k1.so)
7ebaa134a7 check-abi: remove support for obsolete CMake library output location (src/libsecp256k1.so) (Sebastian Falbesoner)

Pull request description:

  The CMake library output location was changed from "src/" to "lib/" in PR #1553, supporting the old location (presumably done to avoid having users to reconfigure existing CMake builds for a temporary transition window) shouldn't be necessary anymore.

ACKs for top commit:
  real-or-random:
    utACK 7ebaa134a7

Tree-SHA512: 7a4e86260d9593ba4616590c927ae8753b007d51426a86eeb6f8fa35338cfa6c9b05d962f32d0d84a3271340edff2cd50f9180ce1357ab49b7850b58fa017192
2025-09-09 08:57:55 +02:00
Jonas Nick
83d0fa25a8 extrakeys: fix pubkey_sort_cmp test
Instead of providing CTX directly, pass a cmp_data object containing CTX.
Otherwise, memory sanitizer fails with "use-of-uninitialized-value".
2025-09-08 19:18:39 +00:00
John Moffett
399b582a5f Split memclear into two versions
secp256k1_memclear has the side effect of undefining bytes for
valgrind checks. In some cases, we may want to zero bytes
but allow subsequent reads. So we split memclear into
memclear_explicit, which makes no guarantees about the content
of the buffer on return, and memzero_explicit, which guarantees
zero value on return.

Change the memset in partial_sign to use memzero_explicit.
2025-09-08 12:26:04 -04:00
merge-script
4985ac0f89 Merge bitcoin-core/secp256k1#1737: doc: mention ctx requirement for _ellswift_create (not secp256k1_context_static)
806de38bfc doc: mention ctx requirement for `_ellswift_create` (not secp256k1_context_static) (Sebastian Falbesoner)

Pull request description:

  Public functions that require a context for generator point multiplication (i.e. `ctx->ecmult_gen_ctx` is built) usually denote this in the API header by mentioning to not use `secp256k1_context_static`, so add this for `_ellswift_create` as well. This seems the only instance where this is missing currently, see
  ```
  $ git grep ecmult_gen_context_is_built
  $ git grep ctx:.*context_static
  ```
  (note that in the musig and schnorr modules, two public functions for nonce generation / signing map to a single internal function where the context requirement is checked).

  Noted while reviewing #1698.

ACKs for top commit:
  sipa:
    ACK 806de38bfc
  jonasnick:
    ACK 806de38bfc
  real-or-random:
    ACK 806de38bfc
  josibake:
    ACK 806de38bfc

Tree-SHA512: 902e9e21060e09e8e7d72fec8cdc42e0ed18f95824d3220100d7b65720511f934d38e3e556e38bb510d98284bccc12b857f329997640d1c07edd5b55ef6d8e09
2025-09-08 16:44:54 +02:00
Sebastian Falbesoner
7ebaa134a7 check-abi: remove support for obsolete CMake library output location (src/libsecp256k1.so)
The CMake library output location was changed from "src/" to "lib/"
in PR #1553, supporting the old location shouldn't be necessary anymore.
2025-09-07 23:54:06 +02:00
Sebastian Falbesoner
806de38bfc doc: mention ctx requirement for _ellswift_create (not secp256k1_context_static) 2025-09-05 19:11:29 +02:00
merge-script
03fb60ad2e Merge bitcoin-core/secp256k1#1681: doc: Recommend clang-cl when building on Windows
737912430d ci: Add more tests for clang-cl (Hennadii Stepanov)
7379a5bed3 doc: Recommend clang-cl when building on Windows (Hennadii Stepanov)

Pull request description:

  There are several reasons to prefer clang-cl over MSVC, such as improved [security](https://github.com/bitcoin-core/secp256k1/issues/1164) and performance.

  Below are the benchmark results for the master branch @ 201b2b8f06:
  - using [MSVC](https://github.com/bitcoin-core/secp256k1/actions/runs/15439981265/job/43455271726):
  ```
  Benchmark                     ,    Min(us)    ,    Avg(us)    ,    Max(us)

  ecdsa_verify                  ,    66.0       ,    71.0       ,   113.0
  ecdsa_sign                    ,    37.0       ,    37.1       ,    37.5
  ec_keygen                     ,    28.5       ,    28.9       ,    29.0
  ecdh                          ,    66.0       ,    66.2       ,    67.0
  ecdsa_recover                 ,    67.0       ,    74.9       ,   123.0
  schnorrsig_sign               ,    30.0       ,    30.3       ,    30.5
  schnorrsig_verify             ,    66.5       ,    70.6       ,   104.0
  ellswift_encode               ,    17.5       ,    17.9       ,    18.0
  ellswift_decode               ,    14.5       ,    15.3       ,    19.0
  ellswift_keygen               ,    55.0       ,    56.4       ,    63.5
  ellswift_ecdh                 ,    72.5       ,    73.5       ,    79.5
  ```

  - using [clang-cl](https://github.com/bitcoin-core/secp256k1/actions/runs/15439981265/job/43455271749):
  ```
  Benchmark                     ,    Min(us)    ,    Avg(us)    ,    Max(us)

  ecdsa_verify                  ,    41.0       ,    47.5       ,   100.0
  ecdsa_sign                    ,    27.0       ,    27.2       ,    27.5
  ec_keygen                     ,    19.0       ,    19.3       ,    19.5
  ecdh                          ,    42.0       ,    42.4       ,    43.0
  ecdsa_recover                 ,    41.5       ,    45.7       ,    80.0
  schnorrsig_sign               ,    20.0       ,    20.5       ,    20.5
  schnorrsig_verify             ,    41.5       ,    45.5       ,    77.5
  ellswift_encode               ,    13.0       ,    13.0       ,    13.0
  ellswift_decode               ,    10.0       ,    10.4       ,    10.5
  ellswift_keygen               ,    38.5       ,    39.1       ,    41.5
  ellswift_ecdh                 ,    47.0       ,    48.5       ,    59.0
  ```

  On my local machine, the "Release" build configuration:
  - using MSVC:
  ```
  > .\build-msvc\bin\Release\bench.exe
  Benchmark                     ,    Min(us)    ,    Avg(us)    ,    Max(us)

  ecdsa_verify                  ,    81.2       ,    90.6       ,   102.0
  ecdsa_sign                    ,    46.5       ,    48.6       ,    52.9
  ec_keygen                     ,    31.6       ,    34.8       ,    36.2
  ecdh                          ,    73.0       ,    76.4       ,    79.5
  schnorrsig_sign               ,    32.1       ,    34.4       ,    35.8
  schnorrsig_verify             ,    74.6       ,    76.2       ,    79.8
  ellswift_encode               ,    33.4       ,    34.0       ,    34.8
  ellswift_decode               ,    14.9       ,    15.5       ,    17.1
  ellswift_keygen               ,    64.5       ,    65.6       ,    67.1
  ellswift_ecdh                 ,    78.3       ,    80.7       ,    90.1
  ```

  - using clang-cl:
  ```
  > .\build-clangcl\bin\Release\bench.exe
  Benchmark                     ,    Min(us)    ,    Avg(us)    ,    Max(us)

  ecdsa_verify                  ,    40.3       ,    40.6       ,    40.9
  ecdsa_sign                    ,    30.6       ,    30.9       ,    31.3
  ec_keygen                     ,    21.2       ,    21.3       ,    21.5
  ecdh                          ,    41.5       ,    42.4       ,    44.8
  schnorrsig_sign               ,    22.5       ,    22.7       ,    22.8
  schnorrsig_verify             ,    41.2       ,    41.4       ,    41.7
  ellswift_encode               ,    20.3       ,    20.6       ,    20.8
  ellswift_decode               ,     8.50      ,     8.64      ,     8.76
  ellswift_keygen               ,    41.7       ,    42.0       ,    42.4
  ellswift_ecdh                 ,    45.1       ,    45.5       ,    46.3
  ```

ACKs for top commit:
  real-or-random:
    utACK 737912430d

Tree-SHA512: b0a4219cf24208e875a9757a490376af021dd3771911a670d80bb4979713bf1bbdbe206b8e121a3c4d1913c58f4b4593047410aa8104eff19aa3d3f359fd94af
2025-09-02 22:55:03 +02:00
merge-script
d93380fb35 Merge bitcoin-core/secp256k1#1731: schnorrsig: Securely clear buf containing k or its negation
325d65a8cf Rename and clear var containing k or -k (John Moffett)

Pull request description:

  Follow-up to #1579. `buf` still holds the nonce or its negation, so ought to be cleared.

ACKs for top commit:
  theStack:
    Code review re-ACK 325d65a8cf
  real-or-random:
    utACK 325d65a8cf

Tree-SHA512: a2fe39d7c44cebc0abe712828d521c2a7aba1db2d9dc5fc811dcaf96f1e45494dba5d7f016b6d9200ab523641ff62083686dbc942284e0f548183aaf60d8bfa2
2025-09-02 22:38:59 +02:00
merge-script
8113671f80 Merge bitcoin-core/secp256k1#1729: hash: Use size_t instead of int for RFC6979 outlen copy
960ba5f9c6 Use size_t instead of int for RFC6979 outlen copy (John Moffett)

Pull request description:

  If `outlen > INT_MAX` it results in segfault or hang (when `outlen` is a multiple of 2^32) on most implementations due to conversion in: `int now = outlen` producing negative values or zero. Unreachable in current code and highly improbable in future practice, but fits contract better and fixes a couple of compiler warnings.

ACKs for top commit:
  real-or-random:
    utACK 960ba5f9c6
  theStack:
    Code-review ACK 960ba5f9c6

Tree-SHA512: b91ee2fd3e962000f1b98a42e6f3c70cb3738c639fef8c2ce0cf53f49fe55da3e5d332eabbd8cbe9cdccb4e9c0ae70d3390a41f9468fd23ded3318596548c68f
2025-09-02 22:38:17 +02:00
John Moffett
325d65a8cf Rename and clear var containing k or -k
buf currently holds k or -k and isn't cleared, so clear it and rename to
nonce32 to clarify its sensitivity and match how it is named in the
corresponding ECDSA sign_inner.
2025-09-02 12:40:35 -04:00
John Moffett
960ba5f9c6 Use size_t instead of int for RFC6979 outlen copy
If outlen is > INT_MAX, could trigger segfault or hang after copy
int now = outlen.
2025-09-01 09:18:48 -04:00
Hennadii Stepanov
737912430d ci: Add more tests for clang-cl 2025-08-24 11:11:55 +01:00
Hennadii Stepanov
7379a5bed3 doc: Recommend clang-cl when building on Windows 2025-08-24 11:11:07 +01:00
merge-script
f36afb8b3d Merge bitcoin-core/secp256k1#1725: tests: refactor tagged hash verification
5153cf1c91 tests: refactor tagged hash tests (josibake)

Pull request description:

  Opened in response to https://github.com/bitcoin-core/secp256k1/pull/1698#discussion_r2269449070

  ---

  We use tagged hashes in `modules/musig`, `modules/schnorrsig`, `modules/ellswift`, and the proposed `modules/silentpayments`. In looking for inspiration on how to add tagged hash midstate verification for https://github.com/bitcoin-core/secp256k1/pull/1698, it seemed like a good opportunity to DRY up the code across all of the modules.

  I chose the convention used in the ellswift module as this seems the most idiomatic C. Since the tags are normally specified as strings in the BIPs, I also added a comment above each char array for convenience.

  If its deemed too invasive to refactor the existing modules in this PR, I'm happy to drop the refactor commits for the ellswift and schnorrsig modules. All I need for https://github.com/bitcoin-core/secp256k1/pull/1698 is the first commit which moves the utility function out of the musig module to make it available to use in the silent payments module.

ACKs for top commit:
  real-or-random:
    utACK 5153cf1c91 assuming CI passes
  theStack:
    Code-review ACK 5153cf1c91

Tree-SHA512: 335ec3ee6a265e13cc379968f8fa1624534bef2389e4e21b85e6a9572ce1bd9dee4eabd2cb6d187ac974db3ab8246c2626d309ccfbee5744c30cf7560d1e261c
2025-08-21 09:56:22 +02:00
josibake
5153cf1c91 tests: refactor tagged hash tests
Move the sha256_tag_test_internal function out of the musig module
into tests.c. This makes it available to other modules wishing to verify tagged
hashes without needing to duplicate the function.

Change the function signature to expect a const unsigned char and update
the tagged hash tests to use static const unsigned char character
arrays (where necessary).

Add a comment for each tag. This is done as a convenience for checking
the strings against the protocol specifications, where the tags are
normally specified as strings.

Update tests in the ellswift and schnorrsig modules to use the
sha256_tag_test_internal helper function.
2025-08-20 10:37:06 +01:00
merge-script
d2dcf52091 Merge bitcoin-core/secp256k1#1726: docs: fix broken link to Tromer's cache.pdf paper
489a43d1bf docs: fix broken link to eprint cache.pdf paper (VolodymyrBg)

Pull request description:

  - Updated outdated link (https://www.tau.ac.il/~tromer/papers/cache.pdf)
    to working link (https://cs-people.bu.edu/tromer/papers/cache.pdf).

ACKs for top commit:
  real-or-random:
    ACK 489a43d1bf

Tree-SHA512: 7f7dc0cbd72680025fbc75df545b36359162ca8c4ed26c4d23e9999d6ddc4a270e008718b71434ea85e7dc55cd0652a1557f1103268fd6ac5875d9861b3f3f64
2025-08-18 15:28:25 +02:00
VolodymyrBg
489a43d1bf docs: fix broken link to eprint cache.pdf paper 2025-08-18 12:19:08 +00:00
merge-script
d599714147 Merge bitcoin-core/secp256k1#1722: docs: Exclude modules' bench_impl.h headers from coverage report
0458def51e doc: Add `--gcov-ignore-parse-errors=all` option to `gcovr` invocations (Hennadii Stepanov)
1aecce5936 doc: Add `--merge-mode-functions=separate` option to `gcovr` invocations (Hennadii Stepanov)
106a7cbf41 doc: Exclude modules' `bench_impl.h` headers from coverage report (Hennadii Stepanov)
a9e955d3ea autotools, docs: Adjust help string for `--enable-coverage` option (Hennadii Stepanov)

Pull request description:

  Additionally, [this](https://github.com/bitcoin-core/secp256k1/pull/1113#discussion_r916977981) comment has been addressed.

ACKs for top commit:
  real-or-random:
    utACK 0458def51e
  josibake:
    ACK 0458def51e

Tree-SHA512: 23306435fa581bb492df92427bbb8dea1b6edabd71a79acd2e2c142af599639690e6b01e2453a0700a38ec78997bfc2b0f38b7cb0d5e5af9db12dd4cea271f34
2025-08-13 13:07:49 +02:00
Hennadii Stepanov
0458def51e doc: Add --gcov-ignore-parse-errors=all option to gcovr invocations
Otherwise, commands might fail due to bugs in the `gcov` tool.
2025-08-12 09:11:44 +01:00
Hennadii Stepanov
1aecce5936 doc: Add --merge-mode-functions=separate option to gcovr invocations
Otherwise, commands fail with the error:
```
Stderr of gcov was >><< End of stderr
Exception was >>Got function secp256k1_scalar_split_lambda on multiple lines: 67, 142.
	You can run gcovr with --merge-mode-functions=MERGE_MODE.
	The available values for MERGE_MODE are described in the documentation.<< End of stderr
```
2025-08-11 11:35:53 +01:00
Hennadii Stepanov
106a7cbf41 doc: Exclude modules' bench_impl.h headers from coverage report 2025-08-11 11:29:23 +01:00
Hennadii Stepanov
a9e955d3ea autotools, docs: Adjust help string for --enable-coverage option 2025-08-10 17:02:17 +01:00
merge-script
e523e4f90e Merge bitcoin-core/secp256k1#1720: chore(ci): Fix typo in Dockerfile comment
24ba8ff168 chore(ci): Fix typo in Dockerfile comment (Maximilian Hubert)

Pull request description:

  Corrects the spelling of "dpkg-dev" in a comment within the Dockerfile.

  The comment explains the reason for installing the `dpkg-dev` package..

ACKs for top commit:
  real-or-random:
    ACK 24ba8ff168

Tree-SHA512: 79742bcd8018f6435d1113a08e44bacca6027faa5171e564b6c6f9cc8a5630aac32f8f611d276ef50b7f03d842bc9228d368c99bdc816decf947d39956caed2c
2025-08-10 13:18:46 +02:00
Maximilian Hubert
24ba8ff168 chore(ci): Fix typo in Dockerfile comment 2025-08-09 23:51:04 +02:00
merge-script
74b8068c5d Merge bitcoin-core/secp256k1#1717: test: update wycheproof test vectors
c25c3c8a88 test: update wycheproof test vectors (josibake)

Pull request description:

  Pull in updated test vectors. This update is done as a follow-up to #1711.

ACKs for top commit:
  real-or-random:
    ACK c25c3c8a88

Tree-SHA512: 6f3b41460155a9f78d23711e471e73f732d3f6cdc2442f2f024540c04c3d4ab2ca376d4db020e99b093cd6a95c11f7dd3220f18727d62c4995a9a069d362406d
2025-08-01 07:54:32 +02:00
josibake
c25c3c8a88 test: update wycheproof test vectors
Pull in updated test vectors. This update is done as a follow-up to #1711.
2025-07-31 14:33:49 +01:00