Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Wim Lewis
nettle
Commits
bf2a410f
Commit
bf2a410f
authored
Oct 03, 2005
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also display cycles per block.
Rev: src/nettle/examples/nettle-benchmark.c:1.15
parent
8a6ff296
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
examples/nettle-benchmark.c
examples/nettle-benchmark.c
+14
-10
No files found.
examples/nettle-benchmark.c
View file @
bf2a410f
...
...
@@ -169,19 +169,22 @@ header(void)
{
printf
(
"%18s %11s Mbyte/s%s
\n
"
,
"Algorithm"
,
"mode"
,
frequency
>
0
.
0
?
" cycles/byte"
:
""
);
frequency
>
0
.
0
?
" cycles/byte
cycles/block
"
:
""
);
}
static
void
display
(
const
char
*
name
,
const
char
*
mode
,
display
(
const
char
*
name
,
const
char
*
mode
,
unsigned
block_size
,
double
time
)
{
printf
(
"%18s %11s %7.1f"
,
name
,
mode
,
BENCH_BLOCK
/
(
time
*
1048576
.
0
));
if
(
frequency
>
0
.
0
)
printf
(
" %11.1f"
,
time
*
frequency
/
BENCH_BLOCK
);
{
printf
(
" %11.1f"
,
time
*
frequency
/
BENCH_BLOCK
);
if
(
block_size
>
0
)
printf
(
" %12.1f"
,
time
*
frequency
*
block_size
/
BENCH_BLOCK
);
}
printf
(
"
\n
"
);
}
...
...
@@ -210,7 +213,7 @@ time_hash(const struct nettle_hash *hash)
init_data
(
data
);
hash
->
init
(
info
.
ctx
);
display
(
hash
->
name
,
"update"
,
display
(
hash
->
name
,
"update"
,
hash
->
block_size
,
time_function
(
bench_hash
,
&
info
));
free
(
info
.
ctx
);
...
...
@@ -238,7 +241,7 @@ time_cipher(const struct nettle_cipher *cipher)
init_key
(
cipher
->
key_size
,
key
);
cipher
->
set_encrypt_key
(
ctx
,
cipher
->
key_size
,
key
);
display
(
cipher
->
name
,
"ECB encrypt"
,
display
(
cipher
->
name
,
"ECB encrypt"
,
cipher
->
block_size
,
time_function
(
bench_cipher
,
&
info
));
}
...
...
@@ -251,11 +254,12 @@ time_cipher(const struct nettle_cipher *cipher)
init_key
(
cipher
->
key_size
,
key
);
cipher
->
set_decrypt_key
(
ctx
,
cipher
->
key_size
,
key
);
display
(
cipher
->
name
,
"ECB decrypt"
,
display
(
cipher
->
name
,
"ECB decrypt"
,
cipher
->
block_size
,
time_function
(
bench_cipher
,
&
info
));
}
if
(
cipher
->
block_size
)
/* Don't use nettle cbc to benchmark openssl ciphers */
if
(
cipher
->
block_size
&&
cipher
->
name
[
0
]
!=
'o'
)
{
uint8_t
*
iv
=
xalloc
(
cipher
->
block_size
);
...
...
@@ -272,7 +276,7 @@ time_cipher(const struct nettle_cipher *cipher)
cipher
->
set_encrypt_key
(
ctx
,
cipher
->
key_size
,
key
);
display
(
cipher
->
name
,
"CBC encrypt"
,
display
(
cipher
->
name
,
"CBC encrypt"
,
cipher
->
block_size
,
time_function
(
bench_cbc_encrypt
,
&
info
));
}
...
...
@@ -288,7 +292,7 @@ time_cipher(const struct nettle_cipher *cipher)
cipher
->
set_decrypt_key
(
ctx
,
cipher
->
key_size
,
key
);
display
(
cipher
->
name
,
"CBC decrypt"
,
display
(
cipher
->
name
,
"CBC decrypt"
,
cipher
->
block_size
,
time_function
(
bench_cbc_decrypt
,
&
info
));
}
free
(
iv
);
...
...
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