Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Brian Smith
nettle
Commits
24c9769b
Commit
24c9769b
authored
Aug 28, 2014
by
Niels Möller
Browse files
ecc_ecdsa_sign: Use mul_g and h_to_a function pointers.
Implies (obscure) support for curve25519. Also added a testcase for this.
parent
0276b45a
Changes
3
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
24c9769b
2014-08-28 Niels Möller <nisse@lysator.liu.se>
* testsuite/ecdsa-sign-test.c (test_main): Added test for the
obscure case of ecdsa using curve25519.
* ecc-ecdsa-sign.c (ecc_ecdsa_sign): Use mul_g and h_to_a function
pointers. Implies (obscure) support for curve25519.
* ecc-25519.c (ecc_25519_modq): Access q via the ecc struct.
* ecc-eh-to-a.c (ecc_eh_to_a): Analogous change as for ecc_j_to_a.
...
...
ecc-ecdsa-sign.c
View file @
24c9769b
/* ecc-ecdsa-sign.c
Copyright (C) 2013 Niels Möller
Copyright (C) 2013
, 2014
Niels Möller
This file is part of GNU Nettle.
...
...
@@ -46,7 +46,8 @@
mp_size_t
ecc_ecdsa_sign_itch
(
const
struct
ecc_curve
*
ecc
)
{
/* Needs 3*ecc->size + scratch for ecc_mul_g. */
/* Needs 3*ecc->size + scratch for ecc->mul_g. Currently same for
ecc_mul_g and ecc_mul_g_eh. */
return
ECC_ECDSA_SIGN_ITCH
(
ecc
->
size
);
}
...
...
@@ -77,9 +78,9 @@ ecc_ecdsa_sign (const struct ecc_curve *ecc,
4. s2 <-- (h + z*s1)/k mod q.
*/
ecc
_
mul_g
(
ecc
,
P
,
kp
,
P
+
3
*
ecc
->
size
);
ecc
->
mul_g
(
ecc
,
P
,
kp
,
P
+
3
*
ecc
->
size
);
/* x coordinate only, modulo q */
ecc
_j
_to_a
(
ecc
,
2
,
rp
,
P
,
P
+
3
*
ecc
->
size
);
ecc
->
h
_to_a
(
ecc
,
2
,
rp
,
P
,
P
+
3
*
ecc
->
size
);
/* Invert k, uses 5 * ecc->size including scratch */
mpn_copyi
(
hp
,
kp
,
ecc
->
size
);
...
...
testsuite/ecdsa-sign-test.c
View file @
24c9769b
...
...
@@ -156,5 +156,18 @@ test_main (void)
"97536710 1F67D1CF 9BCCBF2F 3D239534"
"FA509E70 AAC851AE 01AAC68D 62F86647"
"2660"
);
/* s */
}
/* Non-standard ecdsa using curve25519. Not interop-tested with
anything else. */
test_ecdsa
(
&
nettle_curve25519
,
"1db511101b8fd16f e0212c5679ef53f3"
"323bde77f9efa442 617314d576d1dbcb"
,
/* z */
"aa2fa8facfdc3a99 ec466d41a2c9211c"
"e62e1706f54037ff 8486e26153b0fa79"
,
/* k */
SHEX
(
"e99df2a098c3c590 ea1e1db6d9547339"
"ae760d5331496119 5d967fd881e3b0f5"
),
/* h */
" 62cbc248a549765 3641d1cbedda2733"
"a7357821dca43727 d8081448d608030d"
,
/* r */
" 14726f472f44f84 63fe82c2712231cd"
"937f2aecdcfe9c39 e2ab0d68c390ccf4"
);
/* s */
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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