Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dmitry Baryshkov
nettle
Commits
a7770022
Commit
a7770022
authored
Aug 28, 2014
by
Niels Möller
Browse files
ecc_ecdsa_verify: Use struct ecc_curve function pointers.
parent
79a4cff0
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
a7770022
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
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
function, not the corresponding macro.
* ecc-ecdsa-verify.c (ecc_ecdsa_verify_itch): Take ecc->mul_itch
...
...
ecc-ecdsa-verify.c
View file @
a7770022
/* ecc-ecdsa-verify.c
Copyright (C) 2013 Niels Möller
Copyright (C) 2013
, 2014
Niels Möller
This file is part of GNU Nettle.
...
...
@@ -113,7 +113,7 @@ ecc_ecdsa_verify (const struct ecc_curve *ecc,
ecc_modq_mul
(
ecc
,
u2
,
rp
,
sinv
);
/* 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 */
ecc_hash
(
ecc
,
hp
,
length
,
digest
);
...
...
@@ -124,7 +124,7 @@ ecc_ecdsa_verify (const struct ecc_curve *ecc,
if
(
!
zero_p
(
u1
,
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
case u1 G = +/- u2 V. However, anyone who gets his or her
...
...
@@ -140,11 +140,11 @@ ecc_ecdsa_verify (const struct ecc_curve *ecc,
s_1 = z. Hitting that is about as unlikely as finding the
private key by guessing.
*/
/* Total storage: 6*ecc->size +
ECC_ADD_JJJ_ITCH (ecc->size)
*/
ecc
_
add_
jjj
(
ecc
,
P1
,
P1
,
P2
,
u1
);
/* Total storage: 6*ecc->size +
ecc->add_hhh_itch
*/
ecc
->
add_
hhh
(
ecc
,
P1
,
P1
,
P2
,
u1
);
}
/* 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
);
#undef P2
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment