BC
← All projectsBitcoin Core

libsecp256k1

High-assurance secp256k1 elliptic-curve library used throughout the Bitcoin ecosystem.

BitcoinCryptographic librariesNormal
Repository coverage

257 commits in the local evidence base

Every captured commit receives deterministic security triage and a separate communication-quality score. Security candidates and broader second-pass signals receive full-patch Ollama analysis.

85security candidates7second-pass queue215AI analyses
28commits · 30 days
53commits · 60 days
152commits · 180 days
206commits · 365 days
Backfill bands
Aug 5 → Feb 682 seen1 candidatesComplete
Feb 6 → Jun 625 seen2 candidatesComplete
Jun 6 → Jul 619 seen1 candidatesComplete
Jul 6 → Aug 548 seen1 candidatesComplete
Commit communication

Does the history explain itself?

Message quality measures whether a commit identifies its scope, purpose, rationale, testing, and supporting references. It does not change the security-severity score.

72/100 average clarity
100Strong · 80–100
89Adequate · 60–79
64Thin · 40–59
4Opaque · 0–39
Read the scoring rubric →
Developer activity

Who is changing the project?

Public Git author strings; identities are not independently verified.

DeveloperCommitsCandidatesAnalyzedHigh riskMessage avg.
merge-script482426193
Sebastian Falbesoner502145068
Hennadii Stepanov51746064
Tim Ruffing22622055
furszy13413087
josibake949066
Lőrinc13313077
kevkevinpal626064
Ferdinando Ametrano522074
John Moffett424069
copilot-swe-agent[bot]323074
Bruno Garcia322090
Analysis record

Published AI watches

Last scanned 48 minutes ago

Informational 21 AI analysisMessage 81 · Strong
BC Bitcoin Corelibsecp256k1 BitcoinCryptographic libraries

Merge bitcoin-core/secp256k1#1980: examples: randomize the context in musig, erase the keypair in schnorr

This change improves two example programs in the secp256k1 cryptographic library. It adds a recommended side-channel protection step to the multi-signature example (musig.c) and ensures the single-signature example (schnorr.c) also wipes a…

Context randomization added to protect against side-channel leakageSecret key material explicitly erased from keypair object after useChanges are confined to example code, not the core library
5959bed6by merge-script+14−12 files
No security note in commit
Low 36 AI analysisMessage 98 · Strong
BC Bitcoin Corelibsecp256k1 BitcoinCryptographic libraries

Merge bitcoin-core/secp256k1#1998: Avoid unsequenced accesses to volatile variables

This change fixes a subtle compiler-warning/undefined-behavior issue in the code that performs secret math inside Bitcoin's cryptographic library. The code uses 'volatile' variables to prevent the compiler from turning certain operations i…

Touches constant-time arithmetic paths (modular inversion normalization)Fixes undefined behavior involving volatile-qualified variablesCompiler warning (-Wunsequenced) treated as a correctness defect
a0e2e23aby merge-script+42−362 files
Vendor flagged security relevance
Low 32 AI analysisMessage 80 · Strong
BC Bitcoin Corelibsecp256k1 BitcoinCryptographic libraries

Avoid unsequenced accesses to volatile variables

This commit fixes a subtle C language rule violation in Bitcoin Core's libsecp256k1 cryptographic library. The code was reading a special 'volatile' variable multiple times within the same expression, which modern C standards treat as unde…

Undefined behavior in cryptographic constant-time codeCompiler warning (-Wunsequenced) in security-critical pathVolatile variable used as constant-time execution barrier
e7a34ba3by Hennadii Stepanov+20−142 files
No security note in commit
Informational 16 AI analysisMessage 100 · Strong
BC Bitcoin Corelibsecp256k1 BitcoinCryptographic libraries

Merge bitcoin-core/secp256k1#1898: tests: Silent Payments ctime test never reaches a match or label lookup

This commit fixes a flawed test in the libsecp256k1 cryptographic library. The test was supposed to exercise the Silent Payments constant-time scanning code, but due to a bug in how the test was written, it never actually verified that the…

Test-only change in ctime_tests.cFixes incorrect test key mutation that prevented matching outputAdds label callback to exercise label-candidate serialization/batching path
5d2ff536by merge-script+27−131 file
No security note in commit
Informational 15 AI analysisMessage 98 · Strong
BC Bitcoin Corelibsecp256k1 BitcoinCryptographic libraries

ci: Run the Wine jobs on ubuntu-24.04

This is a routine continuous-integration (CI) maintenance change. It pins a Windows cross-compilation test job to an older Ubuntu version because the newer GitHub-hosted runner image breaks Wine's networking syscalls. There is no change to…

ecfe7ab8by Ferdinando Ametrano+2−11 file
No security note in commit
Informational 23 AI analysisMessage 96 · Strong
BC Bitcoin Corelibsecp256k1 BitcoinCryptographic libraries

Merge bitcoin-core/secp256k1#1986: examples: exit with failure if signature verification fails

This change fixes two example programs so they return a failure code when a signature check fails. Previously, the examples always reported success even if verification failed, which meant automated tests would pass even when the underlyin…

Incorrect return status masked verification failures in example/test programsAutomated tests would pass despite cryptographic verification failingFix aligns ECDSA and Schnorr examples with existing MuSig example behavior
b97f7f5fby merge-script+2−22 files
No security note in commit
Informational 18 AI analysisMessage 88 · Strong
BC Bitcoin Corelibsecp256k1 BitcoinCryptographic libraries

examples: exit with failure if signature verification fails

This is a small hardening fix to two example programs. Previously, the example programs for ECDSA and Schnorr signatures would print whether a signature was valid but always report success to the operating system. Because the project's bui…

Test/example code silently succeeded on verification failureRegression-test gap for signature verification behaviorFix hardens CI/test signal without changing cryptographic logic
900613a7by Amartya Singh+2−22 files
No security note in commit
Low 35 AI analysisMessage 96 · Strong
BC Bitcoin Corelibsecp256k1 BitcoinCryptographic libraries

Merge bitcoin-core/secp256k1#1974: silentpayments: reject label tweaks that overflow the group order

This change fixes a silent handling problem in Bitcoin's silent payments feature. When a user-supplied label tweak value was larger than the cryptographic group order, the code previously reduced it silently, which could lead to incorrect …

silent modular reduction of attacker/caller-controlled scalarAPI misuse now rejected via ARG_CHECKsensitive scalar clearing before early return to avoid leaking transaction indistinguishability data
1c088b64by merge-script+13−22 files
Vendor flagged security relevance
High 76 AI analysisMessage 86 · Strong
BC Bitcoin Corelibsecp256k1 BitcoinCryptographic libraries

Merge bitcoin-core/secp256k1#1983: silentpayments: return 0 instead of `ARG_CHECK`ing for empty inputs/outputs

This update fixes a crash risk in Bitcoin's silent payments scanning code. Before the change, if a transaction had no suitable inputs or no taproot outputs, the library treated that as an illegal argument and could call abort(), killing th…

Denial-of-service vector: maliciously crafted transaction could trigger abort() in a scanning/indexing processAPI contract violation: documented return-0 behavior was not implemented for empty inputs/outputsARG_CHECK removal in two public silentpayments functions
a3a5cd45by merge-script+46−334 files
Vendor flagged security relevance
Low 30 AI analysisMessage 73 · Adequate
BC Bitcoin Corelibsecp256k1 BitcoinCryptographic libraries

silentpayments: allow NULL arrays in scan_outputs if n_tx_outputs is 0

This commit fixes a minor API usability issue in the experimental silent payments module. Previously, a function that scans transaction outputs for silent payments would crash if given empty arrays represented as NULL pointers, even though…

NULL pointer argument check relaxed for empty arraysSECP256K1_ARG_NONNULL attributes removed for two parametersNew API test verifying NULL-with-zero-length behavior
e7bb0112by Sebastian Falbesoner+18−113 files
No security note in commit
Moderate 60 AI analysisMessage 78 · Adequate
BC Bitcoin Corelibsecp256k1 BitcoinCryptographic libraries

silentpayments: return 0 instead of `ARG_CHECK`ing for empty inputs/outputs

This change fixes two functions in the Silent Payments module so they return a normal failure value (0) instead of triggering an internal abort when given a transaction with no eligible inputs or no taproot outputs. Previously, callers sca…

