Show correct cipher

Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
This commit is contained in:
Adrien Gallouët
2019-10-05 06:05:34 +00:00
parent 65f636555b
commit 0c82c06119
3 changed files with 6 additions and 5 deletions

View File

@@ -50,7 +50,7 @@ gt_bench(int argc, char **argv)
randombytes_buf(key, sizeof(key));
if (term) {
printf("cipher: %s\n\n", chacha ? "chacha20poly1305" : "aegis256");
printf("cipher: %s\n\n", GT_CIPHER(chacha));
printf(" size min mean max \n");
printf("----------------------------------------------------\n");
}
@@ -108,8 +108,7 @@ gt_bench(int argc, char **argv)
printf("\n");
} else {
printf("bench %s %"PRIi64" %"PRIi64" %"PRIi64" %"PRIi64"\n",
chacha ? "chacha20poly1305" : "aegis256",
size, mbps.min, mbps.mean, mbps.max);
GT_CIPHER(chacha), size, mbps.min, mbps.mean, mbps.max);
}
size += 2 * 5 * 13;

View File

@@ -54,6 +54,8 @@
#undef MIN
#define MIN(x,y) ({ __typeof__(x) X=(x); __typeof__(y) Y=(y); X < Y ? X : Y; })
#define GT_CIPHER(x) ((x) ? "chacha20poly1305" : "aegis256")
extern volatile sig_atomic_t gt_alarm;
extern volatile sig_atomic_t gt_reload;
extern volatile sig_atomic_t gt_quit;

View File

@@ -47,7 +47,7 @@ gt_show_status(int fd)
bindstr[0] ? bindstr : "-",
gt_get_port((struct sockaddr *)&res.status.bind),
res.status.mtu,
res.status.chacha ? "chacha20poly1305" : "aes256gcm");
GT_CIPHER(res.status.chacha));
} else {
printf(term ? "client %s:\n"
" pid: %li\n"
@@ -69,7 +69,7 @@ gt_show_status(int fd)
peerstr[0] ? peerstr : "-",
gt_get_port((struct sockaddr *)&res.status.peer),
res.status.mtu,
res.status.chacha ? "chacha20poly1305" : "aes256gcm");
GT_CIPHER(res.status.chacha));
}
return 0;