Skip to content
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

Verify threshold ecdsa signatures with RustCrypto #23

Merged
merged 1 commit into from
Jan 2, 2024
Merged

Conversation

mzacho
Copy link
Owner

@mzacho mzacho commented Dec 29, 2023

This PR changes two things that were stopping our signatures from validating with rustcrypto:

  • Change hash_message to serialize using big endian
  • Normalize s from the threshold signature before calling RustCrypto verify

The normalization of s is done by computing -s mod ORDER if s >= ORDER / 2. This is OK to do since both s and -s mod ORDER are valid for the signature, don't really know why this is, but ECDSA on wiki also remarks this.

It was kind of funny - I first fixed the hash, and could see that the test was passing about half of the times. Then I found this check, that they perform during verification. There's a link in the doc string for normalize_s which describes why they do this.

@mzacho mzacho merged commit 8cbabb1 into main Jan 2, 2024
1 check passed
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