1
0
Commit Graph

5 Commits

Author SHA1 Message Date
ThomasV
2f3d89f415 prepare for separation of ecc module:
- move encrypt/sign functions elsewhere
- remove local dependencies in ecc.py, ecc_fast.py (except logging)
2024-06-17 13:05:57 +02:00
SomberNight
07c80d2ca1 ecc: ecdsa_verify to enforce low-S rule
The low-S rule for ecdsa signatures is mandated by Bitcoin Core policy/standardness (though not by consensus). If we get signatures from untrusted sources, we should mandate they obey the policy rules. (e.g. from LN peers)

Note that we normalize the signatures in the sig format conversion methods (DER <-> (r,s) <-> sig64).

The BOLTs treat high-S signatures as invalid, and this changes our behaviour to that.
(previously we would silently normalize the S value)

see https://github.com/bitcoin/bitcoin/pull/6769
see https://github.com/lightning/bolts/pull/807
2024-05-27 17:12:33 +00:00
SomberNight
52f1a2ce25 ecc: add method "bip340_tagged_hash"
I decided to use the stdlib (hashlib) instead of libsecp for this,
as it is simple enough, and the former is faster on my PC.

Added a unit test that compares the two.
2024-04-12 14:20:45 +00:00
SomberNight
bd9d0ccc33 ecc: refactor/clean-up sign/verify APIs 2024-04-11 15:25:45 +00:00
SomberNight
44e27ac8b5 ecc: add bindings for schnorr sign/verify
and require "schnorrsig" and "extrakeys" modules of libsecp256k1
2024-04-11 13:09:57 +00:00