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
3c87a5aa
Commit
3c87a5aa
authored
Aug 26, 2014
by
Niels Möller
Browse files
Make ecc mod q test unconditional.
parent
14bca47e
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
3c87a5aa
2014-08-26 Niels Möller <nisse@lysator.liu.se>
* testsuite/ecc-mod-test.c (test_curve): Make modq test
unconditional, partially reverting 2014-07-04 change.
* ecc-25519.c (ecc_25519_modq): New function.
* eccdata.c (output_curve): Precomputation for curve25519 mod q.
...
...
testsuite/ecc-mod-test.c
View file @
3c87a5aa
...
...
@@ -76,22 +76,19 @@ test_curve (gmp_randstate_t rands, const struct ecc_curve *ecc)
ref_mod
(
ref
,
a
,
ecc
->
q
,
ecc
->
size
);
if
(
ecc
->
modq
)
{
mpn_copyi
(
m
,
a
,
2
*
ecc
->
size
);
ecc
->
modq
(
ecc
,
m
);
if
(
mpn_cmp
(
m
,
ecc
->
q
,
ecc
->
size
)
>=
0
)
mpn_sub_n
(
m
,
m
,
ecc
->
q
,
ecc
->
size
);
mpn_copyi
(
m
,
a
,
2
*
ecc
->
size
);
ecc
->
modq
(
ecc
,
m
);
if
(
mpn_cmp
(
m
,
ecc
->
q
,
ecc
->
size
)
>=
0
)
mpn_sub_n
(
m
,
m
,
ecc
->
q
,
ecc
->
size
);
if
(
mpn_cmp
(
m
,
ref
,
ecc
->
size
))
{
fprintf
(
stderr
,
"ecc->modq failed: bit_size = %u
\n
"
,
ecc
->
bit_size
);
gmp_fprintf
(
stderr
,
"a = %Nx
\n
"
,
a
,
2
*
ecc
->
size
);
gmp_fprintf
(
stderr
,
"m = %Nx (bad)
\n
"
,
m
,
ecc
->
size
);
gmp_fprintf
(
stderr
,
"ref = %Nx
\n
"
,
ref
,
ecc
->
size
);
abort
();
}
if
(
mpn_cmp
(
m
,
ref
,
ecc
->
size
))
{
fprintf
(
stderr
,
"ecc->modq failed: bit_size = %u
\n
"
,
ecc
->
bit_size
);
gmp_fprintf
(
stderr
,
"a = %Nx
\n
"
,
a
,
2
*
ecc
->
size
);
gmp_fprintf
(
stderr
,
"m = %Nx (bad)
\n
"
,
m
,
ecc
->
size
);
gmp_fprintf
(
stderr
,
"ref = %Nx
\n
"
,
ref
,
ecc
->
size
);
abort
();
}
if
(
ecc
->
Bmodq_size
<
ecc
->
size
)
{
...
...
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