BIP352: ECDSA verify compare x(R) modulo n to r#1959
Closed
radik878 wants to merge 1 commit intobitcoin:masterfrom
Closed
BIP352: ECDSA verify compare x(R) modulo n to r#1959radik878 wants to merge 1 commit intobitcoin:masterfrom
radik878 wants to merge 1 commit intobitcoin:masterfrom
Conversation
Member
|
Ping authors, @RubenSomsen, @josibake |
Member
|
cc: @theStack |
Contributor
|
ECDSA signature verification is not relevant to BIP-352 (neither in the reference implementation nor in test vector generation/execution), and secp256k1.py is planned to be replaced with secp256k1lab anyway (see #2087), which currently doesn't even have ECDSA support. I was going to suggest the possibility of submitting this upstream to Bitcoin Core (since this code appears to be based on its test framework), but it looks like the modulo logic is already there: This PR can be closed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The signer computes r = x(R) mod n, but the verifier compared the affine x-coordinate directly to r. This could incorrectly reject valid signatures when x(R) ≥ n (rare but possible). Update ECPubKey.verify_ecdsa to check (x(R) % n) == r, aligning verification with ECDSA as defined in SEC1/FIPS 186 and matching our signer’s behavior.