-
Notifications
You must be signed in to change notification settings - Fork 6
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
gen/ec: code generation for efd formulae #57
Comments
Formulae required for P-256 #55. Note that operations with arrows
|
Summary of all the "non primitive" expressions:
In the general case, these reduce to addition chain problems. However in these simple cases the naive binary algorithms should be enough. |
The current work-in-progress diff produces the following. Note:
// Code generated by ec3. DO NOT EDIT.
package p256
type Jacobian struct {
X Elt
Y Elt
Z Elt
}
func (p *Jacobian) Add(q, r *Jacobian) {
var (
t1 Elt
U2 Elt
t6 Elt
U1 Elt
S1 Elt
t4 Elt
t5 Elt
J Elt
t10 Elt
t12 Elt
t13 Elt
t0 Elt
I Elt
t14 Elt
t8 Elt
t3 Elt
r Elt
t11 Elt
Z1Z1 Elt
S2 Elt
Z2Z2 Elt
t7 Elt
t9 Elt
H Elt
t2 Elt
V Elt
)
Sqr(&Z1Z1, &q.Z)
Sqr(&Z2Z2, &r.Z)
Mul(&U1, &q.X, &Z2Z2)
Mul(&U2, &r.X, &Z1Z1)
Mul(&t0, &r.Z, &Z2Z2)
Mul(&S1, &q.Y, &t0)
Mul(&t1, &q.Z, &Z1Z1)
Mul(&S2, &r.Y, &t1)
Sub(&H, &U2, &U1)
Add(&t2, &H, &H)
Sqr(&I, &t2)
Mul(&J, &H, &I)
Sub(&t3, &S2, &S1)
Add(&r, &t3, &t3)
Mul(&V, &U1, &I)
Sqr(&t4, &r)
Add(&t5, &V, &V)
Sub(&t6, &t4, &J)
Sub(&p.X, &t6, &t5)
Sub(&t7, &V, &p.X)
Mul(&t8, &S1, &J)
Add(&t9, &t8, &t8)
Mul(&t10, &r, &t7)
Sub(&p.Y, &t10, &t9)
Add(&t11, &q.Z, &r.Z)
Sqr(&t12, &t11)
Sub(&t13, &t12, &Z1Z1)
Sub(&t14, &t13, &Z2Z2)
Mul(&p.Z, &t14, &H)
} |
mmcloughlin
added a commit
that referenced
this issue
Aug 3, 2019
Changes the generated Add() and Sub() functions to take a third return parameter. Updates #57
mmcloughlin
added a commit
that referenced
this issue
Aug 12, 2019
mmcloughlin
added a commit
that referenced
this issue
Sep 6, 2019
Refactors point operation generation to enable us to add single field element parameters, rather than only point parameters. This also allows us to clean up the handling of conditional parameters. Updates #57
mmcloughlin
added a commit
that referenced
this issue
Sep 6, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Generate Go code to compute a given EFD formula.
Related #41 #29 #38 #55
The text was updated successfully, but these errors were encountered: