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
c4752123
Commit
c4752123
authored
Mar 26, 2014
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update dsa benchmarking to use new DSA interface.
parent
38edca97
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
17 deletions
+22
-17
ChangeLog
ChangeLog
+3
-0
examples/hogweed-benchmark.c
examples/hogweed-benchmark.c
+19
-17
No files found.
ChangeLog
View file @
c4752123
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_public_key_init): Use dsa_params_init.
(dsa_public_key_clear): Use dsa_params_clear.
...
...
examples/hogweed-benchmark.c
View file @
c4752123
...
...
@@ -2,7 +2,7 @@
/* 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
* it under the terms of the GNU Lesser General Public License as published by
...
...
@@ -264,9 +264,10 @@ bench_rsa_clear (void *p)
}
struct
dsa_ctx
{
struct
dsa_public_key
pub
;
struct
dsa_private_key
key
;
{
struct
dsa_params
params
;
mpz_t
pub
;
mpz_t
key
;
struct
knuth_lfib_ctx
lfib
;
struct
dsa_signature
s
;
uint8_t
*
digest
;
...
...
@@ -292,8 +293,9 @@ bench_dsa_init (unsigned size)
ctx
=
xalloc
(
sizeof
(
*
ctx
));
dsa_public_key_init
(
&
ctx
->
pub
);
dsa_private_key_init
(
&
ctx
->
key
);
dsa_params_init
(
&
ctx
->
params
);
mpz_init
(
ctx
->
pub
);
mpz_init
(
ctx
->
key
);
dsa_signature_init
(
&
ctx
->
s
);
knuth_lfib_init
(
&
ctx
->
lfib
,
1
);
...
...
@@ -303,16 +305,15 @@ bench_dsa_init (unsigned size)
if
(
!
(
sexp_transport_iterator_first
(
&
i
,
sizeof
(
dsa1024
)
-
1
,
dsa1024
)
&&
sexp_iterator_check_type
(
&
i
,
"private-key"
)
&&
sexp_iterator_check_type
(
&
i
,
"dsa"
)
&&
dsa_keypair_from_sexp_alist
((
struct
dsa_params
*
)
&
ctx
->
pub
,
ctx
->
pub
.
y
,
ctx
->
key
.
x
,
&&
dsa_keypair_from_sexp_alist
(
&
ctx
->
params
,
ctx
->
pub
,
ctx
->
key
,
0
,
DSA_SHA1_Q_BITS
,
&
i
))
)
die
(
"Internal error.
\n
"
);
ctx
->
digest
=
hash_string
(
&
nettle_sha1
,
3
,
"foo"
);
dsa_s
ha1_sign_digest
(
&
ctx
->
pub
,
&
ctx
->
key
,
&
ctx
->
lfib
,
(
nettle_random_func
*
)
knuth_lfib_random
,
ctx
->
digest
,
&
ctx
->
s
);
dsa_s
ign
(
&
ctx
->
params
,
ctx
->
key
,
&
ctx
->
lfib
,
(
nettle_random_func
*
)
knuth_lfib_random
,
SHA1_DIGEST_SIZE
,
ctx
->
digest
,
&
ctx
->
s
);
return
ctx
;
}
...
...
@@ -324,9 +325,9 @@ bench_dsa_sign (void *p)
struct
dsa_signature
s
;
dsa_signature_init
(
&
s
);
dsa_s
ha1_sign_digest
(
&
ctx
->
pub
,
&
ctx
->
key
,
&
ctx
->
lfib
,
(
nettle_random_func
*
)
knuth_lfib_random
,
ctx
->
digest
,
&
s
);
dsa_s
ign
(
&
ctx
->
params
,
ctx
->
key
,
&
ctx
->
lfib
,
(
nettle_random_func
*
)
knuth_lfib_random
,
SHA1_DIGEST_SIZE
,
ctx
->
digest
,
&
s
);
dsa_signature_clear
(
&
s
);
}
...
...
@@ -334,7 +335,7 @@ static void
bench_dsa_verify
(
void
*
p
)
{
struct
dsa_ctx
*
ctx
=
p
;
if
(
!
dsa_
sha1_verify_digest
(
&
ctx
->
pub
,
ctx
->
digest
,
&
ctx
->
s
))
if
(
!
dsa_
verify
(
&
ctx
->
params
,
ctx
->
pub
,
SHA1_DIGEST_SIZE
,
ctx
->
digest
,
&
ctx
->
s
))
die
(
"Internal error, dsa_sha1_verify_digest failed.
\n
"
);
}
...
...
@@ -342,8 +343,9 @@ static void
bench_dsa_clear
(
void
*
p
)
{
struct
dsa_ctx
*
ctx
=
p
;
dsa_public_key_clear
(
&
ctx
->
pub
);
dsa_private_key_clear
(
&
ctx
->
key
);
dsa_params_clear
(
&
ctx
->
params
);
mpz_clear
(
ctx
->
pub
);
mpz_clear
(
ctx
->
key
);
dsa_signature_clear
(
&
ctx
->
s
);
free
(
ctx
->
digest
);
free
(
ctx
);
...
...
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