aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/tools/show.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/show.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/show.c')
-rw-r--r--src/tools/show.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/tools/show.c b/src/tools/show.c
index 7b057cf..c9ba473 100644
--- a/src/tools/show.c
+++ b/src/tools/show.c
@@ -4,7 +4,6 @@
#include <inttypes.h>
#include <netinet/in.h>
#include <net/if.h>
-#include <resolv.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
@@ -78,17 +77,16 @@ static void sort_peers(struct wgdevice *device)
static const uint8_t zero[WG_KEY_LEN] = { 0 };
-static char *key(const unsigned char key[static WG_KEY_LEN])
+static char *key(const uint8_t key[static WG_KEY_LEN])
{
- static char b64[b64_len(WG_KEY_LEN)];
+ static char base64[WG_KEY_LEN_BASE64];
if (!memcmp(key, zero, WG_KEY_LEN))
return "(none)";
- memset(b64, 0, b64_len(WG_KEY_LEN));
- b64_ntop(key, WG_KEY_LEN, b64, b64_len(WG_KEY_LEN));
- return b64;
+ key_to_base64(base64, key);
+ return base64;
}
-static char *masked_key(const unsigned char masked_key[static WG_KEY_LEN])
+static char *masked_key(const uint8_t masked_key[static WG_KEY_LEN])
{
const char *var = getenv("WG_HIDE_KEYS");
if (var && !strcmp(var, "never"))