aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/tools/config.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/config.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/config.c')
-rw-r--r--src/tools/config.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/tools/config.c b/src/tools/config.c
index e95626c..8f75804 100644
--- a/src/tools/config.c
+++ b/src/tools/config.c
@@ -118,12 +118,10 @@ static inline bool parse_fwmark(uint32_t *fwmark, unsigned int *flags, const cha
static inline bool parse_key(uint8_t key[static WG_KEY_LEN], const char *value)
{
- uint8_t tmp[WG_KEY_LEN + 1];
- if (strlen(value) != b64_len(WG_KEY_LEN) - 1 || b64_pton(value, tmp, WG_KEY_LEN + 1) != WG_KEY_LEN) {
+ if (!key_from_base64(key, value)) {
fprintf(stderr, "Key is not the correct length or format: `%s`\n", value);
return false;
}
- memcpy(key, tmp, WG_KEY_LEN);
return true;
}