Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nettle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmitry Baryshkov
nettle
Commits
c87bd88c
Commit
c87bd88c
authored
5 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
Comment fixes for ecc_add_eh
parent
b33eea3b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
ecc-add-eh.c
+14
-8
14 additions, 8 deletions
ecc-add-eh.c
with
14 additions
and
8 deletions
ecc-add-eh.c
+
14
−
8
View file @
c87bd88c
...
@@ -55,20 +55,26 @@ ecc_add_eh (const struct ecc_curve *ecc,
...
@@ -55,20 +55,26 @@ ecc_add_eh (const struct ecc_curve *ecc,
#define z3 (r + 2*ecc->p.size)
#define z3 (r + 2*ecc->p.size)
/* Formulas (from djb,
/* Formulas (from djb,
http://www.hyperelliptic.org/EFD/g1p/auto-
edwards
-projective.html#
doubling-dbl
-200
7
-b
l):
http://www.hyperelliptic.org/EFD/g1p/auto-
twisted
-projective.html#
addition-madd
-200
8
-b
bjlp
Computation Operation Live variables
Computation Operation Live variables
C = x1*x2 mul C
C = x1*x2 mul C
D = y1*y2 mul C, D
D = y1*y2 mul C, D
T = (x1+y1)(x2+y2) - C - D C, D, T
T = (x1+y1)*(x2+y2) mul C, D, T
E = b*C*D 2 mul C, E, T (Replace C <-- D - C)
- C - D
E = b*C*D 2 mul C, E, T (Replace C <-- D+C)
B = z1^2 sqr B, C, E, T
B = z1^2 sqr B, C, E, T
F = B - E B, C, E, F, T
F = B - E B, C, E, F, T
G = B + E C, F, G, T
G = B + E C, F, G, T
x3 = z1
*F*T 3
mul C, F, G, T
x3 = z1
* F * T 2
mul C, F, G, T
y3 = z1*G*(D
-
C) 2 mul F, G
y3 = z1*G*(D
+
C) 2 mul F, G
z3 = F*G mul
z3 = F*G mul
10M + 1S
We have different sign for E, hence swapping F and G, because our
ecc->b corresponds to -b above.
*/
*/
#define C (scratch)
#define C (scratch)
#define D (scratch + 1*ecc->p.size)
#define D (scratch + 1*ecc->p.size)
...
@@ -88,17 +94,17 @@ ecc_add_eh (const struct ecc_curve *ecc,
...
@@ -88,17 +94,17 @@ ecc_add_eh (const struct ecc_curve *ecc,
ecc_modp_mul
(
ecc
,
x3
,
C
,
D
);
ecc_modp_mul
(
ecc
,
x3
,
C
,
D
);
ecc_modp_mul
(
ecc
,
E
,
x3
,
ecc
->
b
);
ecc_modp_mul
(
ecc
,
E
,
x3
,
ecc
->
b
);
ecc_modp_add
(
ecc
,
C
,
D
,
C
);
/* ! */
ecc_modp_add
(
ecc
,
C
,
D
,
C
);
ecc_modp_sqr
(
ecc
,
B
,
z1
);
ecc_modp_sqr
(
ecc
,
B
,
z1
);
ecc_modp_sub
(
ecc
,
F
,
B
,
E
);
ecc_modp_sub
(
ecc
,
F
,
B
,
E
);
ecc_modp_add
(
ecc
,
G
,
B
,
E
);
ecc_modp_add
(
ecc
,
G
,
B
,
E
);
/* x3 */
/* x3 */
ecc_modp_mul
(
ecc
,
B
,
G
,
T
);
/* ! */
ecc_modp_mul
(
ecc
,
B
,
G
,
T
);
ecc_modp_mul
(
ecc
,
x3
,
B
,
z1
);
ecc_modp_mul
(
ecc
,
x3
,
B
,
z1
);
/* y3 */
/* y3 */
ecc_modp_mul
(
ecc
,
B
,
F
,
z1
);
/* ! */
ecc_modp_mul
(
ecc
,
B
,
F
,
z1
);
ecc_modp_mul
(
ecc
,
y3
,
B
,
C
);
/* Clobbers z1 in case r == p. */
ecc_modp_mul
(
ecc
,
y3
,
B
,
C
);
/* Clobbers z1 in case r == p. */
/* z3 */
/* z3 */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment