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

feat: Low-s normalization for ecdsa secp256r1 signing (backport #9738) #9794

Closed
wants to merge 1 commit into from

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Jul 27, 2021

This is an automatic backport of pull request #9738 done by Mergify.
Cherry-pick of aa37ae9 has failed:

On branch mergify/bp/release/v0.42.x/pr-9738
Your branch is up to date with 'origin/release/v0.42.x'.

You are currently cherry-picking commit aa37ae9e7.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)
	deleted by us:   crypto/keys/internal/ecdsa/privkey.go
	deleted by us:   crypto/keys/internal/ecdsa/privkey_internal_test.go
	deleted by us:   crypto/keys/internal/ecdsa/pubkey.go

no changes added to commit (use "git add" and/or "git commit -a")

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally


Mergify commands and options

More conditions and actions can be found in the documentation.

You can also trigger Mergify actions by commenting on this pull request:

  • @Mergifyio refresh will re-evaluate the rules
  • @Mergifyio rebase will rebase this PR on its base branch
  • @Mergifyio update will merge the base branch into this PR
  • @Mergifyio backport <destination> will backport this PR on <destination> branch

Additionally, on Mergify dashboard you can:

  • look at your merge queues
  • generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.io/

* added low-s normalization to ecdsa secp256r1 signing

* go fmt fixes

* removed else block as golint required

* implement raw signature encoding for secp256r1

* move the creation of signature to after the check for sig string length

* fake commit to re-run checks? (move the creation of signature to after the check for sig string length)

* added a signature test for high s signature that requires sig validation to fail after the valid signature was mutated by extracting and scalar negating its s value

* reordered code to prevent mutated message from being used in sig verify

* added test for successful high_s signature with the ecdsa portion of the publicKey

* Remove comment for self-explanatory code.

Co-authored-by: Robert Zaremba <[email protected]>

* Missing quote

Co-authored-by: Robert Zaremba <[email protected]>

* Apply minor suggestions from code review

Co-authored-by: Robert Zaremba <[email protected]>

* normalize comments for godoc

* refactored p256Order functions as private vars

* Div -> Rsh optimizing time for division

* resolve two code coverage issues; fix some small review issues

* test using private signatureRaw function instead of copying code. Added tests to improve code coverage

Co-authored-by: Aaron Craelius <[email protected]>
Co-authored-by: Robert Zaremba <[email protected]>
Co-authored-by: Aleksandr Bezobchuk <[email protected]>
(cherry picked from commit aa37ae9)

# Conflicts:
#	crypto/keys/internal/ecdsa/privkey.go
#	crypto/keys/internal/ecdsa/privkey_internal_test.go
#	crypto/keys/internal/ecdsa/pubkey.go
@aaronc
Copy link
Member

aaronc commented Jul 27, 2021

This doesn't belong in the 0.41 branch

@mergify mergify bot deleted the mergify/bp/release/v0.42.x/pr-9738 branch July 27, 2021 18:32
@robert-zaremba
Copy link
Collaborator

@aaronc - this is for 0.42

@robert-zaremba
Copy link
Collaborator

robert-zaremba commented Jul 27, 2021

Anyway, Aaron is right - secp256r1 was not release in 0.42. I was a bit confused as we were announcing that feature back in time but we changed the scope for 0.42.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants