aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/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
commit755217bd853f2581a8bb420728942cf785afe204 (patch)
treec7f9d39659e43bbbe1c62370787b5ff7c2925593 /src/config.c
parentwg: do not use addrconfig with port in gai (diff)
downloadwireguard-tools-755217bd853f2581a8bb420728942cf785afe204.tar.xz
wireguard-tools-755217bd853f2581a8bb420728942cf785afe204.zip
wg: side channel resistant base64
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/config.c b/src/config.c
index e95626c..8f75804 100644
--- a/src/config.c
+++ b/src/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;
}