ARG_CHECK default behavior is abort(), turning an expected non-Silent-Payments transaction into a potential DoS crashAPI contract promised return 0 for non-Silent-Payments transactions, but implementation violated it for empty input/output edge casesCallers scanning blocks would need special-case handling before the fix to avoid crashes
d7821f4aby Sebastian Falbesoner+27−223 files
Vendor flagged security relevance
Low 31 AI analysisMessage 100 · Strong
BC Bitcoin Corelibsecp256k1 BitcoinCryptographic libraries

silentpayments: reject label tweaks that overflow the group order

This change tightens error handling in the silent payments scanning code. Previously, if a caller-supplied label tweak was as large as or larger than the elliptic curve group order, it was silently wrapped around (reduced modulo the order)…

silent reduction modulo group order replaced with explicit overflow rejectionsensitive scalars and shared secret explicitly cleared before aborting on invalid inputoutput assignment reordered to avoid partial state update on failure path
95552e16by Sebastian Falbesoner+13−22 files
No security note in commit
Informational 15 AI analysisMessage 35 · Opaque
BC Bitcoin Corelibsecp256k1 BitcoinCryptographic libraries

remove unused SECP256K1_GE_CONST_INFINITY

This commit simply deletes an unused macro named SECP256K1_GE_CONST_INFINITY from a header file. A macro is a shorthand definition for code, and this one was no longer referenced anywhere in the project. Removing dead code has no functiona…

7b59e1fcby fanquake+0−11 file
No security note in commit
Low 26 AI analysisMessage 100 · Strong
BC Bitcoin Corelibsecp256k1 BitcoinCryptographic libraries

Merge bitcoin-core/secp256k1#1929: silentpayments: perform tweak addition with actual scalars

This change simplifies how Silent Payments scanning adds a small tweak value to a secret-derived value. It replaces a function meant for secret-key tweaking with plain scalar (modular number) addition. The old code had a special case that …

Behavior change: zero-result tweak addition is no longer forced to zero; scalar addition allows zeroBehavior change: label tweaks >= group order N are no longer rejected by the secret-key APIRemoval of defensive comment explaining failure modes of secret-key tweak addition
04b91ce2by merge-script+7−161 file
No security note in commit
Informational 15 AI analysisMessage 86 · Strong
BC Bitcoin Corelibsecp256k1 BitcoinCryptographic libraries

Merge bitcoin-core/secp256k1#1963: doc: say the sha256 compression callback processes secrets

This commit only adds a documentation comment to a public header file. It reminds developers that a special callback function used for SHA256 hashing may receive secret data such as private keys, so any custom implementation must be consta…

31716e4bby merge-script+3−01 file
No security note in commit
Informational 18 AI analysisMessage 81 · Strong
BC Bitcoin Corelibsecp256k1 BitcoinCryptographic libraries

doc: say the sha256 compression callback processes secrets

This is a documentation-only change. It adds a warning to the public header file telling developers that the optional SHA256 compression callback may receive secret key material, and therefore any custom implementation must run in constant…

Documentation clarifies that a pluggable cryptographic callback receives secret materialDocumentation imposes constant-time and no-logging requirements on callback implementersReferences RFC 6979 nonce derivation as an example of secret-key processing
494d3053by Ferdinando Ametrano+3−01 file
Vendor flagged security relevance
Informational 15 AI analysisMessage 96 · Strong
BC Bitcoin Corelibsecp256k1 BitcoinCryptographic libraries

Merge bitcoin-core/secp256k1#1946: doc: clean up lingering ECMULT_WINDOW_SIZE comment

This is a documentation-only cleanup. It moves a comment about the ECMULT_WINDOW_SIZE setting to a better location and fixes an outdated formula in the comment. No code behavior changes.

6f065e9aby merge-script+10−112 files
No security note in commit
Low 37 AI analysisMessage 100 · Strong
BC Bitcoin Corelibsecp256k1 BitcoinCryptographic libraries

Merge bitcoin-core/secp256k1#1933: refactor: introduce `ecmult_const_ge` helper (preventing accidential gej leaks)

This commit is a defensive code cleanup in Bitcoin Core's secp256k1 cryptography library. It introduces a helper function that automatically clears temporary secret data after a constant-time elliptic curve multiplication, and switches exi…

Defensive refactoring to prevent accidental leakage of secret scalar information from Jacobian coordinatesNew helper enforces memory clearing of intermediate group element after constant-time scalar multiplicationAdoption in ECDH and silentpayments modules, which process secret keys
2365dc64by merge-script+35−427 files
Vendor flagged security relevance
Informational 15 AI analysisMessage 93 · Strong
BC Bitcoin Corelibsecp256k1 BitcoinCryptographic libraries

Merge bitcoin-core/secp256k1#1949: ecdsa: Clarify derivation of the r check in `_sig_verify`

This commit only rewrites comments in the source code to make the mathematical explanation clearer. It does not change any actual code instructions, function behavior, or security properties. There is no vulnerability or fix here.

4a264a93by merge-script+21−151 file
No security note in commit
Informational 12 AI analysisMessage 100 · Strong
BC Bitcoin Corelibsecp256k1 BitcoinCryptographic libraries

Merge bitcoin-core/secp256k1#1948: tests: add ECDSA verify case where r + n overflows p

This commit only adds a new test case to the project's test suite. It does not change any production cryptographic code. The new test verifies that the ECDSA signature verification function correctly rejects a crafted invalid signature in …

Adds test coverage for ECDSA verification edge case involving r + n overflow against field order pReferences a surviving mutant where the early-rejection check in secp256k1_ecdsa_sig_verify is removedDoes not modify production code; purely a test-suite enhancement
e23e9201by merge-script+28−01 file
No security note in commit
Repository ledger

Explore captured commits

Expand any commit for its author, full message, clarity score, changed files, triage signals, analysis, and source link.

Security candidateMerge bitcoin-core/secp256k1#1980: examples: randomize the context in musig, erase the keypair in schnorrby merge-script · 5959bed6 · Nov 21, 2026 · 2 filesMessage 81 · StrongInformational 21Details
Commit message · merge-script

Merge bitcoin-core/secp256k1#1980: examples: randomize the context in musig, erase the keypair in schnorr

608d12faa157e9185b843a2669d0f9e9a7554305 examples: randomize the context in musig, erase the keypair in schnorr (Ferdinando Ametrano)

Pull request description:

examples/musig.c is the only example that handles secret keys without
randomizing the context, which secp256k1.h highly recommends. Randomize
it as schnorr.c does.

schnorr.c erases the secret key buffer after use, but the keypair holds
a copy of the secret key and stayed on the stack. Erase it too.

ACKs for top commit:
theStack:
re-ACK 608d12faa157e9185b843a2669d0f9e9a7554305

Tree-SHA512: ec1de541687c121663469848ae82af02c2bd87f8b0a5037017ed1f8927f72a48ae8ddd76544aba66941b80ef35053fc232c8d7c4887541dbe6199fa3e05d5a13

81/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
Why it was queued
secret or key materialaccess controlmerge-commit duplicate discount
AI analysis · Informational 21/100

This change improves two example programs in the secp256k1 cryptographic library. It adds a recommended side-channel protection step to the multi-signature example (musig.c) and ensures the single-signature example (schnorr.c) also wipes a second copy of the secret key from memory. These are hardening fixes in demonstration code, not the library itself, so they do not directly fix an exploitable vulnerability in production use.

Security candidateMerge bitcoin-core/secp256k1#1998: Avoid unsequenced accesses to volatile variablesby merge-script · a0e2e23a · Nov 16, 2026 · 2 filesMessage 98 · StrongLow 36Details
Commit message · merge-script

Merge bitcoin-core/secp256k1#1998: Avoid unsequenced accesses to volatile variables

e7a34ba3ecee49421404994eeeeb0383f3e2fbbf Avoid unsequenced accesses to volatile variables (Hennadii Stepanov)
709e39c2fb2bcc36d8eda0b04c2d4669d6fd00b2 refactor: Prefix volatile variable names with "v" (Hennadii Stepanov)

Pull request description:

