Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dmitry Baryshkov
nettle
Commits
77234173
Commit
77234173
authored
Feb 05, 2011
by
Niels Möller
Browse files
(time_gmac): New function.
(main): Call time_gmac. Rev: nettle/examples/nettle-benchmark.c:1.16
parent
98d9d232
Changes
1
Hide whitespace changes
Inline
Side-by-side
examples/nettle-benchmark.c
View file @
77234173
...
...
@@ -43,6 +43,7 @@
#include
"cast128.h"
#include
"cbc.h"
#include
"des.h"
#include
"gcm.h"
#include
"memxor.h"
#include
"serpent.h"
#include
"sha.h"
...
...
@@ -343,6 +344,28 @@ time_hash(const struct nettle_hash *hash)
free
(
info
.
ctx
);
}
static
void
time_gmac
(
void
)
{
static
uint8_t
data
[
BENCH_BLOCK
];
struct
bench_hash_info
info
;
struct
gcm_ctx
gcm
;
struct
aes_ctx
aes
;
uint8_t
key
[
16
];
uint8_t
iv
[
GCM_IV_SIZE
];
aes_set_encrypt_key
(
&
aes
,
sizeof
(
key
),
key
);
gcm_set_key
(
&
gcm
,
&
aes
,
(
nettle_crypt_func
*
)
aes_encrypt
);
gcm_set_iv
(
&
gcm
,
sizeof
(
iv
),
iv
);
info
.
ctx
=
&
gcm
;
info
.
update
=
(
nettle_hash_update_func
*
)
gcm_auth
;
info
.
data
=
data
;
display
(
"gmac"
,
"auth"
,
GCM_BLOCK_SIZE
,
time_function
(
bench_hash
,
&
info
));
}
static
void
time_cipher
(
const
struct
nettle_cipher
*
cipher
)
{
...
...
@@ -560,6 +583,13 @@ main(int argc, char **argv)
if
(
!
alg
||
strstr
(
hashes
[
i
]
->
name
,
alg
))
time_hash
(
hashes
[
i
]);
}
if
(
!
alg
||
strstr
(
"gmac"
,
alg
))
{
time_gmac
();
printf
(
"
\n
"
);
}
for
(
i
=
0
;
ciphers
[
i
];
i
++
)
if
(
!
alg
||
strstr
(
ciphers
[
i
]
->
name
,
alg
))
time_cipher
(
ciphers
[
i
]);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment