Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Nettle
nettle
Commits
03d8c760
Commit
03d8c760
authored
Aug 26, 2014
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some curve25519 unification in ecc-benchmark.
parent
3c87a5aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
21 deletions
+11
-21
ChangeLog
ChangeLog
+6
-0
examples/ecc-benchmark.c
examples/ecc-benchmark.c
+5
-21
No files found.
ChangeLog
View file @
03d8c760
2014-08-26 Niels Möller <nisse@lysator.liu.se>
* examples/ecc-benchmark.c (bench_mul_g, bench_mul_a): Use struct
ecc_curve function pointers.
(bench_mul_g_eh, bench_mul_a_eh): Deleted.
(bench_curve): Make modq benchmark unconditional. Use bench_mul_g
and bench_mul_a also for curve25519.
* testsuite/ecc-mod-test.c (test_curve): Make modq test
unconditional, partially reverting 2014-07-04 change.
...
...
examples/ecc-benchmark.c
View file @
03d8c760
...
...
@@ -227,14 +227,14 @@ static void
bench_mul_g
(
void
*
p
)
{
struct
ecc_ctx
*
ctx
=
(
struct
ecc_ctx
*
)
p
;
ecc
_
mul_g
(
ctx
->
ecc
,
ctx
->
rp
,
ctx
->
ap
,
ctx
->
tp
);
ctx
->
ecc
->
mul_g
(
ctx
->
ecc
,
ctx
->
rp
,
ctx
->
ap
,
ctx
->
tp
);
}
static
void
bench_mul_a
(
void
*
p
)
{
struct
ecc_ctx
*
ctx
=
(
struct
ecc_ctx
*
)
p
;
ecc
_
mul
_a
(
ctx
->
ecc
,
ctx
->
rp
,
ctx
->
ap
,
ctx
->
bp
,
ctx
->
tp
);
ctx
->
ecc
->
mul
(
ctx
->
ecc
,
ctx
->
rp
,
ctx
->
ap
,
ctx
->
bp
,
ctx
->
tp
);
}
static
void
...
...
@@ -258,20 +258,6 @@ bench_add_ehh (void *p)
ecc_add_ehh
(
ctx
->
ecc
,
ctx
->
rp
,
ctx
->
ap
,
ctx
->
bp
,
ctx
->
tp
);
}
static
void
bench_mul_g_eh
(
void
*
p
)
{
struct
ecc_ctx
*
ctx
=
(
struct
ecc_ctx
*
)
p
;
ecc_mul_g_eh
(
ctx
->
ecc
,
ctx
->
rp
,
ctx
->
ap
,
ctx
->
tp
);
}
static
void
bench_mul_a_eh
(
void
*
p
)
{
struct
ecc_ctx
*
ctx
=
(
struct
ecc_ctx
*
)
p
;
ecc_mul_a_eh
(
ctx
->
ecc
,
ctx
->
rp
,
ctx
->
ap
,
ctx
->
bp
,
ctx
->
tp
);
}
#if NETTLE_USE_MINI_GMP
static
void
mpn_random
(
mp_limb_t
*
xp
,
mp_size_t
n
)
...
...
@@ -322,7 +308,7 @@ bench_curve (const struct ecc_curve *ecc)
modp
=
time_function
(
bench_modp
,
&
ctx
);
redc
=
ecc
->
redc
?
time_function
(
bench_redc
,
&
ctx
)
:
0
;
modq
=
ecc
->
modq
?
time_function
(
bench_modq
,
&
ctx
)
:
0
;
modq
=
time_function
(
bench_modq
,
&
ctx
);
modinv
=
time_function
(
bench_modinv
,
&
ctx
);
#if !NETTLE_USE_MINI_GMP
...
...
@@ -338,8 +324,6 @@ bench_curve (const struct ecc_curve *ecc)
if
(
ecc
->
bit_size
==
255
)
{
/* For now, curve25519 is a special case */
mul_g
=
time_function
(
bench_mul_g_eh
,
&
ctx
);
mul_a
=
time_function
(
bench_mul_a_eh
,
&
ctx
);
dup_jj
=
time_function
(
bench_dup_eh
,
&
ctx
);
add_jja
=
time_function
(
bench_add_eh
,
&
ctx
);
add_jjj
=
time_function
(
bench_add_ehh
,
&
ctx
);
...
...
@@ -349,9 +333,9 @@ bench_curve (const struct ecc_curve *ecc)
dup_jj
=
time_function
(
bench_dup_jj
,
&
ctx
);
add_jja
=
time_function
(
bench_add_jja
,
&
ctx
);
add_jjj
=
time_function
(
bench_add_jjj
,
&
ctx
);
mul_g
=
time_function
(
bench_mul_g
,
&
ctx
);
mul_a
=
time_function
(
bench_mul_a
,
&
ctx
);
}
mul_g
=
time_function
(
bench_mul_g
,
&
ctx
);
mul_a
=
time_function
(
bench_mul_a
,
&
ctx
);
free
(
ctx
.
rp
);
free
(
ctx
.
ap
);
...
...
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