aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/tools/showconf.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-04-16 01:20:43 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-04-19 18:26:32 +0200
commit94273094f6607923f7e52b16717325f6ed7d9d46 (patch)
treef35a0bbd1d17ca66f857bc75b3434d59dddb7227 /src/tools/showconf.c
parentnetns: cleanup and add diagram (diff)
downloadwireguard-monolithic-historical-94273094f6607923f7e52b16717325f6ed7d9d46.tar.xz
wireguard-monolithic-historical-94273094f6607923f7e52b16717325f6ed7d9d46.zip
tools: side channel resistant base64
Diffstat (limited to 'src/tools/showconf.c')
-rw-r--r--src/tools/showconf.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/tools/showconf.c b/src/tools/showconf.c
index 585b08d..da48486 100644
--- a/src/tools/showconf.c
+++ b/src/tools/showconf.c
@@ -3,7 +3,6 @@
#include <arpa/inet.h>
#include <netinet/in.h>
#include <net/if.h>
-#include <resolv.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
@@ -18,7 +17,7 @@
int showconf_main(int argc, char *argv[])
{
static const uint8_t zero[WG_KEY_LEN] = { 0 };
- char b64[b64_len(WG_KEY_LEN)] = { 0 };
+ char base64[WG_KEY_LEN_BASE64];
char ip[INET6_ADDRSTRLEN];
struct wgdevice *device = NULL;
struct wgpeer *peer;
@@ -48,17 +47,17 @@ int showconf_main(int argc, char *argv[])
if (device->fwmark)
printf("FwMark = 0x%x\n", device->fwmark);
if (memcmp(device->private_key, zero, WG_KEY_LEN)) {
- b64_ntop(device->private_key, WG_KEY_LEN, b64, b64_len(WG_KEY_LEN));
- printf("PrivateKey = %s\n", b64);
+ key_to_base64(base64, device->private_key);
+ printf("PrivateKey = %s\n", base64);
}
if (memcmp(device->preshared_key, zero, WG_KEY_LEN)) {
- b64_ntop(device->preshared_key, WG_KEY_LEN, b64, b64_len(WG_KEY_LEN));
- printf("PresharedKey = %s\n", b64);
+ key_to_base64(base64, device->preshared_key);
+ printf("PresharedKey = %s\n", base64);
}
printf("\n");
for_each_wgpeer(device, peer, i) {
- b64_ntop(peer->public_key, WG_KEY_LEN, b64, b64_len(WG_KEY_LEN));
- printf("[Peer]\nPublicKey = %s\n", b64);
+ key_to_base64(base64, peer->public_key);
+ printf("[Peer]\nPublicKey = %s\n", base64);
if (peer->num_ipmasks)
printf("AllowedIPs = ");
for_each_wgipmask(peer, ipmask, j) {