aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/pubkey_speed.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2009-09-04 13:46:09 +0200
committerMartin Willi <martin@strongswan.org>2009-09-04 13:46:09 +0200
commit7daf5226b74e14a6e0f1a888b0be26f3d246f9f8 (patch)
tree6436de2e84e7a677ecfb83db4bf44766cc273d9f /scripts/pubkey_speed.c
parent7d1b0304467bc668b592ccd6680fd9615efbb5b2 (diff)
downloadstrongswan-7daf5226b74e14a6e0f1a888b0be26f3d246f9f8.tar.bz2
strongswan-7daf5226b74e14a6e0f1a888b0be26f3d246f9f8.tar.xz
removed trailing spaces ([[:space:]]+$)
Diffstat (limited to 'scripts/pubkey_speed.c')
-rw-r--r--scripts/pubkey_speed.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/scripts/pubkey_speed.c b/scripts/pubkey_speed.c
index 120ca858c..99075d251 100644
--- a/scripts/pubkey_speed.c
+++ b/scripts/pubkey_speed.c
@@ -13,7 +13,7 @@ void start_timing(struct timespec *start)
double end_timing(struct timespec *start)
{
struct timespec end;
-
+
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &end);
return (end.tv_nsec - start->tv_nsec) / 1000000000.0 +
(end.tv_sec - start->tv_sec) * 1.0;
@@ -37,14 +37,14 @@ int main(int argc, char *argv[])
key_type_t type = KEY_ANY;
signature_scheme_t scheme = SIGN_UNKNOWN;
chunk_t keydata, *sigs, data = chunk_from_buf(data_buf);
-
+
if (argc < 4)
{
usage();
}
-
+
rounds = atoi(argv[3]);
-
+
if (streq(argv[2], "rsa"))
{
type = KEY_RSA;
@@ -58,18 +58,18 @@ int main(int argc, char *argv[])
{
usage();
}
-
+
library_init(STRONGSWAN_CONF);
lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR, argv[1]);
atexit(library_deinit);
-
+
keydata = chunk_create(buf, 0);
while ((read = fread(pos, 1, sizeof(buf) - (pos - buf), stdin)))
{
pos += read;
keydata.len += read;
}
-
+
private = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, type,
BUILD_BLOB_PEM, keydata, BUILD_END);
if (!private)
@@ -82,7 +82,7 @@ int main(int argc, char *argv[])
switch (private->get_keysize(private))
{
case 32:
- scheme = SIGN_ECDSA_256;
+ scheme = SIGN_ECDSA_256;
break;
case 48:
scheme = SIGN_ECDSA_384;
@@ -96,12 +96,12 @@ int main(int argc, char *argv[])
exit(1);
}
}
-
+
printf("%4d bit %N: ", private->get_keysize(private)*8,
key_type_names, type);
-
+
sigs = malloc(sizeof(chunk_t) * rounds);
-
+
start_timing(&timing);
for (round = 0; round < rounds; round++)
{
@@ -112,7 +112,7 @@ int main(int argc, char *argv[])
}
};
printf("sign()/s: %8.1f ", rounds / end_timing(&timing));
-
+
public = private->get_public_key(private);
if (!public)
{
@@ -131,7 +131,7 @@ int main(int argc, char *argv[])
printf("verify()/s: %8.1f\n", rounds / end_timing(&timing));
public->destroy(public);
private->destroy(private);
-
+
for (round = 0; round < rounds; round++)
{
free(sigs[round].ptr);