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

btcec/schnorr: use private key copy for BIP-340 signatures #1919

Merged
merged 1 commit into from
Nov 9, 2022

Conversation

Roasbeef
Copy link
Member

@Roasbeef Roasbeef commented Nov 9, 2022

This is a fix similar to #1905. We'll always make a copy of the key in the local scope before passing it around elsewhere. Depending on the parity of the public key, the private key itself might need to be negated.

A similar test is added here that fails without the patch to the signature.go file.

@coveralls
Copy link

coveralls commented Nov 9, 2022

Pull Request Test Coverage Report for Build 3431230647

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+9.1%) to 82.252%

Files with Coverage Reduction New Missed Lines %
connmgr/connmanager.go 2 86.07%
Totals Coverage Status
Change from base Build 3423315641: 9.1%
Covered Lines: 7202
Relevant Lines: 8756

💛 - Coveralls

btcec/schnorr/signature_test.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

btcec/schnorr/signature_test.go Outdated Show resolved Hide resolved
This is a fix similar to btcsuite#1905.
We'll always make a copy of the key in the local scope before passing it
around elsewhere. Depending on the parity of the public key, the private
key itself might need to be negated.

A similar test is added here that fails without the patch to the
signature.go file.
@Roasbeef
Copy link
Member Author

Roasbeef commented Nov 9, 2022

Thx for the review y'all! Added the intermediate copy just to make things a bit more explicit, I think this is g2g now.

@Roasbeef Roasbeef merged commit 108fcf7 into btcsuite:master Nov 9, 2022
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.

6 participants