Skip to content

Enforce low-S signature verification#2

Draft
mamonet wants to merge 1 commit intomainfrom
fix/ecdsa-signature-malleability
Draft

Enforce low-S signature verification#2
mamonet wants to merge 1 commit intomainfrom
fix/ecdsa-signature-malleability

Conversation

@mamonet
Copy link
Collaborator

@mamonet mamonet commented Jan 9, 2026

Signature verification now rejects high-S signatures (BIP-62). Added normalize_low_s() and is_low_s() utility functions for both secp256k1 and secp256r1.
Verifiers will reject any ECDSA signature where s > n/2. This prevents signature malleability attacks since both (r, s) and (r, n - s) are mathematically valid for the same message.

If you have an existing high-S signature, call normalize_low_s() to convert it before verification.

Reference: BIP-62: Dealing with malleability

@mamonet
Copy link
Collaborator Author

mamonet commented Jan 9, 2026

I will look at the test failures tomorrow.

@rkeene
Copy link
Member

rkeene commented Jan 10, 2026

It's not clear what the point of this change is.

@mamonet
Copy link
Collaborator Author

mamonet commented Jan 11, 2026

I think the reference I attached causes confusion in the description. Let me get back to this PR when I add support for secp256k1/secp256r1 in ledger device app, as it will add more context.

@rkeene rkeene marked this pull request as draft January 12, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants