-
-
Notifications
You must be signed in to change notification settings - Fork 680
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
In ecdsa_verify_digest() allow the digest to be equal to the order of the group #1374
Conversation
… the order of the group.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Let's wait until the test go green in the CI and for Ondrej's review.
Just did a quick test and I believe verification still fails but I have more time to test this later today. |
… to the group order.
It's correct that libsecp256k1 allows the group order as a digest. But libsecp256k1 also allows the all-zero digest, so I think this should be allowed here, too. |
The reasons why we decided to forbid all-zero digest are:
|
Ok, but then I believe this PR should be rejected entirely because the same is true for the digest that is encodes the group order. |
I don't think so, because it's easier (or more likely) to "inject" zero bytes than any pattern with both zeros and ones. |
Let me just summarize and elaborate a bit on what has already been written by @onvej-sl:
|
I've tested again, I've verified that the patch is working as intended. |
Based on a bug report from Guido Vranken:
The reason for this is that
in
is congruent to 0 modulo the order of the group. So it's equivalent to the casein = 0000...00
we had earlier. The other libraries are behaving correctly and Trezor should also accept the signature as valid, since I think the original argument for rejecting no longer applies in this case.