Since C11, if a side effect on a scalar object is unsequenced relative to another side effect on the same scalar object, the behavior is undefined (see https://en.cppreference.com/c/language/eval_order). Although this code targets C89, where the order of volatile reads is merely unspecified, this is exactly what happens with the volatile `cond_negate` in the master branch, because a read of such a variable is a side effect. Clang 24 [warns](https://github.com/llvm/llvm-project/pull/180955) about it with `-Wunsequenced` regardless of the language standard:
```console
$ cmake -B build -DCMAKE_C_COMPILER=clang-24
$ cmake --build build
[5/19] Building C object src/CMakeFiles/exhaustive_tests.dir/tests_exhaustive.c.o
In file included from /home/hebasto/dev/secp256k1/secp256k1/src/tests_exhaustive.c:23:
In file included from /home/hebasto/dev/secp256k1/secp256k1/src/secp256k1.c:27:
In file included from /home/hebasto/dev/secp256k1/secp256k1/src/field_impl.h:14:
In file included from /home/hebasto/dev/secp256k1/secp256k1/src/field_5x52_impl.h:13:
/home/hebasto/dev/secp256k1/secp256k1/src/modinv64_impl.h:116:31: warning: unsequenced accesses to volatile qualified 'cond_negate' [-Wunsequenced]
116 | r0 = (r0 ^ cond_negate) - cond_negate;
| ~~~~~~~~~~~ ^
/home/hebasto/dev/secp256k1/secp256k1/src/modinv64_impl.h:117:31: warning: unsequenced accesses to volatile qualified 'cond_negate' [-Wunsequenced]
117 | r1 = (r1 ^ cond_negate) - cond_negate;
| ~~~~~~~~~~~ ^
/home/hebasto/dev/secp256k1/secp256k1/src/modinv64_impl.h:118:31: warning: unsequenced accesses to volatile qualified 'cond_negate' [-Wunsequenced]
118 | r2 = (r2 ^ cond_negate) - cond_negate;
| ~~~~~~~~~~~ ^
/home/hebasto/dev/secp256k1/secp256k1/src/modinv64_impl.h:119:31: warning: unsequenced accesses to volatile qualified 'cond_negate' [-Wunsequenced]
119 | r3 = (r3 ^ cond_negate) - cond_negate;
| ~~~~~~~~~~~ ^
/home/hebasto/dev/secp256k1/secp256k1/src/modinv64_impl.h:120:31: warning: unsequenced accesses to volatile qualified 'cond_negate' [-Wunsequenced]
120 | r4 = (r4 ^ cond_negate) - cond_negate;
| ~~~~~~~~~~~ ^
5 warnings generated.
<snip>
```

Avoid such behavior by separating the access to a volatile variable, which still prevents compilers from generating branching, non-constant-time machine code, from the actual use of its value in expressions where the evaluation order is unspecified.

ACKs for top commit:
real-or-random:
utACK e7a34ba3ecee49421404994eeeeb0383f3e2fbbf
theStack:
re-ACK e7a34ba3ecee49421404994eeeeb0383f3e2fbbf

Tree-SHA512: eb047f0eab822322402024e883c154b7e4985cc6fe018ef347db39afdd3edf64f4885f28cffd0f2e7f975c646f662e82ffa2ac74f28bde90020cece8435abb6f

98/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
Why it was queued
constant-time or timing behaviormerge-commit duplicate discount
AI analysis · Low 36/100

This change fixes a subtle compiler-warning/undefined-behavior issue in the code that performs secret math inside Bitcoin's cryptographic library. The code uses 'volatile' variables to prevent the compiler from turning certain operations into branches that could leak secrets through timing. However, reading the same volatile variable twice in one expression (for example, '(x ^ v) - v') is technically undefined behavior in modern C and triggers a new Clang warning. The patch copies the volatile value into a regular variable first, then uses that value in the math. It is a defensive, correctness fix rather than a confirmed exploitable bug, but because it touches constant-time code paths it has security relevance.

Security candidateAvoid unsequenced accesses to volatile variablesby Hennadii Stepanov · e7a34ba3 · Nov 16, 2026 · 2 filesMessage 80 · StrongLow 32Details
Commit message · Hennadii Stepanov

Avoid unsequenced accesses to volatile variables

Since C11, if a side effect on a scalar object is unsequenced relative
to another side effect on the same scalar object, the behavior is
undefined. Although this code targets C89, where the order of volatile
reads is merely unspecified, this is exactly what happens with the
volatile `cond_negate` in the master branch, because a read of such a
variable is a side effect. Clang 24 warns about it with `-Wunsequenced`
regardless of the language standard.

Avoid such behavior by separating the access to a volatile variable,
which still prevents compilers from generating branching,
non-constant-time machine code, from the actual use of its value in
expressions where the evaluation order is unspecified.

80/100 · StrongMessage clarity
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode
Why it was queued
constant-time or timing behavior
AI analysis · Low 32/100

This commit fixes a subtle C language rule violation in Bitcoin Core's libsecp256k1 cryptographic library. The code was reading a special 'volatile' variable multiple times within the same expression, which modern C standards treat as undefined behavior. The fix copies the value to a regular variable first, then uses it. This is a defensive, code-correctness fix in a security-critical constant-time algorithm, but the commit itself does not demonstrate any actual exploit or real-world vulnerability.

Security candidateMerge bitcoin-core/secp256k1#1898: tests: Silent Payments ctime test never reaches a match or label lookupby merge-script · 5d2ff536 · Nov 16, 2026 · 1 fileMessage 100 · StrongInformational 16Details
Commit message · merge-script

Merge bitcoin-core/secp256k1#1898: tests: Silent Payments ctime test never reaches a match or label lookup

f391539a3b2d16059883dbd281bee33e1f995423 tests: cover Silent Payments label scanning (Lőrinc)
078f67f86bd07a25c2dbff2398965738f1f594ad tests: make Silent Payments ctime scan find output (Lőrinc)

Pull request description:

**Problem:** The constant-time test generates an output for one scan key, then mutates the key before scanning, so the scan cannot find it.
It also passes no label callback, so label-candidate serialization and batching never run.
The test still passes because it never checks the scan result.
Nothing verifies the match path, or that the label callback only receives public data, while the scan key is marked undefined.

**Fix:** Regenerate the output for the actual scan key, prepend a nonmatching output, and require one direct, unlabeled match.
Pass a label callback that verifies each serialized 33-byte candidate is defined and counts the misses.

ACKs for top commit:
fametrano:
ACK f391539a3b2d16059883dbd281bee33e1f995423
theStack:
re-ACK f391539a3b2d16059883dbd281bee33e1f995423

Tree-SHA512: 49b00182214cf910e94704c212750c3ba07de2ad33ea6ca0051e10dd5a6949b4825127574c439e61f07d81d88159cfc807e738b0bdc64a4ea8875f73e10a9aa4

100/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
Why it was queued
constant-time or timing behaviormerge-commit duplicate discount
AI analysis · Informational 16/100

This commit fixes a flawed test in the libsecp256k1 cryptographic library. The test was supposed to exercise the Silent Payments constant-time scanning code, but due to a bug in how the test was written, it never actually verified that the scanner found a matching output or exercised the label-lookup code path. The fix makes the test generate the output with the correct key, adds a non-matching output, supplies a label callback, and checks that exactly one unlabeled match is found. This is a test-only improvement; no production code behavior changes and no vulnerability is introduced or fixed in shipped software.

Security candidateci: Run the Wine jobs on ubuntu-24.04by Ferdinando Ametrano · ecfe7ab8 · Nov 13, 2026 · 1 fileMessage 98 · StrongInformational 15Details
Commit message · Ferdinando Ametrano

ci: Run the Wine jobs on ubuntu-24.04

ubuntu-latest now runs ubuntu-26.04, whose Docker 29.4.2 blocks the
socketcall syscall. Every test under Wine then fails with "wine:
socket : Function not implemented". Pin mingw_debian to ubuntu-24.04
until actions/runner-images#14790 is fixed, then revert this.

98/100 · StrongMessage clarity
✓ Descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
Why it was queued
access controldocumentation-only discount
AI analysis · Informational 15/100

This is a routine continuous-integration (CI) maintenance change. It pins a Windows cross-compilation test job to an older Ubuntu version because the newer GitHub-hosted runner image breaks Wine's networking syscalls. There is no change to cryptographic code, no change to how Bitcoin or libsecp256k1 behaves when built or run by users, and no security-relevant behavior change.

Security candidateMerge bitcoin-core/secp256k1#1986: examples: exit with failure if signature verification failsby merge-script · b97f7f5f · Nov 4, 2026 · 2 filesMessage 96 · StrongInformational 23Details
Commit message · merge-script

Merge bitcoin-core/secp256k1#1986: examples: exit with failure if signature verification fails

900613a742f8b08fe8ce2511488e777c235214c1 examples: exit with failure if signature verification fails (Amartya Singh)

Pull request description:

The ecdsa and schnorr examples print whether the signature verified, but return `EXIT_SUCCESS` either way. Both build systems run the examples as tests, so if verification broke, those test runs would still pass.

I checked this by flipping a byte of the signature (schnorr) and of the message hash (ecdsa) right before verification: both examples printed "Is the signature valid? false" and `ctest -R "example\.(schnorr|ecdsa)"` still reported them as passed. With this change the same experiment makes both tests fail.

This matches what the musig example already does when `secp256k1_schnorrsig_verify` fails. The return stays at the end of `main`, so the context destroy and secret key erasure still happen first.

ACKs for top commit:
real-or-random:
utACK 900613a742f8b08fe8ce2511488e777c235214c1 It will ultimately depend on the application how to handle an invalid sig but a) it's good to keep this in sync with the musig example, and b) the examples are supposed to generate valid sigs, so returning EXIT_FAILURE is better for testing the examples in CI

Tree-SHA512: 2c053adcde327cd20bd9447794ad0e8042618dd489b8640361ea5cfc6cf9760719e92bdd5700c7d3c280646b599ae7b1b8773dc45bbdc65a0da9c424703c1f84

96/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
Why it was queued
secret or key materialsigning boundarydefensive validationcryptography-sensitive pathmerge-commit duplicate discount
AI analysis · Informational 23/100

This change fixes two example programs so they return a failure code when a signature check fails. Previously, the examples always reported success even if verification failed, which meant automated tests would pass even when the underlying cryptographic code was broken. This is a test-quality and example-correctness fix, not a vulnerability in the library itself.

Security candidateexamples: exit with failure if signature verification failsby Amartya Singh · 900613a7 · Nov 3, 2026 · 2 filesMessage 88 · StrongInformational 18Details
Commit message · Amartya Singh

examples: exit with failure if signature verification fails

The ecdsa and schnorr examples print whether the signature is valid
but return EXIT_SUCCESS either way. Since the examples are run as tests
by both build systems, a regression that broke verification would go
unnoticed there. The musig example already fails in this case.

88/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Names security-relevant behavior explicitly
Why it was queued
signing boundarydefensive validationcryptography-sensitive path
AI analysis · Informational 18/100

This is a small hardening fix to two example programs. Previously, the example programs for ECDSA and Schnorr signatures would print whether a signature was valid but always report success to the operating system. Because the project's build systems run these examples as automated tests, a future bug that broke signature verification could have been hidden. Now the examples return a failure code when verification fails, so the test harness will notice.

Security candidateMerge bitcoin-core/secp256k1#1974: silentpayments: reject label tweaks that overflow the group orderby merge-script · 1c088b64 · Nov 3, 2026 · 2 filesMessage 96 · StrongLow 35Details
Commit message · merge-script

Merge bitcoin-core/secp256k1#1974: silentpayments: reject label tweaks that overflow the group order

95552e1654bfd3d34facfcf64e7ca3b0a52594c0 silentpayments: reject label tweaks that overflow the group order (Sebastian Falbesoner)

Pull request description:

Label tweaks returned by the `label_lookup` callback that overflow the group order were silently reduced. `recipient_label_create` never produces such tweaks, so an overflowing one means the caller's label cache is broken. As suggested in https://github.com/bitcoin-core/secp256k1/pull/1929#issuecomment-6310143782, this PR treats it as API misuse using `ARG_CHECK` (illegal callback, return 0), documents the requirement. It also adds a test and a changelog entry.

ACKs for top commit:
fametrano:
tACK 95552e1654bfd3d34facfcf64e7ca3b0a52594c0
real-or-random:
utACK 95552e1654bfd3d34facfcf64e7ca3b0a52594c0

Tree-SHA512: 3530e3887d4b3c1a7b083eb3e8c743d860499fb68f5395b2d5b04b7c13d1bab88bd1180517015d0f08e1b48c92dde68a5a367a808416d609ef5372742ed129a3

96/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
Why it was queued
memory safetymerge-commit duplicate discount
AI analysis · Low 35/100

This change fixes a silent handling problem in Bitcoin's silent payments feature. When a user-supplied label tweak value was larger than the cryptographic group order, the code previously reduced it silently, which could lead to incorrect payment scanning results. Now the code rejects such oversized values as API misuse. This is a defensive correctness fix rather than an active remote exploit.

Security candidateMerge bitcoin-core/secp256k1#1983: silentpayments: return 0 instead of `ARG_CHECK`ing for empty inputs/outputsby merge-script · a3a5cd45 · Nov 1, 2026 · 4 filesMessage 86 · StrongHigh 76Details
Commit message · merge-script

Merge bitcoin-core/secp256k1#1983: silentpayments: return 0 instead of `ARG_CHECK`ing for empty inputs/outputs

160590d1922914ddabe7c4d39fe14846b009212e changelog: mention silentpayments returning 0 for empty inputs/outputs (Sebastian Falbesoner)
e7bb01121ffbd2bd8ea66c1e09d2dbd287aabdf6 silentpayments: allow NULL arrays in scan_outputs if n_tx_outputs is 0 (Sebastian Falbesoner)
d7821f4adbe7d13925bf670a720618a52a890d6e silentpayments: return 0 instead of `ARG_CHECK`ing for empty inputs/outputs (Sebastian Falbesoner)

Pull request description:

`secp256k1_silentpayments_recipient_prevouts_summary_create` and `secp256k1_silentpayments_recipient_scan_outputs` treated a transaction with no eligible inputs, or no taproot outputs, as an illegal argument. With the default illegal callback, that calls abort().

That contradicts the API documentation. Both functions are documented to return 0 if the transaction is not a Silent Payments transaction, and a transaction with no eligible inputs or no taproot outputs is exactly that case. It also puts the burden on callers. Anyone scanning a block or building an index has to filter these transactions out before calling the library. If they forget, a transaction someone else created can crash their process.

This PR makes both functions return 0 in these cases:

- `prevouts_summary_create`: drops the `ARG_CHECK((n_pubkeys > 0) || (n_xonly_pubkeys > 0))`. With no public keys, the sum is the point at infinity, so the existing "sum is infinity" check already returns 0. No new code path is needed.
- `scan_outputs`: drops the `ARG_CHECK(n_tx_outputs > 0)`. It returns 0 after all other arguments have been validated and before the scan key is loaded. `*n_found_outputs` is still set to 0.
- `scan_outputs`: tx_outputs and found_outputs are now only checked for NULL if `n_tx_outputs > 0`, and their `SECP256K1_ARG_NONNULL` attributes are removed. This lets callers pass an empty array as NULL (e.g., data() of an empty std::vector). It matches how prevouts_summary_create and sender_create_outputs already treat empty key arrays (see the [previous "Fixed" entry in the CHANGELOG](https://github.com/bitcoin-core/secp256k1/blob/b88cbc7a65ab7629e13368c6c46468fc96d0d3da/CHANGELOG.md?plain=1#L11) added in PR #1932).

ACKs for top commit:
fametrano:
ACK 160590d1922914ddabe7c4d39fe14846b009212e
real-or-random:
utACK 160590d1922914ddabe7c4d39fe14846b009212e

Tree-SHA512: 5ae2f7515356ad4eb0d7499a3705f1e03dac8532e26601603d415d0ba4bc01410cdef4e123b5deecdd0b2f0b395d623c934fc1ce16a7f9d364f6108393be36dc

86/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
Why it was queued
defensive validationcryptography-sensitive pathmerge-commit duplicate discount
AI analysis · High 76/100

This update fixes a crash risk in Bitcoin's silent payments scanning code. Before the change, if a transaction had no suitable inputs or no taproot outputs, the library treated that as an illegal argument and could call abort(), killing the program. Now it calmly returns 0, matching its own documentation. This matters because a stranger could craft a transaction that crashes a wallet or indexing service that forgot to filter these cases first.

Security candidatesilentpayments: allow NULL arrays in scan_outputs if n_tx_outputs is 0by Sebastian Falbesoner · e7bb0112 · Oct 31, 2026 · 3 filesMessage 73 · AdequateLow 30Details
Commit message · Sebastian Falbesoner

silentpayments: allow NULL arrays in scan_outputs if n_tx_outputs is 0

Since the previous commit, scan_outputs accepts a transaction without
taproot outputs and returns 0. It still required tx_outputs and
found_outputs to be non-NULL, so a caller passing an empty array as
NULL (e.g., data() of an empty std::vector in C++) would still abort.

Neither array is dereferenced if n_tx_outputs is 0, so only check them
for NULL if n_tx_outputs > 0, and drop their SECP256K1_ARG_NONNULL
attributes. This matches how prevouts_summary_create and
sender_create_outputs treat empty key arrays.

73/100 · AdequateMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
Why it was queued
cryptography-sensitive path
AI analysis · Low 30/100

This commit fixes a minor API usability issue in the experimental silent payments module. Previously, a function that scans transaction outputs for silent payments would crash if given empty arrays represented as NULL pointers, even though it did not actually need to read any data. The change allows NULL pointers when the number of outputs is zero, matching how similar functions already behave. It is a defensive hardening fix rather than an active security vulnerability.

Security candidatesilentpayments: return 0 instead of `ARG_CHECK`ing for empty inputs/outputsby Sebastian Falbesoner · d7821f4a · Oct 31, 2026 · 3 filesMessage 78 · AdequateModerate 60Details
Commit message · Sebastian Falbesoner

silentpayments: return 0 instead of `ARG_CHECK`ing for empty inputs/outputs

secp256k1_silentpayments_recipient_prevouts_summary_create and
secp256k1_silentpayments_recipient_scan_outputs treated a transaction
without eligible inputs or without taproot outputs as an illegal
argument, which calls abort() by default. The API documentation says
they return 0 if the transaction is not a Silent Payments transaction,
and callers scanning a block would have to special-case such
transactions.

With no public keys, the sum in prevouts_summary_create is the point at
infinity, so the existing check already returns 0. scan_outputs returns
0 after argument validation and before the scan key is loaded.

Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-25O0CNV8.

78/100 · AdequateMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Names security-relevant behavior explicitly
Why it was queued
explicit security languagecryptography-sensitive path
AI analysis · Moderate 60/100

This change fixes two functions in the Silent Payments module so they return a normal failure value (0) instead of triggering an internal abort when given a transaction with no eligible inputs or no taproot outputs. Previously, callers scanning many transactions could have their program crash if they passed such a transaction to these functions. The patch aligns behavior with the documented API and prevents denial-of-service crashes in normal scanning workflows.

Security candidatesilentpayments: reject label tweaks that overflow the group orderby Sebastian Falbesoner · 95552e16 · Oct 22, 2026 · 2 filesMessage 100 · StrongLow 31Details
Commit message · Sebastian Falbesoner

silentpayments: reject label tweaks that overflow the group order

Previously, a label tweak returned by the `label_lookup` callback that
is not smaller than the group order was silently reduced modulo the
group order. Such a tweak can never be produced by
`secp256k1_silentpayments_recipient_label_create`, so it indicates a
corrupted or improperly constructed label cache, i.e., a bug on the
caller side rather than invalid data from an untrusted source. Treat
this as an API misuse (similar to the magic byte checks on the
`prevouts_summary` argument), and add a test.

The assignment of the found output is moved after the label tweak
check, so that the found_outputs[k] entry is left untouched if the
scan is aborted due to an invalid label tweak.

100/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Names security-relevant behavior explicitly
Why it was queued
memory safety
AI analysis · Low 31/100

This change tightens error handling in the silent payments scanning code. Previously, if a caller-supplied label tweak was as large as or larger than the elliptic curve group order, it was silently wrapped around (reduced modulo the order). Now the function rejects such tweaks and aborts scanning. The tweak value comes from a caller-provided callback/cache, not from untrusted network data, so this is treated as a caller bug rather than an externally exploitable vulnerability. The patch also ensures that if this rejection happens, sensitive intermediate values are cleared from memory and the output entry is not partially written.

Security candidateMerge bitcoin-core/secp256k1#1929: silentpayments: perform tweak addition with actual scalarsby merge-script · 04b91ce2 · Oct 12, 2026 · 1 fileMessage 100 · StrongLow 26Details
Commit message · merge-script

Merge bitcoin-core/secp256k1#1929: silentpayments: perform tweak addition with actual scalars

11e9c6ede7f0e68e42aa7cd018702bcf88e48ca8 silentpayments: perform tweak addition with actual scalars (Sebastian Falbesoner)

Pull request description:

When having a labeled match in the silentpayments scanning function (`_silentpayments_recipient_scan_outputs`), the addition of the [spending tweak (being t_k + label_tweak)](https://github.com/bitcoin/bips/blob/09e21036a4001fe6c9ba65c1d3a39b737768132f/bip-0352.mediawiki?plain=1#L367) is currently done using the secret key tweaking function `secp256k1_ec_seckey_tweak_add`. This, and the long comment explaining why this call could fail, stem from what I'd argue is ultimately a type mismatch: a tweak is not a secret key, and the value 0, both for individual tweaks and for the result, is just fine for additive tweaking. Simplify by just using scalar addition instead, so the long comment and the branch can be removed.

There is one subtle behavior change in the case a label tweak is returned from the label cache that is overflowing (i.e. larger than or equal than the group order N). As this is an user error, I'd argue that the concrete tweak output doesn't matter in this case. If anything, we should consider if we return 0 in this case to indicate that the user did something wrong (though I don't think it's needed).

ACKs for top commit:
Yudis-bit:
Tested ACK 11e9c6e.
nymius:
ACK 11e9c6ede7f0e68e42aa7cd018702bcf88e48ca8

Tree-SHA512: 7a53bee44e405ae5bec3c6fdb21d1ad5929a5794779036f1a057140f679ef23c7660d2ac8b6ff12f398a233de36967464004ea425c3d233dfacca8cd12b081cb

100/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
Why it was queued
secret or key materialmemory safetymerge-commit duplicate discount
AI analysis · Low 26/100

This change simplifies how Silent Payments scanning adds a small tweak value to a secret-derived value. It replaces a function meant for secret-key tweaking with plain scalar (modular number) addition. The old code had a special case that set the result to zero if the addition 'failed' (produced zero). The new code no longer does that, and it also no longer rejects malformed tweak values larger than the group order. The commit author treats these as user errors with no meaningful security difference, but the behavior does change subtly.

Security candidateMerge bitcoin-core/secp256k1#1963: doc: say the sha256 compression callback processes secretsby merge-script · 31716e4b · Oct 12, 2026 · 1 fileMessage 86 · StrongInformational 15Details
Commit message · merge-script

Merge bitcoin-core/secp256k1#1963: doc: say the sha256 compression callback processes secrets

494d3053c0cb4d28c7015a088f8c6270063fd017 doc: say the sha256 compression callback processes secrets (Ferdinando Ametrano)

Pull request description:

As agreed in #1958, this notes in the header that the callback sees secrets such as secret keys, so it must run in constant time and must not keep or log its input.

Fixes #1958.

*Assisted-by: my usual tools (LLM, Internet, computer). Mistakes are mine.*

ACKs for top commit:
real-or-random:
ACK 494d3053c0cb4d28c7015a088f8c6270063fd017
furszy:
utACK 494d3053c0cb4d28c7015a088f8c6270063fd017
theStack:
ACK 494d3053c0cb4d28c7015a088f8c6270063fd017

Tree-SHA512: 90f14ab91bdf1f9f30aea67afe3eed561726312ec046728be08856065bb8bdb6b1c83efe84ea5af450c6339666fd749ca596e68867feffee3e157d6e50fff897

86/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
Why it was queued
secret or key materialconstant-time or timing behaviorcryptography-sensitive pathmerge-commit duplicate discount
AI analysis · Informational 15/100

This commit only adds a documentation comment to a public header file. It reminds developers that a special callback function used for SHA256 hashing may receive secret data such as private keys, so any custom implementation must be constant-time and must not leak or store the input. No code behavior was changed.

Security candidatedoc: say the sha256 compression callback processes secretsby Ferdinando Ametrano · 494d3053 · Oct 12, 2026 · 1 fileMessage 81 · StrongInformational 18Details
Commit message · Ferdinando Ametrano

doc: say the sha256 compression callback processes secrets

The function set by secp256k1_context_set_sha256_compression hashes
secret keys, for example when deriving RFC 6979 nonces. Say so, and
require it to run in constant time and not to keep or log its input.

Fixes #1958.

Assisted-by: my usual tools (LLM, Internet, computer). Mistakes are mine.
Signed-off-by: Ferdinando Ametrano <ferdinando@ametrano.net>

81/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
Why it was queued
secret or key materialconstant-time or timing behaviorcryptography-sensitive path
AI analysis · Informational 18/100

This is a documentation-only change. It adds a warning to the public header file telling developers that the optional SHA256 compression callback may receive secret key material, and therefore any custom implementation must run in constant time and must not retain or log its input. The change itself does not alter any code behavior, fix a bug, or add a security control. It only clarifies a security requirement that was already implicit in the API design.

Security candidateMerge bitcoin-core/secp256k1#1946: doc: clean up lingering ECMULT_WINDOW_SIZE commentby merge-script · 6f065e9a · Oct 1, 2026 · 2 filesMessage 96 · StrongInformational 15Details
Commit message · merge-script

Merge bitcoin-core/secp256k1#1946: doc: clean up lingering ECMULT_WINDOW_SIZE comment

685247a3817cdb932fa21c785c64a60bc0e9f135 doc: correct ecmult table storage size (Yudistira Putra)
cc0e03ffd4ddfce3663dc807a10cc4e3d0132d79 doc: clean up lingering ECMULT_WINDOW_SIZE comment (Yudistira Putra)

Pull request description:

Move the `ECMULT_WINDOW_SIZE` comment from under `WINDOW_A` in `src/ecmult_impl.h` to the window-size setting in `src/ecmult.h`, and replace the stale `WINDOW_G` references.

The second commit corrects the table-size formula to `ECMULT_TABLE_SIZE(ECMULT_WINDOW_SIZE) * 64` bytes. A comment above it points to the existing `STATIC_ASSERT` in `group_impl.h` that guarantees the storage size. The macro can only be used inside functions.

Tested on Windows x64 with GCC 16.2.0, C90, `-Werror -pedantic-errors`, and all modules enabled. All 237 CTest tests passed, including exhaustive tests and examples.

Closes #1766.

ACKs for top commit:
real-or-random:
ACK 685247a3817cdb932fa21c785c64a60bc0e9f135
theStack:
ACK 685247a3817cdb932fa21c785c64a60bc0e9f135

Tree-SHA512: e54dc1cd9f27da491d3ab60a1b1265f4e30397528e7146c04e608616badc6ad3c3b88f1e67f37d42d124feea8f36a3ed8bcf9f199d0289b5dd75bbbcec42eccf

96/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
Why it was queued
access controlmerge-commit duplicate discount
AI analysis · Informational 15/100

This is a documentation-only cleanup. It moves a comment about the ECMULT_WINDOW_SIZE setting to a better location and fixes an outdated formula in the comment. No code behavior changes.

Security candidateMerge bitcoin-core/secp256k1#1933: refactor: introduce `ecmult_const_ge` helper (preventing accidential gej leaks)by merge-script · 2365dc64 · Oct 1, 2026 · 7 filesMessage 100 · StrongLow 37Details
Commit message · merge-script

Merge bitcoin-core/secp256k1#1933: refactor: introduce `ecmult_const_ge` helper (preventing accidential gej leaks)

02e00f54a0e0ac72c74eb4f5b84855b290bba124 test: refactor: simplify tests by using `_ecmult_const_ge` helper (Sebastian Falbesoner)
b4fbee61e91d30aedbe0e84f407393e0c27c8c55 refactor: rename `_ecmult_const` -> `_ecmult_const_gej` for consistency (Sebastian Falbesoner)
ace566f66c1b75d929c367612abf22944d81fb8e refactor: introduce `_ecmult_const_ge` helper (preventing accidental gej leaks) (Sebastian Falbesoner)

Pull request description:

This PR is the counterpart of #1861 for `_ecmult_const`: constant-time scalar multiplication with arbitrary points frequently involves a conversion to affine coordinates and clearing out the temporary Jacobian group element object after to avoid leaking secret key material, i.e. executing the following three functions:
* `secp256k1_ecmult_const(&rj, ...)`
* `secp256k1_ge_set_gej(&r, &rj)`
* `secp256k1_gej_clear(&rj)`

A helper `ecmult_const_ge` is introduced to deduplicate code and mitigate the risk that the last step is forgotten (which can easily happen, as it would not be detected by tests). It is applied in the ECDH and silentpayments modules.

The idea came up in the course of reviewing the DLEQ module, where a gej clearing was missing, see https://github.com/bitcoin-core/secp256k1/pull/1802#discussion_r3960829657.

ACKs for top commit:
real-or-random:
utACK 02e00f54a0e0ac72c74eb4f5b84855b290bba124

Tree-SHA512: dadfbace89875d50c331170738ebc413516a01d8b05a1e75a3d9c10ade194772633920a3ea0592c4b709cfb78b86a3bc72806e3f06f3ba5567a42e17ae1e2309

100/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
Why it was queued
secret or key materialconstant-time or timing behaviormerge-commit duplicate discount
AI analysis · Low 37/100

This commit is a defensive code cleanup in Bitcoin Core's secp256k1 cryptography library. It introduces a helper function that automatically clears temporary secret data after a constant-time elliptic curve multiplication, and switches existing code to use it. The change prevents future mistakes where sensitive intermediate values could be left in memory, but the commit itself does not claim to fix an active vulnerability in the current code.

Security candidateMerge bitcoin-core/secp256k1#1949: ecdsa: Clarify derivation of the r check in `_sig_verify`by merge-script · 4a264a93 · Sep 30, 2026 · 1 fileMessage 93 · StrongInformational 15Details
Commit message · merge-script

Merge bitcoin-core/secp256k1#1949: ecdsa: Clarify derivation of the r check in `_sig_verify`

93987567a1bf2bb5d3ea1492c286cd2b5a76f544 ecdsa: Clarify derivation of the r check in `_sig_verify` (Tim Ruffing)

Pull request description:

Introduce the `xr + n < p` condition in the step where it is needed, namely right before switching from integer equality to equality modulo p, and explain why it is required there. Write congruences as `a == b (mod m)`, because `a mod p == b` reads as if `mod p` were an operator applied to the left-hand side only.

Also reword the comment at the `p - n` check: the check is needed for correctness, not merely an optimization.

Made these improvements when trying to understand the background of #1948.

ACKs for top commit:
theStack:
re-ACK 93987567a1bf2bb5d3ea1492c286cd2b5a76f544

Tree-SHA512: 162508706fdb3c912c71de5935f276f24ed31c62620eee513896c4058327a697f3c9f9250634d65bcd1687a716f0347e8775b3382dade5ea77ede17759e70ad4

93/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Links an issue, advisory, or supporting reference
Why it was queued
cryptography-sensitive pathmerge-commit duplicate discount
AI analysis · Informational 15/100

This commit only rewrites comments in the source code to make the mathematical explanation clearer. It does not change any actual code instructions, function behavior, or security properties. There is no vulnerability or fix here.

Security candidateMerge bitcoin-core/secp256k1#1948: tests: add ECDSA verify case where r + n overflows pby merge-script · e23e9201 · Sep 30, 2026 · 1 fileMessage 100 · StrongInformational 12Details
Commit message · merge-script

Merge bitcoin-core/secp256k1#1948: tests: add ECDSA verify case where r + n overflows p

fc88acc3e2e2cbba7ee202634eb73d5d21694126 tests: add ECDSA verify case where r + n overflows p (ViniciusCestarii)

Pull request description:

Currently no test checks that ECDSA verify rejects a signature where r + n ≥ p and (r + n) mod p equals x(R), so the following mutant lives:

```diff
diff --git a/src/ecdsa_impl.h b/src/ecdsa_impl.h
index 5963877..5301eaa 100644
--- a/src/ecdsa_impl.h
+++ b/src/ecdsa_impl.h
@@ -258,10 +258,6 @@ static int secp256k1_ecdsa_sig_verify(const secp256k1_scalar *sigr, const secp25
/* xr * pr.z^2 mod p == pr.x, so the signature is valid. */
return 1;
}
- if (secp256k1_fe_cmp_var(&xr, &secp256k1_ecdsa_const_p_minus_order) >= 0) {
- /* xr + n >= p, so we can skip testing the second case. */
- return 0;
- }
secp256k1_fe_add(&xr, &secp256k1_ecdsa_const_order_as_fe);
if (secp256k1_gej_eq_x_var(&xr, &pr)) {
/* (xr + n) * pr.z^2 mod p == pr.x, so the signature is valid. */
```

This adds a case with r = p - n + 1, so that (r + n) mod p = 1, and a pubkey chosen so that x(R) = 1, covering this gap.

ACKs for top commit:
real-or-random:
utACK fc88acc3e2e2cbba7ee202634eb73d5d21694126
theStack:
re-ACK fc88acc3e2e2cbba7ee202634eb73d5d21694126

Tree-SHA512: b9ab5ff0e7312e3ff8b5667eed56f616f7fc59ad8d1777fd54d70fcb3342b5084dc8915c0638a6486fdfe4522da5905521dd32622a64d5a2b5d0a3385e381098

100/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
Why it was queued
signing boundarymemory safetymerge-commit duplicate discount
AI analysis · Informational 12/100

This commit only adds a new test case to the project's test suite. It does not change any production cryptographic code. The new test verifies that the ECDSA signature verification function correctly rejects a crafted invalid signature in a rare edge case where a mathematical overflow condition occurs. It closes a testing gap that could otherwise allow a subtle code mutation to go undetected, but it is not a security fix by itself.

Security candidatetests: add ECDSA verify case where r + n overflows pby ViniciusCestarii · fc88acc3 · Sep 30, 2026 · 1 fileMessage 60 · AdequateInformational 20Details
Commit message · ViniciusCestarii

tests: add ECDSA verify case where r + n overflows p

60/100 · AdequateMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Mentions testing or verification! No meaningful explanatory body
Why it was queued
memory safety
AI analysis · Informational 20/100

This commit adds a new test case to the secp256k1 cryptographic library's test suite. It checks that ECDSA signature verification correctly rejects a crafted edge case where a mathematical value (r + n) overflows the prime field boundary. The change only adds tests; it does not modify the verification logic itself, so it is not a fix for a known vulnerability but rather a regression test for a subtle boundary condition.

Security candidateMerge bitcoin-core/secp256k1#1947: musig: test nonce_gen_counter with random countersby merge-script · 2b4a7b90 · Sep 29, 2026 · 1 fileMessage 100 · StrongInformational 12Details
Commit message · merge-script

Merge bitcoin-core/secp256k1#1947: musig: test nonce_gen_counter with random counters

b819a790f06122d5a53c0320e79c0dc486349fbd musig: test nonce_gen_counter with random counters (ViniciusCestarii)

Pull request description:

The only output check of `nonce_gen_counter` uses `nonrepeating_cnt = 0`, so the following mutant replacing `secp256k1_write_be64` with `secp256k1_write_be32` (which could enable nonce reuse) survived because zero serializes the same either way.

```diff
diff --git a/src/modules/musig/session_impl.h b/src/modules/musig/session_impl.h
index d8a3cca..710c4c5 100644
--- a/src/modules/musig/session_impl.h
+++ b/src/modules/musig/session_impl.h
@@ -447,7 +447,7 @@ int secp256k1_musig_nonce_gen_counter(const secp256k1_context* ctx, secp256k1_mu
memset(secnonce, 0, sizeof(*secnonce));
ARG_CHECK(keypair != NULL);

- secp256k1_write_be64(buf, nonrepeating_cnt);
+ secp256k1_write_be32(buf, nonrepeating_cnt);
/* keypair_sec and keypair_pub do not fail if the arguments are not NULL */
ret = secp256k1_keypair_sec(ctx, seckey, keypair);
VERIFY_CHECK(ret);
```

This add a new test, which checks that for random 64-bit counters, `nonce_gen_counter` gives the same nonce as `nonce_gen`.

ACKs for top commit:
real-or-random:
utACK b819a790f06122d5a53c0320e79c0dc486349fbd

Tree-SHA512: 1f16375880808eacea1f4db9931f345f2f1b44a2724d61710beb5e39e956d4f28bd6707c90b8300f033282bee207fd2f44c039cb01ef0675858d415ad6ea2978

100/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
Why it was queued
nonce handlingmerge-commit duplicate discount
AI analysis · Informational 12/100

This commit only adds a new test to the MuSig cryptographic module. It does not change any production code. The new test verifies that two different nonce-generation functions produce matching results when given equivalent random 64-bit counters. The pull request description mentions a hypothetical mutation (replacing a 64-bit write with a 32-bit write) that could survive testing if only zero-valued counters were used, but that mutation is not present in the code and is only described as motivation for stronger testing.

Security candidateMerge bitcoin-core/secp256k1#1918: refactor: split `ge_parse` into explicit variants (compressed, uncompressed, uncompressed+hybrid)by merge-script · 46db7871 · Sep 11, 2026 · 6 filesMessage 100 · StrongInformational 15Details
Commit message · merge-script

Merge bitcoin-core/secp256k1#1918: refactor: split `ge_parse` into explicit variants (compressed, uncompressed, uncompressed+hybrid)

de02108c51ca052245c7ba154b02a890e6815fdb tests: cover compressed pubkey parsing/serialization in `_ec_pubkey_parse` test (Sebastian Falbesoner)
31b1b300e812038e5b52f534370f7bd0cae01a79 refactor: split `ge_parse` helper into explicit variants (Sebastian Falbesoner)

Pull request description:

This PR is a follow-up to #1915, see the suggestion https://github.com/bitcoin-core/secp256k1/pull/1915#pullrequestreview-4962713401.

Splits the `ge_parse` function into three explicit variants for parsing from:
- compressed public keys (33-bytes, prefixes 0x02 or 0x03)
- uncompressed public keys (65-bytes, prefix 0x04)
- uncompressed and hybrid public keys (65-bytes, prefixes 0x04, 0x06 or 0x07)

The first two are the counter-parts for the existing serialization functions `ge_serialize{33,65}`. The latter one is only needed for legacy reasons and likely not needed in the future. Having it named explicitly helps to avoid accepting hybrid pubkeys unintentionally. `ge_parse65` is currently unused outside of tests, but one potential use-case would be the serialization of the prevouts_summary in the silentpayments light-client API PR #1912 (see commit https://github.com/bitcoin-core/secp256k1/pull/1912/changes/82b95fde6fe2c75ec940ade339013939b8ecc5ea), unless we want to define a custom serialization there (where we e.g. remove the constant prefix byte).

ACKs for top commit:
fjahr:
Code review ACK de02108c51ca052245c7ba154b02a890e6815fdb
real-or-random:
utACK de02108c51ca052245c7ba154b02a890e6815fdb

Tree-SHA512: 8bc92f6f53eb5ce3546ecf0a1fa72a909ee6231a08e25a3a9f4070e7d630379fc3e5b2f9bc6dea25726b7d9c97c2cfd8ee39be413328c4159134ec55ec1a59c6

100/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
Why it was queued
cryptography-sensitive pathmerge-commit duplicate discount
AI analysis · Informational 15/100

This commit is a code cleanup (refactor) that splits one internal public-key parsing helper into three clearly named versions. It does not change what keys the public API accepts or rejects, and it adds more tests. There is no security vulnerability being fixed here.

Security candidateMerge bitcoin-core/secp256k1#1893: test: cover schnorrsig_sign_custom in constant-time testsby merge-script · 99ae2312 · Sep 9, 2026 · 1 fileMessage 96 · StrongInformational 15Details
Commit message · merge-script

Merge bitcoin-core/secp256k1#1893: test: cover schnorrsig_sign_custom in constant-time tests

38255a943f09831c7615bad854e9b827f6c994fa test: cover custom Schnorr nonce callback in ctime tests (Yudistira Putra)
2a3780d73ffcceda5fa113b5a6ca38fb236ca51b test: cover schnorrsig_sign_custom in constant-time tests (Yudistira Putra)

Pull request description:

### Description

`src/ctime_tests.c` covers `secp256k1_schnorrsig_sign32` and `secp256k1_schnorrsig_sign_custom` entry points under Valgrind/CHECKMEM.

`secp256k1_schnorrsig_sign_custom` accepts optional `extraparams`, including a custom nonce function, before calling the shared internal signer. Functional tests cover this API, but previously it was not exercised under the constant-time CHECKMEM harness.

This PR adds coverage for:

- `secp256k1_schnorrsig_sign_custom(..., NULL)` using the default nonce path with NULL extraparams.
- The default BIP340 nonce function with non-NULL `extraparams.ndata`.
- The custom nonce callback dispatch path via a distinct `nonce_function_custom` callback that delegates to `secp256k1_nonce_function_bip340`.
- Secret key material and keypair state under CHECKMEM for these signing paths.

Message and auxiliary data are not treated as secret inputs in these tests.

### Coverage gap

The existing constant-time test suite exercised `secp256k1_schnorrsig_sign32`, but did not exercise the public `secp256k1_schnorrsig_sign_custom` entry point and its custom nonce callback dispatch path under CHECKMEM.

Local synthetic mutations were used during development to verify that the added coverage reaches these paths. These mutations are not included in this branch.

This is a test-coverage improvement. No production cryptographic code is modified, and this PR does not claim a production vulnerability in unmodified libsecp256k1.

### Change

- `src/ctime_tests.c` only
- No production code changes
- No new dependencies

### Build / test

```sh
cmake -B build \
-DSECP256K1_VALGRIND=ON \
-DSECP256K1_BUILD_CTIME_TESTS=ON \
-DSECP256K1_ENABLE_MODULE_SCHNORRSIG=ON \
-DSECP256K1_ENABLE_MODULE_EXTRAKEYS=ON

cmake --build build --parallel
ctest --test-dir build --output-on-failure
valgrind --error-exitcode=42 ./build/bin/ctime_tests
```

Local validation after addressing review feedback:

- 207/207 CTest tests passed.
- `ctime_tests` passed under Valgrind.
- Valgrind reported `ERROR SUMMARY: 0 errors`.
- Valgrind process exited with code 0.

ACKs for top commit:
real-or-random:
utACK 38255a943f09831c7615bad854e9b827f6c994fa

Tree-SHA512: d53655ddebe1444c004cb256e0c68cbf14d7741f67ebcec36eb860af2d27320abba0ab8c0ef04a6c7753ad0b5de49f79bd3c425695c7aebebb32d72f3152c99b

96/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
Why it was queued
explicit security languagesecret or key materialsigning boundaryconstant-time or timing behaviormerge-commit duplicate discount
AI analysis · Informational 15/100

This commit only adds new test code to check that a specific Schnorr signing function behaves in a constant-time manner under Valgrind. It does not change any production cryptographic code, so it cannot introduce or fix a security vulnerability in the library itself. It is a test-coverage improvement.

Security candidateMerge bitcoin-core/secp256k1#1923: group: VERIFY input/output ge/gej/fe exhaustivelyby merge-script · a7f26437 · Sep 9, 2026 · 2 filesMessage 100 · StrongInformational 14Details
Commit message · merge-script

Merge bitcoin-core/secp256k1#1923: group: VERIFY input/output ge/gej/fe exhaustively

c36269ef95da99498b3b62736f09dc42ffe5d094 group/refactor: Use constant expression for readability (Tim Ruffing)
031dbae6591664cf321bd9b09dd12535a5087533 group: Export secp256k1_ge_set_ge(j)_zinv properly in group.h (Tim Ruffing)
4f3bd158d5edd69cc66f39f20c42c72c776fa2d4 group: Cover all input/output ge/gej/fe with VERIFY calls (Tim Ruffing)
0711443e6da39cc98660fbeef3f989935443caa6 group: Add missing FE_VERIFY checks on rzr outputs (Tim Ruffing)
1bd7492181aca5967bbc690a4b81560101b1408b group: Remove redundant SECP256K1_GEJ_VERIFY (Tim Ruffing)
cddd125f72f6156b360edb760d4ae089c3ae7a0f group: Split functions into pre/post VERIFY and _impl (Tim Ruffing)

Pull request description:

This PR splits the functions in group_impl.h in a wrapper that only performs VERIFY and an `_impl` function that has the actual code. This ensures that the post VERIFY calls are not skipped in case of early returns.

Also, this PR adds VERIFY calls wherever they were missing (inside group_impl.h)

The new structure is similar to field_impl.h but a bit simpler because we don't need to deal with two different implementations. A real difference is that, in non-VERIFY mode, field_impl.h delegates via #defines (ensure there's no overhead due to a function call) and here I decided to delegate via function calls. It keeps the code a bit simpler to read (and maybe also simpler to parser for tools such as language servers). The _impl functions all have SECP256K1_INLINE. I think every sane compiler will inline the function calls in non-VERIFY mode (even without SECP256K1_INLINE) because the body of the wrapper is really just a single function call then with the same signature.

Follow-up PR can cover modifications of ges and fes outside the group and field modules, e.g., ecmult modifies ges/gejs directly. Maybe it will be good that it does this only through group functions but we'll need to see; in C++ this module could legitimately be considered a "friend" of group.

ACKs for top commit:
theStack:
ACK c36269ef95da99498b3b62736f09dc42ffe5d094

Tree-SHA512: 7b5a74de1823434037ba0cf84f0e3a8aba56479da508014b8a4c738dd55c5a437edce5255cb45bf067a437bbf3912bc0f6c4c558dda589b0c2dc4dd6b2a0ed06

100/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
Why it was queued
signing boundarymerge-commit duplicate discount
AI analysis · Informational 14/100

This commit is a code-quality and defensive-programming change. It restructures internal elliptic-curve helper functions so that runtime consistency checks (VERIFY macros) wrap the real implementation and cannot be skipped by an early 'return' statement. It also adds a few missing checks. These VERIFY macros are debug/test-only assertions; they are disabled in production builds, so the change does not alter normal behavior and is not a security fix for a live vulnerability.

Security candidateMerge bitcoin-core/secp256k1#1928: tests: add coverage for exact-size DER signature serializationby merge-script · aa0af2fa · Sep 7, 2026 · 1 fileMessage 96 · StrongInformational 15Details
Commit message · merge-script

Merge bitcoin-core/secp256k1#1928: tests: add coverage for exact-size DER signature serialization

500ccb60f70550332adf6b6f894ce84659cd6831 tests: add coverage for exact-size DER signature serialization (Bruno Garcia)

Pull request description:

The existing tests only serialize into oversized buffers or one that is far too small, so the boundary case where the output buffer is exactly the required size was untested. Check that this succeeds with identical output, and that one byte less fails while reporting the required size.

Kills the following mutant (https://secp256k1.space/src/ecdsa_impl.h#1141):
```diff
diff --git a/src/ecdsa_impl.h b/src/ecdsa_impl.h
index 5963877..499fe03 100644
--- a/src/ecdsa_impl.h
+++ b/src/ecdsa_impl.h
@@ -176,7 +176,7 @@ static int secp256k1_ecdsa_sig_serialize(unsigned char *sig, size_t *size, const
secp256k1_scalar_get_b32(&s[1], as);
while (lenR > 1 && rp[0] == 0 && rp[1] < 0x80) { lenR--; rp++; }
while (lenS > 1 && sp[0] == 0 && sp[1] < 0x80) { lenS--; sp++; }
- if (*size < 6+lenS+lenR) {
+ if (*size <= 6+lenS+lenR) {
*size = 6 + lenS + lenR;
return 0;
}
```

ACKs for top commit:
real-or-random:
utACK 500ccb60f70550332adf6b6f894ce84659cd6831
theStack:
ACK 500ccb60f70550332adf6b6f894ce84659cd6831

Tree-SHA512: 8ac002a9e67729f5cb09a9ba8244e926e81898abb273ae4f43a13ccf981322e434caee06d27dcae9b840e0b850908c2281399d48a444319bcc11a0af82bb52a3

96/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
Why it was queued
signing boundarymerge-commit duplicate discount
AI analysis · Informational 15/100

This commit only adds new test code to check that a specific function behaves correctly when given a buffer of exactly the right size. It does not change any production code, fix a bug, or introduce a vulnerability. It is a routine improvement to the test suite.