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

Fuzzing #54

Open
mratsim opened this issue May 20, 2020 · 3 comments
Open

Fuzzing #54

mratsim opened this issue May 20, 2020 · 3 comments
Labels

Comments

@mratsim
Copy link
Contributor

mratsim commented May 20, 2020

A a minimum we need to add fuzzing to Hash-To-Curve as we might receive forged messages that might trigger edge cases.

One nice thing is that Milagro is using Exception-Free Addition formulas that fail to handle infinity points and for a point P(x, y) that needs special handling of Q(x, y) or Q(x, -y)

The issue stems from Short Weierstrass Addition law

P + Q = R
(Px, Py) + (Qx, Qy) = (Rx, Ry)

with
Rx = λ² - Px - Qx
Ry = λ(Px - Rx) - Py

with `λ = (Qy - Py) / (Px - Qx)`
which would divide by 0 if Px == Qx

For actual elliptic curve testing, it's quite probably the a fuzzer won't be able to create valid elliptic curve points (though AFL learned to create valid jpegs from nothing but fuzzing https://lcamtuf.blogspot.com/2014/11/pulling-jpegs-out-of-thin-air.html) so we will need to turn to differential fuzzing.

Thankfully there is a host of alternative implementations that we can use and that are sufficiently fast:

And somewhat slower:

@mratsim mratsim added the tests label May 20, 2020
@zah
Copy link
Member

zah commented May 20, 2020

#53 shows how you can get started. I hope you'll be able to take if from here.

@mratsim
Copy link
Contributor Author

mratsim commented May 20, 2020

Ah, somehow I missed this PR

@arnetheduck
Copy link
Member

what's our stance on herumi, in the end? it seems to have reached a critical support point

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

No branches or pull requests

3 participants