Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nettle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmitry Baryshkov
nettle
Commits
ac1e6e5a
Commit
ac1e6e5a
authored
10 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
Added benchmarking of curve25519 functions.
parent
df7b4aca
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ChangeLog
+6
-0
6 additions, 0 deletions
ChangeLog
examples/hogweed-benchmark.c
+46
-0
46 additions, 0 deletions
examples/hogweed-benchmark.c
with
52 additions
and
0 deletions
ChangeLog
+
6
−
0
View file @
ac1e6e5a
2014-09-06 Niels Möller <nisse@lysator.liu.se>
* examples/hogweed-benchmark.c (bench_curve25519_mul_g)
(bench_curve25519_mul, bench_curve25519): New functions.
(main): Added benchmarking of curve25519 functions.
2014-09-03 Niels Möller <nisse@lysator.liu.se>
2014-09-03 Niels Möller <nisse@lysator.liu.se>
* Makefile.in: Revert 2013-02-06 Makefile changes: use a single
* Makefile.in: Revert 2013-02-06 Makefile changes: use a single
...
...
This diff is collapsed.
Click to expand it.
examples/hogweed-benchmark.c
+
46
−
0
View file @
ac1e6e5a
...
@@ -47,6 +47,7 @@
...
@@ -47,6 +47,7 @@
#include
"dsa.h"
#include
"dsa.h"
#include
"rsa.h"
#include
"rsa.h"
#include
"curve25519.h"
#include
"nettle-meta.h"
#include
"nettle-meta.h"
#include
"sexp.h"
#include
"sexp.h"
...
@@ -649,6 +650,48 @@ bench_openssl_ecdsa_clear (void *p)
...
@@ -649,6 +650,48 @@ bench_openssl_ecdsa_clear (void *p)
}
}
#endif
#endif
struct
curve25519_ctx
{
char
x
[
CURVE25519_SIZE
];
char
s
[
CURVE25519_SIZE
];
};
static
void
bench_curve25519_mul_g
(
void
*
p
)
{
struct
curve25519_ctx
*
ctx
=
p
;
char
q
[
CURVE25519_SIZE
];
curve25519_mul_g
(
q
,
ctx
->
s
);
}
static
void
bench_curve25519_mul
(
void
*
p
)
{
struct
curve25519_ctx
*
ctx
=
p
;
char
q
[
CURVE25519_SIZE
];
if
(
!
curve25519_mul
(
q
,
ctx
->
s
,
ctx
->
x
))
die
(
"Internal error, curve25519_mul failed.
\n
"
);
}
static
void
bench_curve25519
(
void
)
{
double
mul_g
;
double
mul
;
struct
knuth_lfib_ctx
lfib
;
struct
curve25519_ctx
ctx
;
knuth_lfib_init
(
&
lfib
,
2
);
knuth_lfib_random
(
&
lfib
,
sizeof
(
ctx
.
s
),
ctx
.
s
);
curve25519_mul_g
(
ctx
.
x
,
ctx
.
s
);
mul_g
=
time_function
(
bench_curve25519_mul_g
,
&
ctx
);
mul
=
time_function
(
bench_curve25519_mul
,
&
ctx
);
printf
(
"%15s %4d %9.4f %9.4f
\n
"
,
"curve25519"
,
255
,
1e-3
/
mul_g
,
1e-3
/
mul
);
}
struct
alg
alg_list
[]
=
{
struct
alg
alg_list
[]
=
{
{
"rsa"
,
1024
,
bench_rsa_init
,
bench_rsa_sign
,
bench_rsa_verify
,
bench_rsa_clear
},
{
"rsa"
,
1024
,
bench_rsa_init
,
bench_rsa_sign
,
bench_rsa_verify
,
bench_rsa_clear
},
{
"rsa"
,
2048
,
bench_rsa_init
,
bench_rsa_sign
,
bench_rsa_verify
,
bench_rsa_clear
},
{
"rsa"
,
2048
,
bench_rsa_init
,
bench_rsa_sign
,
bench_rsa_verify
,
bench_rsa_clear
},
...
@@ -693,5 +736,8 @@ main (int argc, char **argv)
...
@@ -693,5 +736,8 @@ main (int argc, char **argv)
if
(
!
filter
||
strstr
(
alg_list
[
i
].
name
,
filter
))
if
(
!
filter
||
strstr
(
alg_list
[
i
].
name
,
filter
))
bench_alg
(
&
alg_list
[
i
]);
bench_alg
(
&
alg_list
[
i
]);
if
(
!
filter
||
strstr
(
"curve25519"
,
filter
))
bench_curve25519
();
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment