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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmitry Baryshkov
nettle
Commits
a7770022
Commit
a7770022
authored
Aug 28, 2014
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
ecc_ecdsa_verify: Use struct ecc_curve function pointers.
parent
79a4cff0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ChangeLog
+7
-0
7 additions, 0 deletions
ChangeLog
ecc-ecdsa-verify.c
+6
-6
6 additions, 6 deletions
ecc-ecdsa-verify.c
with
13 additions
and
6 deletions
ChangeLog
+
7
−
0
View file @
a7770022
2014-08-28 Niels Möller <nisse@lysator.liu.se>
2014-08-28 Niels Möller <nisse@lysator.liu.se>
* ecc-ecdsa-verify.c (ecc_ecdsa_verify): Use the struct ecc_curve
function pointers: mul, mul_g, add_hhh, h_to_a.
* ecc-internal.h (ECC_ECDSA_VERIFY_ITCH): Deleted macro. Needed
* ecc-internal.h (ECC_ECDSA_VERIFY_ITCH): Deleted macro. Needed
scratch depends on curve type, not just size.
scratch depends on curve type, not just size.
(ecc_add_func): New typedef.
(struct ecc_curve): New function pointer add_hhh, and constant
add_hhh_itch. Updated all instances.
* ecdsa-verify.c (ecdsa_verify): Use the ecc_ecdsa_verify_itch
* ecdsa-verify.c (ecdsa_verify): Use the ecc_ecdsa_verify_itch
function, not the corresponding macro.
function, not the corresponding macro.
* ecc-ecdsa-verify.c (ecc_ecdsa_verify_itch): Take ecc->mul_itch
* ecc-ecdsa-verify.c (ecc_ecdsa_verify_itch): Take ecc->mul_itch
...
...
This diff is collapsed.
Click to expand it.
ecc-ecdsa-verify.c
+
6
−
6
View file @
a7770022
/* ecc-ecdsa-verify.c
/* ecc-ecdsa-verify.c
Copyright (C) 2013 Niels Möller
Copyright (C) 2013
, 2014
Niels Möller
This file is part of GNU Nettle.
This file is part of GNU Nettle.
...
@@ -113,7 +113,7 @@ ecc_ecdsa_verify (const struct ecc_curve *ecc,
...
@@ -113,7 +113,7 @@ ecc_ecdsa_verify (const struct ecc_curve *ecc,
ecc_modq_mul
(
ecc
,
u2
,
rp
,
sinv
);
ecc_modq_mul
(
ecc
,
u2
,
rp
,
sinv
);
/* Total storage: 5*ecc->size + ecc->mul_itch */
/* Total storage: 5*ecc->size + ecc->mul_itch */
ecc
_
mul
_a
(
ecc
,
P2
,
u2
,
pp
,
u2
+
ecc
->
size
);
ecc
->
mul
(
ecc
,
P2
,
u2
,
pp
,
u2
+
ecc
->
size
);
/* u1 = h / s, P1 = u1 * G */
/* u1 = h / s, P1 = u1 * G */
ecc_hash
(
ecc
,
hp
,
length
,
digest
);
ecc_hash
(
ecc
,
hp
,
length
,
digest
);
...
@@ -124,7 +124,7 @@ ecc_ecdsa_verify (const struct ecc_curve *ecc,
...
@@ -124,7 +124,7 @@ ecc_ecdsa_verify (const struct ecc_curve *ecc,
if
(
!
zero_p
(
u1
,
ecc
->
size
))
if
(
!
zero_p
(
u1
,
ecc
->
size
))
{
{
/* Total storage: 6*ecc->size + ecc->mul_g_itch (ecc->size) */
/* Total storage: 6*ecc->size + ecc->mul_g_itch (ecc->size) */
ecc
_
mul_g
(
ecc
,
P1
,
u1
,
u1
+
ecc
->
size
);
ecc
->
mul_g
(
ecc
,
P1
,
u1
,
u1
+
ecc
->
size
);
/* NOTE: ecc_add_jjj and/or ecc_j_to_a will produce garbage in
/* NOTE: ecc_add_jjj and/or ecc_j_to_a will produce garbage in
case u1 G = +/- u2 V. However, anyone who gets his or her
case u1 G = +/- u2 V. However, anyone who gets his or her
...
@@ -140,11 +140,11 @@ ecc_ecdsa_verify (const struct ecc_curve *ecc,
...
@@ -140,11 +140,11 @@ ecc_ecdsa_verify (const struct ecc_curve *ecc,
s_1 = z. Hitting that is about as unlikely as finding the
s_1 = z. Hitting that is about as unlikely as finding the
private key by guessing.
private key by guessing.
*/
*/
/* Total storage: 6*ecc->size +
ECC_ADD_JJJ_ITCH (ecc->size)
*/
/* Total storage: 6*ecc->size +
ecc->add_hhh_itch
*/
ecc
_
add_
jjj
(
ecc
,
P1
,
P1
,
P2
,
u1
);
ecc
->
add_
hhh
(
ecc
,
P1
,
P1
,
P2
,
u1
);
}
}
/* x coordinate only, modulo q */
/* x coordinate only, modulo q */
ecc
_j
_to_a
(
ecc
,
2
,
P2
,
P1
,
u1
);
ecc
->
h
_to_a
(
ecc
,
2
,
P2
,
P1
,
u1
);
return
(
mpn_cmp
(
rp
,
P2
,
ecc
->
size
)
==
0
);
return
(
mpn_cmp
(
rp
,
P2
,
ecc
->
size
)
==
0
);
#undef P2
#undef P2
...
...
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