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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmitry Baryshkov
nettle
Commits
c4752123
Commit
c4752123
authored
Mar 26, 2014
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
Update dsa benchmarking to use new DSA interface.
parent
38edca97
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
+3
-0
3 additions, 0 deletions
ChangeLog
examples/hogweed-benchmark.c
+19
-17
19 additions, 17 deletions
examples/hogweed-benchmark.c
with
22 additions
and
17 deletions
ChangeLog
+
3
−
0
View file @
c4752123
2014-03-26 Niels Möller <nisse@lysator.liu.se>
2014-03-26 Niels Möller <nisse@lysator.liu.se>
* examples/hogweed-benchmark.c: Update dsa benchmarking to use new
DSA interface.
* dsa.c (dsa_params_init, dsa_params_clear): New functions.
* dsa.c (dsa_params_init, dsa_params_clear): New functions.
(dsa_public_key_init): Use dsa_params_init.
(dsa_public_key_init): Use dsa_params_init.
(dsa_public_key_clear): Use dsa_params_clear.
(dsa_public_key_clear): Use dsa_params_clear.
...
...
This diff is collapsed.
Click to expand it.
examples/hogweed-benchmark.c
+
19
−
17
View file @
c4752123
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
/* nettle, low-level cryptographics library
/* nettle, low-level cryptographics library
*
*
* Copyright (C) 2013 Niels Möller
* Copyright (C) 2013
, 2014
Niels Möller
*
*
* The nettle library is free software; you can redistribute it and/or modify
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* it under the terms of the GNU Lesser General Public License as published by
...
@@ -265,8 +265,9 @@ bench_rsa_clear (void *p)
...
@@ -265,8 +265,9 @@ bench_rsa_clear (void *p)
struct
dsa_ctx
struct
dsa_ctx
{
{
struct
dsa_public_key
pub
;
struct
dsa_params
params
;
struct
dsa_private_key
key
;
mpz_t
pub
;
mpz_t
key
;
struct
knuth_lfib_ctx
lfib
;
struct
knuth_lfib_ctx
lfib
;
struct
dsa_signature
s
;
struct
dsa_signature
s
;
uint8_t
*
digest
;
uint8_t
*
digest
;
...
@@ -292,8 +293,9 @@ bench_dsa_init (unsigned size)
...
@@ -292,8 +293,9 @@ bench_dsa_init (unsigned size)
ctx
=
xalloc
(
sizeof
(
*
ctx
));
ctx
=
xalloc
(
sizeof
(
*
ctx
));
dsa_public_key_init
(
&
ctx
->
pub
);
dsa_params_init
(
&
ctx
->
params
);
dsa_private_key_init
(
&
ctx
->
key
);
mpz_init
(
ctx
->
pub
);
mpz_init
(
ctx
->
key
);
dsa_signature_init
(
&
ctx
->
s
);
dsa_signature_init
(
&
ctx
->
s
);
knuth_lfib_init
(
&
ctx
->
lfib
,
1
);
knuth_lfib_init
(
&
ctx
->
lfib
,
1
);
...
@@ -303,16 +305,15 @@ bench_dsa_init (unsigned size)
...
@@ -303,16 +305,15 @@ bench_dsa_init (unsigned size)
if
(
!
(
sexp_transport_iterator_first
(
&
i
,
sizeof
(
dsa1024
)
-
1
,
dsa1024
)
if
(
!
(
sexp_transport_iterator_first
(
&
i
,
sizeof
(
dsa1024
)
-
1
,
dsa1024
)
&&
sexp_iterator_check_type
(
&
i
,
"private-key"
)
&&
sexp_iterator_check_type
(
&
i
,
"private-key"
)
&&
sexp_iterator_check_type
(
&
i
,
"dsa"
)
&&
sexp_iterator_check_type
(
&
i
,
"dsa"
)
&&
dsa_keypair_from_sexp_alist
((
struct
dsa_params
*
)
&
ctx
->
pub
,
&&
dsa_keypair_from_sexp_alist
(
&
ctx
->
params
,
ctx
->
pub
,
ctx
->
key
,
ctx
->
pub
.
y
,
ctx
->
key
.
x
,
0
,
DSA_SHA1_Q_BITS
,
&
i
))
)
0
,
DSA_SHA1_Q_BITS
,
&
i
))
)
die
(
"Internal error.
\n
"
);
die
(
"Internal error.
\n
"
);
ctx
->
digest
=
hash_string
(
&
nettle_sha1
,
3
,
"foo"
);
ctx
->
digest
=
hash_string
(
&
nettle_sha1
,
3
,
"foo"
);
dsa_s
ha1_sign_digest
(
&
ctx
->
p
ub
,
&
ctx
->
key
,
dsa_s
ign
(
&
ctx
->
p
arams
,
ctx
->
key
,
&
ctx
->
lfib
,
(
nettle_random_func
*
)
knuth_lfib_random
,
&
ctx
->
lfib
,
(
nettle_random_func
*
)
knuth_lfib_random
,
ctx
->
digest
,
&
ctx
->
s
);
SHA1_DIGEST_SIZE
,
ctx
->
digest
,
&
ctx
->
s
);
return
ctx
;
return
ctx
;
}
}
...
@@ -324,9 +325,9 @@ bench_dsa_sign (void *p)
...
@@ -324,9 +325,9 @@ bench_dsa_sign (void *p)
struct
dsa_signature
s
;
struct
dsa_signature
s
;
dsa_signature_init
(
&
s
);
dsa_signature_init
(
&
s
);
dsa_s
ha1_sign_digest
(
&
ctx
->
p
ub
,
&
ctx
->
key
,
dsa_s
ign
(
&
ctx
->
p
arams
,
ctx
->
key
,
&
ctx
->
lfib
,
(
nettle_random_func
*
)
knuth_lfib_random
,
&
ctx
->
lfib
,
(
nettle_random_func
*
)
knuth_lfib_random
,
ctx
->
digest
,
&
s
);
SHA1_DIGEST_SIZE
,
ctx
->
digest
,
&
s
);
dsa_signature_clear
(
&
s
);
dsa_signature_clear
(
&
s
);
}
}
...
@@ -334,7 +335,7 @@ static void
...
@@ -334,7 +335,7 @@ static void
bench_dsa_verify
(
void
*
p
)
bench_dsa_verify
(
void
*
p
)
{
{
struct
dsa_ctx
*
ctx
=
p
;
struct
dsa_ctx
*
ctx
=
p
;
if
(
!
dsa_
sha1_
verify
_digest
(
&
ctx
->
p
ub
,
ctx
->
digest
,
&
ctx
->
s
))
if
(
!
dsa_verify
(
&
ctx
->
p
arams
,
ctx
->
pub
,
SHA1_DIGEST_SIZE
,
ctx
->
digest
,
&
ctx
->
s
))
die
(
"Internal error, dsa_sha1_verify_digest failed.
\n
"
);
die
(
"Internal error, dsa_sha1_verify_digest failed.
\n
"
);
}
}
...
@@ -342,8 +343,9 @@ static void
...
@@ -342,8 +343,9 @@ static void
bench_dsa_clear
(
void
*
p
)
bench_dsa_clear
(
void
*
p
)
{
{
struct
dsa_ctx
*
ctx
=
p
;
struct
dsa_ctx
*
ctx
=
p
;
dsa_public_key_clear
(
&
ctx
->
pub
);
dsa_params_clear
(
&
ctx
->
params
);
dsa_private_key_clear
(
&
ctx
->
key
);
mpz_clear
(
ctx
->
pub
);
mpz_clear
(
ctx
->
key
);
dsa_signature_clear
(
&
ctx
->
s
);
dsa_signature_clear
(
&
ctx
->
s
);
free
(
ctx
->
digest
);
free
(
ctx
->
digest
);
free
(
ctx
);
free
(
ctx
);
...
...
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