-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Panic in btcec.RecoverCompact #1651
Comments
@janos I am trying to reproduce the error with your examples. For the success case, can you confirm that it's normal that |
Hi, @onyb. Thanks for looking into this issue. Yes, I confirm that the error you mentioned is a normal behaviour. |
@janos I just opened a PR addressing the issue. Note that the error is no longer going to be "calculated Rx is larger than curve P". It'll be "signature R is 0" for both the test cases, which is more accurate. |
Wonderful, thanks @onyb! The PR looks neat. |
Fixed in #1691 |
Calling
btcec.RecoverCompact
withbtcec.S256()
and certain signatures and hashes results in a panic.I am providing a test btcrecover.zip with a case as an example that can be reproduced. Panic is a result of big int mod inverse returning nil in
invr := new(big.Int).ModInverse(sig.R, curve.Params().N)
github.com/btcsuite/btcd/btcec/signature.go:319
v0.21.0-beta.Test execution result:
The text was updated successfully, but these errors were encountered: