AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 26 Bitcoin

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

Public commit record

What the developer wrote

Authored by merge-script

100/100 · Strong
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
✓ 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
The short version

What changed, and why it matters

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.

Recommended action

Review whether allowing zero tweak results and non-reduced label tweaks affects downstream spendability or wallet behavior. If the Silent Payments BIP expects reduced, non-zero tweaks in this path, add explicit validation and tests for the overflow and zero cases. Otherwise, document the new behavior and add regression tests covering label_tweak = 0, label_tweak = N, and label_tweak = -t_k_scalar mod N.

Security signals we found

01

Behavior change: zero-result tweak addition is no longer forced to zero; scalar addition allows zero

02

Behavior change: label tweaks >= group order N are no longer rejected by the secret-key API

03

Removal of defensive comment explaining failure modes of secret-key tweak addition

04

Author explicitly frames changes as user-error edge cases, not security fixes

05

No CVE, advisory, or vendor security disclosure language present in commit

Risk score

Why this scored 26/100

Our methodology →
Potential impact 5/30
Exploitability 3/25
Stealth signal 4/15
Affected reach 5/15
Confidence 6/10
Evidence quality 3/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.