Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nettle
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
5
Merge Requests
5
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Nettle
nettle
Commits
fe776103
Commit
fe776103
authored
Sep 17, 2014
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deleted curve25519-add-test and curve25519-dup-test.
parent
94177bec
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
222 deletions
+9
-222
ChangeLog
ChangeLog
+9
-0
testsuite/Makefile.in
testsuite/Makefile.in
+0
-1
testsuite/curve25519-add-test.c
testsuite/curve25519-add-test.c
+0
-136
testsuite/curve25519-dup-test.c
testsuite/curve25519-dup-test.c
+0
-85
No files found.
ChangeLog
View file @
fe776103
2014-09-17 Niels Möller <nisse@lysator.liu.se>
* testsuite/curve25519-dup-test.c: Deleted file. In the way for
conversion to Edwards coordiante convention, and in the end
the tests will be done by ecc-dup-test.c.
* testsuite/curve25519-add-test.c: Similarly deleted.
* testsuite/Makefile.in (TS_HOGWEED_SOURCES): Removed
curve25519-dup-test.c and curve25519-add-test.c.
2014-09-16 Niels Möller <nisse@lysator.liu.se>
* testsuite/ecc-add-test.c: New generalized testcase, to replace
...
...
testsuite/Makefile.in
View file @
fe776103
...
...
@@ -38,7 +38,6 @@ TS_HOGWEED_SOURCES = sexp-test.c sexp-format-test.c \
pkcs1-test.c
\
rsa-test.c rsa-encrypt-test.c rsa-keygen-test.c
\
dsa-test.c dsa-keygen-test.c
\
curve25519-dup-test.c curve25519-add-test.c
\
curve25519-dh-test.c
\
ecc-mod-test.c ecc-modinv-test.c ecc-redc-test.c
\
ecc-dup-test.c ecc-add-test.c
\
...
...
testsuite/curve25519-add-test.c
deleted
100644 → 0
View file @
94177bec
#include "testutils.h"
static
int
point_zero_p
(
const
struct
ecc_curve
*
ecc
,
const
mp_limb_t
*
p
)
{
mp_limb_t
*
d
;
int
ret
;
mp_size_t
i
;
d
=
xalloc_limbs
(
ecc
->
size
);
ecc_modp_sub
(
ecc
,
d
,
p
+
ecc
->
size
,
p
+
2
*
ecc
->
size
);
while
(
mpn_cmp
(
d
,
ecc
->
p
,
ecc
->
size
)
>=
0
)
mpn_sub_n
(
d
,
d
,
ecc
->
p
,
ecc
->
size
);
for
(
i
=
0
,
ret
=
1
;
i
<
ecc
->
size
;
i
++
)
if
(
d
[
i
])
{
ret
=
0
;
break
;
}
free
(
d
);
return
ret
;
}
void
test_main
(
void
)
{
const
struct
ecc_curve
*
ecc
=
&
nettle_curve25519
;
mp_limb_t
*
g
;
mp_limb_t
*
z
;
mp_limb_t
*
g2
;
mp_limb_t
*
g3
;
mp_limb_t
*
g4
;
mp_limb_t
*
pe
;
mp_limb_t
*
pa
;
mp_limb_t
*
scratch
;
const
struct
ecc_ref_point
rg
=
{
"9"
,
"20ae19a1b8a086b4e01edd2c7748d14c923d4d7e6d7c61b229e9c5a27eced3d9"
};
const
struct
ecc_ref_point
rg2
=
{
/* In Edwards coordinates:
x = 0x1a1c31f8665368131698fecfd54233fcdc638bb46d25cc61d8bc4bcdbfbb4459,
y = 0x2260cdf3092329c21da25ee8c9a21f5697390f51643851560e5f46ae6af8a3c9
*/
"20d342d51873f1b7d9750c687d157114"
"8f3f5ced1e350b5c5cae469cdd684efb"
,
"13b57e011700e8ae050a00945d2ba2f3"
"77659eb28d8d391ebcd70465c72df563"
};
const
struct
ecc_ref_point
rg3
=
{
"1c12bc1a6d57abe645534d91c21bba64"
"f8824e67621c0859c00a03affb713c12"
,
"2986855cbe387eaeaceea446532c338c"
"536af570f71ef7cf75c665019c41222b"
};
const
struct
ecc_ref_point
rg4
=
{
"79ce98b7e0689d7de7d1d074a15b315f"
"fe1805dfcd5d2a230fee85e4550013ef"
,
"075af5bf4ebdc75c8fe26873427d275d"
"73c0fb13da361077a565539f46de1c30"
};
g
=
xalloc_limbs
(
ecc_size_j
(
ecc
));
z
=
xalloc_limbs
(
ecc_size_j
(
ecc
));
g2
=
xalloc_limbs
(
ecc_size_j
(
ecc
));
g3
=
xalloc_limbs
(
ecc_size_j
(
ecc
));
g4
=
xalloc_limbs
(
ecc_size_j
(
ecc
));
pe
=
xalloc_limbs
(
ecc_size_j
(
ecc
));
pa
=
xalloc_limbs
(
ecc_size_j
(
ecc
));
scratch
=
xalloc_limbs
(
ECC_ADD_EHH_ITCH
(
ecc
->
size
));
mpn_copyi
(
g
,
ecc
->
g
,
2
*
ecc
->
size
);
g
[
2
*
ecc
->
size
]
=
1
;
mpn_zero
(
g
+
2
*
ecc
->
size
+
1
,
ecc
->
size
-
1
);
/* Zero point has x = 0, y = 1, z = 1 */
mpn_zero
(
z
,
3
*
ecc
->
size
);
z
[
ecc
->
size
]
=
z
[
2
*
ecc
->
size
]
=
1
;
ecc_add_ehh
(
ecc
,
pe
,
z
,
z
,
scratch
);
if
(
!
point_zero_p
(
ecc
,
pe
))
die
(
"dup of zero point failed.
\n
"
);
ecc_add_eh
(
ecc
,
pe
,
z
,
z
,
scratch
);
if
(
!
point_zero_p
(
ecc
,
pe
))
die
(
"dup of zero point failed.
\n
"
);
ecc_add_ehh
(
ecc
,
pe
,
g
,
pe
,
scratch
);
ecc_eh_to_a
(
ecc
,
0
,
pa
,
pe
,
scratch
);
test_ecc_point
(
ecc
,
&
rg
,
pa
);
ecc_add_eh
(
ecc
,
pe
,
z
,
g
,
scratch
);
ecc_eh_to_a
(
ecc
,
0
,
pa
,
pe
,
scratch
);
test_ecc_point
(
ecc
,
&
rg
,
pa
);
ecc_add_ehh
(
ecc
,
g2
,
g
,
pe
,
scratch
);
ecc_eh_to_a
(
ecc
,
0
,
pa
,
g2
,
scratch
);
test_ecc_point
(
ecc
,
&
rg2
,
pa
);
ecc_add_eh
(
ecc
,
g2
,
g
,
g
,
scratch
);
ecc_eh_to_a
(
ecc
,
0
,
pa
,
g2
,
scratch
);
test_ecc_point
(
ecc
,
&
rg2
,
pa
);
ecc_add_ehh
(
ecc
,
g3
,
g
,
g2
,
scratch
);
ecc_eh_to_a
(
ecc
,
0
,
pa
,
g3
,
scratch
);
test_ecc_point
(
ecc
,
&
rg3
,
pa
);
ecc_add_eh
(
ecc
,
g3
,
g2
,
g
,
scratch
);
ecc_eh_to_a
(
ecc
,
0
,
pa
,
g3
,
scratch
);
test_ecc_point
(
ecc
,
&
rg3
,
pa
);
ecc_add_ehh
(
ecc
,
g4
,
g
,
g3
,
scratch
);
ecc_eh_to_a
(
ecc
,
0
,
pa
,
g4
,
scratch
);
test_ecc_point
(
ecc
,
&
rg4
,
pa
);
ecc_add_eh
(
ecc
,
g4
,
g3
,
g
,
scratch
);
ecc_eh_to_a
(
ecc
,
0
,
pa
,
g4
,
scratch
);
test_ecc_point
(
ecc
,
&
rg4
,
pa
);
ecc_add_ehh
(
ecc
,
g4
,
g2
,
g2
,
scratch
);
ecc_eh_to_a
(
ecc
,
0
,
pa
,
g4
,
scratch
);
test_ecc_point
(
ecc
,
&
rg4
,
pa
);
free
(
g
);
free
(
z
);
free
(
g2
);
free
(
g3
);
free
(
g4
);
free
(
pe
);
free
(
pa
);
free
(
scratch
);
}
testsuite/curve25519-dup-test.c
deleted
100644 → 0
View file @
94177bec
#include "testutils.h"
static
int
point_zero_p
(
const
struct
ecc_curve
*
ecc
,
const
mp_limb_t
*
p
)
{
mp_limb_t
*
d
;
int
ret
;
mp_size_t
i
;
d
=
xalloc_limbs
(
ecc
->
size
);
ecc_modp_sub
(
ecc
,
d
,
p
+
ecc
->
size
,
p
+
2
*
ecc
->
size
);
while
(
mpn_cmp
(
d
,
ecc
->
p
,
ecc
->
size
)
>=
0
)
mpn_sub_n
(
d
,
d
,
ecc
->
p
,
ecc
->
size
);
for
(
i
=
0
,
ret
=
1
;
i
<
ecc
->
size
;
i
++
)
if
(
d
[
i
])
{
ret
=
0
;
break
;
}
free
(
d
);
return
ret
;
}
void
test_main
(
void
)
{
const
struct
ecc_curve
*
ecc
=
&
nettle_curve25519
;
mp_limb_t
*
g
;
mp_limb_t
*
z
;
mp_limb_t
*
pe
;
mp_limb_t
*
pa
;
mp_limb_t
*
scratch
;
const
struct
ecc_ref_point
g2
=
{
/* In Edwards coordinates:
x = 0x1a1c31f8665368131698fecfd54233fcdc638bb46d25cc61d8bc4bcdbfbb4459,
y = 0x2260cdf3092329c21da25ee8c9a21f5697390f51643851560e5f46ae6af8a3c9
*/
"20d342d51873f1b7d9750c687d157114"
"8f3f5ced1e350b5c5cae469cdd684efb"
,
"13b57e011700e8ae050a00945d2ba2f3"
"77659eb28d8d391ebcd70465c72df563"
};
const
struct
ecc_ref_point
g4
=
{
"79ce98b7e0689d7de7d1d074a15b315f"
"fe1805dfcd5d2a230fee85e4550013ef"
,
"075af5bf4ebdc75c8fe26873427d275d"
"73c0fb13da361077a565539f46de1c30"
};
g
=
xalloc_limbs
(
ecc_size_j
(
ecc
));
z
=
xalloc_limbs
(
ecc_size_j
(
ecc
));
pe
=
xalloc_limbs
(
ecc_size_j
(
ecc
));
pa
=
xalloc_limbs
(
ecc_size_j
(
ecc
));
scratch
=
xalloc_limbs
(
ECC_DUP_EH_ITCH
(
ecc
->
size
));
mpn_copyi
(
g
,
ecc
->
g
,
2
*
ecc
->
size
);
g
[
2
*
ecc
->
size
]
=
1
;
mpn_zero
(
g
+
2
*
ecc
->
size
+
1
,
ecc
->
size
-
1
);
/* Zero point has x = 0, y = 1, z = 1 */
mpn_zero
(
z
,
3
*
ecc
->
size
);
z
[
ecc
->
size
]
=
z
[
2
*
ecc
->
size
]
=
1
;
ecc_dup_eh
(
ecc
,
pe
,
z
,
scratch
);
if
(
!
point_zero_p
(
ecc
,
pe
))
die
(
"dup of zero point failed.
\n
"
);
ecc_dup_eh
(
ecc
,
pe
,
g
,
scratch
);
ecc_eh_to_a
(
ecc
,
0
,
pa
,
pe
,
scratch
);
test_ecc_point
(
ecc
,
&
g2
,
pa
);
ecc_dup_eh
(
ecc
,
pe
,
pe
,
scratch
);
ecc_eh_to_a
(
ecc
,
0
,
pa
,
pe
,
scratch
);
test_ecc_point
(
ecc
,
&
g4
,
pa
);
free
(
g
);
free
(
z
);
free
(
pe
);
free
(
pa
);
free
(
scratch
);
}
Write
Preview
Markdown
is supported
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