-
Notifications
You must be signed in to change notification settings - Fork 133
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
ECDSA gadget #1240
ECDSA gadget #1240
Conversation
Note: I discovered a vulnerability in the ECDSA gadget today, and fixed it in the last few commits: The issue was that a malicious prover could make the I fixed this by adding a proper equality check which handles multiples of the modulus. |
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.
Amazing work! Approved, with a few minor things, questions and suggestions.
Closes #1159, #1153, #1154, #1157
This PR adds an ECDSA gadget, which uses 39k rows. Ingredients:
add()
anddouble()
methods built on top of Foreign fields 5: Optimized multiplication of sums #1262multiScalarMul()
gadget which ECDSA uses with 2 points as input. To save constraints, thisadd()
result. the aggregator scaled by2^maxbits
is subtracted at the endc
, we pick from one of2^c
multiples. Picking multiples uses a new optimized gadget for getting the element of an array.c
can be picked independently for each point; the optimal value isc=4
for constant points andc=3
for variable pointssrc/examples/zkprogram/ecdsa
, which is also used for a new vk regression testNewEDIT: scrapped in favor of how Foreign curve and ECDSA #1007 exposes ECDSA.Gadgets.Ecdsa
namespace with the verify gadget and a non-provable method for signingCrypto
namespace to generate a curve from curve parameters. Also exposes parameters for secp256k1 and the Pasta curvesbindings: o1-labs/o1js-bindings#207
TODO left for follow-up PR: Expose individual EC operations and
Point
type on public API