removed trailing spaces ([[:space:]]+$)
This commit is contained in:
+1
-1
@@ -27,7 +27,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("};\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
}
|
||||
printf("%02x", (unsigned int)byte);
|
||||
}
|
||||
}
|
||||
printf("'\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+12
-12
@@ -38,7 +38,7 @@ static void start_timing(struct timespec *start)
|
||||
static 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;
|
||||
@@ -50,7 +50,7 @@ static void run_test(diffie_hellman_group_t group, int rounds)
|
||||
chunk_t chunk;
|
||||
struct timespec timing;
|
||||
int round;
|
||||
|
||||
|
||||
r = lib->crypto->create_dh(lib->crypto, group);
|
||||
if (!r)
|
||||
{
|
||||
@@ -58,24 +58,24 @@ static void run_test(diffie_hellman_group_t group, int rounds)
|
||||
diffie_hellman_group_names, group);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
printf("%N:\t",
|
||||
diffie_hellman_group_names, group);
|
||||
|
||||
|
||||
start_timing(&timing);
|
||||
for (round = 0; round < rounds; round++)
|
||||
{
|
||||
l[round] = lib->crypto->create_dh(lib->crypto, group);
|
||||
}
|
||||
printf("A = g^a/s: %8.1f", rounds / end_timing(&timing));
|
||||
|
||||
|
||||
for (round = 0; round < rounds; round++)
|
||||
{
|
||||
l[round]->get_my_public_value(l[round], &chunk);
|
||||
r->set_other_public_value(r, chunk);
|
||||
chunk_free(&chunk);
|
||||
}
|
||||
|
||||
|
||||
r->get_my_public_value(r, &chunk);
|
||||
start_timing(&timing);
|
||||
for (round = 0; round < rounds; round++)
|
||||
@@ -84,7 +84,7 @@ static void run_test(diffie_hellman_group_t group, int rounds)
|
||||
}
|
||||
printf(" | S = B^a/s: %8.1f\n", rounds / end_timing(&timing));
|
||||
chunk_free(&chunk);
|
||||
|
||||
|
||||
for (round = 0; round < rounds; round++)
|
||||
{
|
||||
l[round]->destroy(l[round]);
|
||||
@@ -95,22 +95,22 @@ static void run_test(diffie_hellman_group_t group, int rounds)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int rounds, i, j;
|
||||
|
||||
|
||||
if (argc < 4)
|
||||
{
|
||||
usage();
|
||||
}
|
||||
|
||||
|
||||
library_init(STRONGSWAN_CONF);
|
||||
lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR, argv[1]);
|
||||
atexit(library_deinit);
|
||||
|
||||
|
||||
rounds = atoi(argv[2]);
|
||||
|
||||
|
||||
for (i = 3; i < argc; i++)
|
||||
{
|
||||
bool found = FALSE;
|
||||
|
||||
|
||||
for (j = 0; j < countof(groups); j++)
|
||||
{
|
||||
if (streq(groups[j].name, argv[i]))
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ int main(int argc, char *argv[])
|
||||
identification_t *id;
|
||||
chunk_t enc;
|
||||
int i;
|
||||
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
return -1;
|
||||
@@ -29,7 +29,7 @@ int main(int argc, char *argv[])
|
||||
for (i = 0; i < enc.len; i++)
|
||||
{
|
||||
printf("%02x", (unsigned int)enc.ptr[i]);
|
||||
}
|
||||
}
|
||||
printf("'\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+5
-5
@@ -15,7 +15,7 @@ int main(int argc, char *argv[])
|
||||
chunk_t chunk;
|
||||
char buf[8096];
|
||||
int read;
|
||||
|
||||
|
||||
library_init(NULL);
|
||||
lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR, PLUGINS);
|
||||
atexit(library_deinit);
|
||||
@@ -26,9 +26,9 @@ int main(int argc, char *argv[])
|
||||
fprintf(stderr, "reading key failed.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
chunk = chunk_create(buf, read);
|
||||
|
||||
|
||||
private = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, KEY_RSA,
|
||||
BUILD_BLOB_PEM, chunk_clone(chunk),
|
||||
BUILD_END);
|
||||
@@ -52,7 +52,7 @@ int main(int argc, char *argv[])
|
||||
private->destroy(private);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
public = lib->creds->create(lib->creds, CRED_PUBLIC_KEY, KEY_ANY,
|
||||
BUILD_BLOB_PEM, chunk_clone(chunk),
|
||||
BUILD_END);
|
||||
@@ -82,7 +82,7 @@ int main(int argc, char *argv[])
|
||||
public->destroy(public);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
fprintf(stderr, "unable to parse input key.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
+5
-5
@@ -15,7 +15,7 @@ int main(int argc, char *argv[])
|
||||
chunk_t chunk;
|
||||
char buf[8096];
|
||||
int read, n;
|
||||
|
||||
|
||||
library_init(NULL);
|
||||
lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR, PLUGINS);
|
||||
atexit(library_deinit);
|
||||
@@ -26,9 +26,9 @@ int main(int argc, char *argv[])
|
||||
fprintf(stderr, "reading key failed.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
chunk = chunk_create(buf, read);
|
||||
|
||||
|
||||
private = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, KEY_RSA,
|
||||
BUILD_BLOB_PEM, chunk_clone(chunk),
|
||||
BUILD_END);
|
||||
@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
|
||||
private->destroy(private);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
public = lib->creds->create(lib->creds, CRED_PUBLIC_KEY, KEY_ANY,
|
||||
BUILD_BLOB_PEM, chunk_clone(chunk),
|
||||
BUILD_END);
|
||||
@@ -70,7 +70,7 @@ int main(int argc, char *argv[])
|
||||
public->destroy(public);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
fprintf(stderr, "unable to parse input key.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
+13
-13
@@ -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);
|
||||
|
||||
+11
-11
@@ -1,5 +1,5 @@
|
||||
/* Analyzes the concurrent use of charon's threads
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2008 Andreas Steffen
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
@@ -52,7 +52,7 @@ static int readline(FILE *fd, char *line)
|
||||
*line = '\0';
|
||||
return 1;
|
||||
}
|
||||
line++;
|
||||
line++;
|
||||
}
|
||||
*line = '\0';
|
||||
return 0;
|
||||
@@ -69,14 +69,14 @@ static void printline(state_t *state, char *timestamp)
|
||||
for (th = 1; th <= THREADS; th++)
|
||||
{
|
||||
states[state[th]]++;
|
||||
printf("<td class=\"%s\"></td>", state_names[state[th]]);
|
||||
printf("<td class=\"%s\"></td>", state_names[state[th]]);
|
||||
}
|
||||
total = states[STATE_INIT] + states[STATE_AUTH] + states[STATE_BUSY] + states[STATE_RETRY];
|
||||
printf("<td class=\"init\">%d</td><td class=\"auth\">%d</td><td class=\"busy\">%d</td>",
|
||||
states[STATE_INIT], states[STATE_AUTH], total);
|
||||
for (th = 10; th <= (THREADS + 2); th += 5)
|
||||
{
|
||||
printf("<td class=\"%s\"></td>", (th <= total + 2)? "busy":"idle");
|
||||
printf("<td class=\"%s\"></td>", (th <= total + 2)? "busy":"idle");
|
||||
}
|
||||
printf("\n");
|
||||
printf(" </tr>\n");
|
||||
@@ -91,13 +91,13 @@ int main(int argc, char *argv[])
|
||||
FILE *fd;
|
||||
|
||||
state_t state[THREADS + 1];
|
||||
|
||||
|
||||
/* threads 1..5 and 9 are always busy */
|
||||
for (th = 1; th <= THREADS; th++)
|
||||
{
|
||||
state[th] = (th <= 7 && th != 3)? STATE_BUSY : STATE_IDLE;
|
||||
}
|
||||
|
||||
|
||||
/* open the log file */
|
||||
fd = fopen(LOGFILE, "r");
|
||||
if (!fd)
|
||||
@@ -135,16 +135,16 @@ int main(int argc, char *argv[])
|
||||
printf(" <td class=\"log\">Timestamp</td>");
|
||||
for (th = 1 ; th <= THREADS; th++)
|
||||
{
|
||||
printf("<td>%02d</td>", th);
|
||||
printf("<td>%02d</td>", th);
|
||||
}
|
||||
printf("<td class=\"init\">I</td><td class=\"auth\">A</td><td class=\"busy\">B</td>");
|
||||
for (th = 10; th <= (THREADS + 2); th += 5)
|
||||
{
|
||||
printf("<td class=\"busy\">%d</td>", (th == 100)? 99:th);
|
||||
printf("<td class=\"busy\">%d</td>", (th == 100)? 99:th);
|
||||
}
|
||||
printf("\n");
|
||||
printf(" </tr>\n");
|
||||
|
||||
|
||||
while (readline(fd, line))
|
||||
{
|
||||
char *p_section, *p_charon, *p_thread, *p_log;
|
||||
@@ -170,7 +170,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* determine thread */
|
||||
p_thread = p_charon + 8;
|
||||
th = atol(p_thread);
|
||||
@@ -268,6 +268,6 @@ int main(int argc, char *argv[])
|
||||
printf("</body>\n");
|
||||
printf("</html>\n");
|
||||
|
||||
fclose(fd);
|
||||
fclose(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user