Skip to content

feat: fix v computation in ECDSA signature#385

Merged
ivokub merged 5 commits intodevelopfrom
fix/ecdsa-v
Apr 26, 2023
Merged

feat: fix v computation in ECDSA signature#385
ivokub merged 5 commits intodevelopfrom
fix/ecdsa-v

Conversation

@ivokub
Copy link
Copy Markdown
Collaborator

@ivokub ivokub commented Apr 21, 2023

I referred to other implementations to understand how v is computed when creating an ECDSA signature. I had assumed that v gives if y coordinate of the ephemeral point is small or large (e.h. bigger than half the order). But due to different encoding order, it was actually the oddity of y.

This is confirmed also in Ethereum Yellow paper (Appendix F) and makes also a lot more sense.

@ivokub ivokub added the type: bug Something isn't working label Apr 21, 2023
@ivokub ivokub added this to the v0.10.0 milestone Apr 21, 2023
@ivokub ivokub requested a review from yelhousni April 21, 2023 08:33
@ivokub ivokub self-assigned this Apr 21, 2023
Copy link
Copy Markdown
Collaborator

@yelhousni yelhousni left a comment

Choose a reason for hiding this comment

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

Ok makes sense!
image

@ivokub ivokub merged commit 2a781ae into develop Apr 26, 2023
@ivokub ivokub deleted the fix/ecdsa-v branch April 26, 2023 09:00
p4u pushed a commit to vocdoni/gnark-crypto that referenced this pull request May 4, 2023
* fix: first ecdsa v bit is oddity

* fix: recover oddity of public key y

* chore: generate

* fix: add check for s

* chore: generate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants